38 |
38 |
39 |
39 |
40 (* A helper FUNCTION BLOCK declaration *) |
40 (* A helper FUNCTION BLOCK declaration *) |
41 function_block foo_fb |
41 function_block foo_fb |
42 var_input |
42 var_input |
43 a_1, b_1: int; |
43 a_1, b_1: real; |
44 end_var |
44 end_var |
45 var_output |
45 var_output |
46 c_1, d_1: int; |
46 c_1, d_1: real; |
47 end_var |
47 end_var |
48 c_1 := 10 + b_1; |
48 c_1 := 10.0 + b_1; |
49 end_function_block |
49 end_function_block |
50 |
50 |
51 |
51 |
52 (* A helper FUNCTION declaration *) |
52 (* A helper FUNCTION declaration *) |
53 function foo_f1 : int |
53 function foo_f1 : real |
54 var_input |
54 var_input |
55 a_1, b_1: int; |
55 a_1, b_1: real; |
56 end_var |
56 end_var |
57 var_output |
57 var_output |
58 c_1, d_1: int; |
58 c_1, d_1: real; |
59 end_var |
59 end_var |
60 c_1 := 10 + b_1; |
60 c_1 := 10.0 + b_1; |
61 end_function |
61 end_function |
62 |
62 |
63 (* Another helper FUNCTION declaration *) |
63 (* Another helper FUNCTION declaration *) |
64 function foo_f2 : int |
64 function foo_f2 :real |
65 var_input |
65 var_input |
66 a_1, b_1: foo_fb; |
66 a_1, b_1: foo_fb; |
67 end_var |
67 end_var |
68 var_output |
68 var_output |
69 c_1, d_1: int; |
69 c_1, d_1: real; |
70 end_var |
70 end_var |
71 c_1 := 10; |
71 c_1 := 10.0; |
72 end_function |
72 end_function |
73 |
73 |
74 |
74 |
75 |
75 |
76 (*********************************************************************) |
76 (*********************************************************************) |
77 (* Testing use of XXXX in several locations of variable declarations *) |
77 (* Testing use of XXXX in several locations of variable declarations *) |
78 (*********************************************************************) |
78 (*********************************************************************) |
79 |
79 |
80 function bar01 : int |
80 function bar01 : real |
81 var_input |
81 var_input |
82 XXXX, a_1, b_1: int; |
82 XXXX, a_1, b_1: real; |
83 end_var |
83 end_var |
84 a_1 := 1; |
84 a_1 := 1.0; |
85 end_function |
85 end_function |
86 |
86 |
87 function_block bar02 |
87 function_block bar02 |
88 var_input |
88 var_input |
89 a_1, XXXX, b_1: int; |
89 a_1, XXXX, b_1: int; |
185 (* Using XXXX as a standard variable name in ST *) |
185 (* Using XXXX as a standard variable name in ST *) |
186 (************************************************) |
186 (************************************************) |
187 |
187 |
188 function_block bar90 |
188 function_block bar90 |
189 var |
189 var |
|
190 e_1, f_1 : real; |
|
191 XXXX : real; |
|
192 fb : foo_fb; |
|
193 end_var |
|
194 e_1 := bar01 (XXXX := 10.0); |
|
195 e_1 := bar01 (a_1 := XXXX); |
|
196 e_1 := bar01 (XXXX := XXXX); |
|
197 fb(XXXX, 20.0); |
|
198 fb (10.0, XXXX, e_1, f_1); |
|
199 fb (a_1 := XXXX, b_1:=XXXX, c_1=>XXXX, d_1=>f_1); |
|
200 fb(a_1 := 10.0, b_1:=20.0, c_1=>e_1, d_1=>XXXX); |
|
201 fb (c_1=>XXXX, a_1:=20.0, d_1=>f_1); |
|
202 XXXX := fb.c_1; |
|
203 fb.a_1 := XXXX + XXXX * 2.0 * (XXXX) / foo_f1(XXXX, 10.0, XXXX, e_1) / XXXX ** XXXX; |
|
204 IF (XXXX >= 10.0) THEN XXXX := 10.0; END_IF; |
|
205 end_function_block |
|
206 |
|
207 |
|
208 function_block bar90a |
|
209 var |
190 e_1, f_1 : int; |
210 e_1, f_1 : int; |
191 XXXX : int; |
211 XXXX : int; |
192 fb : foo_fb; |
212 end_var |
193 end_var |
213 XXXX := XXXX MOD XXXX; |
194 e_1 := bar01 (XXXX := 10); |
|
195 e_1 := bar01 (a_1 := XXXX); |
|
196 e_1 := bar01 (XXXX := XXXX); |
|
197 fb(XXXX, 20); |
|
198 fb (10, XXXX, e_1, f_1); |
|
199 fb (a_1 := XXXX, b_1:=XXXX, c_1=>XXXX, d_1=>f_1); |
|
200 fb(a_1 := 10, b_1:=20, c_1=>e_1, d_1=>XXXX); |
|
201 fb (c_1=>XXXX, a_1:=20, d_1=>f_1); |
|
202 XXXX := fb.c_1; |
|
203 fb.a_1 := XXXX + XXXX * 2 * (XXXX) / foo_f1(XXXX, 10, XXXX, e_1) MOD XXXX MOD XXXX ** XXXX; |
|
204 IF (XXXX >= 10) THEN XXXX := 10; END_IF; |
|
205 CASE (XXXX + 10) OF |
214 CASE (XXXX + 10) OF |
206 10: XXXX := 10; |
215 10: XXXX := 10; |
207 10..20:XXXX := 20; |
216 10..20:XXXX := 20; |
208 ELSE XXXX := 20; |
217 ELSE XXXX := 20; |
209 END_CASE; |
218 END_CASE; |
232 |
241 |
233 (* Using XXXX as a function block instance/variable name in ST *) |
242 (* Using XXXX as a function block instance/variable name in ST *) |
234 |
243 |
235 function_block bar91 |
244 function_block bar91 |
236 var |
245 var |
237 e_1, f_1 : int; |
246 e_1, f_1 : real; |
238 XXXX : foo_fb; |
247 XXXX : foo_fb; |
239 end_var |
248 end_var |
240 XXXX(e_1, 20); |
249 XXXX(e_1, 20.0); |
241 XXXX (10, e_1, e_1, f_1); |
250 XXXX (10.0, e_1, e_1, f_1); |
242 XXXX (a_1 := e_1, b_1:=e_1 , c_1=>e_1, d_1=>f_1); |
251 XXXX (a_1 := e_1, b_1:=e_1 , c_1=>e_1, d_1=>f_1); |
243 XXXX(a_1 := 10, b_1:=20, c_1=>e_1, d_1=>e_1); |
252 XXXX(a_1 := 10.0, b_1:=20.0, c_1=>e_1, d_1=>e_1); |
244 XXXX (c_1=>e_1, a_1:=20, d_1=>f_1); |
253 XXXX (c_1=>e_1, a_1:=20.0, d_1=>f_1); |
245 e_1 := XXXX.c_1; |
254 e_1 := XXXX.c_1; |
246 XXXX.a_1 := e_1; |
255 XXXX.a_1 := e_1; |
247 e_1 := foo_f2(XXXX, XXXX, e_1, f_1); |
256 e_1 := foo_f2(XXXX, XXXX, e_1, f_1); |
248 e_1 := foo_f2 (XXXX, XXXX); |
257 e_1 := foo_f2 (XXXX, XXXX); |
249 e_1 := foo_f2 (c_1 => e_1, b_1 := XXXX, d_1 := 10, a_1 := XXXX); |
258 e_1 := foo_f2 (c_1 => e_1, b_1 := XXXX, d_1 := 10.0, a_1 := XXXX); |
250 e_1 := foo_f2 (b_1 := XXXX); |
259 e_1 := foo_f2 (b_1 := XXXX); |
251 end_function_block |
260 end_function_block |
252 |
261 |
253 |
262 |
254 |
263 |