Book a Demo
Prev Next

Variable Actions

Variable Actions are closely concerned with the simulation of the behavior of and actions on Objects in a process. They have an association variable in the form of the Tagged Value variable with, as its value, the name of an Object in run-time. That is:

     sim.ObjectName

Variable Actions provide the variable not only as an Object but also as a property (such as an attribute or Port) of an Object. For example:

     sim.a.a1

The parameter a.a1 can have an integer value.

Variable Actions include:

  • ReadVariable
  • WriteVariable
  • ClearVariable
  • AddVariableValue
  • RemoveVariable

ReadVariable

A ReadVariable Action has a Result Action Pin as an output Port. The value of the Port will be the result to be read, this being a copy of the variable read. Therefore, it is not affected by changes to the value of the variable. For example, if the variable is sim.Object.a that has the value 3, and its value has been changed into 5 after it is read, the value read is still 3.

Before reading:

     sim.Object.a = 3;

     sim.Action1.result = null;

After reading:

     sim.Object.a = 3;

     sim.Action1.result = 3;

After a change in the value of the variable:

     sim.Object.a = 5;

     sim.Action2.value = 3;

In that example, the value is a Port of Action2 that is connected to the result Port of Action1 by an Object Flow connector.

WriteVariable

This Action has a Value Action Pin as an input Port. The value of the Port will be written into its variable. The result value is a copy of the variable from the Value Port.

ClearVariable

This Action clears all values of a variable, the variable being either an Object or a value.

AddVariableValue

This Action is effectively the same as a WriteVariable Action, because the current variables of the simulation do not support multiple values.

RemoveVariableValue

This Action is effectively the same as a ClearVariable Action because the current variables of the simulation do not support multiple values.

Learn more