Virtual Objects
To better integrate scripts with other Desigo CC functions (such as, macros, reactions, and so on), it is possible to create virtual objects which are global variables (or virtual data points) that scripts can read and write to store information that can be accessed by other scripts or other Desigo CC functions. In particular, scripts use virtual objects to store the values for the Desigo CC supported data types that are useful to the other Desigo CC functions, or where such functions can write to interact with scripts. See the following examples of use:
- A script monitors a virtual object to execute certain instructions while a macro writes in this virtual object to trigger the execution of the script instructions.
- A script monitors a virtual object to execute certain instructions while another script writes in this virtual object to trigger the execution of the script instructions.
- A reaction uses a virtual data point as trigger while a script writes in this virtual object to match the conditions of the reaction.
The Desigo CC virtual objects are located in a dedicated folder under Logics in Application View of System Browser.
Object Configurator rights define the access permission to create and delete objects in a Desigo CC system. For more details about access permission for objects, see Object Configurator in Application Rights.
You can manually create virtual objects using Object Configurator, or configure virtual objects in bulk through the import of a configuration file. For instructions, see Configuring Virtual Objects.
Virtual objects are made up of a property and a command:
- Value: property in which the concerned information is stored. See the following table for details about data types that can be stored based on the object model.
- Write: command available for the Value property that allows other scripts or other Desigo CC functions to write the concerned value.
- WriteInternal: command available for the Value property that allows other scripts or other Desigo CC functions to write the concerned value. The execution of this command is not recorded in the History Database.
Virtual Object | Data Type | Simple Data Type |
Virtual Analog | GmsReal | Yes |
Virtual Binary | GmsBool | Yes |
Virtual BitString | GmsBitString | Yes |
Virtual BitString 64 | GmsBitString64 | Yes |
Virtual Combination | - | No |
Virtual DateTime | PvssTime | Yes |
Virtual Duration | GmsDuration | Yes |
Virtual Folder | - | No |
Virtual Integer | GmsInt | Yes |
Virtual Integer 64 | GmsInt64 | Yes |
Virtual Multistate | GmsEnum | Yes |
Virtual String | PvssString | Yes |
Virtual Unsigned | GmsUint | Yes |
Virtual Unsigned 64 | GmsUint64 | Yes |
Note that:
- For many of these objects, you can customize the display of
Value
, in the Details expander of the Object Configurator. For example, it is possible to specify the unit of a Virtual Analog by changing the value attributes at the point level. - The parameter for Virtual Binary can be one of the following:
0/1
,"True"
/"False"
(strings) ortrue
/false
(keywords). - For Virtual BitString and BitString 64, when storing the values, it is necessary to pass the decimal value that corresponds with the bitmask. Consequently, the result of the read operation is the decimal value, possibly to convert again into string or bit for later use.
- The Virtual Combination is a combination of simple data types.
- The Virtual Folder can be used to create hierarchies of virtual objects or other virtual object folders.
- For the Virtual Multistate, when storing the values, it is necessary to pass the numeric value that corresponds with a specific textgroup item, previously configured.
For an example of use, see Write, Read, and Print to Console Virtual Datapoints.
When the execution of a script starts, the script will check whether all the necessary virtual objects (global variables) exist; if not:
- In Engineering mode, the technician is informed by an error of type Warning in the Script Editor (Error List expander). If any required virtual object is missing, then it can be created in the scripts library (see Create Missing Objects for Library Scripts).
- In Operating mode, the operator is not informed, and the script is executed anyway but it may not work properly.
To prevent Desigo CC failure, be careful not to store too much data (at megabyte level) in an individual virtual object.
Virtual Objects in Distributed Systems
In distributed systems, a script of a certain system can store information in a virtual object that belongs to another system.