When a frame containing objects that reference other objects is duplicated, it may not function as expected if the object references are absolute.
Plant Simulation allows for Frames to be Duplicated. When a Frame is duplicated, a copy of the Frame is made. In addition a copy of every object is made and placed in the duplicated Frame.
Many objects reference Tables for data and/or Methods for control.
If the original Frame objects reference objects in the Class Library, the duplicate objects will reference the same Class Library objects. These are absolute references.
If the original Frame objects reference objects in the Frame, the duplicate objects will reference the duplicated objects in the duplicated Frame. These are local references
If an object in the Class Library is modified, then all of the objects that reference it will be affected. Hence, all of the duplicated Frames with absolute references will be affected. This is usually not desirable.
If an object in the Frame is modified, then only the objects that reference it will be affected. Hence, only the objects in the duplicated Frames with local references will be affected. This is usually the more desirable action.
Generally, local references should be used. Then redirection can be used to reference an object in the Class Library. By using redirection, the duplicated frame will reference the same object as the original. But, when the redirection in the Frame is modified, only the Frame will be affected.
Redirection is easily accomplished. In the Frame create a variable of type 'object'. Then, a control Method will references the value of the variable instead of the actual object.
For example, to reference a table in the Class Library:
1. Add a Variable to the Frame (Assemb_table) with Data Type 'object'.
2. Set the value to the path to the table in the Class Library. Drag and drop the Class Library Table into the Variable.
3. In the method access the table using the Variable name.
local rows := Assemb_table.ydim;
for local i := 1 to rows loop
TableFileObj[1, i] := Assemb_table[3, i];
See Reference Help > SimTalk > Names > Paths > Object Reference for more details.
See the model example_assembly_1.spp.
Notes and References
OS Version: 764SP1