Iec 61131-3 Second edition 2003-01 Programmable controllers – Part 3: Programming languages


Download 1.35 Mb.
Pdf ko'rish
bet46/158
Sana17.06.2023
Hajmi1.35 Mb.
#1528208
1   ...   42   43   44   45   46   47   48   49   ...   158
Bog'liq
ourdev 569653

implementation-dependent
parameter.
Table 20 a) - Function features
No.
Description
Example
1
In-out variable declaration (textual)
VAR_IN_OUT A: INT; END_VAR
2
In-out variable declaration (graphical)
See figure 6 b)
3
Graphical connection of in-out variable to different
variables(graphical)
See figure 6 d)
Copyright International Electrotechnical Commission 
Provided by IHS under license with IEC
Not for Resale
No reproduction or networking permitted without license from IHS
--``````-`-`,,`,,`,`,,`---


– 52 –
61131-3 
 IEC:2003(E)
a)
FUNCTION SIMPLE_FUN : REAL
VAR_INPUT
A,B : REAL ; (* External interface specification *)
C : REAL := 1.0;
END_VAR
VAR_IN_OUT COUNT : INT ; END_VAR
VAR COUNTP1 : INT ; END_VAR
COUNTP1 := ADD(COUNT,1); (*Function body specification *)
COUNT := COUNTP1 ;
SIMPLE_FUN := A*B/C;
END_FUNCTION
NOTE In the above example, the input variable is given a default value of 1.0, as
specified in 2.4.3.2, to avoid a “division by zero” error if the input is not specified
when the function is invoked, for example, if a graphical input to the function is
left unconnected.
b)
FUNCTION
+-------------+ (* External interface specification *)
| SIMPLE_FUN |
REAL----|A |----REAL
REAL----|B |
REAL----|C |
INT-----|COUNT---COUNT|----INT
+-------------+
(* Function body specification *)
+---+
|ADD|--- +----+
COUNT--| |---COUNTP1--| := |---COUNT
1--| | +----+
+---+ +---+
A---| * | +---+
B---| |---| / |---SIMPLE_FUN
+---+ | |
C-----------| |
+---+
END_FUNCTION
c)
....
VAR X,Y,Z,RESULT : REAL:
VAR COUNT1,COUNT2 : INT;
...
RESULT := SIMPLE_FUN(A:=X,B:=Y,C:=Z,COUNT:=COUNT1);
COUNT2 := COUNT1;
...
d)
+-------------+
| SIMPLE_FUN |
X----|A |----RESULT
Y----|B |
Z----|C |
COUNT1---|COUNT---COUNT|----COUNT2
+-------------+
NOTE The effect of this invocation of this function is identical to that
in figure 6 c)
a) Textual declaration in ST language (subclause 3.3)
b) Graphical declaration in FBD language (subclause 4.3)
c) Usage of a function in ST language
d) Usage of a function in FBD language (subclause 4.3)

Download 1.35 Mb.

Do'stlaringiz bilan baham:
1   ...   42   43   44   45   46   47   48   49   ...   158




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling