Using Custom Menu Options on a Symbol to Write Values to a Point
In this example, a Mimic is configured to contain custom menu options. The Mimic is designed to be used as a ‘Symbol’ Mimic; it will be embedded on many other Mimics. The custom menu options will be used to write values to a point that is associated with the Mimic, but each embedded version of the Mimic will need to be associated with a different point. To achieve this, Mimic parameters and pick action expressions that reference the parameters are used.
Example:
A Mimic called ‘Pump’ is configured so that it contains a visual representation of a pump. This pump is controlled via an analog point named ‘Pump Controls’.
‘Increase Power 10’:
Type: Method
Object: SCX:////CPointAlgManual/.Pump Controls
Method: Hand Control
Expression: ".Pump Controls" +10
‘Max Power’:
Type: Method
Object: SCX:////CPointAlgManual/.Pump Controls
Method: Hand Control
Expression: ".Pump Controls" 90
‘Decrease Power 10’:
Type: Method
Object: SCX:////CPointAlgManual/.Pump Controls
Method: Hand Control
Expression: ".Pump Controls" -10
‘Min Power’:
Type: Method
Object: SCX:////CPointAlgManual/.Pump Controls
Method: Hand Control
Expression: ".Pump Controls" 5
For the 4 custom menu options, the Animate Parameter setting is cleared.
This means that each custom action can only be associated with the properties of a specific database item (in this case, the ‘Pump Controls’ point). As the ‘Pump’ Mimic is designed to be used as a symbol Mimic (a generic representation of a pump that can be embedded on many Mimics), only being able to link the Mimic with one specific point means it has limited use. So the ‘Pump’ Mimic is reconfigured so that it can be associated with any database point.
An engineer uses the Parameters window (accessed via the View command group on the Graphics tab) to add the following Mimic parameters:
Name: Point
Group: Yes (selected)
Name: CurrentValue
Parent: Point
Name: FullScale
Parent: Point
Name: ObjectLink
Parent: Point
Name: ZeroScale
Parent: Point
These parameters will allow the ‘Pump’ Mimic to be associated with the CurrentValue, FullScale, and ZeroScale properties of a point (the ObjectLink is required to link the pick action menu of any point to the ‘Pump’ Mimic). The parameters require the same name as the database item properties with which they will be used.
The engineer then reconfigures the 4 custom menu options so that they have the Animate Parameter setting selected (enabled). This allows each custom menu to use a parameter as an animation property.
When the Animate Parameter setting is enabled and the Next button is selected, the engineer is prompted to enter an expression. The engineer enters the following expressions for the custom menu options:
‘Increase Power 10’:
"Parameter:Point.ObjectLink"+'?CurrentValue&value="' +STR("Parameter:Point.CurrentValue"+10) +'"'
The expression links the custom menu with the ObjectLink and CurrentValue parameters and is set to convert the current value of a point to a string. It then adds 10 to the value before writing it back to the parameter source (which will be a point).
‘Decrease Power 10’:
"Parameter:Point.ObjectLink"+'?CurrentValue&value="' +STR("Parameter:Point.CurrentValue"-10) +'"'
The expression links the custom menu with the ObjectLink and CurrentValue parameters and is set to convert the current value of a point to a string. It then subtracts 10 from the value before writing it back to the parameter source (which will be a point).
‘Max Power’:
"Parameter:Point.ObjectLink"+'?CurrentValue&value="' +STR("Parameter:Point.FullScale") +'"'
The expression links the custom menu with the ObjectLink and CurrentValue parameters and is set to convert the current value of a point to a string. It then sets the value to the same value as the FullScale of the parameter source (which will be a point).
‘Min Power’:
"Parameter:Point.ObjectLink"+'?CurrentValue&value="' +STR("Parameter:Point.ZeroScale") +'"'
The expression links the custom menu with the ObjectLink and CurrentValue parameters and is set to convert the current value of a point to a string. It then sets the value to the same value as the ZeroScale of the parameter source (which will be a point).
The engineer saves the ‘Pump’ Mimic and creates a new, blank Mimic. Next, the engineer adds an embedded version of the ‘Pump’ Mimic to the new Mimic. The embedded ‘Pump’ Mimic has the custom menu options of Increase Power 10, Decrease Power 10, Max Power and Min Power, but they are not associated with any database item.
To associate the custom menus with a point, the engineer selects the embedded ‘Pump’ Mimic so that it is highlighted. They then drag the required point from the Database Bar onto the ‘Pump’ Mimic, and a context sensitive menu is displayed.The engineer selects the Point option (which corresponds to the name of the parent group of parameters) and then selects the Configure All option. This associates the custom menu options on the embedded ‘Pump’ Mimic with the point’s FullScale, ZeroScale, CurrentValue and ObjectLink properties. When a user selects the options on the custom menu, they will increase or decrease the point’s value accordingly.
The engineer embeds the ‘Pump’ Mimic on other Mimics and associates the custom menus with a variety of other points. The embedded ‘Pump’ Mimics can be associated with any points as the custom menu pick actions have the Animate Parameter setting enabled.