Simulation Configuration Schema

The simulation schema contains all the necessary information to initialize and run an experiment, including details such as the engines involved in the experiment, active TransceiverFunctions, and engine timesteps. It defines the structure and parameters of the simulation configuration file to be created by the users for each of their experiments.

Parameters

Name

Description

Type

Default

Required

Array

Values

SimulationLoop

Type of simulation loop used in the experiment

enum

“FTILoop”

“FTILoop”, “EventLoop”

SimulationTimeout

Experiment Timeout (in seconds). It refers to simulation time

integer

0

ProcessLauncherType

string

Basic

EngineConfigs

Engines that will be started in the experiment Framework used to process and rely datapack data between engines. Available options are the TF framework (tf) and Computation Graph (cg). Only used if “SimulationLoop” parameter is set to “FTILoop” (default)

enum

“tf”

X

“tf”, “cg”

DataPackProcessingFunctions

Transceiver and Preprocessing functions that will be used in the experiment

X

DataPackPassingPolicy

Policy of passing DataPacks into Transceiver, Preprocessing, and Status Functions. When set to “value”, all input DataPacks are passed by value (copied). When set to “reference”, the DataPacks are passed by reference. The latter should be faster, but extra care has to be taken to not overwrite DataPacks used by other Functions or Engines. Status Function that can be used to exchange data between NRP Python Client and Engines List of filenames defining the Event Loop configuration parameters. Only used if “SimulationLoop” parameter is set to “EventLoop”

string

string

“value”

X

“value”, “reference”

ExternalProcesses

Additional processes that will be started in the experiment

X

ROSNode

If this parameter is present a ROS node is started by NRPCoreSim

MQTTNode

If this parameter is present an MQTT client is instantiated and connected

Example

{
    "SimulationName": "tf_exchange",
    "SimulationDescription": "Launch two python engines. Engine1 will offer the current time as a datapack. tf_1 will request said datapack and send it to Engine2. Engine2 will receive the time and display it",
    "SimulationTimeout": 1,
    "EngineConfigs":
    [
        {
            "EngineType": "python_json",
            "EngineName": "python_1",
            "PythonFileName": "engine_1.py"
        },
        {
            "EngineType": "python_json",
            "EngineName": "python_2",
            "PythonFileName": "engine_2.py"
        }
    ],
    "DataPackProcessingFunctions":
    [
        {
            "Name": "tf_1",
            "FileName": "tf_1.py"
        }
    ]
}

Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Simulation",
  "description": "Simulation configuration schema. Specify an experiment using multiple engines and transceiver functions.",
  "$id": "#Simulation",
  "type": "object",
  "properties" : {
    "SimulationLoop" : {
      "enum" : ["FTILoop", "EventLoop"],
      "default": "FTILoop",
      "description": "Type of simulation loop used in the experiment"
    },
    "SimulationTimeout" : {
      "type" : "number",
      "default": 0,
      "description": "Experiment Timeout (in seconds). It refers to simulation time."
    },
    "DataPackProcessor" : {
      "type" : "string",
      "enum" :  ["tf", "cg"],
      "default": "tf",
      "description": "Framework used to process and rely datapack data between engines. Available options are the TF framework (tf) and Computational Graph (cg). Only used if \"SimulationLoop\" parameter is set to \"FTILoop\" (default)"
    },
    "ProcessLauncherType" : {
      "type" : "string",
      "default": "Basic",
      "description": "ProcessLauncher type to be used for launching engine processes"
    },
    "EngineConfigs" : {
      "type" : "array",
      "items": {"$ref": "json://nrp-core/engines/engine_base.json#EngineBase"},
      "description": "Engines that will be started in the experiment"
    },
    "ExternalProcesses" : {
      "type" : "array",
      "items": {"$ref": "json://nrp-core/process_launcher.json#ProcessLauncher"},
      "description": "Additional processes that will be started in the experiment"
    },
    "DataPackProcessingFunctions" : {
      "type" : "array",
      "items": {"$ref": "json://nrp-core/transceiver_function.json#TransceiverFunction"},
      "description": "Transceiver and Preprocessing functions that will be used in the experiment"
    },
    "StatusFunction" : {
      "type" : "object",
      "items": {"$ref": "json://nrp-core/transceiver_function.json#TransceiverFunction"},
      "description": "Status Function that will be used in the experiment"
    },
    "ComputationalGraph" : {
      "type": "array",
      "items": "string",
      "description": "List of filenames defining the CG nodes and connections"
    },
    "EventLoop" : {
      "$ref": "json://nrp-core/event_loop.json#/event_loop",
      "description": "Event Loop configuration parameters. Only used if \"SimulationLoop\" parameter is set to \"EventLoop\""
    },
    "ROSNode" : {
      "$ref": "json://nrp-core/nrp_connectors.json#/ROSNode",
      "description": "If this parameter is present a ROS node is started by NRPCoreSim"
    },
    "MQTTNode" : {
      "$ref": "json://nrp-core/nrp_connectors.json#/MQTTClient",
      "description": "If this parameter is present an MQTT client is instantiated and connected"
    },
    "FunctionArgumentsPassingMethod" : {
      "type" : "string",
      "enum" :  ["value", "reference"],
      "default": "value",
      "description": "Method used for passing DataPacks into Preprocessing, Transceiver, and Status Functions. Passing by reference should be more performant, but extra care must be taken to not alter data used by other Functions and Engines."
    }
  },
  "required": []
}