Unity Pro - Getting started
Presentation
Introduction This is a Getting started tutorial for Unity Pro. The goal is not to cover all
the functionality of Unity Pro, but to cover the basic features of the software
for new users to quickly get started.
You will need the Injection modeling machine.stu application for the
tutorial.
1
Index
Getting started ............................................................................................................................... 1
Presentation ............................................................................................................................. 1
Introduction ................................................................................................................. 1
Load / Run application ............................................................................................................ 4
Load the application .................................................................................................... 4
Open Operator screen.................................................................................................. 5
Open Diagnostic viewer .............................................................................................. 5
Start demo machine..................................................................................................... 6
Acknowledge fault ...................................................................................................... 6
On line debugging ................................................................................................................... 7
Debugging in Ladder diagram..................................................................................... 7
Variable window ......................................................................................................... 8
Break point in FBD ..................................................................................................... 8
Break point in ST ........................................................................................................ 9
Watch point ............................................................................................................... 10
Animation Table........................................................................................................ 11
Variable adjust........................................................................................................... 12
Multiple adjust in one shot ........................................................................................12
System Diagnostic..................................................................................................... 14
Application diagnostic............................................................................................... 15
Operator screen ......................................................................................................... 16
Programming tools ................................................................................................................ 18
Cross references ........................................................................................................ 18
Data Editor ................................................................................................................ 21
Create a new variable .................................................................................... 21
Direct Selecting variable type ....................................................................... 21
Selection variable type assistant.................................................................... 22
Display variable............................................................................................. 23
Map variables on physical addresses ............................................................ 24
Structured variables................................................................................................... 25
Hyperlink node.......................................................................................................... 26
Hyperlink properties...................................................................................... 26
Programming structure..........................................................................................................27
Create a new Task ..................................................................................................... 27
Create a new section.................................................................................................. 28
Activate the protection .................................................................................. 29
Events 30
IEC Languages ...................................................................................................................... 31
SFC Steps .................................................................................................................. 31
SFC Transitions............................................................................................. 32
FBD (Function block Diagram) ................................................................................ 33
FBD (New section)........................................................................................33
FBD (Data Selection) .................................................................................... 34
FBD (Description).........................................................................................35
2
Index (continued)
LD (Ladder Diagram)................................................................................................ 36
LD (New section) ..........................................................................................37
LD (Tool bar) ................................................................................................ 37
LD (Description) ........................................................................................... 38
ST (Structured Text).................................................................................................. 39
ST (Description)............................................................................................ 39
IL (Instruction List)................................................................................................... 40
IL (Description)............................................................................................. 40
3
Load / Run application
Load the
application
1
Open injection modeling
machine.stu
( File / Open )
Select the Simulator.
Build the application.
The output window will
display 4 Warnings and no
Errors.
d After the build, the
status bar displays BUILT
in the lower right. 2
eConnect to the
Simulator.
4
f Download application.
g Click on Transfer.
h Then Run Application.
5
All these actions can be
done from the menus.
4
Load / Run application
Open Operator
screen
In the Project Browser
expand the Program
folder.
1 4
All scheduled sections
are highlighted with a
green circle.
A red circle indicates a
2
non-activated section.
3
In the expanded Operator
Screens select
Start_Process :
Process_ overview.
(double click)
In the Process Overview
screen select “Process
control screen”.
Open Diagnostic 1
viewer
The Diagnostic viewer is
independent from the
operator screens and can
be opened on demand by
selecting
c Tools -> Diagnostic
viewer from the menu bar.
The Diagnostic viewer can
also be opened
automatically when a fault
is triggered.
(The fault trigger selection
can be found in the
Properties windows of the
Diagnostic viewer.)
5
Load / Run application
Start demo machine
2
After selecting
Diagnostic viewer, a new
window appears.
Click the last icon on 3 4
the Operator screen tool
bar to Enable write
variable icon.
Next, click the Start
button in the Operator
screen.
Select either 5 pieces or
10 pieces. 1
Acknowledge fault
After clicking on Start a
fault for “Temperature to
low” occurs.
Select the Temp. low
fault with right mouse
click. A pop-up window
appears.
Click on Acknowledge to
acknowledge the fault.
3
Change the
Temperature Setpoint by 2
moving the lever on the
bar graph
1
When the temperature
reaches the new setpoint,
the Temp. low fault
disappears. (Deleted)
6
On line debugging
Debugging in
Ladder diagram 4
Open the Ladder Program
section Heating. 5
3
Energized contacts are 2
highlighted in green.
The variables values 1
(e.g. %Mw, Int, Dint,
Real) are displayed and
highlighted in yellow.
Select a contact
then click on the
Inspect icon.
An Inspect window
appears (Inspect windows
are available in every IEC
Language except SFC
Diagram.).
h Another method of
animating the Ladder
(method by default) is to
use the object animation
by deselecting ‘Generate
with LD link animation’
in Code generation 6
located in Tools ->
Project Settings on the
top menu bar.
Project must be Rebuild
after modifying settings.
i Close all the opened
windows. Right click on
the editor tabs zone and
select ‘Close all
windows’.
7
On line debugging
Variable window
2
Open both sections in the
Project Browser: Feeder and
Forming.
1
d Use Tile horizontally
from the window Icons bar.
e Open Variable Window
in Tools menu.
Switching from one Editor 4 material a value : 50
screen to another 3
automatically updates the
variables in the Variable
window.
f In the ST logic window,
move the cursor over a
yellow highlighted variable
display the value.
Break point in FBD
1
Open the Debug bar. 3 5 6 4
Simply right click in the
Tool bar and select Debug
2
from the drop down menu.
Select the forming
motor block of FBD
editor
click on
in the icon bar. A small
circle appears on the
block.
Click on the Step into
icon . The block to be
executed in the next step is
highlighted in yellow.
Delete the Break
Point.
Restart the Cyclic
execution.
8
On line debugging
Break point in ST
Click in the Feeder
window and mark one of
the instructions.
Click on icon the
selected instruction is
rounded with a red square.
A click on icon to
execute the instruction.
The instruction to be
executed is highlighted in
yellow.
Step through the logic by
clicking on the icon
until it steps into another
program instruction.
Icon brings you back
to the actual step.
Icon deletes the break
point.
Icon starts the cyclic
execution.
Note: A breakpoint in SFC
does not stop execution of the
task, but freezes the chart
unlike the other IEC
languages.
9
On line debugging
Watch point
Select program section 3
Feeder from the Project
Browser.
The Watch Point feature
can be used to troubleshoot 1
the problem. For this exercise
we will watch to see the
number of times the if
statement executes.
2
Simply right click in the
Tool bar and select Watch
Point from the drop down
menu.
Select the if statement and
click on the Watch Point
icon .
A camera appears to the 5
left of the if statement.
The counter in the Watch
Point bar indicates the
number of time the function
has executed.
Delete the Watch Point .
4
10
On line debugging
Animation Table
We are now going to generate
an animation table to monitor
data points and force a
located variable.
Select Edit-> Select All.
Select Services -> Initialize
Animation Table.
To modify a unlocated
1
BOOL variable select the
variable name
(feeder_full).
Click on Modification
button.
Bits can be set and
reset.
Or directly modified in the
value field.
11
On line debugging
Variable adjust 1
To force a located EBOOL
data type, select the
variable (Mixing_done).
Click on the Force
button.
Bits can be set and
reset.
Or directly modified in the
value field.
Multiple adjust in
one shot 2
Enter the Table at the
bottom of the list of
animated variables and
expand it by clicking on
the + sign.
Click on the icon in
the bar, a new column Set
1
value appears.
Enter new values in the
column Set value.
12
On line debugging
Click on the Flash Icon .
All of the modified values
are simultaneously written
to the PLC.
Blank field are not taken in
account.
The entire Set value
column can be erased with
the Icon of the menu.
13
On line debugging
System Diagnostic
System diagnostic is
activated in the application
from the Tools - > Project
Settings.
Each time, a new system
event is triggered the value
is recorded in the
diagnostic buffer.
Open the Diagnostic
1 2
operator screen.
c Adjust the Index
overflow value to 11. An
Index overflow message
is immediately displayed,
in the diagnostic viewer.
d Click the Overflow
button to trigger an
arithmetic overflow error.
The fault is displayed in
the viewer.
Additional information
pertaining to the error is
displayed at the bottom of
the diagnostic viewer
window. 3
e A double click on the
error or click on the
program icon opens the
editor and highlights the
location where the error
occurred.
14
On line debugging
Application
diagnostic
Diagnostic function blocks
can be used to help to
diagnose the process.
Open the Diagnostic
section in the Project
Browser and the 1
Diagnostic operator
screen.
c Trigger a fault by
clicking on valve_1.
Before continuing, verify
that the Diagnostic section
in Tools –> Project ->
Build tab is configured the
same as the following
diagram.
6
5
d The error is displayed in
the viewer. 4
Select the fault to display
detail information about
the cause of the error at
below the error message.
e The details tell us that
Valve_1 is the source of
the fault.
f Looking at the program 2
it appears that the error
comes from the Check
contact.
g The contact is in a false 3
state on the COND1 pin of
the block because Aux_1
contact is false located in
the network just over the
block.
h Aux_1 is false because
Valve_1 contact is in the
false state.
15
On line debugging
Operator screen
1
In on-line mode, select
Forming+Packaging
Unit operator screen.
c In the Operator screen
title bar, select Circle
Icon.
d In the Drawing editor,
using the left mouse key,
drag the cursor to draw
the circle. 2
e Right click on the circle
and select Properties.
16
On line debugging
c Select Pattern full,
d Background color
green.
Then Apply.
1
2
e Select Animation tab
then check Animated
Object, enter %s6 in the
field (that variable will
blink every second).
Select Bit=1 in Display 3
condition select.
Click OK.
The circle will blink.
This simple example show
how it is easy to create and
animate drawing objects
while in on line mode.
17
Programming tools
Cross references
Open Cross reference 2
1
editor by clicking the
icon.
c Enter Forming in the
Item field or click on the
button to select it from
the database.
d Click on the Binocular 3
icon. All the references are
displayed in the table
under the variable.
e Select program and
expand the structure by 4
clicking on the right arrow
button .
f Select Forming in
Feeder section and right
click to select Open.
18
Programming tools
Cross references
c The Feeder section
opens and the cursor is on
the selected variable.
19
Programming tools
Cross references
The Option button at
the top of the screen 1
allows the user to select
options for the cross-
reference.
A linked object allows
the program to cross-
reference a structure with
nested levels.
2
Enter a 1 in the Max
hierarchical level of linked
objects field.
Select element
robot_one from the drop
down menu.
Select to generate a
cross-reference table.
Here the result display is
given in a functional view.
Only the name of the
functional module (if it
exists) and the name of the
module (section, Table,
Operator screen) is shown.
20
Programming tools
Data Editor
Create a new variable 1
From the Project Browser
select Elementary
Variables under the
Variables & FB instances
2
section
On the top right corner
are three check boxes used
to filter the EDT, DDT or
IODDT variables.
To insert a new variable :
Right click inside the
window and select Insert
New from the menu.
A blank field appears,
enter a variable name
My_var.
Direct Selecting
variable type
There are two methods of
selecting the variable type: 1 2
c Click on the Type pull
down drop box to expand
it and then select the
variable type.
d Click on button and
select an already used type
from the library.
21
Programming tools
Selection variable type
assistant
c Click on the Variable 1
Type assistance button.
d The following screen is
opened and the user can
select predefined variable
types.
e The DDT types are
variables defined in the
application.
The IODDT types are
defined in the catalog
Libraries.
In this example we will
create an array of 10 2
words.
f Select WORD in the
<EDT> folder.
3
g Check the Array box
and enter a 0 after the 4
0…1.
Click OK.
22
Programming tools
Display variable
After validation, variable
My_var appears with a +
sign. 1
c Click on the + to
expand the structure of
My_var variable.
23
Programming tools
Map variables on
physical addresses
The array can be mapped,
using physical address.
c Click on My_var 1
address and enter %MW10
in the field.
Expand My_var again
(click on the + sign).
The addresses are
automatically assigned to
all structure members.
The mapping is done on
%M for Ebool types or
%MW for all other types
(Bool, Int, Dint, Word,
Dword, Real, Time, Date,
String…).
Use the %MW for
structures containing both
Bit and Word type
elements.
This example shows the
addressing scheme for the
3
Recipe structure. Notice
that the Recipe structure
contains different data
types and the addresses are
all mapped on %MW.
Depending the data type, 2
Unity Pro maps the 1
variable in parts :
c Half word for Bool.
d One word for 16 bits
variables.
e Two words for 32 bits
variables.
24
Programming tools
Structured
variables
Structure types are
declared in the Data editor
in the DDT type.
The creation is as simple
as the variable. We will
create a structure named
1
Belt.
Select DDT Types tab.
2
In the Name column,
enter Belt.
A little icon shows that the
structure is under
construction.
d Add the three Boolean
variables : Start, Stop,
Fault.
After creating the
structure, you must
perform an Analyze type
before it can be used.
e Click on the variables
tab 3
f Insert a new variable
named belt_1
g select the structure type 4 5
belt created just before.
The variable is now
created and can be used in
the program.
25
Programming tools
Hyperlink node
In this exercise we are
going to create a hyperlink
in the Configuration
section to an Electrical
diagram.
Right click on the
Configuration node and
select Add Hyperlink
Just above the Add
Hyperlink… option you
will see Add user
directory. The user can
create a specific node that
includes one or several
hyperlinks.
Hyperlink properties
Enter the name of the
hyperlink in the upper
field, and the target path in
the bottom one.
For an URL just enter the
name (without http://).
Click on Cancel for this
exercise. Most likely the
file does not exist.
26
Programming structure
Create a new Task
To create new auxiliary
task :
In the Program section of
the Project Browser right
click on Task. Select New
Task from the drop down
menu.
Select AUX0 in the task
Name in the Create…
1 2
window.
Enter a 5 for the
Configuration Period and
100 for the Watch Dog.
e The new task is created.
A new section can now be
3
created.
27
Programming structure
Create a new
section
To create a new section
right click on Section and
select New Section from
the drop down menu.
A dialog box is opened :
Select the General tab.
In the Name: section
enter My_section.
select the FBD IEC
language.
1
(SFC is available in mast
task). 2 3
A protection can be
added select No read &
write.
The Localization tab
allows the user to attach a
section directly to an
existing functional 4
module.
The Condition tab
allows
a Boolean variable to 5
activate or deactivate the
execution of the section.
Select a variable from the
data selector clicking on
.
h The Comment tab
allows a description of the
section to be added. 6
Comments are printed in
the documentation.
Click on Ok to validate the
information.
28
Programming structure
Activate the protection
After the validation, an
open padlock appears next
to the section name.
1
Password protection can
be added to a section to
lock out unauthorized
users.
To put a protection lock on
a section :
Right click on the first
node injection molding
machine then select
Properties.
Click on the Protection
tab.
2
Check the Protection
active box. Because it is
the first time the section is 3
locked a password is
asked.
Enter a password in the
Entry field and again in the
Confirmation field. Click
OK to close password box.
Click OK to close 4
Properties of station box
The padlock is now
locked. It is impossible to
modify the section without
entering the correct
password.
29
Programming structure
Events
Sections can be
triggered by Events.
Right click on either the
Timer Events or I/O
Event in the Events
section. 1
Events can be of two
different kinds :
Timer events (up to 32 2
timers) generate periodical
triggers at a rate defined in
the event properties for the
associated section.
e I/O events (up to 128)
are triggered by hardware
modules to force the
controller to execute a
section associated with the 3
event. The event number
must be declared in the
module configuration.
The four Languages that
can be selected are ST, IL,
FBD and LD.
30
IEC Languages
SFC Steps
SFC (Sequential Function
Chart) is the language for
structuring applications.
Unity Pro allows multiple
declarations of SFC sections
and the usage of Macro
steps. 1
Open Program section
Packaging_Robot.
2
Select Rotation step
d right click to select object
Properties.
The Step name is 3 4
numbered by default S_x_y
where x is a number given
for the section and y is the
step number. Here the
default name is replaced by 5
Rotation.
A check box allows to 6
define initial steps
Step can be monitored
with a max and min activity
times, direct values or
variables can be entered for 9 8
monitoring.
A Delay does not allow
the program to execute the
10
next step until the 7
configured timer has
stopped even if the
transition is active.
Select the Actions Tab.
All performed actions are
listed in the window.
Action can be done on a
Boolean variable or a
section by applying a
qualifier Set, Reset, It is possible to create a section :
Delayed Set, etc…. Enter a qualifier None (section performed when the step is active only),
l Actions can be added, select section, enter a name (e.g. step_section), click on New action.
modified or deleted with the A new line is added to the list, select it and click on Edit action section and
buttons select the language(e.g. ST) . Click OK the new section is opened.
31
IEC Languages
SFC Transitions
Transition conditions can
be a variable or a section
containing several
variables that must be
evaluate for the transition
to occur.
c Click on the second
transition. 1
d Right click on the
transition and select
Properties…. 2
The Transition properties
dialog box appears.
e A Boolean variable can
be entered in the field
f When Variable radio
button is selected. 4
g When TRANSITION
section is selected, the
name of the section is
entered in the field.
Clicking the Edit button 5
opens the section,
6
h if it is the first time that
the dialog box is opened,
then the user is asked to
select a programming
language.
7
i The transition
automatically generates a
hidden Boolean variable
that is used as the result of
the equation entered in
that section.
32
IEC Languages
FBD (Function
block Diagram)
The FBD editor makes
graphic functional module
programming in
accordance with
International Electronical
Commission for 61131-3.
FBD (New section)
c Open a new section by
right clicking on Sections
located in the Project
Browser.
1
d Select Language FBD.
33
IEC Languages
FBD (Data Selection)
How to select a function :
Right mouse click in the
Logic window and a pop
up window appears.
1
Select Data selection…
Click on the icon.
Select the Function and
function block types.
Select Libset -> Base
Lib. All available function
types are displayed in the
window.
A subset can be displayed
selecting a specific library
(Communication, 2
Diagnostic, Motion…)
f select the AND function
then click on Ok.
3
g Click in the editor to
drop the function block.
34
IEC Languages
FBD (Description)
EN-Input ENO-Output inverting ST-expression
assembly
Variable
crossing
literal topological assembly
address
35
IEC Languages
LD (Ladder
Diagram)
In this section, the ladder
diagram is compliant with
the International
Electronical Commission
61131-3.
The structure of a LD
section corresponds to a
current path for a relay
circuits. On the left side
LD editor is the so-called
left power rail. The left
power rail corresponds to
the phase (l-leader) of a
power flow. In the LD
programming, only the LD
objects "are worked on"
which are connected to a
power supply attached, i.e.
with the left power rail.
The right power rail
corresponds to the neutral
leader. All coils and
courses of building of FF
are connected directly or
indirectly with it.
36
IEC Languages
LD (New section)
Create a new section
and select Language LD.
LD (Tool bar)
1
All programming
functions of LD can be
done with the LD tool bar.
Higher functions (e.g. SIN,
Loop control, ROL...) may
not be located on the LD
tool bar. The higher
functions can be found in
the Library (see FBD).
37
IEC Languages
LD (Description)
opener horizontal boolean connection coil
vertical boolean connection
shutter
jump
contact for detection of rising edge
bench mark (jump)
ENO-Output inverting ST-expression
EN-Input
connection
variable
crossing
literal topological connection
Address
left current bar
right current bar
38
IEC Languages
ST (Structured Text)
Structured text is a
programming language
based on a high level
programming language
(e.g. Turbo Pascal, VB..).
With the programming
language structured text
(ST) you can call e.g.
functional modules,
implement functions,
implement assignments,
implement instructions
conditionally and repeat
instructions.
ST (Description) operator operand
command
command expression
39
IEC Languages
IL (Instruction List)
With the IL programming
language, you can call e.g.
functional modules and
functions, conditionally or
absolutely, implement
assignments and
implement jumps within
the section conditionally or
absolutely.
IL (Description)
bench mark operator
operand
modifier comment
40