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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Engine Simulator Data Storage Part 1

No ratings

 

 

Use a Timer to record mass amounts of test data, and then export it as a Comma-Separated Values file.

 

GUIDE CONCEPT

 

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.

 

IoTProductMgmt_0-1667490417460.png

 

YOU'LL LEARN HOW TO

 

  • Create a Timer
  • Subscribe to a Timer to Trigger a Service
  • Generate Mass Amounts of Test Data
  • Import the CSV Parser Extension
  • Create a File Repository
  • Export the Test Data as a Comma-Separated Values (.csv) file
  • Download from a File Repository

 

NOTE:  The estimated time to complete all parts of this guide is 30 minutes.

 

 

Step 1: Scenario

 

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.

 

IoTProductMgmt_1-1667490544090.jpeg

 

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.

 

 

Step 2: Create a Timer

 

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.

 

IoTProductMgmt_0-1667491729226.png

 

     2. Click MODELING > Timers.


IoTProductMgmt_1-1667491729232.png

 

    3, Click + New.


IoTProductMgmt_2-1667491729233.png

 

    4. On the Choose Template pop-up, select Timer and click OK.


IoTProductMgmt_3-1667491729237.png

    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.


IoTProductMgmt_4-1667491729239.png

 

    8. On the Warning pop-up, click Yes.

 

  • Note that the Administrator user should only be utilized for testing and never in a production system.

 

    9. Set the Update Rate to 2000.

 

  • The EMS updates values around every second, i.e. 1000ms, so we want a time longer than that.
IoTProductMgmt_5-1667491729240.png

 

  10. At the top, click Save.


IoTProductMgmt_6-1667491729243.png

 

 

 

Step 3: Subscribe to the Timer

 

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.


IoTProductMgmt_0-1667492342858.png

 

   2. Open EdgeThing and click Properties and Alerts.


IoTProductMgmt_1-1667492342864.png

 

   3. Scroll down past the custom Properties to the Inherited Properties.


IoTProductMgmt_2-1667492342866.png

 

   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.


IoTProductMgmt_3-1667492342868.png

 

   2. Click + Add.


IoTProductMgmt_4-1667492342871.png

 

   3. In the Name field, type ESDS_Timer_Subscription.


IoTProductMgmt_5-1667492342872.png

 

   4. Under Source, select the Other entity radio-button.


IoTProductMgmt_6-1667492342874.png

 

   5. In the Search Entities field, search for and select ESDS_Timer.


IoTProductMgmt_7-1667492342876.png

 

   6. Check the Enabled box.


IoTProductMgmt_8-1667492342877.png

 

   7. Expand the Inputs section.


IoTProductMgmt_9-1667492342880.png

 

   8. In the Select an Event field, search for and select Timer.


IoTProductMgmt_10-1667492342882.png

 

   9. Expand the Me/Entities section.


IoTProductMgmt_11-1667492342884.png

 

   10. Expand the Services sub-section.


IoTProductMgmt_12-1667492342888.png

 

   11. Scroll down until you find the custom recordService, and click the right-arrow beside it.


IoTProductMgmt_13-1667492342890.png

 

   12. Click Save and Continue.

Note that you should NOT click the top “Save”, as that will erase the Subscription.

           IoTProductMgmt_14-1667492342892.png

 

 

 

 

Step 4: Data Acquisition

 

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 infoTablePropertyThingWorx 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.


IoTProductMgmt_0-1667493751986.png

 

    2. Click the Refresh button several times.

  • Note that both the identifier Property and the count of the number of entries in the infoTableProperty are continually increasing.

 

    3. Under the Value column, click the “pencil icon” for infoTableProperty to select Set value of property.

  • It may take a few moments for the pop-up to load.

 

IoTProductMgmt_1-1667493751992.png

 

    4. Note that various values coming from the EMS engine simulator.

 

    5. At the top-right of the pop-up, click the X button.

 

Stop Data Gathering


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. 


IoTProductMgmt_2-1667493751996.png

 

    5. Click Save and Continue.

 

 

 

Click here to view Part 2 of this guide.

 

 

Version history
Last update:
‎Mar 07, 2023 02:44 PM
Updated by:
Labels (1)
Contributors