1 <?xml version='1.0' encoding='utf-8'?> |
|
2 <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201"> |
|
3 <fileHeader companyName="Beremiz" productName="Beremiz" productVersion="1" creationDateTime="2016-10-24T18:09:22"/> |
|
4 <contentHeader name="First Steps" modificationDateTime="2018-09-26T12:52:51"> |
|
5 <coordinateInfo> |
|
6 <fbd> |
|
7 <scaling x="0" y="0"/> |
|
8 </fbd> |
|
9 <ld> |
|
10 <scaling x="0" y="0"/> |
|
11 </ld> |
|
12 <sfc> |
|
13 <scaling x="0" y="0"/> |
|
14 </sfc> |
|
15 </coordinateInfo> |
|
16 </contentHeader> |
|
17 <types> |
|
18 <dataTypes/> |
|
19 <pous> |
|
20 <pou name="AverageVal" pouType="function"> |
|
21 <interface> |
|
22 <returnType> |
|
23 <REAL/> |
|
24 </returnType> |
|
25 <inputVars> |
|
26 <variable name="Cnt1"> |
|
27 <type> |
|
28 <INT/> |
|
29 </type> |
|
30 </variable> |
|
31 <variable name="Cnt2"> |
|
32 <type> |
|
33 <INT/> |
|
34 </type> |
|
35 </variable> |
|
36 <variable name="Cnt3"> |
|
37 <type> |
|
38 <INT/> |
|
39 </type> |
|
40 </variable> |
|
41 <variable name="Cnt4"> |
|
42 <type> |
|
43 <INT/> |
|
44 </type> |
|
45 </variable> |
|
46 <variable name="Cnt5"> |
|
47 <type> |
|
48 <INT/> |
|
49 </type> |
|
50 </variable> |
|
51 </inputVars> |
|
52 <localVars> |
|
53 <variable name="InputsNumber"> |
|
54 <type> |
|
55 <REAL/> |
|
56 </type> |
|
57 <initialValue> |
|
58 <simpleValue value="5.0"/> |
|
59 </initialValue> |
|
60 <documentation> |
|
61 <xhtml:p><![CDATA[Количество входных значений]]></xhtml:p> |
|
62 </documentation> |
|
63 </variable> |
|
64 </localVars> |
|
65 </interface> |
|
66 <body> |
|
67 <ST> |
|
68 <xhtml:p><![CDATA[AverageVal := INT_TO_REAL(Cnt1+Cnt2+Cnt3+Cnt4+Cnt5)/InputsNumber;]]></xhtml:p> |
|
69 </ST> |
|
70 </body> |
|
71 </pou> |
|
72 <pou name="plc_prg" pouType="program"> |
|
73 <interface> |
|
74 <inputVars> |
|
75 <variable name="Reset"> |
|
76 <type> |
|
77 <BOOL/> |
|
78 </type> |
|
79 </variable> |
|
80 </inputVars> |
|
81 <outputVars> |
|
82 <variable name="Cnt1"> |
|
83 <type> |
|
84 <INT/> |
|
85 </type> |
|
86 </variable> |
|
87 <variable name="Cnt2"> |
|
88 <type> |
|
89 <INT/> |
|
90 </type> |
|
91 </variable> |
|
92 <variable name="Cnt3"> |
|
93 <type> |
|
94 <INT/> |
|
95 </type> |
|
96 </variable> |
|
97 <variable name="Cnt4"> |
|
98 <type> |
|
99 <INT/> |
|
100 </type> |
|
101 </variable> |
|
102 <variable name="Cnt5"> |
|
103 <type> |
|
104 <INT/> |
|
105 </type> |
|
106 </variable> |
|
107 </outputVars> |
|
108 <localVars> |
|
109 <variable name="CounterST0"> |
|
110 <type> |
|
111 <derived name="CounterST"/> |
|
112 </type> |
|
113 </variable> |
|
114 <variable name="CounterFBD0"> |
|
115 <type> |
|
116 <derived name="CounterFBD"/> |
|
117 </type> |
|
118 </variable> |
|
119 <variable name="CounterSFC0"> |
|
120 <type> |
|
121 <derived name="CounterSFC"/> |
|
122 </type> |
|
123 </variable> |
|
124 <variable name="CounterIL0"> |
|
125 <type> |
|
126 <derived name="CounterIL"/> |
|
127 </type> |
|
128 </variable> |
|
129 <variable name="CounterLD0"> |
|
130 <type> |
|
131 <derived name="CounterLD"/> |
|
132 </type> |
|
133 </variable> |
|
134 <variable name="AVCnt"> |
|
135 <type> |
|
136 <REAL/> |
|
137 </type> |
|
138 </variable> |
|
139 </localVars> |
|
140 </interface> |
|
141 <body> |
|
142 <FBD> |
|
143 <block localId="1" typeName="CounterST" instanceName="CounterST0" executionOrderId="0" height="60" width="125"> |
|
144 <position x="207" y="53"/> |
|
145 <inputVariables> |
|
146 <variable formalParameter="Reset"> |
|
147 <connectionPointIn> |
|
148 <relPosition x="0" y="40"/> |
|
149 <connection refLocalId="2"> |
|
150 <position x="207" y="93"/> |
|
151 <position x="114" y="93"/> |
|
152 </connection> |
|
153 </connectionPointIn> |
|
154 </variable> |
|
155 </inputVariables> |
|
156 <inOutVariables/> |
|
157 <outputVariables> |
|
158 <variable formalParameter="OUT"> |
|
159 <connectionPointOut> |
|
160 <relPosition x="125" y="40"/> |
|
161 </connectionPointOut> |
|
162 </variable> |
|
163 </outputVariables> |
|
164 </block> |
|
165 <inVariable localId="2" executionOrderId="0" height="30" width="79" negated="false"> |
|
166 <position x="35" y="78"/> |
|
167 <connectionPointOut> |
|
168 <relPosition x="79" y="15"/> |
|
169 </connectionPointOut> |
|
170 <expression>Reset</expression> |
|
171 </inVariable> |
|
172 <block localId="4" typeName="CounterFBD" instanceName="CounterFBD0" executionOrderId="0" height="54" width="121"> |
|
173 <position x="211" y="146"/> |
|
174 <inputVariables> |
|
175 <variable formalParameter="Reset"> |
|
176 <connectionPointIn> |
|
177 <relPosition x="0" y="37"/> |
|
178 <connection refLocalId="13"> |
|
179 <position x="211" y="183"/> |
|
180 <position x="115" y="183"/> |
|
181 </connection> |
|
182 </connectionPointIn> |
|
183 </variable> |
|
184 </inputVariables> |
|
185 <inOutVariables/> |
|
186 <outputVariables> |
|
187 <variable formalParameter="OUT"> |
|
188 <connectionPointOut> |
|
189 <relPosition x="121" y="37"/> |
|
190 </connectionPointOut> |
|
191 </variable> |
|
192 </outputVariables> |
|
193 </block> |
|
194 <comment localId="6" height="365" width="569"> |
|
195 <position x="620" y="130"/> |
|
196 <content> |
|
197 <xhtml:p><![CDATA[In this example function block with the same functionality |
|
198 is created using all five IEC 61131-3 programing languages: |
|
199 - IL; |
|
200 - FBD; |
|
201 - LD; |
|
202 - ST; |
|
203 - SFC. |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 Function block is a counter with reset control input. |
|
209 If reset is True counter value is reset to the value defined by |
|
210 global configuration constant ResetCounterValue. |
|
211 If reset is False, counter is incremented every cycle. |
|
212 ]]></xhtml:p> |
|
213 </content> |
|
214 </comment> |
|
215 <block localId="7" typeName="CounterSFC" instanceName="CounterSFC0" executionOrderId="0" height="52" width="121"> |
|
216 <position x="211" y="237"/> |
|
217 <inputVariables> |
|
218 <variable formalParameter="Reset"> |
|
219 <connectionPointIn> |
|
220 <relPosition x="0" y="36"/> |
|
221 <connection refLocalId="12"> |
|
222 <position x="211" y="273"/> |
|
223 <position x="103" y="273"/> |
|
224 </connection> |
|
225 </connectionPointIn> |
|
226 </variable> |
|
227 </inputVariables> |
|
228 <inOutVariables/> |
|
229 <outputVariables> |
|
230 <variable formalParameter="OUT"> |
|
231 <connectionPointOut> |
|
232 <relPosition x="121" y="36"/> |
|
233 </connectionPointOut> |
|
234 </variable> |
|
235 </outputVariables> |
|
236 </block> |
|
237 <block localId="9" typeName="CounterIL" instanceName="CounterIL0" executionOrderId="0" height="62" width="121"> |
|
238 <position x="211" y="322"/> |
|
239 <inputVariables> |
|
240 <variable formalParameter="Reset"> |
|
241 <connectionPointIn> |
|
242 <relPosition x="0" y="41"/> |
|
243 <connection refLocalId="10"> |
|
244 <position x="211" y="363"/> |
|
245 <position x="101" y="363"/> |
|
246 </connection> |
|
247 </connectionPointIn> |
|
248 </variable> |
|
249 </inputVariables> |
|
250 <inOutVariables/> |
|
251 <outputVariables> |
|
252 <variable formalParameter="OUT"> |
|
253 <connectionPointOut> |
|
254 <relPosition x="121" y="41"/> |
|
255 </connectionPointOut> |
|
256 </variable> |
|
257 </outputVariables> |
|
258 </block> |
|
259 <inVariable localId="10" executionOrderId="0" height="30" width="67" negated="false"> |
|
260 <position x="34" y="348"/> |
|
261 <connectionPointOut> |
|
262 <relPosition x="67" y="15"/> |
|
263 </connectionPointOut> |
|
264 <expression>Reset</expression> |
|
265 </inVariable> |
|
266 <inVariable localId="12" executionOrderId="0" height="30" width="67" negated="false"> |
|
267 <position x="36" y="258"/> |
|
268 <connectionPointOut> |
|
269 <relPosition x="67" y="15"/> |
|
270 </connectionPointOut> |
|
271 <expression>Reset</expression> |
|
272 </inVariable> |
|
273 <inVariable localId="13" executionOrderId="0" height="30" width="79" negated="false"> |
|
274 <position x="36" y="168"/> |
|
275 <connectionPointOut> |
|
276 <relPosition x="79" y="15"/> |
|
277 </connectionPointOut> |
|
278 <expression>Reset</expression> |
|
279 </inVariable> |
|
280 <block localId="14" typeName="CounterLD" instanceName="CounterLD0" executionOrderId="0" height="62" width="124"> |
|
281 <position x="210" y="412"/> |
|
282 <inputVariables> |
|
283 <variable formalParameter="Reset"> |
|
284 <connectionPointIn> |
|
285 <relPosition x="0" y="41"/> |
|
286 <connection refLocalId="16"> |
|
287 <position x="210" y="453"/> |
|
288 <position x="100" y="453"/> |
|
289 </connection> |
|
290 </connectionPointIn> |
|
291 </variable> |
|
292 </inputVariables> |
|
293 <inOutVariables/> |
|
294 <outputVariables> |
|
295 <variable formalParameter="Out"> |
|
296 <connectionPointOut> |
|
297 <relPosition x="124" y="41"/> |
|
298 </connectionPointOut> |
|
299 </variable> |
|
300 </outputVariables> |
|
301 </block> |
|
302 <inVariable localId="16" executionOrderId="0" height="30" width="64" negated="false"> |
|
303 <position x="36" y="438"/> |
|
304 <connectionPointOut> |
|
305 <relPosition x="64" y="15"/> |
|
306 </connectionPointOut> |
|
307 <expression>Reset</expression> |
|
308 </inVariable> |
|
309 <block localId="17" typeName="AverageVal" executionOrderId="0" height="470" width="100"> |
|
310 <position x="514" y="28"/> |
|
311 <inputVariables> |
|
312 <variable formalParameter="Cnt1"> |
|
313 <connectionPointIn> |
|
314 <relPosition x="0" y="65"/> |
|
315 <connection refLocalId="3"> |
|
316 <position x="514" y="93"/> |
|
317 <position x="474" y="93"/> |
|
318 </connection> |
|
319 </connectionPointIn> |
|
320 </variable> |
|
321 <variable formalParameter="Cnt2"> |
|
322 <connectionPointIn> |
|
323 <relPosition x="0" y="155"/> |
|
324 <connection refLocalId="5"> |
|
325 <position x="514" y="183"/> |
|
326 <position x="473" y="183"/> |
|
327 </connection> |
|
328 </connectionPointIn> |
|
329 </variable> |
|
330 <variable formalParameter="Cnt3"> |
|
331 <connectionPointIn> |
|
332 <relPosition x="0" y="245"/> |
|
333 <connection refLocalId="8"> |
|
334 <position x="514" y="273"/> |
|
335 <position x="472" y="273"/> |
|
336 </connection> |
|
337 </connectionPointIn> |
|
338 </variable> |
|
339 <variable formalParameter="Cnt4"> |
|
340 <connectionPointIn> |
|
341 <relPosition x="0" y="335"/> |
|
342 <connection refLocalId="11"> |
|
343 <position x="514" y="363"/> |
|
344 <position x="469" y="363"/> |
|
345 </connection> |
|
346 </connectionPointIn> |
|
347 </variable> |
|
348 <variable formalParameter="Cnt5"> |
|
349 <connectionPointIn> |
|
350 <relPosition x="0" y="425"/> |
|
351 <connection refLocalId="15"> |
|
352 <position x="514" y="453"/> |
|
353 <position x="469" y="453"/> |
|
354 </connection> |
|
355 </connectionPointIn> |
|
356 </variable> |
|
357 </inputVariables> |
|
358 <inOutVariables/> |
|
359 <outputVariables> |
|
360 <variable formalParameter="OUT"> |
|
361 <connectionPointOut> |
|
362 <relPosition x="100" y="65"/> |
|
363 </connectionPointOut> |
|
364 </variable> |
|
365 </outputVariables> |
|
366 </block> |
|
367 <outVariable localId="18" executionOrderId="0" height="30" width="55" negated="false"> |
|
368 <position x="649" y="78"/> |
|
369 <connectionPointIn> |
|
370 <relPosition x="0" y="15"/> |
|
371 <connection refLocalId="17" formalParameter="OUT"> |
|
372 <position x="649" y="93"/> |
|
373 <position x="614" y="93"/> |
|
374 </connection> |
|
375 </connectionPointIn> |
|
376 <expression>AVCnt</expression> |
|
377 </outVariable> |
|
378 <inOutVariable localId="3" executionOrderId="0" height="30" width="106" negatedOut="false" negatedIn="false"> |
|
379 <position x="368" y="78"/> |
|
380 <connectionPointIn> |
|
381 <relPosition x="0" y="15"/> |
|
382 <connection refLocalId="1" formalParameter="OUT"> |
|
383 <position x="368" y="93"/> |
|
384 <position x="332" y="93"/> |
|
385 </connection> |
|
386 </connectionPointIn> |
|
387 <connectionPointOut> |
|
388 <relPosition x="106" y="15"/> |
|
389 </connectionPointOut> |
|
390 <expression>Cnt1</expression> |
|
391 </inOutVariable> |
|
392 <inOutVariable localId="5" executionOrderId="0" height="30" width="103" negatedOut="false" negatedIn="false"> |
|
393 <position x="370" y="168"/> |
|
394 <connectionPointIn> |
|
395 <relPosition x="0" y="15"/> |
|
396 <connection refLocalId="4" formalParameter="OUT"> |
|
397 <position x="370" y="183"/> |
|
398 <position x="332" y="183"/> |
|
399 </connection> |
|
400 </connectionPointIn> |
|
401 <connectionPointOut> |
|
402 <relPosition x="103" y="15"/> |
|
403 </connectionPointOut> |
|
404 <expression>Cnt2</expression> |
|
405 </inOutVariable> |
|
406 <inOutVariable localId="8" executionOrderId="0" height="30" width="97" negatedOut="false" negatedIn="false"> |
|
407 <position x="375" y="258"/> |
|
408 <connectionPointIn> |
|
409 <relPosition x="0" y="15"/> |
|
410 <connection refLocalId="7" formalParameter="OUT"> |
|
411 <position x="375" y="273"/> |
|
412 <position x="332" y="273"/> |
|
413 </connection> |
|
414 </connectionPointIn> |
|
415 <connectionPointOut> |
|
416 <relPosition x="97" y="15"/> |
|
417 </connectionPointOut> |
|
418 <expression>Cnt3</expression> |
|
419 </inOutVariable> |
|
420 <inOutVariable localId="11" executionOrderId="0" height="30" width="91" negatedOut="false" negatedIn="false"> |
|
421 <position x="378" y="348"/> |
|
422 <connectionPointIn> |
|
423 <relPosition x="0" y="15"/> |
|
424 <connection refLocalId="9" formalParameter="OUT"> |
|
425 <position x="378" y="363"/> |
|
426 <position x="332" y="363"/> |
|
427 </connection> |
|
428 </connectionPointIn> |
|
429 <connectionPointOut> |
|
430 <relPosition x="91" y="15"/> |
|
431 </connectionPointOut> |
|
432 <expression>Cnt4</expression> |
|
433 </inOutVariable> |
|
434 <inOutVariable localId="15" executionOrderId="0" height="30" width="88" negatedOut="false" negatedIn="false"> |
|
435 <position x="381" y="438"/> |
|
436 <connectionPointIn> |
|
437 <relPosition x="0" y="15"/> |
|
438 <connection refLocalId="14" formalParameter="Out"> |
|
439 <position x="381" y="453"/> |
|
440 <position x="334" y="453"/> |
|
441 </connection> |
|
442 </connectionPointIn> |
|
443 <connectionPointOut> |
|
444 <relPosition x="88" y="15"/> |
|
445 </connectionPointOut> |
|
446 <expression>Cnt5</expression> |
|
447 </inOutVariable> |
|
448 </FBD> |
|
449 </body> |
|
450 </pou> |
|
451 <pou name="CounterST" pouType="functionBlock"> |
|
452 <interface> |
|
453 <inputVars> |
|
454 <variable name="Reset"> |
|
455 <type> |
|
456 <BOOL/> |
|
457 </type> |
|
458 </variable> |
|
459 </inputVars> |
|
460 <localVars> |
|
461 <variable name="Cnt"> |
|
462 <type> |
|
463 <INT/> |
|
464 </type> |
|
465 </variable> |
|
466 </localVars> |
|
467 <outputVars> |
|
468 <variable name="OUT"> |
|
469 <type> |
|
470 <INT/> |
|
471 </type> |
|
472 </variable> |
|
473 </outputVars> |
|
474 <externalVars constant="true"> |
|
475 <variable name="ResetCounterValue"> |
|
476 <type> |
|
477 <INT/> |
|
478 </type> |
|
479 </variable> |
|
480 </externalVars> |
|
481 </interface> |
|
482 <body> |
|
483 <ST> |
|
484 <xhtml:p><![CDATA[IF Reset THEN |
|
485 Cnt := ResetCounterValue; |
|
486 ELSE |
|
487 Cnt := Cnt + 1; |
|
488 END_IF; |
|
489 |
|
490 Out := Cnt;]]></xhtml:p> |
|
491 </ST> |
|
492 </body> |
|
493 </pou> |
|
494 <pou name="CounterFBD" pouType="functionBlock"> |
|
495 <interface> |
|
496 <inputVars> |
|
497 <variable name="Reset"> |
|
498 <type> |
|
499 <BOOL/> |
|
500 </type> |
|
501 </variable> |
|
502 </inputVars> |
|
503 <outputVars> |
|
504 <variable name="OUT"> |
|
505 <type> |
|
506 <INT/> |
|
507 </type> |
|
508 </variable> |
|
509 </outputVars> |
|
510 <localVars> |
|
511 <variable name="Cnt"> |
|
512 <type> |
|
513 <INT/> |
|
514 </type> |
|
515 </variable> |
|
516 </localVars> |
|
517 <externalVars constant="true"> |
|
518 <variable name="ResetCounterValue"> |
|
519 <type> |
|
520 <INT/> |
|
521 </type> |
|
522 </variable> |
|
523 </externalVars> |
|
524 </interface> |
|
525 <body> |
|
526 <FBD> |
|
527 <inVariable localId="1" executionOrderId="0" height="30" width="61" negated="false"> |
|
528 <position x="321" y="58"/> |
|
529 <connectionPointOut> |
|
530 <relPosition x="61" y="15"/> |
|
531 </connectionPointOut> |
|
532 <expression>Reset</expression> |
|
533 </inVariable> |
|
534 <outVariable localId="2" executionOrderId="0" height="30" width="39" negated="false"> |
|
535 <position x="675" y="137"/> |
|
536 <connectionPointIn> |
|
537 <relPosition x="0" y="15"/> |
|
538 <connection refLocalId="3"> |
|
539 <position x="675" y="152"/> |
|
540 <position x="589" y="152"/> |
|
541 </connection> |
|
542 </connectionPointIn> |
|
543 <expression>OUT</expression> |
|
544 </outVariable> |
|
545 <inOutVariable localId="3" executionOrderId="0" height="30" width="37" negatedOut="false" negatedIn="false"> |
|
546 <position x="557" y="137"/> |
|
547 <connectionPointIn> |
|
548 <relPosition x="0" y="15"/> |
|
549 <connection refLocalId="7" formalParameter="OUT"> |
|
550 <position x="557" y="152"/> |
|
551 <position x="527" y="152"/> |
|
552 <position x="527" y="130"/> |
|
553 <position x="517" y="130"/> |
|
554 </connection> |
|
555 </connectionPointIn> |
|
556 <connectionPointOut> |
|
557 <relPosition x="37" y="15"/> |
|
558 </connectionPointOut> |
|
559 <expression>Cnt</expression> |
|
560 </inOutVariable> |
|
561 <block localId="4" typeName="ADD" executionOrderId="0" height="80" width="69"> |
|
562 <position x="328" y="115"/> |
|
563 <inputVariables> |
|
564 <variable formalParameter="IN1"> |
|
565 <connectionPointIn> |
|
566 <relPosition x="0" y="35"/> |
|
567 <connection refLocalId="6"> |
|
568 <position x="328" y="150"/> |
|
569 <position x="275" y="150"/> |
|
570 </connection> |
|
571 </connectionPointIn> |
|
572 </variable> |
|
573 <variable formalParameter="IN2"> |
|
574 <connectionPointIn> |
|
575 <relPosition x="0" y="65"/> |
|
576 <connection refLocalId="3"> |
|
577 <position x="328" y="180"/> |
|
578 <position x="317" y="180"/> |
|
579 <position x="317" y="213"/> |
|
580 <position x="604" y="213"/> |
|
581 <position x="604" y="152"/> |
|
582 <position x="594" y="152"/> |
|
583 </connection> |
|
584 </connectionPointIn> |
|
585 </variable> |
|
586 </inputVariables> |
|
587 <inOutVariables/> |
|
588 <outputVariables> |
|
589 <variable formalParameter="OUT"> |
|
590 <connectionPointOut> |
|
591 <relPosition x="69" y="35"/> |
|
592 </connectionPointOut> |
|
593 </variable> |
|
594 </outputVariables> |
|
595 </block> |
|
596 <inVariable localId="5" executionOrderId="0" height="30" width="163" negated="false"> |
|
597 <position x="222" y="256"/> |
|
598 <connectionPointOut> |
|
599 <relPosition x="163" y="15"/> |
|
600 </connectionPointOut> |
|
601 <expression>ResetCounterValue</expression> |
|
602 </inVariable> |
|
603 <inVariable localId="6" executionOrderId="0" height="30" width="21" negated="false"> |
|
604 <position x="254" y="135"/> |
|
605 <connectionPointOut> |
|
606 <relPosition x="21" y="15"/> |
|
607 </connectionPointOut> |
|
608 <expression>1</expression> |
|
609 </inVariable> |
|
610 <block localId="7" typeName="SEL" executionOrderId="0" height="80" width="69"> |
|
611 <position x="448" y="100"/> |
|
612 <inputVariables> |
|
613 <variable formalParameter="G"> |
|
614 <connectionPointIn> |
|
615 <relPosition x="0" y="30"/> |
|
616 <connection refLocalId="1"> |
|
617 <position x="448" y="130"/> |
|
618 <position x="415" y="130"/> |
|
619 <position x="415" y="73"/> |
|
620 <position x="382" y="73"/> |
|
621 </connection> |
|
622 </connectionPointIn> |
|
623 </variable> |
|
624 <variable formalParameter="IN0"> |
|
625 <connectionPointIn> |
|
626 <relPosition x="0" y="50"/> |
|
627 <connection refLocalId="4" formalParameter="OUT"> |
|
628 <position x="448" y="150"/> |
|
629 <position x="397" y="150"/> |
|
630 </connection> |
|
631 </connectionPointIn> |
|
632 </variable> |
|
633 <variable formalParameter="IN1"> |
|
634 <connectionPointIn> |
|
635 <relPosition x="0" y="70"/> |
|
636 <connection refLocalId="5"> |
|
637 <position x="448" y="170"/> |
|
638 <position x="414" y="170"/> |
|
639 <position x="414" y="271"/> |
|
640 <position x="385" y="271"/> |
|
641 </connection> |
|
642 </connectionPointIn> |
|
643 </variable> |
|
644 </inputVariables> |
|
645 <inOutVariables/> |
|
646 <outputVariables> |
|
647 <variable formalParameter="OUT"> |
|
648 <connectionPointOut> |
|
649 <relPosition x="69" y="30"/> |
|
650 </connectionPointOut> |
|
651 </variable> |
|
652 </outputVariables> |
|
653 </block> |
|
654 </FBD> |
|
655 </body> |
|
656 </pou> |
|
657 <pou name="CounterSFC" pouType="functionBlock"> |
|
658 <interface> |
|
659 <inputVars> |
|
660 <variable name="Reset"> |
|
661 <type> |
|
662 <BOOL/> |
|
663 </type> |
|
664 </variable> |
|
665 </inputVars> |
|
666 <outputVars> |
|
667 <variable name="OUT"> |
|
668 <type> |
|
669 <INT/> |
|
670 </type> |
|
671 </variable> |
|
672 </outputVars> |
|
673 <localVars> |
|
674 <variable name="Cnt"> |
|
675 <type> |
|
676 <INT/> |
|
677 </type> |
|
678 </variable> |
|
679 </localVars> |
|
680 <externalVars constant="true"> |
|
681 <variable name="ResetCounterValue"> |
|
682 <type> |
|
683 <INT/> |
|
684 </type> |
|
685 </variable> |
|
686 </externalVars> |
|
687 </interface> |
|
688 <actions/> |
|
689 <body> |
|
690 <SFC> |
|
691 <step localId="1" name="Start" initialStep="true" height="34" width="90"> |
|
692 <position x="241" y="14"/> |
|
693 <connectionPointOut formalParameter=""> |
|
694 <relPosition x="45" y="34"/> |
|
695 </connectionPointOut> |
|
696 </step> |
|
697 <selectionDivergence localId="2" height="1" width="431"> |
|
698 <position x="70" y="86"/> |
|
699 <connectionPointIn> |
|
700 <relPosition x="216" y="0"/> |
|
701 <connection refLocalId="1"> |
|
702 <position x="286" y="86"/> |
|
703 <position x="286" y="42"/> |
|
704 </connection> |
|
705 </connectionPointIn> |
|
706 <connectionPointOut formalParameter=""> |
|
707 <relPosition x="0" y="1"/> |
|
708 </connectionPointOut> |
|
709 <connectionPointOut formalParameter=""> |
|
710 <relPosition x="431" y="1"/> |
|
711 </connectionPointOut> |
|
712 </selectionDivergence> |
|
713 <transition localId="3" height="2" width="20"> |
|
714 <position x="491" y="132"/> |
|
715 <connectionPointIn> |
|
716 <relPosition x="10" y="0"/> |
|
717 <connection refLocalId="2"> |
|
718 <position x="501" y="132"/> |
|
719 <position x="501" y="87"/> |
|
720 </connection> |
|
721 </connectionPointIn> |
|
722 <connectionPointOut> |
|
723 <relPosition x="10" y="2"/> |
|
724 </connectionPointOut> |
|
725 <condition> |
|
726 <inline name=""> |
|
727 <ST> |
|
728 <xhtml:p><![CDATA[Reset]]></xhtml:p> |
|
729 </ST> |
|
730 </inline> |
|
731 </condition> |
|
732 </transition> |
|
733 <transition localId="4" height="2" width="20" executionOrderId="0"> |
|
734 <position x="60" y="135"/> |
|
735 <connectionPointIn> |
|
736 <relPosition x="10" y="0"/> |
|
737 <connection refLocalId="2"> |
|
738 <position x="70" y="135"/> |
|
739 <position x="70" y="87"/> |
|
740 </connection> |
|
741 </connectionPointIn> |
|
742 <connectionPointOut> |
|
743 <relPosition x="10" y="2"/> |
|
744 </connectionPointOut> |
|
745 <condition> |
|
746 <inline name=""> |
|
747 <ST> |
|
748 <xhtml:p><![CDATA[NOT Reset]]></xhtml:p> |
|
749 </ST> |
|
750 </inline> |
|
751 </condition> |
|
752 </transition> |
|
753 <step localId="5" name="ResetCounter" initialStep="false" height="30" width="134"> |
|
754 <position x="434" y="190"/> |
|
755 <connectionPointIn> |
|
756 <relPosition x="67" y="0"/> |
|
757 <connection refLocalId="3"> |
|
758 <position x="501" y="190"/> |
|
759 <position x="501" y="134"/> |
|
760 </connection> |
|
761 </connectionPointIn> |
|
762 <connectionPointOut formalParameter=""> |
|
763 <relPosition x="67" y="30"/> |
|
764 </connectionPointOut> |
|
765 <connectionPointOutAction formalParameter=""> |
|
766 <relPosition x="134" y="15"/> |
|
767 </connectionPointOutAction> |
|
768 </step> |
|
769 <actionBlock localId="6" height="63" width="254"> |
|
770 <position x="641" y="190"/> |
|
771 <connectionPointIn> |
|
772 <relPosition x="0" y="15"/> |
|
773 <connection refLocalId="5"> |
|
774 <position x="641" y="205"/> |
|
775 <position x="568" y="205"/> |
|
776 </connection> |
|
777 </connectionPointIn> |
|
778 <action localId="0"> |
|
779 <relPosition x="0" y="0"/> |
|
780 <inline> |
|
781 <ST> |
|
782 <xhtml:p><![CDATA[Cnt := ResetCounterValue;]]></xhtml:p> |
|
783 </ST> |
|
784 </inline> |
|
785 </action> |
|
786 <action localId="0"> |
|
787 <relPosition x="0" y="0"/> |
|
788 <inline> |
|
789 <ST> |
|
790 <xhtml:p><![CDATA[OUT := Cnt;]]></xhtml:p> |
|
791 </ST> |
|
792 </inline> |
|
793 </action> |
|
794 </actionBlock> |
|
795 <step localId="7" name="Count" initialStep="false" height="30" width="85" executionOrderId="0"> |
|
796 <position x="28" y="191"/> |
|
797 <connectionPointIn> |
|
798 <relPosition x="42" y="0"/> |
|
799 <connection refLocalId="4"> |
|
800 <position x="70" y="191"/> |
|
801 <position x="70" y="137"/> |
|
802 </connection> |
|
803 </connectionPointIn> |
|
804 <connectionPointOut formalParameter=""> |
|
805 <relPosition x="42" y="30"/> |
|
806 </connectionPointOut> |
|
807 <connectionPointOutAction formalParameter=""> |
|
808 <relPosition x="85" y="15"/> |
|
809 </connectionPointOutAction> |
|
810 </step> |
|
811 <actionBlock localId="8" height="52" width="164" executionOrderId="0"> |
|
812 <position x="154" y="191"/> |
|
813 <connectionPointIn> |
|
814 <relPosition x="0" y="15"/> |
|
815 <connection refLocalId="7"> |
|
816 <position x="154" y="206"/> |
|
817 <position x="113" y="206"/> |
|
818 </connection> |
|
819 </connectionPointIn> |
|
820 <action localId="0"> |
|
821 <relPosition x="0" y="0"/> |
|
822 <inline> |
|
823 <ST> |
|
824 <xhtml:p><![CDATA[Cnt := Cnt + 1;]]></xhtml:p> |
|
825 </ST> |
|
826 </inline> |
|
827 </action> |
|
828 <action localId="0"> |
|
829 <relPosition x="0" y="0"/> |
|
830 <inline> |
|
831 <ST> |
|
832 <xhtml:p><![CDATA[OUT := Cnt;]]></xhtml:p> |
|
833 </ST> |
|
834 </inline> |
|
835 </action> |
|
836 </actionBlock> |
|
837 <selectionConvergence localId="10" height="1" width="431"> |
|
838 <position x="70" y="273"/> |
|
839 <connectionPointIn> |
|
840 <relPosition x="0" y="0"/> |
|
841 <connection refLocalId="13"> |
|
842 <position x="70" y="273"/> |
|
843 <position x="70" y="244"/> |
|
844 </connection> |
|
845 </connectionPointIn> |
|
846 <connectionPointIn> |
|
847 <relPosition x="431" y="0"/> |
|
848 <connection refLocalId="14"> |
|
849 <position x="501" y="273"/> |
|
850 <position x="501" y="250"/> |
|
851 </connection> |
|
852 </connectionPointIn> |
|
853 <connectionPointOut> |
|
854 <relPosition x="216" y="1"/> |
|
855 </connectionPointOut> |
|
856 </selectionConvergence> |
|
857 <jumpStep localId="12" targetName="Start" height="13" width="12"> |
|
858 <position x="280" y="317"/> |
|
859 <connectionPointIn> |
|
860 <relPosition x="6" y="0"/> |
|
861 <connection refLocalId="10"> |
|
862 <position x="286" y="317"/> |
|
863 <position x="286" y="274"/> |
|
864 </connection> |
|
865 </connectionPointIn> |
|
866 </jumpStep> |
|
867 <transition localId="13" height="2" width="20" executionOrderId="0"> |
|
868 <position x="60" y="242"/> |
|
869 <connectionPointIn> |
|
870 <relPosition x="10" y="0"/> |
|
871 <connection refLocalId="7"> |
|
872 <position x="70" y="242"/> |
|
873 <position x="70" y="215"/> |
|
874 </connection> |
|
875 </connectionPointIn> |
|
876 <connectionPointOut> |
|
877 <relPosition x="10" y="2"/> |
|
878 </connectionPointOut> |
|
879 <condition> |
|
880 <inline name=""> |
|
881 <ST> |
|
882 <xhtml:p><![CDATA[Reset]]></xhtml:p> |
|
883 </ST> |
|
884 </inline> |
|
885 </condition> |
|
886 </transition> |
|
887 <transition localId="14" height="2" width="20" executionOrderId="0"> |
|
888 <position x="491" y="248"/> |
|
889 <connectionPointIn> |
|
890 <relPosition x="10" y="0"/> |
|
891 <connection refLocalId="5"> |
|
892 <position x="501" y="248"/> |
|
893 <position x="501" y="220"/> |
|
894 </connection> |
|
895 </connectionPointIn> |
|
896 <connectionPointOut> |
|
897 <relPosition x="10" y="2"/> |
|
898 </connectionPointOut> |
|
899 <condition> |
|
900 <inline name=""> |
|
901 <ST> |
|
902 <xhtml:p><![CDATA[NOT Reset]]></xhtml:p> |
|
903 </ST> |
|
904 </inline> |
|
905 </condition> |
|
906 </transition> |
|
907 </SFC> |
|
908 </body> |
|
909 </pou> |
|
910 <pou name="CounterIL" pouType="functionBlock"> |
|
911 <interface> |
|
912 <localVars> |
|
913 <variable name="Cnt"> |
|
914 <type> |
|
915 <INT/> |
|
916 </type> |
|
917 </variable> |
|
918 </localVars> |
|
919 <inputVars> |
|
920 <variable name="Reset"> |
|
921 <type> |
|
922 <BOOL/> |
|
923 </type> |
|
924 </variable> |
|
925 </inputVars> |
|
926 <outputVars> |
|
927 <variable name="OUT"> |
|
928 <type> |
|
929 <INT/> |
|
930 </type> |
|
931 </variable> |
|
932 </outputVars> |
|
933 <externalVars constant="true"> |
|
934 <variable name="ResetCounterValue"> |
|
935 <type> |
|
936 <INT/> |
|
937 </type> |
|
938 </variable> |
|
939 </externalVars> |
|
940 </interface> |
|
941 <body> |
|
942 <IL> |
|
943 <xhtml:p><![CDATA[LD Reset |
|
944 JMPC ResetCnt |
|
945 |
|
946 (* increment counter *) |
|
947 LD Cnt |
|
948 ADD 1 |
|
949 JMP QuitFb |
|
950 |
|
951 ResetCnt: |
|
952 (* reset counter *) |
|
953 LD ResetCounterValue |
|
954 |
|
955 QuitFb: |
|
956 (* save results *) |
|
957 ST Cnt |
|
958 ST Out |
|
959 ]]></xhtml:p> |
|
960 </IL> |
|
961 </body> |
|
962 </pou> |
|
963 <pou name="CounterLD" pouType="functionBlock"> |
|
964 <interface> |
|
965 <inputVars> |
|
966 <variable name="Reset"> |
|
967 <type> |
|
968 <BOOL/> |
|
969 </type> |
|
970 </variable> |
|
971 </inputVars> |
|
972 <outputVars> |
|
973 <variable name="Out"> |
|
974 <type> |
|
975 <INT/> |
|
976 </type> |
|
977 </variable> |
|
978 </outputVars> |
|
979 <localVars> |
|
980 <variable name="Cnt"> |
|
981 <type> |
|
982 <INT/> |
|
983 </type> |
|
984 </variable> |
|
985 </localVars> |
|
986 <externalVars constant="true"> |
|
987 <variable name="ResetCounterValue"> |
|
988 <type> |
|
989 <INT/> |
|
990 </type> |
|
991 </variable> |
|
992 </externalVars> |
|
993 </interface> |
|
994 <body> |
|
995 <LD> |
|
996 <outVariable localId="2" executionOrderId="0" height="30" width="34" negated="false"> |
|
997 <position x="527" y="87"/> |
|
998 <connectionPointIn> |
|
999 <relPosition x="0" y="15"/> |
|
1000 <connection refLocalId="3"> |
|
1001 <position x="527" y="102"/> |
|
1002 <position x="443" y="102"/> |
|
1003 </connection> |
|
1004 </connectionPointIn> |
|
1005 <expression>Out</expression> |
|
1006 </outVariable> |
|
1007 <inOutVariable localId="3" executionOrderId="0" height="30" width="34" negatedOut="false" negatedIn="false"> |
|
1008 <position x="409" y="87"/> |
|
1009 <connectionPointIn> |
|
1010 <relPosition x="0" y="15"/> |
|
1011 <connection refLocalId="7" formalParameter="OUT"> |
|
1012 <position x="409" y="102"/> |
|
1013 <position x="367" y="102"/> |
|
1014 </connection> |
|
1015 </connectionPointIn> |
|
1016 <connectionPointOut> |
|
1017 <relPosition x="34" y="15"/> |
|
1018 </connectionPointOut> |
|
1019 <expression>Cnt</expression> |
|
1020 </inOutVariable> |
|
1021 <block localId="4" typeName="ADD" executionOrderId="0" height="80" width="67"> |
|
1022 <position x="180" y="87"/> |
|
1023 <inputVariables> |
|
1024 <variable formalParameter="IN1"> |
|
1025 <connectionPointIn> |
|
1026 <relPosition x="0" y="35"/> |
|
1027 <connection refLocalId="6"> |
|
1028 <position x="180" y="122"/> |
|
1029 <position x="127" y="122"/> |
|
1030 </connection> |
|
1031 </connectionPointIn> |
|
1032 </variable> |
|
1033 <variable formalParameter="IN2"> |
|
1034 <connectionPointIn> |
|
1035 <relPosition x="0" y="65"/> |
|
1036 <connection refLocalId="3"> |
|
1037 <position x="180" y="152"/> |
|
1038 <position x="169" y="152"/> |
|
1039 <position x="169" y="185"/> |
|
1040 <position x="453" y="185"/> |
|
1041 <position x="453" y="102"/> |
|
1042 <position x="443" y="102"/> |
|
1043 </connection> |
|
1044 </connectionPointIn> |
|
1045 </variable> |
|
1046 </inputVariables> |
|
1047 <inOutVariables/> |
|
1048 <outputVariables> |
|
1049 <variable formalParameter="OUT"> |
|
1050 <connectionPointOut> |
|
1051 <relPosition x="67" y="35"/> |
|
1052 </connectionPointOut> |
|
1053 </variable> |
|
1054 </outputVariables> |
|
1055 </block> |
|
1056 <inVariable localId="5" executionOrderId="0" height="30" width="158" negated="false"> |
|
1057 <position x="74" y="228"/> |
|
1058 <connectionPointOut> |
|
1059 <relPosition x="158" y="15"/> |
|
1060 </connectionPointOut> |
|
1061 <expression>ResetCounterValue</expression> |
|
1062 </inVariable> |
|
1063 <inVariable localId="6" executionOrderId="0" height="30" width="21" negated="false"> |
|
1064 <position x="106" y="107"/> |
|
1065 <connectionPointOut> |
|
1066 <relPosition x="21" y="15"/> |
|
1067 </connectionPointOut> |
|
1068 <expression>1</expression> |
|
1069 </inVariable> |
|
1070 <block localId="7" typeName="SEL" executionOrderId="0" height="80" width="67"> |
|
1071 <position x="300" y="72"/> |
|
1072 <inputVariables> |
|
1073 <variable formalParameter="G"> |
|
1074 <connectionPointIn> |
|
1075 <relPosition x="0" y="30"/> |
|
1076 <connection refLocalId="9"> |
|
1077 <position x="300" y="102"/> |
|
1078 <position x="266" y="102"/> |
|
1079 <position x="266" y="62"/> |
|
1080 <position x="134" y="62"/> |
|
1081 </connection> |
|
1082 </connectionPointIn> |
|
1083 </variable> |
|
1084 <variable formalParameter="IN0"> |
|
1085 <connectionPointIn> |
|
1086 <relPosition x="0" y="50"/> |
|
1087 <connection refLocalId="4" formalParameter="OUT"> |
|
1088 <position x="300" y="122"/> |
|
1089 <position x="247" y="122"/> |
|
1090 </connection> |
|
1091 </connectionPointIn> |
|
1092 </variable> |
|
1093 <variable formalParameter="IN1"> |
|
1094 <connectionPointIn> |
|
1095 <relPosition x="0" y="70"/> |
|
1096 <connection refLocalId="5"> |
|
1097 <position x="300" y="142"/> |
|
1098 <position x="266" y="142"/> |
|
1099 <position x="266" y="243"/> |
|
1100 <position x="232" y="243"/> |
|
1101 </connection> |
|
1102 </connectionPointIn> |
|
1103 </variable> |
|
1104 </inputVariables> |
|
1105 <inOutVariables/> |
|
1106 <outputVariables> |
|
1107 <variable formalParameter="OUT"> |
|
1108 <connectionPointOut> |
|
1109 <relPosition x="67" y="30"/> |
|
1110 </connectionPointOut> |
|
1111 </variable> |
|
1112 </outputVariables> |
|
1113 </block> |
|
1114 <leftPowerRail localId="8" height="40" width="3"> |
|
1115 <position x="46" y="42"/> |
|
1116 <connectionPointOut formalParameter=""> |
|
1117 <relPosition x="3" y="20"/> |
|
1118 </connectionPointOut> |
|
1119 </leftPowerRail> |
|
1120 <contact localId="9" height="15" width="21" negated="false"> |
|
1121 <position x="113" y="54"/> |
|
1122 <connectionPointIn> |
|
1123 <relPosition x="0" y="8"/> |
|
1124 <connection refLocalId="8"> |
|
1125 <position x="113" y="62"/> |
|
1126 <position x="49" y="62"/> |
|
1127 </connection> |
|
1128 </connectionPointIn> |
|
1129 <connectionPointOut> |
|
1130 <relPosition x="21" y="8"/> |
|
1131 </connectionPointOut> |
|
1132 <variable>Reset</variable> |
|
1133 </contact> |
|
1134 </LD> |
|
1135 </body> |
|
1136 </pou> |
|
1137 </pous> |
|
1138 </types> |
|
1139 <instances> |
|
1140 <configurations> |
|
1141 <configuration name="config"> |
|
1142 <resource name="resource1"> |
|
1143 <task name="plc_task" priority="1" interval="T#100ms"> |
|
1144 <pouInstance name="plc_task_instance" typeName="plc_prg"/> |
|
1145 </task> |
|
1146 </resource> |
|
1147 <globalVars constant="true"> |
|
1148 <variable name="ResetCounterValue"> |
|
1149 <type> |
|
1150 <INT/> |
|
1151 </type> |
|
1152 <initialValue> |
|
1153 <simpleValue value="17"/> |
|
1154 </initialValue> |
|
1155 </variable> |
|
1156 </globalVars> |
|
1157 </configuration> |
|
1158 </configurations> |
|
1159 </instances> |
|
1160 </project> |
|