Events

The events section of a scenario file is a list of events to trigger during the simulation run. An event is typically specified by:

"at" : "2017-01-01T00:00:00"    # The time at which the event happens (can be relative)
"action" : {}   # The action to conduct. Generally this create_device, but can also be a client-specific method

The “at” time can be absolute (“2017-01-01T00:00:00”), relative to the previous event (“PT3M”) or “end” to schedule events at the end of the simulation. A common pattern is to create a sequence of actions all happening at relative times using at=”PTxx”. If the relative time is “PT0S” then the event will be scheduled for the same (*) time as the previous event. Relative times can even be negative to add an event before the previous event!

For convenience:

  • If you omit the “at” then it defaults to “PT0S” i.e. “immediately after the previous event”
  • If you omit the “action” then it simply acts to set the time for any subsequent relative events

(*) The sim engine guarantees that events which are scheduled for the same time will be executed in the order that they are defined.

Optionally, an event can repeat, with optionally an interval between each repeat, so for example the scenario below starts with the creation of 10 devices, one per minute:

"events" : [
    {
    "at" : "PT0S",
    "repeats" : 10,
    "interval" : "PT1M",
    "action": {
        "create_device" : {
            "functions" : {
                ...
            }
        }
    }
]

Actions

Create a device:

"create_device" : {
    "functions" : {
            ...
    }
}

Change arbitrary device properties with arbitrary timestamps:

"change_property" : {
    "identity_property" : "name_of_property",   # e.g. "$id" - which property is used to identify device
    "identity_value" : value_of_property,       # e.g. "01-02-03-04-05-06"
    "property_name" : "name_of_property",
    "property_value" : value_of_property  [can be string, number or boolean]
    "$ts" : "time_specification"    # e.g. "-P1D" or "2000-01-01T00:00:00" - optional, if omitted change is stamped with current simulation time
    "is_attribute" : False  # If true, then instead of this setting a named property of the device, it sets an attribute of the object managing the device (i.e. a way to change the device behaviour)
}

Execute an action on whichever Synth client is in use (e.g. aws, devicepilot, filesystem etc. - see docs for each client):

"client.<action>" {
    <whatever parameters it expects>
}

Get Synth to run a query on the historical data it has just generated [TODO: code not yet complete!]:

"query" : {
    "expression" : "$ts < ago(30)"
}

Install an anomaly-analyser:

"install_analyser" {
}

Client-specific actions are documented here: Clients