cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

ThingWorx Analytics Training: Module 11 Part 1

100% helpful (1/1)

This video is Module 11: ThingWorx Analytics Mashup Exercise of the ThingWorx Analytics Training videos. It shows you how to create a ThingWorx project and populate it with entities that collectively comprise a functioning application. 

 

It contains a recommended hands-on exercise. Here you are shown how to build a ThingWorx application that uses a ThingWorx Analytics predictive model. If your ThingWorx environment is connected to a streaming asset, say, through Kepware, you may use five tags from that asset rather than from the "CCPP" thing shown in this video. Simply bind to those tags and rename the new properties as shown in this video. NOTE: This exercise is only for demonstration purposes, and will not produce a meaningful or accurate model.

 

**Update June 16, 2023: The following steps now reference "DataSimulator_Standalone.xml" instead of the previous "dataSimulator.xml". This new Thing will prevent errors on import.**

If your environment isn't connected to a streaming asset, you may import and use the attached "DataSimulator_Standalone.xml". This data simulator takes the place of the streaming asset. Follow these steps to create your "CCPP_StreamingThing":

  1. Create new thing called "CCPP_StreamingThing" that uses the GenericThing thing template, and is tagged to your "CCPP_Project".
  2. Under its "Properties and Alerts", click "Manage Bindings". 
  3. Search for the "DataSimulator_Standalone" Thing along the top left.
  4. Using the four-sided arrows for each property, click and drag the following properties from the left side to the right side:
    • AmbientPressure
    • AmbientTemperature
    • ElectricalOutput
    • ExhaustVacuum
    • RelativeHumidity
  5. Click "Done" to set these bindings, and then save your Thing.
  6. Modify these five properties to be persistent and logged, and then save your Thing (refer to playback time 3:19 for guidance).
  7. Under "Properties and Alerts", click the black "Refresh" button to see if the values for the five properties you just created are updating. If they aren't updating, navigate to Timers --> dataSimulator, and edit its 'Enabled' property under 'Inherited Properties' to be True. Don't save your Thing, as this may reset 'Enabled' to False.
  8. Resume video at playback time 5:00.

 

Here are the additional properties that will be added to your Thing:

  • ModelResultID
  • Goal (default value: ElectricalOutput)
  • OptimalElectricalOutput
  • OptimalAmbientTemperature
  • PredictedElectricalOutput

 

The services to be added to your Thing are attached to this page as .txt files. NOTE: In these services, you must change references to the default microservices ('AnalyticsServer_TrainingThing', 'AnalyticsServer_SignalsThing', etc.) to be the correct name used by your ThingWorx Analytics installation. These correct names can be found by navigating to Things, and locating the microservices ('…_TrainingThing', '…_SignalsThing', etc.).

 

In the service TrainModel, change line  27 to be:

me.ModelResultID =  Things["<your microservice here>"].CreateJob({

 

In the service RunRealTimeScore, change line 24 to be:

var prescriptiveScores =  Things["<your microservice here>"].RealtimeScore({

 

Note: It is possible that in creating and modifying the above properties that some properties may start logging values before others. This will result in the TrainModel service creating a dataset with missing values, and the model will fail to train. To avoid this from happening, add the following code to the TrainModel service in line 23:

 

// cleaning up the rows that have empty values

for(var k=0; k<data.rows.length; k++){

    var row = data.rows[k];

    for(var j=0; j<modelFeatures.rows.length; j++){

        if ( row[modelFeatures.rows[j].name] === undefined ) {

            data.RemoveRow(k);

            k--;

            break;

        }

    }

}

 

 

 

Back: Module 10 Part 1

Main Course Page

Version history
Last update:
‎Jun 16, 2023 02:08 PM
Updated by:
Labels (2)
Attachments
Contributors