--- a/tests/projects/iec61131_lang_test/plc.xml Sat Nov 23 01:09:55 2024 +0100
+++ b/tests/projects/iec61131_lang_test/plc.xml Wed Nov 27 16:05:26 2024 +0100
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<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">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2023-03-11T14:33:27"/>
- <contentHeader name="Unnamed" modificationDateTime="2023-03-27T09:12:21">
+ <contentHeader name="Unnamed" modificationDateTime="2024-11-27T15:23:14"> @@ -17,6 +17,138 @@
+ <pou name="FLOW_CONTROL_TEST" pouType="functionBlock"> + <variable name="RESULT"> + <variable name="WORDS"> + <dimension lower="1" upper="10"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <simpleValue value="0"/> + <xhtml:p><![CDATA[(* FOR loop test s *) +RESULT := 'Single iteration FOR loop'; +IF NOT J THEN RETURN; END_IF; +RESULT := 'By 2 FOR loop'; +J := J AND WORDS[1] = 0; +J := J AND WORDS[2] = 2; +J := J AND WORDS[3] = 0; +J := J AND WORDS[4] = 4; +J := J AND WORDS[5] = 0; +J := J AND WORDS[6] = 6; +J := J AND WORDS[7] = 0; +J := J AND WORDS[8] = 8; +J := J AND WORDS[9] = 0; +J := J AND WORDS[10] = 10; +IF NOT J THEN RETURN; END_IF; +RESULT := 'By 2 FOR loop with CONTINUE'; +J := J AND WORDS[1] = 1; +J := J AND WORDS[2] = 2; +J := J AND WORDS[3] = 3; +J := J AND WORDS[4] = 4; +J := J AND WORDS[5] = 0; +J := J AND WORDS[6] = 6; +J := J AND WORDS[7] = 7; +J := J AND WORDS[8] = 8; +J := J AND WORDS[9] = 9; +J := J AND WORDS[10] = 10; +IF NOT J THEN RETURN; END_IF; +(* TODO: CONTINUE EXIT WHILE REPEAT *) <pou name="CONVERSION_TEST" pouType="functionBlock">
@@ -1065,6 +1197,26 @@
+ <variable name="FLOW_CONTROL_TEST0"> + <derived name="FLOW_CONTROL_TEST"/> + <variable name="R_TRIG1"> + <derived name="R_TRIG"/> + <variable name="LOGGER3"> + <derived name="LOGGER"/> @@ -1445,7 +1597,7 @@
- <block localId="21" typeName="AND" executionOrderId="0" height="64" width="64">
+ <block localId="21" typeName="AND" executionOrderId="0" height="80" width="64"> <position x="1296" y="496"/>
<variable formalParameter="IN1">
@@ -1461,15 +1613,26 @@
<variable formalParameter="IN2">
- <relPosition x="0" y="56"/>
+ <relPosition x="0" y="48"/> <connection refLocalId="20" formalParameter="Q1">
- <position x="1296" y="552"/>
- <position x="1232" y="552"/>
+ <position x="1296" y="544"/> + <position x="1232" y="544"/> <position x="1232" y="600"/>
<position x="1168" y="600"/>
+ <variable formalParameter="IN3"> + <relPosition x="0" y="72"/> + <connection refLocalId="37" formalParameter="Q1"> + <position x="1296" y="568"/> + <position x="1280" y="568"/> + <position x="1280" y="920"/> + <position x="1264" y="920"/> @@ -1640,6 +1803,259 @@
- time is emulated]]></xhtml:p>
+ <block localId="30" typeName="FLOW_CONTROL_TEST" instanceName="FLOW_CONTROL_TEST0" executionOrderId="0" height="72" width="152"> + <position x="392" y="928"/> + <variable formalParameter="EN"> + <relPosition x="0" y="32"/> + <connection refLocalId="31" formalParameter="Q"> + <position x="392" y="960"/> + <position x="336" y="960"/> + <variable formalParameter="ENO"> + <relPosition x="152" y="32"/> + <variable formalParameter="RESULT"> + <relPosition x="152" y="56"/> + <block localId="31" typeName="R_TRIG" instanceName="R_TRIG1" executionOrderId="0" height="48" width="64"> + <position x="272" y="928"/> + <variable formalParameter="CLK"> + <relPosition x="0" y="32"/> + <connection refLocalId="32"> + <position x="272" y="960"/> + <position x="240" y="960"/> + <variable formalParameter="Q"> + <relPosition x="64" y="32"/> + <inVariable localId="32" executionOrderId="0" height="32" width="48" negated="false"> + <position x="192" y="944"/> + <relPosition x="48" y="16"/> + <expression>TRUE</expression> + <block localId="33" typeName="LOGGER" instanceName="LOGGER3" executionOrderId="0" height="112" width="64"> + <position x="920" y="952"/> + <variable formalParameter="TRIG"> + <relPosition x="0" y="32"/> + <connection refLocalId="30" formalParameter="ENO"> + <position x="920" y="984"/> + <position x="832" y="984"/> + <position x="832" y="960"/> + <position x="544" y="960"/> + <variable formalParameter="MSG"> + <relPosition x="0" y="64"/> + <connection refLocalId="34" formalParameter="OUT"> + <position x="920" y="1016"/> + <position x="808" y="1016"/> + <variable formalParameter="LEVEL"> + <relPosition x="0" y="96"/> + <connection refLocalId="36"> + <position x="920" y="1048"/> + <position x="888" y="1048"/> + <block localId="34" typeName="CONCAT" executionOrderId="0" height="64" width="64"> + <position x="744" y="984"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="32"/> + <connection refLocalId="35"> + <position x="744" y="1016"/> + <position x="712" y="1016"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="56"/> + <connection refLocalId="30" formalParameter="RESULT"> + <position x="744" y="1040"/> + <position x="554" y="1040"/> + <position x="554" y="984"/> + <position x="544" y="984"/> + <variable formalParameter="OUT"> + <relPosition x="64" y="32"/> + <inVariable localId="35" executionOrderId="0" height="32" width="144" negated="false"> + <position x="584" y="1000"/> + <relPosition x="144" y="16"/> + <expression>'FLOW CONTROL: '</expression> + <inVariable localId="36" executionOrderId="0" height="32" width="56" negated="false"> + <position x="832" y="1032"/> + <relPosition x="56" y="16"/> + <expression>DEBUG</expression> + <block localId="37" typeName="SR" instanceName="SR2" executionOrderId="0" height="64" width="48"> + <position x="1216" y="888"/> + <variable formalParameter="S1"> + <relPosition x="0" y="32"/> + <connection refLocalId="38" formalParameter="OUT"> + <position x="1216" y="920"/> + <position x="1176" y="920"/> + <variable formalParameter="R"> + <relPosition x="0" y="56"/> + <variable formalParameter="Q1"> + <relPosition x="48" y="32"/> + <block localId="38" typeName="AND" executionOrderId="0" height="64" width="64"> + <position x="1112" y="888"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="32"/> + <connection refLocalId="30" formalParameter="ENO"> + <position x="1112" y="920"/> + <position x="832" y="920"/> + <position x="832" y="960"/> + <position x="544" y="960"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="56"/> + <connection refLocalId="39" formalParameter="OUT"> + <position x="1112" y="944"/> + <position x="1086" y="944"/> + <position x="1086" y="1072"/> + <position x="1072" y="1072"/> + <variable formalParameter="OUT"> + <relPosition x="64" y="32"/> + <block localId="39" typeName="EQ" executionOrderId="0" height="64" width="64"> + <position x="1008" y="1040"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="32"/> + <connection refLocalId="30" formalParameter="RESULT"> + <position x="1008" y="1072"/> + <position x="554" y="1072"/> + <position x="554" y="984"/> + <position x="544" y="984"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="56"/> + <connection refLocalId="40"> + <position x="1008" y="1096"/> + <position x="960" y="1096"/> + <variable formalParameter="OUT"> + <relPosition x="64" y="32"/> + <inVariable localId="40" executionOrderId="0" height="32" width="48" negated="false"> + <position x="912" y="1080"/> + <relPosition x="48" y="16"/> + <expression>'OK'</expression> + <comment localId="41" height="40" width="248"> + <position x="160" y="864"/> + <xhtml:p><![CDATA[Execute only on first cycle]]></xhtml:p> + <comment localId="42" height="40" width="248"> + <position x="648" y="864"/> + <xhtml:p><![CDATA[Log when just executed]]></xhtml:p>