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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Engine Simulator Data Storage Part 2

No ratings

 

Step 5: Import Extension

 

Now that we have a valid dataset, we want to export it as a .csv file, which can be imported into ThingWorx Analytics in a future guide to generate an analytical model.

 

An easy way to do this is with the CSV Parser Extension, which you’ll now import.

 

    1. Download the CSV Parser Extension from our third party provider IQNOX.

 

Note:  An account is required but the download is free.

    2. At the bottom-left, click Import/Export.


IoTProductMgmt_0-1667494238572.png

 

    3. On the drop-down, click Import.


IoTProductMgmt_1-1667494238579.png

 

    4. For Import Option, select Extension.


IoTProductMgmt_2-1667494238581.png

 

    5. Click Browse and navigate to the extension you downloaded above.


IoTProductMgmt_3-1667494238584.png

 

    6. Click Open.


IoTProductMgmt_4-1667494238589.png

 

    7. Click Import.


IoTProductMgmt_5-1667494238590.png

 

    8. Click Close.


IoTProductMgmt_6-1667494238591.png

 

    9. On the Refresh Composer? pop-up, click Yes.

 

  

Step 6: Create File Repository

 

ThingWorx Foundation uses File Repositories to read and write files from disk (including .csv files created by the CSV Parser Extension).

 

In this step, we’ll create a File Repository Entity.

 

    1. Return to Browse > All.


IoTProductMgmt_0-1667495809630.png

 

    2. Click MODELING > Things.


IoTProductMgmt_1-1667495809633.png

 

    3. Click + New.


IoTProductMgmt_2-1667495809634.png

 

    4. In the Name field, type ESDS_File_Repository.

 

    5. If Project is not already set, search for and select PTCDefaultProject.

 

    6. In the Base Thing Template field, search for and select FileRepository.


IoTProductMgmt_3-1667495809634.png

 

   7. At the top, click Save.

IoTProductMgmt_4-1667495809637.png

 

 

 

 Step 7: Create .csv Export Service

 

We have imported an Extension which gives us tools to manipulate .csv files. We have created a File Repository to which the export can save the file. We'll now make use of some of this new functionality. 

 

We’ll do so by creating a Service which calls built-in functions of the CSV Parser Extension.

 

    1. Return to EdgeThing.

 

    2. Click Services.


IoTProductMgmt_0-1667496515773.png

 

    3. Click + Add.


IoTProductMgmt_1-1667496515776.png

 

    4. On the drop-down, select Local (JavaScript).


IoTProductMgmt_2-1667496515778.png

 

    5. In the Name field, type exportCSVservice.


IoTProductMgmt_3-1667496515779.png

 

    6. In the blank JavaScript field, copy-and-paste the following code:

 

 

 

 

 

var sFile = "vibrationCSVfile.csv";



var paramsCSV = {

    path: sFile,

    data: me.infoTableProperty,

    fileRepository: "ESDS_File_Repository",

    withHeader: true

};



Resources["CSVParserFunctions"].WriteCSVFile(paramsCSV);

 

 

 

 

 

    7. Click Save and Continue.

  • Note that you should NOT click the top Save button, as that will erase your Service.

 

IoTProductMgmt_4-1667496515781.png

 

 

 

Step 8: Export the Engine Data

 

We now have all the tools in place to export the infoTableProperty as a .csv file to our new File Repository.

 

All that’s left is to call the appropriate functions.

 

    1. Ensure that you’re still on the Services tab of EdgeThing, and have the exportCSVservice open.


IoTProductMgmt_0-1667497268896.png

 

    2. At the bottom, click Execute.


IoTProductMgmt_1-1667497268899.png

 

    3. Return to ESDS_File_Repository.


IoTProductMgmt_2-1667497268901.png

 

    4. Click Services.


IoTProductMgmt_3-1667497268904.png

 

    5. Scroll down and find the GetFileListingsWithLinks Service.


IoTProductMgmt_4-1667497268906.png

 

    6. Click the “Play” icon for Execute service.


IoTProductMgmt_5-1667497268908.png

 

    7. At the bottom-right, click Execute.


IoTProductMgmt_6-1667497268909.png

 

    8. On the right, click Thingworx/FileRepositories/ESDS_File_Repository/vibrationCSVfile.csv.

54-esds-download.png

    9. The .csv export of the vibration data will now be in your local folder to which your browser saves downloads.


IoTProductMgmt_8-1667497268920.png

 

 

 

Step 9: Next Steps

 

Congratulations! You've completed the Engine Simulator Data Storage guide, and learned 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-Seperated Values (.csv) file
  • Download from a File Repository

 

The next guide in the Vehicle Predictive Pre-Failure Detection with ThingWorx Platform

learning path is Build an Engine Analytical Model

 

Learn More

 

We recommend the following resources to continue your learning experience:

 

CapabilityGuide
AnalyzeBuild a Predictive Analytics Model
BuildImplement Services, Events, and Subscriptions

 

Additional Resources

 

If you have questions, issues, or need additional information, refer to:

      

ResourceLink
CommunityDeveloper Community Forum
SupportAnalytics Builder Help Center
Version history
Last update:
‎Mar 07, 2023 02:49 PM
Updated by:
Labels (1)
Contributors