Connected Field Service > Using the Connected Field Service Accelerator > MRI Machine Demo Data Simulator
  
MRI Machine Demo Data Simulator
In version 6.5.3 and later, the ThingWorx Utilities Simulator has been replaced by the Configurable Demo Simulator. The Configurable Demo Simulator uses an initialization file to determine which asset properties to send to the ThingWorx server.
The simulator is distributed as an executable jar file named ptc-cslm-demo-simulator-{build-info}.jar. The jar file contains a sample initialization file, sample-init.json.
The following is an example of how to launch the simulator
java -jar ptc-cslm-demo-simulator-xxxxxx.jar -uri ws://localhost:8080/Thingworx/WS -appKey 6289198c-cac0-446a-b899-7f53fb7e0c3a -scanRate 3000 -initFile /sample-init.json
Parameter
Required/Optional
Description
Example
-uri
Required
WebSocket URI
ws://localhost:8080/Thingworx/WS
-appKey
Required
Application Key
6289198c-cac0-446a-b899-7f53fb7e0c3a
-scanRate
Required
Interval at which data will be sent to the Server (in milliseconds)
3000
-initFile
Required
Initialization file
/sample-init.json
-args
Optional (if set all other params are optional)
Lists usage parameters
The Application Key (-appKey) parameter provided in the example above is the default key for the MRIMachineKey, so it should work out of the box. If your instance does not have this key, then create one (it does not have to be named MRIMachineKey) under the ThingWorx SECURITY / Application Keys menu and use its generated key as the appKey parameter for the simulator.
The initialization file contains the Assets and the Properties of those assets that will have data sent to the server. The file contains assets (“things”) that will have their property values sent to the server and the properties that will be sent.
The following file will send property information for assets MRI_1, MRI_11, and MRI_12. The properties sent to the server will be HeliumLevel and Temperature.
{
"properties" : [{
"name" : "HeliumLevel",
"type" : "RANGE",
"minValue" : 26,
"maxValue" : 100
},{
"name" : "Temperature",
"type" : "RANGE",
"minValue" : 100,
"maxValue" : 200
}
],
"things" : [{
"id" : "SN0001",
"desc" : "MRI_1 remote thing for Demo Simulator"
},{
"id" : "MRI_11",
"desc" : "MRI_11 remote thing for Demo Simulator",
},{
"id" : "MRI_12",
"desc" : "MRI_14 remote thing for Demo Simulator"
}
]
}
Properties have three types: Range, Increment, and Event.
Range Property
For each scan, the Range property returns a random number between the minimum and maximum value. The following returns a number between 10 and 90. This property reports a value for every scan.
"properties" : [{
"name" : "HeliumLevel",
"type" : "RANGE",
"minValue" : 10,
"maxValue" : 90
}]
Increment Property
The Increment property returns a number that is incremented every incrementDelay period. The following starts the PressureLevel at 5, then increments it by 2 every 60 seconds. This property reports its value on the next scan that occurs after an incrementDelay period has passed and its value has been incremented.
"properties" : [{
"name" : "PressureLevel",
"type" : "INCREMENT",
"startValue" : 5,
"incrementValue" : 2,
"incrementDelay" : 60
}]
Event Property
During a scan, the Range property returns a timestamp for each time the event occurred. The following MRIScan property can occur at an interval of every 30 minutes (1800 seconds), the probability that it occurs is 0.75. Therefore, every half hour there is a 75% chance that the event occurred. If the event occurs then a timestamp of when the event occurred is reported on the next scan.
"properties" : [{
"name" : "MRIScan",
"type" : "EVENT",
"eventInterval" : 1800,
"eventProbability" : 0.75
}],
"things" : [{
"id" : "MRI_11",
"desc" : "MRI_11 remote thing for Demo Simulator",
"hoursOfOperation" : "[[(h7){h12}]*[(t2){d5}]]",
"daysInOperation" : 14
}]
This property requires that the hoursOfOperation and daysInOperation values are set at the Thing level. Below the thing has hoursOfOperation from 7AM to 7PM ([(h7){h12}]) from Monday to Friday ([(t2){d5}]). This property also creates historical data for the number of daysInOperation. For MRI_11 above, it will go back 14 days and simulate whether the event occurred during the hours of operation. Each event will be stored as a timestamp and the history of events will be sent to the server on the next scan. Going forward, if the event occurs, another timestamp entry will be added to the MRIScan property.