Model

The Model stage is used to reshape data in an event data into a model definition without requiring an instance. Unlike instances, the Model stage can only work with data from the event. It cannot read data from other sources. If it’s required to mix data from multiple sources, use a Read Stage followed by a Model Stage.

model_stage.png

Model

The model used to shape the event data. Once set, select the Configure Attributes button to launch the model definition and map event data to each attribute.

Object Name

The name assigned to the event after it’s been re-shaped. Note this is equivalent to an instance name, and populates the _name metadata.

Initialization Block

Similar to instances, the initialization block is used to set variables or calculated values that are shared across attribute expressions.

Example initialization block:

js
variables.mySetPoint = event.value.temp - event.value.tempOffset

Example attribute expression:

js
return (event.value.valveTemp - variables.mySetPoint)

model_stage_attributes.png

Configuring Attributes

Select Configure Attributes to see all the attributes defined in the model and map each attribute to an event value. Both expressions and default values are available.

Expression

Similar to Instances, event data can be mapped to each attribute via a JavaScript expression. Note the {{}} syntax used in Instances is not required as the event is bound to a JavaScript object.

js
return (event.value.temp - event.metadata.pressureOffset)

Default Value

Use the default value to populate the value in cases where the expression is omitted or results in an error.