The Data Simulator Plugin

This plugin provides the capability to simulate historical data based on real world process conditions.

Simulator Collector Settings

Specify Sequences to Repeat

Fields used in Mappings

Process Steps to Automate

Tags to Generate

Placeholder Usage


 

Simulator Collector Settings

These will pertain to specific configuration items for the Simulation to be generated.


"Settings": {
"Backfill": 30,
"StatePath": "C:\\Scratch\\Timebase\\Simulator",
"Sequences": {
"Fillers": {
"map": [
{
"name": "Area Code",
"data": "131"
},
{
"name": "Equipment",
"data": "Filler"
},
{
"name": "Equipment Number",
"data": "101-120/1"
}
],
"steps": [
{
"value": "0",
"duration": "random(0.15, 0.45)"
},
{
"value": "10",
"duration": "random(0.35, 1.20)"
},
{
"value": "20",
"duration": "random(0.35, 1.55)"
},
{
"value": "random(20, 23)",
"duration": "random(0.05, 0.10)"
},
{
"value": "20",
"duration": "random(0.45, 1.55)"
},
{
"value": "random(20, 23)",
"duration": "random(0.05, 0.10)"
},
{
"value": "20",
"duration": "random(0.35, 1.55)"
},
{
"value": "random(20, 23)",
"duration": "random(0.05, 0.10)"
},
{
"value": "20",
"duration": "random(0.45, 1.55)"
},
{
"value": "random(20, 23)",
"duration": "random(0.05, 0.10)"
},
{
"value": "20",
"duration": "random(0.15, 0.45)"
},
{
"value": "30",
"duration": "random(0.35, 0.95)"
}
],
"tags": [
{
"name": "[Equipment Number, FL000].[Measure]",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": {
"0": "Idle",
"10": "Startup",
"20": "Running",
"21": "Bottle starvation",
"22": "Bottle jam",
"23": "Downstream bottleneck",
"30": "Cleaning"
},
"fields": {
"Measure": "State",
"Product": "Juice"
},
"type": "System.Int64",
"values": [
"step"
]
},
{
"name": "[Equipment Number, FL000].[Measure]",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": {
"0": "Water",
"1": "Apple",
"2": "Lemonade",
"3": "Raspberry",
"4": "Orange"
},
"fields": {
"Measure": "Product"
},
"type": "System.Int64",
"values": [
"0",
"random(0, 1, 5)",
"previous"
]
},
{
"name": "[Area Code, 000]-[Instrument Code]-[Equipment Number, 000].PV",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": { "1": "°F" },
"fields": {
"Measure": "Temperature",
"Instrument Code": "TT"
},
"type": "System.Double",
"values": [
"random(1.5, 18.0, 19.0)",
"ramp(1.5, 65.0)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"random(1.5, 64.8, 65.6)",
"ramp(1.5, 18.5)"
]
},
{
"name": "[Area Code, 000]-[Instrument Code]-[Equipment Number, 000].PV",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": { "1": "MPa" },
"fields": {
"Measure": "Pressure",
"Instrument Code": "PT"
},
"type": "System.Double",
"values": [
"random(1.5, 1.5, 1.6)",
"ramp(1.5, 6.5)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"random(1.5, 6.48, 6.56)",
"ramp(1.5, 1.5)"
]
},
{
"name": "[Area Code, 000]-[Instrument Code]-[Equipment Number, 000].PV",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": { "1": "ft³/s" },
"fields": {
"Measure": "Flow Rate",
"Instrument Code": "FT"
},
"type": "System.Double",
"values": [
"random(1.5, -0.5, 0.5)",
"ramp(1.5, 14, 0.5)",
"random(1.5, 13.8, 14.5)",
"random(1.5, -0.5, 0.5)",
"random(1.5, 13.8, 14.5)",
"random(1.5, -0.5, 0.5)",
"random(1.5, 13.8, 14.5)",
"random(1.5, -0.5, 0.5)",
"random(1.5, 13.8, 14.5)",
"random(1.5, -0.5, 0.5)",
"random(1.5, 13.8, 14.5)",
"random(1.5, 3.3, 4)"
]
},
{
"name": "[Area Code, 000]-[Instrument Code]-[Equipment Number, 000].PV",
"description": "[Equipment] [Equipment Number] [Measure]",
"uom": { "1": "ft³" },
"fields": {
"Measure": "Flow Total",
"Instrument Code": "FQ"
},
"type": "System.Double",
"values": [
"0",
"integrate([Area Code, 000]-FT-[Equipment Number, 000].PV, second, true)",
"integrate([Area Code, 000]-FT-[Equipment Number, 000].PV, second)"
]
}
]
}
}

 

Data Settings for Backfill and the State Path

  • Backfill int The number of days of historical data to generate. The Simulator will randomize a start date for each sequence. Default value is 30 days.
  • StatePath string The path where the Simulator will store its running state. This allows a seamless restart after tag modifications or additions have been made to the sequence definitions.

Sequence Definition

A Sequence represents a "cycle" of steps that repeat continuously. Typically, a Sequence would be used to drive a "state engine" for a class of equipment, e.g. "Fillers", "Mixing Tanks", etc.

  • Map array of Field required Used to templatize the generation of a number of Sequence instances. All Tags defined within a Sequencewill inherit the Fields generated for each Sequence instance. If a Taghas already defined a matching Field, then the Tag's field value will take precedence.
  • Steps array of Step required The sequence of steps, in order of process, that define a single "cycle" of the equipment's "state engine", e.g. 0 = "Idle", 10 = "Startup", etc.
  • Tags array of Tag required The configuration of the tags to be created for each Sequence instance. This configuration includes the definition of how the tags data should be generated in relation to the Sequence Steps.

 

In this example we define our equipment Fillers, and map the Equipment Number for each filler as 101-120/1 , starting at 101 and growing by an integer of 1 until we reach 120, resulting in 19 instances.

The first portion of the map syntax is to specify the range, so in this example it will populate values from 101 to 120. The second portion defines how large the steps should be, so /1 means in steps of 1. So the example will generate values 101, 102, 103 ..... 120.)

 

Field Definition

  • Name string required The name of the Field, e.g. "Area Code", "Equipment Type", "Equipment Number", "Product Type", etc.
  • Data string required The patterns of data to be generated for each Sequence instance. There are a number of formats this data can be defined as:
    • Strings Comma separated list of strings, e.g. "Mixing, Packaging, Distribution". Regex ^([^,]+)(, *[^,]+)*$
    • Numbers Comma separated list of number, e.g. "1, 2, 3, 7, 8, 21, 28". Regex ^-?\d*(\.\d+)?(,\s*-?\d*(\.\d+)?)*$
    • String multiplier pairs Comma separated list of string multiplier, e.g. "ABC\10, DEF*3". Regex ^([a-zA-Z][a-zA-Z0-9]*\*\d+)(,\s*[a-zA-Z][a-zA-Z0-9]*\*\d+)*$
    • Number multiplier pairs Comma separated list of numbers, e.g. "12.3*10, 13*3". Regex ^(-?\d+(\.\d+)?\*\d+)(,\s*-?\d+(\.\d+)?\*\d+)*$
    • Number range with optional step Comma separated list of number ranges, with an optional step, e.g. "1-10" or "1.5-2.5/0.1" or "1-10/2" or "1-10, 20-30" or "1-10, 20-30/2, -5.5-3.2". A step of 1 will be used if it is not provided. Regex ^((-?\d+(\.\d+)?)-(-?\d+(\.\d+)?)(/(-?\d+(\.\d+)?))?)(,\s*((-?\d+(\.\d+)?)-(-?\d+(\.\d+)?)(/(-?\d+(\.\d+)?))?))*$
  • Wrap bool Specifies whether to continuously wrap to the beginning of the Data sequence, or to repeat the last value in the sequence, e.g. For 5 instances, "1, 2" with Wrap = true renders the equivalent of "1, 2, 1, 2, 1" whereas Wrap = false renders the equivalent of "1, 2, 2, 2, 2".

Step Definition

  • Value string required The value of the step in the context of a "step engine" cycle. The output must convert to an int. The following definitions are available:
    • Number As single int value, e.g. "0" or "10" or "30"
    • Random random(minimum, maximum) where minimum and maximum are int values, e.g. "random(20, 23)" will generate a random integer from 20 to 23, inclusive.
  • Duration string required The duration of the step in minutes double. The following definitions are available:
    • Number As single int or double value, e.g. "5" or "11.3" or "32.5"
    • Random random(minimum, maximum) where minimum and maximum are int or double values, e.g. "random(2.5, 23.8)" will generate a random duration from 2.5 to 23.8 minutes, inclusive.

Tag Definition

  • Name string required The name of a tag, which can include placeholders, e.g. "[Area Code, 000]-[Instrument Code]-[Device Number, 000].PV"
  • Description string The description of a tag, which can include placeholders, e.g. "[Equipment] [Equipment Number] [Measure] [Device Number]"
  • Format string The formatting of a tag's values, if they are numbers, e.g. "0.00"
  • UOM numbered dictionary of string The unit of measure of a tag. However, the numbered dictionary provides addition features of the UOM:
    • Single key Negative key places UOM in front of number, positive key places UOM after number, e.g. { "-1": "$" } renders as "$ 14.95", { "1": "°F" } renders as "32.3 °F"
    • Binary key For use with boolean tags, e.g. { 1: "Running", 0: "Stopped" }, { 1: "Open", 0: "Closed" }
    • Multiple keys For use with enumerated integer tags, e.g. { 1: "Apple", 2: "Orange", 4: "Lemon" }
  • Fields named dictionary of string Name Value pairs that represent a tag's metadata, e.g. { "Measure": "Temperature", "Measure Code": "TT", "Device Number": "1" }
  • Type string The datatype of a tag, as defined by .NET, e.g. "System.Double", "System.Int64", "System.String", "System.Boolean"
  • Values array of string required The data generation definition for each Step defined by the Sequence Steps. If there are less Valuedefinitions than there are Steps, then the last Value definition will be repeated until the end of the cycle of Steps. A number of options are available for defining a step's data generation:
    • Step Reference to the step number generated by the SequenceStep, e.g. "step"
    • Null Generate a null value, e.g. "null"
    • Previous Generate a value which is equal to the last value that was generated, e.g. "previous"
    • Number Generate a number, e.g. "5" or "3.14"
      • Ramp ramp(interval, to, noise) where interval is the number of seconds double between points generated, to is the value the ramp function will be at the end of the step, and noise is a factor between 0 and 1 used to add some random noise to the generated ramp. noise defaults to 0. Note that the actual interval between points generated is randomized around the interval value. interval cannot be set lower than 1 second. The ramp function will attempt to get the previous value as a starting point. Some examples, "ramp(1.5, 65.0)", "ramp(1.5, 18.5, 0.5)"
    • Random random(interval, minimum, maximum, bias) where interval is the number of seconds double between points generated, minimum is the minimum value that can be generated, maximum is the maximum value that can be generated, and biasis a factor between 0 and 1 that shifts the generated data to minimum, if 0, to maximum, if 1. bias defaults to 0.5. Note that the actual interval between points generated is randomized around the interval value. If interval is set to 0, then only a single data point will be generated at the start of the step. Some examples, "random(0, 1, 5)" will generate a single value from 1 to 5, "random(1.5, 64.8, 65.6)" will generate a series of values, approximately 1.5 seconds apart, with values between 64.8 and 65.6
    • Integrate integrate(tagname, timebase, reset) where tagname refers to a tag within the Sequence instance that will be integrated over time, timebase can be "second", "minute", or "hour", and reset is true or false and determines whether the integrator should reset back to 0 on this step or not. tagname can contain placeholders. As an example, if the tag being integrated represent a flow rate in ft³/s the timebase should be set to "second" so the result of the integration represent total ft³. reset defaults to false. Some examples, "integrate([Area Code, 000]-FT-[Equipment Number, 000].PV, second, true)", "integrate([Area Code, 000]-FT-[Equipment Number, 000].PV, second)"

Placeholders

Placeholders can be used in specified Tag definition properties. Placeholders are key to using the templatization feature of Sequence definitions. They make use of Fields defined at the Sequence Map level, or those defined directly on the Tag. Placeholders are defined by square brackets as follows:

  • [Field Name] The value of the Field will be used to replace the placeholder, e.g. [Area Code] where "Area Code" has a value of 131 will render as 131
  • [Field Name, 000] The formatted value of the Field will be used to replace the placeholde, e.g. [Equipment Number, FL000] where "Equipment Number" has a value of 2 will render as FL002