Profiles for your simulated devices are defined in JSON files inside the profiles directory.
You can have as many as you require and refer to them in the simulation.json file.
Each group in simulation.json must be assigned a profile.
Each profile determines the features of the simulated devices in a group, such as connection and disconnection to/from Digi Remote Manager, remote firmware update processes, or file system management. Additionally, a profile is assigned a set of device requests and data streams that support all devices that use the profile.
Follow these steps to create a profile that satisfies your requirements:
-
Inside the
profilesdirectory, rename thetemplate_profile.jsonfile tostreetlight.json.In your
simulation.jsonfile you configuredprofile_idto bestreetlight, this means you must have a file with that name and.jsonextension inside theprofilesdirectory. See previous step 2. Define simulation parameters. -
Edit the
streetlight.jsonfile to configure the simulated devices behavior. -
Configure the connection settings so your simulated devices can:
-
Recover the connection if they disconnect for any reason (
reconnect_interval). -
Schedule random disconnections to simulate for example, low power modes or connection issues (
disconnect_interval)
This example does not simulate a connection lost, devices are always connected.
To achieve this, remove the
disconnect_intervalfromconnection_settings. See Device profiles definition in case you need this behavior. -
-
Set the maintenance window for the devices: When it starts, how much time it takes, and when it repeats.
For the example, specify a maintenance window of one hour a day. Inside
maintenance_windowset: -
Define the simulated firmware update process.
Simulated streetlights of this example allow remote firmware updates but with a ratio of failure of 30% when installing the downloaded image. Inside
fw_updateset:-
Always succeed in verify stage:
probabilityto0inverify_stage. -
Always succeed during download:
probabilityto0indownload_stage. -
30% of errors during installation:
probabilityto30ininstall_stage.
-
-
Allow remote access to your simulated devices file system.
For this example:
-
Rename directory
template_file_systeminsidefstostreetlight_fs. -
Use resources inside the
streetlight_fsdirectory as the initial file system of your simulated devices: Setbase_fs_idtostreetlight_fs. -
Configure a maximum size per device, for example, 400 bytes.
-
-
Add data streams to your simulation if your devices upload data to Remote Manager.
The streetlight devices must upload the read light level and its status.
To do so, configure the
data_streamsobject:-
Select the set of data streams for the profile, that is the identifier of the file that defines the collection of data streams to upload to Remote Manager.
Sets of streams are defined inside the
data_streamsdirectory of your simulation folder.The data streams identifier,
data_streams_id, for the example islight_streams. It is defined in step 4. Specify data to upload. -
Configure three minutes as the rate to upload a samples batch,
batch_upload_frequency.
-
-
Include support for device requests if your simulation requires them.
Sets of requests are defined inside the
device_requestsdirectory of your simulation folder.The device requests identifier,
device_requests_id, for the example islight_requests. It is defined in step 5. Configure supported remote requests.Adding device requests requires the implementation of custom code to process them. See 6. Implement custom code.
| For a complete explanation of profile files, see Device profiles definition. |
profiles/streetlight.json{
"connection_settings": {
"reconnect_interval": {
"minimum": "PT30S",
"maximum": "PT60S"
}
},
"maintenance_window": {
"type": "auto",
"start_time": "now",
"duration": "PT1H",
"frequency": "PT24H"
},
"fw_update": {
"allow_update": true,
"reconnect_after_update": true,
"progress_messages": [
{
"until_progress": 25,
"message": "Unpacking firmware image..."
},
{
"until_progress": 70,
"message": "Installing firmware image..."
},
{
"until_progress": 100,
"message": "Applying firmware image configurations..."
}
],
"duration": "PT2M",
"stage_errors": {
"verify_stage": {
"probability": 0,
"error_code": 1
},
"download_stage": {
"probability": 0,
"error_code": 1
},
"install_stage": {
"probability": 30,
"error_code": 1
}
}
},
"file_system": {
"base_fs_id": "streetlight_fs",
"virtual_fs": true,
"max_size_bytes": 400,
"reuse_previous_fs": true
},
"data_streams": {
"data_streams_id": "light_streams",
"batch_upload_frequency": "PT3M"
},
"device_requests_id": "light_requests"
}