Instances

Whereas a Model specifies the standardization of an asset, process, product, system or role, an Instance represents a real-time representation of one of these items. For example, a Model may be created to represent how a Quality Manager’s view of a manufacturing line will be standardized. If there are 10 manufacturing lines, 10 modeled instances would be created and populated with data to represent each one.

Create an Instance

  1. Navigate to Instances in the configuration’s Main Menu. Here you can add, edit, and view instances. To add a instance, click the New Instance button.

Graphical user interface, text, application, website Description automatically generated

  1. Enter a Name to represent the instance. Optionally enter in a Description and a Group As folder to categorize the instance. Set the model Expand Arrays for cases where the source data is an array (e.g. SQL) and the output should be an array with each row transformed through the Instance. See below for more details on the Expand Arrays feature. When disabled, a single transformed instance is output. Click Next to continue.

Graphical user interface, application Description automatically generated

  1. Select the Model. This will automatically pre-populate the attributes to be assigned to this instance. Click Next to continue.

    Graphical user interface, text, application Description automatically generated

  2. Set an expression and/or default for each attribute. Use the References panel to find and select sources of interest and drag them into any expression. Click the Submit button when finished.

Hover over and click the expansion icon in the top right of the expression box or enter CTL-SHIFT-F while inside an expression to expand the expression view and provide more area for writing expression.

See Expressions for more details.

Graphical user interface, application Description automatically generated

See Import for more details on importing third-party instances.

Instance Templating

Instances can be templated to quickly create many Instances that have the same basic configuration.

See Templating for more details.

Instance Metadata

Metadata about the Instance is available for use inside the Instance expressions. Below are examples of the available metadata and how to reference it.

Instance Metadata Description
instance.name() Returns the name of the instance. For templated instances this returns the templated name.
instance.model() Returns the model name of the instance.
instance.usage() Returns an array of usage paths for the instance. For example, if instance machine1 has a parent instance line, which is part of a plant/area hierarchy, than instance.usage()[0] returns the full path to the instance plant/area/line/machine1. The usage method takes an optional delimiter (ex. instance.usage("/")).

Array Builder

Attributes that are an array type include a button to launch the array builder. The array builder provides a drag and drop experience for building an array of references. The array is then populated in the expression field, and can be manually edited.

If the expression is manually changed to be more complex than an array, then using the expression builder will replace the expression field. Otherwise the expression builder can be used to manipulate the array.

Array Builder

Expand Arrays

The Expand Arrays feature is useful in cases where the source data is an array of objects (e.g. SQL rows) and you want to transform each row through the model and output a transformed array. Below is an example of how to accomplish this.

Consider the source input {{Connection.sql.rows}}, which returns the following data.

json
[
  {
    "timestamp": 123,
    "value": 100
  },
  {
    "timestamp": 456,
    "value": 101
  }
]

Configure the Instance as follows, where the time and rpm attributes are mapped to index [0] of the array. Index [0] is important, because the Expand Array feature breaks the input array into N arrays of size 1 (i.e. index [0]) and runs each array through the Instance.

json
{
  // Note this format is provided as an example, and this configuration must be done through the UI using the reference panel
  "time": {{Connection.sql.row}}[0].timestamp,
  "rpm": {{Connection.sql.row}}[0].value,
  "model": "myModel"
} 

The resulting Instance read looks as follows, with each row run through the Instance.

json
[
    {
      "time": 123,
      "rpm": 100, 
      "model": "myModel"
    },
    {
      "time": 456,
      "rpm": 101,
      "model": "myModel"
    }
]

Note it’s possible to combine data from multiple arrays using this feature, but each source array must have the name number of rows.