Object Reference

A variable of data type object can accept a path as well as an object reference. This also applies to global variables, local variables, formal parameters, and values in tables which have the data type object.

Let’s suppose we insert a global Variable of data type object into the object Frame and name this Variable TestVarRel.

When we enter Station as the value, the Variable interprets this as a relative path, which points to the object Station in the same Frame. The corresponding SimTalk instruction is TestVarRel := "Station"

When we duplicate or derive the Frame, the respective Variable TestVarRel still points to the Station in the Frame in which the Station is located.

Then, we insert a Variable of data type object in the object Frame and name this Variable TestVarAbs.

When we drag the Station onto the text box value, the Variable interprets this as an absolute <Path>. This path always points to the Station in the object Frame. The corresponding SimTalk instruction is TestVarAbs := ".Models.Frame.Station"

When we now rename the Station to which the Variables TestVarRel and TestVarAbs point, Plant Simulation does not recognize the Station any more, shown by the question mark (?) after the name of the Station.

To enter a reference to the Station into our new Variable TestRef, we can enter *.Models.Frame.Station as the value into the text box. The * (asterisk) in front of the path designates the reference as such. The corresponding SimTalk instruction is TestRef := Station

When we rename the Station to Station1, the Variable TestRef still points to our renamed Station, while the Variables using an absolute or a relative path do not recognize the object any more. When duplicating the Frame, i.e., when duplicating the Variable as well as the object to which the Variable points, Plant Simulation supposes that the duplicated TestRef is to reference the duplicated Station, and it adjusts the reference accordingly in case the value is not inherited. This means that it does not implicitly deactivate inheritance.

Note:

We advise caution when using an object reference. As a rule you can always use an object reference instead of an absolute <Path>. If you need a relative addressing, use a relative path instead.

The main advantages of an object reference as compared to a path are a higher access speed and its tolerance towards renaming objects.

Data type Object

Related Topics

The Absolute Path

The Relative Path