Professional Documents
Culture Documents
GFS-154B M14 Global Objects
GFS-154B M14 Global Objects
Objectives
y Define to Global Objects.
y Use Global Variables.
y Create Global Tables.
y Use Global Forms and Procedures.
Understanding Global Objects
Overview
Thus far, objects have been discussed within a document-based context, most commonly
with regard to Pictures and Dynamo Sets. Every object is described or has functionality
enabled by a set of properties. These objects are very useful, but their scope is limited to the
document of which they are a part.
Global objects provide a means of extending the scope of objects to any document in the
Workspace. Global objects and their properties can be accessed universally for use in
defining animations, providing common forms and displaying system-wide data. Generally,
these objects are data objects and have no visible graphic component.
User Globals reside in a unique area and provide a means for developers and users to
create, store and link to common objects and properties. Plug-and-Solve Globals are
reserved separately for third-party software providers to use with their plug-in applications.
User Globals can be found in the System Tree and browsed in the Expression Builder.
User Globals
User Globals are stored in a single document. The User.FXG file is
found in the project PIC path and can be copied to other iFIX
projects for re-use. Like Pictures and Dynamo Sets, this document
can hold a variety of different object types, as well as VBA forms
and scripts. Global Key Macros can also be built for use anywhere
in the Workspace and these are stored in the User Globals file.
The main interface for Global object access and creation is the
System Tree. From here a user can access a right-mouse menu to
edit the contents of the User Globals.
Save will commit all changes permanently to the User.FXG file. The
Find and Replace and Property Window choices behave exactly
Figure 14-3. User Globals
like their normal object counterparts. right-mouse menu.
Global Variables
Variables are useful tools for storing information used by many different areas of iFIX. The
variable itself is invisible and can only be seen in the System Tree. However, variables can
be used as data sources for DataLinks and other animations as well as VBA scripts. For
example, variables can be used to hold the names of the Current and Previous displays.
These names can then be used to assist with navigation.
Variables receive their data from VBA scripting or via other data sources assigned through
the Expression Builder (such as tags).
Creating Global Variables is relatively easy. The User right-click menu in the System Tree
offers a Create Variable choice that requires manual configuration. The Workspace Toolbox
also provides a button to add variables with a friendly interface.
Text data.
Integer data.
Figure 14-4. SimpleGlobal variable (left) or Global using a data source (right).
Variables must be given a unique name and must be assigned a data type (eg. String, Float,
Boolean, etc.). This will provide the necessary format for the data before it is passed along to
its destination. Note that a Local Variable can be created as well. These variables will be
deposited in the current Workspace document and will be restricted to the same document
scope as normal objects.
Globals SERVER.
Server.Object.Property
Figure 14-5. Browsing the Expression Builder to configure a Datalink to use a Global Variable .
The Source Property Type refers to the incoming data from the data source (eg. a tag
current value) whereas Objects Property Type indicates what the value will be mapped to
before being passed to the destination. Exact match is very good for two-state tables for
color, visibility and text strings. Range Comparison is much better for analog tag ranges.
Entries can be edited in-place or through a mini-dialog that can be opened by double-
clicking on the target cell.
Globals SERVER.
Figure 14-8. Linking to a Global Threshold table with the Expression Editor.
Global document.
Lab Exercises
Lab Objectives: At the end of these exercises, the student will be able to:
y Create Global Variables to track current alarm area, chart groups and current and
previous picture names.
y Create Global Threshold tables for two state equipment and multi-state tanks. Also
create string thresholds for tank level descriptions.
y Create a Global Key Macro to control the Alarm Horn.
When you are finished with these exercises, answer the Summary Questions at the end of
the module.
1. Ensure the Workspace is open and in Configure mode, and that at least one picture is
open.
2. Use the Toolbox Variable icon to create a new Global Variable to store the name of
the currently open process display. Name the variable varCurrentPicture
3. Inspect the new variable in the System Tree by expanding the Globals folder and then
the User document.
4. Using the toolbox button, add three more Global Variables with the following properties:
Variable Name Data Type Variable Type
varPreviousPicture String Global
varChartGroup String Global
varAlarmArea String Global
5. When finished, right-click the User document and select Save. This will save all your
changes to the User.FXG document, whether they are variables, thresholds, key macros,
forms or scripts.
1. Right-click the User document in the System Tree and select Create Threshold Table.
The Custom Lookup Table dialog will appear.
2. We will start with a very simple threshold table for animating the status of two-state
equipment. This table will convert integers into colors.
a. Source Property Type: Integer.
b. Objects Property Type: Color.
Since we are working with only two states we will use Exact Match. The color table will
simplify as a result.
Red.
Green.
9. Using the right-click menu, create another Threshold table. This one will be used to
assign color indication to tank levels. Since we are using analog values with our tank
levels, we will be using Float as the Source Property Type and Color as the Objects
Property Type. We will use a Range Comparison. Use the following figure and table as a
guide.
10. Using the right-click menu, create another Threshold table. This one will be used to
assign text descriptions for the current tank levels. Since we are using analog values
with our tank levels, we will be using Float as the Source Property Type and String as
the Objects Property Type. We will use a Range Comparison. Use the following figure
and table as a guide.
11. Inspect the Globals folder in the System Tree. It should resemble the figure below.
Right–click the User document and select Save.
2. The Key Macro Editor will open already set to add Key Macros
to the User Globals document. Set the Key Macro as such:
a. Key Combination: CTRL-H.
b. Action: Alarm Horn.
4. Click OK and close the Key Macro Editor. Save the User.FXG document on your way out.
-- End of Exercises --
Review Questions
1. Where are Global variables, Thresholds, Procedures, Forms and Key Macros stored?
4. What are three data types that can be used in Global Threshold Tables?
Review
Now that you have completed this module, you should be able to:
y Define to Global Objects.
y Use Global Variables.
y Create Global Tables.
y Use Global Procedures.