Irai Automgen 7 Manuel utilisateur

  • Bonjour ! Je suis un chatbot IA spécialement formé pour vous aider avec le Irai Automgen 7 Manuel utilisateur. J’ai déjà parcouru le document et peux vous fournir des réponses claires et précises.
Language reference manual
Examples
The adventures of Doctor R.
www.irai.com
Language reference manual
1. Common elements............................................................................................................. 7
1.1. Variables................................................................................................................................ 7
1.1.1. Booleen variables........................................................................................................................... 7
1.1.2. Numeric variables .......................................................................................................................... 8
1.1.3. Time delay ..................................................................................................................................... 8
1.2. Actions.................................................................................................................................. 10
1.2.1. Assignment of a boolean variable................................................................................................ 10
Complement assignment of a boolean variable .....................................................................................11
1.2.2. Setting a boolean variable to one ................................................................................................. 12
1.2.3. Resetting a boolean variable ........................................................................................................ 13
1.2.4. Inverting a boolean variable......................................................................................................... 13
1.2.5. Resetting a counter, a word or a long........................................................................................... 14
1.2.6. Incrementing a counter, a word or a long .................................................................................... 15
1.2.7. Decrementing a counter, word or long......................................................................................... 15
1.2.8. Time delays.................................................................................................................................. 16
1.2.9. Interferences among the actions................................................................................................... 17
1.2.10. IEC1131-3 standard actions...................................................................................................... 17
1.2.11. Multiple actions ......................................................................................................................... 18
1.2.12. Literal code ................................................................................................................................ 19
1.3. Tests...................................................................................................................................... 19
1.3.1. General form................................................................................................................................ 20
1.3.2. Test modifier................................................................................................................................ 20
1.3.3. Time delays.................................................................................................................................. 21
1.3.4. Priority of boolean operators........................................................................................................ 21
1.3.5. Always true test............................................................................................................................ 22
1.3.6. Numeric variable test ................................................................................................................... 22
1.3.7. Transitions on multiple lines........................................................................................................ 23
1.4. Use of symbols ..................................................................................................................... 23
1.4.1. Symbol syntax.............................................................................................................................. 23
1.4.2. Automatic symbols ...................................................................................................................... 24
1.4.3. Automatic symbol syntax............................................................................................................. 24
1.4.4. How does the compiler manage the automatic symbols ?............................................................ 24
1.4.5. Range of variable attribution........................................................................................................ 25
1.5. Examples.............................................................................................................................. 26
1.6. Grafcet ................................................................................................................................. 28
1.6.1. Simple Grafcet ............................................................................................................................. 28
1.6.2. Divergence and convergence in « And » .................................................................................... 31
1.6.3. Divergence and convergence in « Or »........................................................................................ 33
1.6.4. Destination and source steps, destination and source transitions................................................. 36
AUTOMGEN
7
3 (C)opyright 2002 IRAI
Language reference manual
1.6.5. Multiple actions, conditioned actions ...........................................................................................36
1.6.6. Synchronization............................................................................................................................38
1.6.7. Grafcet setting ..............................................................................................................................39
1.6.8. Macro-steps ..................................................................................................................................48
1.6.9. Counters........................................................................................................................................51
1.7. Gemma ................................................................................................................................. 52
1.7.1. Creating a Gemma........................................................................................................................54
1.7.2. Content of Gemma rectangles ......................................................................................................54
1.7.3. Obtaining a corresponding Grafcet...............................................................................................54
1.7.4. Printing Gemma............................................................................................................................55
1.7.5. Exporting Gemma ........................................................................................................................55
1.7.6. Example of Gemma ......................................................................................................................55
1.8. Ladder.................................................................................................................................. 58
1.8.1. Example of Ladder .......................................................................................................................59
1.9. Flow chart ............................................................................................................................ 60
1.9.1. Drawing flow charts .....................................................................................................................61
1.9.2. Example of a flow chart................................................................................................................62
1.10. Literal languages............................................................................................................... 65
1.10.1. How is a literal language used? ..................................................................................................65
1.10.2. Setting a code box.......................................................................................................................66
1.10.3. Low level literal language ..........................................................................................................67
1.10.4. Macro-instruction .....................................................................................................................120
1.10.5. Libraries....................................................................................................................................121
1.10.6. Pre-defined macro-instructions.................................................................................................121
1.10.7. Description of pre-defined macro-instructions .........................................................................122
1.10.8. Example of low level literal language ......................................................................................124
1.11. Extended literal language............................................................................................... 126
1.11.1. Writing boolean equations........................................................................................................127
1.11.2. Writing numeric equations .......................................................................................................128
1.11.3. IF...THEN...ELSE...structure.............................................................................................................130
General syntax :....................................................................................................................................130
1.11.4. WHILE ... ENDWHILE structure ...........................................................................................130
1.11.5. Example of a program in extended literal language .................................................................131
1.12. ST literal language .......................................................................................................... 132
1.12.1. General Information .................................................................................................................132
1.12.2. Boolean equations.....................................................................................................................133
1.12.3. Numeric equations....................................................................................................................134
1.12.4. Programming structures............................................................................................................135
1.12.5. Example of a program in extended literal language .................................................................137
AUTOMGEN
7
4 (C)opyright 2002 IRAI
Language reference manual
1.13. Organization chart.......................................................................................................... 137
1.13.1. Creating an organizational chart .............................................................................................. 138
1.13.2. Rectangle content..................................................................................................................... 139
1.14. Illustration ....................................................................................................................... 139
1.15. Function blocks ............................................................................................................... 142
1.15.1. Creating a function block......................................................................................................... 142
1.15.2. Drawing a block and creating a « .ZON » file ......................................................................... 143
1.15.3. Creating an « .LIB » file .......................................................................................................... 145
1.15.4. Simple example of a function block......................................................................................... 145
1.15.5. Illustration................................................................................................................................ 146
1.15.6. Supplementary syntax.............................................................................................................. 149
1.16. Evolved function blocks.................................................................................................. 150
1.16.1. Syntax ...................................................................................................................................... 150
1.16.2. Differentiating between new and old function blocks.............................................................. 150
1.16.3. Example ................................................................................................................................... 151
1.17. Predefined function blocks............................................................................................. 152
1.17.1. Conversion blocks.................................................................................................................... 152
1.17.2. Time delay blocks .................................................................................................................... 152
1.17.3. String blocks ........................................................................................................................... 152
1.17.4. Word table blocks ................................................................................................................... 152
1.18. Advanced techniques ...................................................................................................... 153
1.18.1. Compiler generated code ......................................................................................................... 153
1.18.2. Optimizing generated code ...................................................................................................... 154
2. Examples....................................................................................................................... 157
2.1. Regarding examples.......................................................................................................... 157
2.1.1. Simple grafcet............................................................................................................................ 157
2.1.2. Grafcet with an OR divergence.................................................................................................. 158
2.1.3. Grafcet with an AND divergence.............................................................................................. 159
2.1.4. Grafcet and synchronization ...................................................................................................... 160
2.1.5. Step setting................................................................................................................................. 161
2.1.6. Destination and source steps...................................................................................................... 162
2.1.7. Destination and source steps...................................................................................................... 163
2.1.8. Setting Grafcets.......................................................................................................................... 164
2.1.9. Memorizing Grafcets ................................................................................................................. 165
2.1.10. Grafcet and macro-steps........................................................................................................... 166
2.1.11. Linked sheets ........................................................................................................................... 167
2.1.12. Flow chart ................................................................................................................................ 169
2.1.13. Grafcet and Flow Chart............................................................................................................ 170
2.1.14. Literal language box ................................................................................................................ 171
AUTOMGEN
7
5 (C)opyright 2002 IRAI
Language reference manual
2.1.15. Organizational chart .................................................................................................................172
2.1.16. Organizational chart .................................................................................................................173
2.1.17. Function block..........................................................................................................................174
2.1.18. Function block..........................................................................................................................175
2.1.19. Ladder.......................................................................................................................................176
2.1.20. Example developed on a train model........................................................................................177
Educational training manual for AUTOMGEN users.................................................... 183
Distribution............................................................................................................................... 185
Doctor R. in the home automation kingdom ......................................................................... 185
First example : « which came first the bulb or the switch … »............................................ 186
Solution 1 : natural language of an electrician: ladder .........................................................................187
Solution 2 : the sequential language of the automation specialist: Grafcet ..........................................187
It's your turn to play …........................................................................................................... 189
Second example : « time frames, time-switches and other time fun… »............................. 189
Solution 1 : simplicity ..........................................................................................................................190
Solution 2 : improvement .....................................................................................................................191
Third Example : « variation on the theme of coming and going… » .................................. 192
Here is a flow chart solution :...............................................................................................................193
A solution using AUTOMGEN literal language. .................................................................................194
A cleverer one : ....................................................................................................................................195
Try this : ...............................................................................................................................................195
Fourth example : « And the push button became intelligent … » ....................................... 196
The solutions …........................................................................................................................ 199
The solutions …........................................................................................................................ 200
« which came first the switch or the bulb … » .....................................................................................200
« time delays, time switches and other time fun… »............................................................................200
« variation on the theme of coming and going …»................................................................ 202
AUTOMGEN
7
6 (C)opyright 2002 IRAI
Language reference manual
1. Common elements
This chapter describes the common elements for all the languages used in
AUTOMGEN.
The logo refers to innovations used in version 7 of AUTOMGEN.
1.1. Variables
The following types of variables are present :
Ö boolean type : the variable may have a true (1) or false (0) value.
Ö numeric type : the variable may have a numeric value, different from the
existing types: 16 bits variables, 32 bits and floating point.
Ö time delay type : structured type, it is a combination of a boolean and numeric
type.
Starting from version 6 the variable name syntax may be AUTOMGEN's or the
syntax of IEC standard 1131-3.
1.1.1. Booleen variables
The following table provides a complete list of the Booleen variables used
Type Syntax
AUTOMGEN
Syntax
IEC 1131-3
Comments
Input I0
to I9999
%I0
to %I9999
May or may not correspond to physical input
(depending on the I/O configuration of the
target).
Output O0
to O9999
%Q0
to %Q9999
May or may not correspond to physical output
(depending on the I/O configuration of the
target).
System Bits U0
to U99
%M0
to %M99
For information on the system bits see the
manual on the environment.
User bits U100
to U9999
%M100
to %M9999
Internal bits for general use.
AUTOMGEN
7
7 (C)opyright 2002 IRAI
Language reference manual
Grafcet
Steps
X0
to X9999
%X0
to %X9999
Grafcet step bits
Word bits M0#0
to M9999#15
%MW0 :X0
à %MW9999 :X15
Word bits: the number of bits is
expressed in decimals and is
included between 0 (lower weight
bits) and 15 (higher weight bits).
1.1.2. Numeric variables
The following table provides a complete list of the numeric variables.
Type Syntax
AUTOMGEN
IEC Syntax
1131-3
Comments
Counter C0
to C9999
%C0
to %C9999
16 bit counter, can be initialized,
increased, decreased and tested with
boolean languages without using
literal language.
System
Words
M0
to M199
%MW0
to %MW199
For information on the system words
see the manual on the environment.
User words M200
to M9999
%MW200
to %MW9999
16 bit words for general use.
Long
integer
L100
to L4998
%MD100
to %MD4998
Integer value of 32 bits
Float F100
to F4998
%MF100
to %MF4998
Real value of 32 bits (format IEEE).
1.1.3. Time delay
Time delay is a combined type which groups two boolean variables (launch state,
end state) and two numeric variables on 32 bits (procedure and counter).
AUTOMGEN
7
8 (C)opyright 2002 IRAI
Language reference manual
The following model shows a time chart of time delay functionality:
launch state
1
0
procedure
count value
0
0
1
end state
A time delay procedure value is between 0 ms and 4294967295 ms (a little over
49 days)
The time delay procedure can be modified by the program, see chapter
(instruction STA).
1.10.3.
The time delay counter can be read by the program, see chapter 1.10.3.
(instruction LDA).
AUTOMGEN
7
9 (C)opyright 2002 IRAI
Language reference manual
1.2. Actions
Actions are used in :
Ö Grafcet language action rectangles,
Ö flow chart language action rectangles,
Action
Action
Ö ladder language coils.
Action
1.2.1. Assignment of a boolean variable
The « Assignment » action syntax is :
«boolean variable»
Operation :
Ö if the action rectangle or coil command is in a true state then the variable is put
at 1 (true state),
Ö if the action rectangle or coil command is in a false state then the variable is
put at 1 (false state).
Truth table :
Command Variable state (result)
0 0
1 1
Example :
If step 10 is active then O0 takes the value of 1, if not O0 takes the value 0.
AUTOMGEN
7
10 (C)opyright 2002 IRAI
Language reference manual
Various « Assignment » actions can be used for the same variable in one
program. In this case, the different commands are combined in « Or » logic.
Example :
State of X10 State of X50 State of O5
0 0 0
1 0 1
0 1 1
1 1 1
Complement assignment of a boolean variable
The « Complement assignment » action syntax is :
«N boolean variable»
Operation :
Ö if the action rectangle or coil command is in a true state then the variable is
reset (false state),
Ö if the action rectangle or coil command is in a false state then the variable is
set at 1 (true state).
Truth table :
Command Variable state (result)
0 1
1 0
Example :
If step 20 is active, then U100 takes the value 0, if not U100 takes the value 1.
AUTOMGEN
7
11 (C)opyright 2002 IRAI
Language reference manual
Various « Complement assignment » actions can be used for the same variable in
one program. In this case, the different commands are combined in « Or » logic.
Example :
State of X100 State of X110 State of O20
0 0 1
1 0 0
0 1 0
1 1 0
1.2.2. Setting a boolean variable to one
The « Set to one » syntax is :
«S boolean variable»
Operation :
Ö if the action rectangle or coil command is in a true state then the variable is set
to 1 (true state),
Ö if the action rectangle or coil command is in a false state then the state of the
variable is not modified.
Truth table :
Command Variable state (result)
0 unchanged
1 1
Example :
If step 5000 is active then O2 takes the value of 1, if not O2 keeps the same state.
AUTOMGEN
7
12 (C)opyright 2002 IRAI
Language reference manual
1.2.3. Resetting a boolean variable
The « Reset» action syntax is :
«R boolean variable»
Operation :
Ö if the action rectangle or coil command is in a true state then the variable is
reset (false state),
Ö if the action rectangle or coil command is in a false state then the variable state
is not modified.
Truth table :
Command Variable state (result)
0 unchanged
1 0
Example :
If step 6000 is active then O3 takes the value of 0, if not O3 keeps the same state.
1.2.4. Inverting a boolean variable
The « Inversion » action syntax is :
«I boolean variable»
Operation :
Ö if the action rectangle or coil command is in a true state then the variable state
is inverted for each execution cycle,
Ö if the action rectangle or coil command is in a false state then variable state is
not modified.
AUTOMGEN
7
13 (C)opyright 2002 IRAI
Language reference manual
Truth table :
Command Variable state (result)
0 unchanged
1 inverted
Example :
If step 7000 is active then the state of O4 is inverted, if not O4 keeps the same
state.
1.2.5. Resetting a counter, a word or a long
The « Reset a counter, word or long» syntax is :
«R counter or word»
Operation :
Ö if the action rectangle or coil command is in a true state then the counter, word
or long is reset,
Ö if the action rectangle or coil command is in a false state then the counter, word
or long is not modified.
Truth table :
Command Value of counter, word or long
(result)
0 unchanged
1 0
Example :
If step 100 is active then counter 25 is reset, if not C25 keeps the same value.
AUTOMGEN
7
14 (C)opyright 2002 IRAI
Language reference manual
1.2.6. Incrementing a counter, a word or a long
The «Increment a counter » action syntax is :
«+ counter, word or long»
Operation :
Ö if the action rectangle or coil command is in a true state then the counter, word
or long is incremented for each execution cycle,
Ö if the action rectangle or coil command is in a false state then the counter, word
or long is not modified.
Truth table :
Command Counter, word or long
value (result)
0 Unchanged
1 current value +1
Example :
If step 100 is active then counter 25 is incremented, if not then C25 keeps the
same value.
1.2.7. Decrementing a counter, word or long
The « Decrement a counter » action syntax is :
«- counter, word or long»
Operation :
Ö if the action rectangle or coil command is in a true state then the counter, word
or long is decremented for each execution cycle,
Ö if the action rectangle or coil command is in a false state then the counter, word
or long is not modified..
AUTOMGEN
7
15 (C)opyright 2002 IRAI
Language reference manual
Truth table :
Command Value or counter, word or long
(result)
0 unchanged
1 current value -1
Example :
If step 100 is active then counter 25 is decreased, if not C25 keeps the same
value.
1.2.8. Time delays
Time delays are considered as boolean variables and can be used with
« Assignment », « Complement assignment », « Set to one », « Reset », and
« Invert ». The time delay order can be written after the action. The syntax is::
« time delay(duration) »
By default the duration is expressed in tenths of seconds. The letter « S » at the
end of the duration indicates that it is expressed in seconds.
Examples :
Step 10 launches a time delay of 2 seconds which remains active as long as the
step is. Step 20 sets a time delay of 6 seconds which remains active while step 20
is deactivated.
The same time delay can be used by different places with the same procedure and
at different instants. In this case the time delay procedure must only be indicated
once.
Note : other syntaxes exist for time delays. See chapter 1.3.3.
AUTOMGEN
7
16 (C)opyright 2002 IRAI
Language reference manual
1.2.9. Interferences among the actions
Certain types of actions cannot be used at the same time on a variable. The table
below shows the combinations which cannot be used..
Assignment
Complement
assignment
Set to one Reset Inversion
Assignment
YES NO NO NO NO
Complement
assignment
NO YES NO NO NO
Set to one
NO NO YES YES YES
Reset
NO NO YES YES YES
Inversion
NO NO YES YES YES
1.2.10. IEC1131-3 standard actions
The table below provides the IEC 1131-3 standard actions which can be used with
AUTOMGEN V>=6 based on the AUTOMGEN. V5 standard syntax.
Name AUTOMGE
N V>=6
Syntax
AUTOMGEN
V5
Syntax
AUTOMGEN
V>=6
Example
Equivalent
example
AUTOMGEN V5
Not
memorized
No value No value
Not
memorized
N1 No value
Complement
not
memorized
N0 N
Reset
R R
AUTOMGEN
7
17 (C)opyright 2002 IRAI
Language reference manual
Set to 1 S S
Limited in
time
LTn/duration Non-existent
Time delay DTn/duration Non-existent
Pulse on
rising edge
P1 Non-existent
Pulse
on falling
edge
P0 Non-existent
Memorized
and time
delay
SDTn/duratio
n
Non-existent
Time delay
and
memorized
DSTn/duratio
n
Non-existent
Memorized
limited in time
SLTn/duratio
n
Non-existent
1.2.11. Multiple actions
Within the same action rectangle or coil, multiple actions can be written by
separating them with « , » (comma).
Example :
Multiple action rectangles (Grafcet and flow chart) or coils (ladder) can be
combined. See the chapters on the relative languages for more information.
AUTOMGEN
7
18 (C)opyright 2002 IRAI
Language reference manual
1.2.12. Literal code
Literal code can be entered in an action rectangle or coil.
The syntax is :
« { literal code } »
Multiple lines of literal language can be written in braces. A « , » (comma) is also
used here to separate them.
Example :
For more information see the chapters « Low level literal language », «Extended
literal language » and «ST literal language».
1.3. Tests
Tests are used in :
Ö Grafcet language transitions,
Test
Ö conditions based on Grafcet language action,
Test
Test
Ö flow chart language tests,
Test
AUTOMGEN
7
19 (C)opyright 2002 IRAI
Language reference manual
Ö ladder language tests.
Test
1.3.1. General form
A test is a boolean equation composed of one or n variables separated by the
operators « + » (or) or « . » (and).
Example of a test :
i0 (test input 0)
i0+i2 (test input 0 « or » input 2)
i10.i11 (test input 10 « and » input 11)
1.3.2. Test modifier
By default if only the name of one variable is specified, the test is « equal to one»
(true). Modifiers make it possible to test the complement state, the rising edge and
the falling edge.
Ö the character « / » placed before a variable tests the complement state,
Ö the character « u » or the character « Ï
*
» placed before a variable tests the
rising edge
Ö the character « d » or the character « Ð
**
» placed before a variable tests the
falling edge
Text modifiers can be applied to one variable or to an expression between
parentheses.
Examples :
Ï i0
/i1
/(i2+i3)
Ð(i2+(i4./i5))
*
To obtain this character when editing a test press the [Ï] key.
**
To obtain this character when editing a test press the [Ð] key.
AUTOMGEN
7
20 (C)opyright 2002 IRAI
/