Skip to main content
11-Garnet
December 23, 2022

ThingWorx Analytics Training: Module 11 Part 1

  • December 23, 2022
  • 0 replies
  • 6585 views

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;

        }

    }

}

 

This video has chapters — open the chapter menu in the player to jump to any section.

 

Chapter Summaries:

 

0:00 – Module 11 Intro: ThingWorx Analytics Mashup Exercise This training module demonstrates building a smart application on a ThingWorx Analytics model, covering how to construct the user interface and integrate streaming data with real-time predictions for a real-world use case.

 

0:37 – Use Case: Combined Cycle Power Plant (CCPP) Dataset & Electrical Output Prediction Introduces the combined cycle power plant scenario, explaining how gas and steam turbines plus a heat recovery system generate energy, and the CCPP sensor dataset of temperature, pressure, humidity, and exhaust vacuum used to predict and optimize electrical output.

 

1:44 – Step 1: Project Setup, Remote Thing & Industrial Connection Server Walks through Composer to create a project, connect the Industrial Connection server, use the Discover tab to find CCPP training-channel properties, and bind them to a new Remote Thing template with a value stream.

 

3:11 – Configuring Properties: Persistent, Logged & 1-Second Scan Rate Covers renaming properties to match the model's scoring job and enabling the Persistent and Logged options plus a 1000-millisecond scan rate so every value change is saved to the database and logged to the value stream once per second.

 

4:37 – Adding Service Properties & Setting the Electrical Output Goal Property Explains adding extra persisted and logged properties for the upcoming services and setting the goal property to electrical output, the target variable the neural network model will learn to predict.

 

6:20 – Training Service: Model Features Infotable, Neural Network Learner, QueryNamedPropertyHistory & CreateJob Details the custom training service that builds Model Features, learners, and metadata infotables, calls QueryNamedPropertyHistory for the last 10,000 logged values, joins them into a DatasetRef, and runs the training thing's CreateJob to produce a model, storing its Model Result ID.

 

8:50 – Real-Time Scoring Service: Prescriptive Levers, GetNamedPropertyValues & Optimal Output Builds the RunRealtimeScore service that gathers the latest values via GetNamedPropertyValues, calls the prescriptive thing's Real Time Score with an ambient-temperature lever, and writes the predicted output, prescribed temperature, and optimized electrical output to properties.

 

10:35 – Uploading Media & Creating a Responsive Mashup Shows uploading an image through the Media option into the CCPP project and creating a new responsive Mashup that renders across devices, then opening the Design tab to lay out the interface.

 

12:09 – Mashup Widgets: Image, Label, LED Display & Gauge Binding Adds and configures the image, label, LED display, and single-needle gauge widgets, sets gauge legend properties, and binds them to the CCPP streaming thing's data source through the mashup data panel.

 

14:37 – Styling Widgets: Label Text, Larger Fonts & Custom Themes Demonstrates styling by copying labels over the LED displays, setting label text and larger font style properties, and notes that custom style definitions and themes can enforce a consistent look and feel across the application.

 

15:39 – Previewing the Mashup & Binding Widgets to Streaming Data with Get Property Uses the View Mashup preview to show streaming values, then binds each widget to the streaming thing via the data panel Add button and the Get Property service, enabling the Automatically Update Values option so data refreshes on change.

 

18:09 – Automating Predictions with a Data Change Subscription Creates a subscription that fires on the ambient temperature Data Change event to automatically call RunRealtimeScore, using the "me" keyword and auto-complete, so new prescriptions and LED display values update live in the previewed mashup.

 

19:43 – Extending the App & Vuforia Studio AR Integration Discusses extending the mashup with additional tabs, signals, and profiles, and integrating remote-thing readings and predicted electrical output into an augmented reality experience built in PTC's Vuforia Studio overlaid on plant equipment.

 

Back: Module 10 Part 1

Main Course Page