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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Use the EMS to Create an Engine Simulator Part 1

No ratings

 

Use the Edge MicroServer (EMS) to simulate an engine with vibration sensors.

 

GUIDE CONCEPT

 

The Edge MicroServer (EMS) facilitates connectivity from Edge devices to ThingWorx Foundation.

 

It’s often easier, though, to start development with simulated Edge values rather than hooking up sensors.

 

This guide will show you how to simulate vibration values of an engine using the EMS.

 

 

YOU'LL LEARN HOW TO

 

  • Modify an EMS Template
  • Provision Thing Properties and Values from an EMS rather than Foundation
  • Send information from an EMS to Foundation
  • Store large amounts of data in an InfoTable Property
  • Create a simulator for testing

 

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

 

 

Step 1: Scenario

 

MotorCo manufactures, sells, and services commercial motors.

 

Recently, MotorCo has been developing a new motor, and they already have a working prototype.

 

However, they’ve noticed that the motor has a chance to FAIL CATASTROPHICALLY if it’s not properly serviced to replace lost grease on a key moving part.

 

57-esim-engine.jpg

 

In order to prevent this type of failure in the field, MotorCo has decided to instrument their motors with sensors which record vibration.

 

The hope is that these sensors can detect certain vibrations which indicate required maintenance before a failure occurs.

 

In this guide, you’ll begin this monitoring process by using ThingWorx Foundation to monitor and record vibration data from the prototype motor. In particular, you will learn how to provision Thing Properties and Values from an EMS, as well as how to permanently store these values for analysis in an Info Table Property.

 

These types of modifications to an EMS can be extremely helpful for the automotive segment in particular. For instance, each car that comes off the factory line could have custom, auto-generated EMS scripting that would dynamically create Foundation information for each car in the fleet. This could be a massive time-savings versus manually generating Thing Properties directly within Foundation.

 

Because the motor is still in the process of being instrumented with sensors, you’ll get all the functionality in-place beforehand by constructing a motor simulator using the Edge MicroServer (EMS).

 

 

Step 2: Modify config.lua

 

In the previous Use the Edge MicroServer (EMS) to Connect to ThingWorx  guide, you installed the EMS on a Windows PC, configured it to talk to ThingWorx Foundation, and then created an EdgeThing on Foundation to complete the connectivity.

 

This guide assumes that you have already completed that Windows EMS guide and have an active EMS connection to the EdgeThing.

 

Perform the following steps to modify this connection to increase the task rate of the EMS, which we'll use in the following steps to update Properties more quickly.

 

  1. On your Windows PC, select the Windows PowerShell window where the luaScriptResource.exe program is running.


    01-esim-luascriptresource-powershell.png

     

  2. Type Ctrl-C to close the luaScriptResource.exe operation, i.e. hold the Control key and hit the C key.


    02-esim-luascriptresource-ctrl-c.png 

  3. Minimize the luaScriptResource.exe PowerShell window, and activate the wsemse.exe PowerShell window.


    03-esim-wsems-powershell (1).png

     

  4. Type Ctrl-C to close the wsems.exe operation.


    04-esim-wsems-ctrl-c.png

     

  5. Return to Foundation, and note that EdgeThing is not connected.


    01-elps-edgething-not-connected.png

     

  6. Navigate to the C:\CDEMO_EMSE\etc directory.


    06-esim-cdemo-ems-etc.png

     

  7. Open config.lua in your prefered text-editor.


    07-esim-config-lua.png

     

  8. Change scanRate to 1000.

  9. Add the following line below the scanRate line: taskRate = 1000,


    08-esim-taskrate.png

     

  10. The final code of config.lua should be the following

    Note that the EMS may have slightly modified your config.lua file, such as adding a data_security_key line. Leave these EMS-generated modifications alone.

    scripts.log_level = "WARN"
    
    scripts.script_resource_ssl = false
    scripts.script_resource_authenticate = false
    
    scripts.EdgeThing = {
        file = "thing.lua",
        template = "YourEdgeThingTemplate",
        scanRate = 1000,
        taskRate = 1000,
        sw_update_dir = "C:\\CDEMO_EMS\\updates"
    }
  11. Save the config.lua file.

 

 

Click here to view Part 2 of this guide.

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