Use a Timer to record mass amounts of test data, and then export it as a Comma-Separated Values file.
Having an Edge MicroServer (EMS) Engine Simulator has allowed you to begin work on using ThingWorx Foundation for instrumenting a prototype engine.
However, the end goal is not to inspect the data manually, but to have ThingWorx Analytics perform an automatic notification for any issues.
In this guide, you’ll create a Timer to generate thousands of data points, and then export the dataset as a Comma-Separated Values (.csv) file for future use in building an analytical model of the engine.
NOTE: The estimated time to complete all parts of this guide is 30 minutes.
In this guide, we're finishing up with the MotorCo scenario where an engine can fail catastrophically in a low-grease condition.
In previous guides, you've gathered and exported engine vibration-data from an Edge MicroServer (EMS) and used it to build an engine analytics model. You've even put that analytical model into service to give near-immediate results from current engine-vibration readings.
The goal of this guide is to create a GUI to visualize those predicted "low grease" conditions to facilitate customer warnings.
This is a necessary step, as the end-goal is to automate failure analysis by utilizing ThingWorx Analytics, which builds an analytical model by importing a .csv file with several thousand data points.
Data storage, export, and formatting in this manner can be extremely helpful for the automotive segment in particular. For instance, each car that comes off the factory line could have an EMS constantly sending data from which an analytical model could automatically detect engine trouble.
This could enable your company to offer an engine monitoring subscription service to your customers.
But to enable automatic comparison of engine data to an analytical model, you must first generate and format sample data to build said model, and this guide will show you exactly how to do that.
In the previous Use the EMS to Create an Engine Simulator guide, you ended up with an EMS engine simulator from which Foundation could capture individual readings and store them in an Info Table Property.
But for ThingWorx Analytics, we need thousands of data points, if not tens-of-thousands.
Manually triggering the Service to generate that many data points would be tedious.
Instead, we'll create a Timer Thing off which we can trigger the automatic calling of the data-capture Service.
This guide assumes that you have already completed the Use the Edge MicroServer (EMS) to Connect to ThingWorx and Use the EMS to Create an Engine Simulator guides and have a working, active connection from the EMS Engine Simulator to ThingWorx Foundation.
1. Return to the ThingWorx Foundation Browse > All navigation.
2. Click MODELING > Timers.
3, Click + New.
4. On the Choose Template pop-up, select Timer and click OK.
5. In the Name field, type ESDS_Timer.
6. If Project is not already set, search for and select PTCDefaultProject.
7. In the Run As User field, search for and select Administrator.
8. On the Warning pop-up, click Yes.
9. Set the Update Rate to 2000.
10. At the top, click Save.
Now that we have a Timer, we can use its 2000ms (two seconds) Event generation to trigger something else.
In this case, we’ll use it to trigger the data-capture Service we created in the previous guide.
1. Click Browse > MODELING > Things.
2. Open EdgeThing and click Properties and Alerts.
3. Scroll down past the custom Properties to the Inherited Properties.
4. Under the Value column, ensure that isConnected is checked.
If not, return to the previous guides and confirm that your EMS engine simulator is running.
Having ensured that the EMS engine simulator is still providing values to ThingWorx Foundation, we now want to create a Subscription, which will trigger off our earlier timer.
1. At the top, click Subscriptions.
2. Click + Add.
3. In the Name field, type ESDS_Timer_Subscription.
4. Under Source, select the Other entity radio-button.
5. In the Search Entities field, search for and select ESDS_Timer.
6. Check the Enabled box.
7. Expand the Inputs section.
8. In the Select an Event field, search for and select Timer.
9. Expand the Me/Entities section.
10. Expand the Services sub-section.
11. Scroll down until you find the custom recordService, and click the right-arrow beside it.
12. Click Save and Continue.
Note that you should NOT click the top “Save”, as that will erase the Subscription.
With the progress so far, another entry is captured and added to the Info Table Property ever two seconds. We'll confirm that now.
The longer that you let the Subscription run, the more entries will be automatically captured in the infoTableProperty. ThingWorx Analytics can use this information to build an analytical model.
To do so, though, it needs thousands of entries. For example, we’ve gotten good model results with 30,000 data points. In general, more is better.
As such, your Subscription would need to run until you have gathered 30,000 entries in the infoTableProperty. Unfortunately, this can take roughly 15-16 hours.
You can simply let the timer run for a short time and then continue with this guide immediately.
1. At the top, click Properties and Alerts.
2. Click the Refresh button several times.
3. Under the Value column, click the “pencil icon” for infoTableProperty to select Set value of property.
4. Note that various values coming from the EMS engine simulator.
5. At the top-right of the pop-up, click the X button.
After achieving the dataset size you desire, you should stop gathering to prevent your dataset from growing arbitrarily large.
1. At the top of EdgeThing, click Subscriptions.
2. If it is not already expanded, click ESDS_Timer_Subscription.
3. Expand Subscription Info.
4. Uncheck the Enabled box.
5. Click Save and Continue.
Click here to view Part 2 of this guide.