Vous êtes sur la page 1sur 7

Rockwell FactoryTalk Studio Basics:

Global Objects and Tag Substitution

Global Objects in Rockwell Automation / Allen-Bradley's FactoryTalk HMI development


environment are useful to bring modularization and efficient repeatability of common
elements in your project. This basic feature has been around for a long time, but knowing
how to use Global Objects effectively can greatly reduce your development time, chance of
errors, and number of displays to license at runtime.

In this tutorial, I will show you how to set up a simple control valve as a Global Object which
links to a pop-up faceplate using Tag Substitution. The final result will allow us to input just
three parameters to generate a new valve on the HMI. I will be showing the development for
FactoryTalk View Site Edition (SE), but also applies to Machine Edition (ME).

Global Objects use a special type of display which allows you to link back to the parent when
used in a 'normal' display screen. They are more powerful than a simple template for a group
of objects; any formatting or animation changes made to the Global Object propagate to all
its instances in the project. Another advantage of Global Objects is that they are particularly
suited for coordination in the PLC through User-Defined Data Types (UDTs) and Add-On
Instructions (AOIs), which allow for consistent tag structure and modular logic.

Basic Setup
First off, I have developed a simple PLC program which utilizes the UDT 'udtValve' to track
what is going on with our valve called 'HMI_CYL'. The members of the UDT will be used on
the HMI to display status animations for the valve. There is also an AOI on the PLC side
which handles the logic and makes it easy for me to instantiate new valves into my PLC
project.
User defined data type 'udtValve'.

Now that the PLC side is set, let's move over to the HMI project. Go to 'Graphics' -> 'Global
Objects' -> [Right Click] 'New' to create a new global object display in FactoryTalk Studio.
I've drawn an object group for the valve and set up color animation for the valve to show
green when open, gray when closed, and red when faulted. In my PLC code, the '.Status'
member of udtValve outputs a number for each of these states.

This is where global objects are extremely helpful -- we do not want to copy/paste into each
animation if we need to create many valves in a project! We can insert a placeholder
parameter instead of a direct PLC tag in the animation so that we can make the global object
generic. Use '#1' then '.(name of UDT
member)' to access a specific tag member of the UDT. We could create other tag placeholders
that are different UDTs or just normal tags by referencing '#2', '#3', etc., up to '#500'.

Global Object Animation

Next, we need to set up a definition for the parameter we just referenced. Right-click on the
object (make sure all of the drawing objects are grouped together) and navigate to 'Global
Object Parameter Definitions'. For each placeholder you reference, you must list here with
the # and number.
Global object parameter definition

Now we are ready to create an instance of the global object into our desired runtime screen.
Simply copy/paste the global object group, then right click -> 'Global Object Parameter
Values'. This is where we link the PLC instance name of the particular valve we want to
reference to those placeholders we put in the animation. The result will concatenate to get the
whole tag '[PLC]HMI_CYL.Status' in runtime.

Global object parameter values

Beyond the Basics


Alright, we've created a simple global object! We have a valve that changes color based on
the feedback from the PLC logic. There's a few other things we can do to give the users of
our HMI application more information and control of the valve. I'm going to add a pop-up
that displays when we click on the valve and a placeholder to show the name of each valve
instance.

Let's start with the valve name placeholder. Add a text box to the valve global object. In its
text properties, click 'Insert Variable' -> 'String..' then choose 'Literal string' and input '#2' to
create a new placeholder. The code generated should look something like this (depending on
the options you choose in the dialogue box):

Tag substitution using literal string

Edit the global object parameter definitions again to account for the '#2' placeholder we just
added. Drag a new instance of the global object to your display screen and open its parameter
values. Because we chose 'Literal string', we can now input normal text to display with our
global object, instead of linking to a PLC tag. If you do want it to link to a string tag in the
PLC, then choose 'Tag' when you Insert Variable into the text box setup.

Global object parameter values using string for tag name

Finally, we are going to create a pop-up which displays when you click on the valve. For this
we will use a normal display instead of a global object display, but will reference it from our
global object. Our pop-up will also use tag substitution -- it doesn't just apply to global
objects!

I've created a display called 'CV_Faceplate' which shows additional valve statuses and has
buttons which can be used to open and close the valve if it is in manual mode. Each of the
tags use a '#1' placeholder with .(Name of UDT member) just like the global object. I've
also added the '#2' placeholder for the valve name and additionally I've added a '#3' literal
string placeholder for a valve description.
Control valve faceplate / pop-up using tag substitution

Now we are going to go back to the global object. I want the pop-up I created to display when
the valve is clicked on, so I will add a Touch animation, which uses the display command,
and /T to invoke tag substitution. Add '#3' to the global object parameter definitions. Take
note that #3 is not used in the global object itself, it is passed to the pop-up display only!

Display faceplate/pop-up from global object

Important Note: Because we are using the global object to tag substitute to the pop-up
display, we are also putting #1, #2, and #3 in the display command which are linked to our
global object parameter values. We could also put direct tag references in the display
command which correspond to each of tag placeholders in the pop-up display if we wanted to
call the pop-up outside of a global object. In that case, our Touch animation would look like:
'Display CV_Faceplate /T {[PLC]Another_Valve} {CV-150} {CV-150 Description} /cc'.
We've created a valve which displays a status pop-up without having to change any
background code to create a new instance. To create new valves, all we need to do is copy the
global object and fill in its three input parameters! Here are a few views in runtime:

Animated control valve global object and faceplate / pop-up example 1

Animated control valve global object and faceplate / pop-up example 2


Animated control valve global object and faceplate / pop-up example 3

Tips
To test your global object, make sure you generate an actual client for runtime.
Switching your screen to 'Test Display' may make it look like your global object is not
working correctly.

You can create multiple global objects in one global object display screen. Each group
of objects can have separate parameter definitions and be dragged into displays
individually.

If you want to modify an instance of a global object separately from the parent, you
can 'Break Link' by right-clicking on the instance in the display. It is also useful if you
do want to use a global object as a graphic template, or you don't want changes to the
global object to propagate to the children.

Tools which create modular, re-usable code like Global Objects, Tag Substitution, User-
Defined Data Types (UDT), and Add-On Instructions (AOI) greatly reduce your development
time and makes your implementation much easier to get up and running. DMC focuses on
these strategies for both PLC and HMI/SCADA in order to deliver efficient, high-
performance applications to our customers across many development platforms. See this
blog, Linking PLC UDT Tags to HMI Facplates and Pop-ups in TIA Portal V13 SP1, for
similar tips in the Siemens platform.

Vous aimerez peut-être aussi