--- a/py_ext/pous.xml Thu Dec 05 11:11:11 2024 +0100
+++ b/py_ext/pous.xml Thu Dec 05 16:45:37 2024 +0100
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Beremiz" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:53:26"/>
- <contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2024-12-04T16:26:53">
+ <contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2024-12-05T16:40:43"> @@ -17,15 +17,282 @@
- <pou name="csv_read_by_string" pouType="functionBlock">
+ <pou name="_csv_update" pouType="functionBlock"> <variable name="pyext_csv_update">
+ <variable name="pyext_csv_update_tmp"> + <outVariable localId="2" executionOrderId="0" height="32" width="176" negated="false"> + <position x="696" y="200"/> + <relPosition x="0" y="16"/> + <connection refLocalId="12" formalParameter="OUT"> + <position x="696" y="216"/> + <position x="656" y="216"/> + <expression>pyext_csv_update_tmp</expression> + <block localId="12" typeName="MOVE" executionOrderId="0" height="64" width="56"> + <position x="600" y="160"/> + <variable formalParameter="EN" edge="rising"> + <relPosition x="0" y="32"/> + <connection refLocalId="18" formalParameter="OUT"> + <position x="600" y="192"/> + <position x="520" y="192"/> + <variable formalParameter="IN"> + <relPosition x="0" y="56"/> + <connection refLocalId="17"> + <position x="600" y="216"/> + <position x="568" y="216"/> + <position x="568" y="240"/> + <position x="408" y="240"/> + <variable formalParameter="ENO"> + <relPosition x="56" y="32"/> + <variable formalParameter="OUT"> + <relPosition x="56" y="56"/> + <inVariable localId="1" executionOrderId="0" width="176" height="32" negated="false"> + <position x="232" y="176"/> + <relPosition x="176" y="16"/> + <expression>pyext_csv_update_tmp</expression> + <outVariable localId="15" executionOrderId="0" width="48" height="32" negated="false"> + <position x="880" y="176"/> + <relPosition x="0" y="16"/> + <connection refLocalId="12" formalParameter="ENO"> + <position x="880" y="192"/> + <position x="656" y="192"/> + <expression>TRIG</expression> + <block localId="18" typeName="NE" executionOrderId="0" width="64" height="64"> + <position x="456" y="160"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="32"/> + <connection refLocalId="1"> + <position x="456" y="192"/> + <position x="408" y="192"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="56"/> + <connection refLocalId="17"> + <position x="456" y="216"/> + <position x="432" y="216"/> + <position x="432" y="240"/> + <position x="408" y="240"/> + <variable formalParameter="OUT"> + <relPosition x="64" y="32"/> + <inVariable localId="17" executionOrderId="0" width="176" height="32" negated="false"> + <position x="232" y="224"/> + <relPosition x="176" y="16"/> + <expression>pyext_csv_update</expression> + <pou name="csv_refresh" pouType="functionBlock"> + <variable name="pyext_csv_update"> + <outVariable localId="2" executionOrderId="0" height="32" width="146" negated="false"> + <position x="808" y="312"/> + <relPosition x="0" y="16"/> + <connection refLocalId="12" formalParameter="OUT"> + <position x="808" y="328"/> + <position x="760" y="328"/> + <expression>pyext_csv_update</expression> + <block localId="12" typeName="MOVE" executionOrderId="0" height="64" width="56"> + <position x="704" y="272"/> + <variable formalParameter="EN"> + <relPosition x="0" y="32"/> + <connection refLocalId="13" formalParameter="ENO"> + <position x="704" y="304"/> + <position x="664" y="304"/> + <variable formalParameter="IN"> + <relPosition x="0" y="56"/> + <connection refLocalId="13" formalParameter="OUT"> + <position x="704" y="328"/> + <position x="664" y="328"/> + <variable formalParameter="ENO"> + <relPosition x="56" y="32"/> + <variable formalParameter="OUT"> + <relPosition x="56" y="56"/> + <block localId="13" typeName="ADD" executionOrderId="0" width="64" height="96"> + <position x="600" y="272"/> + <variable formalParameter="EN" edge="rising"> + <relPosition x="0" y="32"/> + <connection refLocalId="15"> + <position x="600" y="304"/> + <position x="336" y="304"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="56"/> + <connection refLocalId="1"> + <position x="600" y="328"/> + <position x="490" y="328"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="80"/> + <connection refLocalId="14"> + <position x="600" y="352"/> + <position x="528" y="352"/> + <variable formalParameter="ENO"> + <relPosition x="64" y="32"/> + <variable formalParameter="OUT"> + <relPosition x="64" y="56"/> + <inVariable localId="1" executionOrderId="0" width="146" height="32" negated="false"> + <position x="344" y="312"/> + <relPosition x="146" y="16"/> + <expression>pyext_csv_update</expression> + <inVariable localId="14" executionOrderId="0" width="24" height="32" negated="false"> + <position x="504" y="336"/> + <relPosition x="24" y="16"/> + <expression>1</expression> + <inVariable localId="15" executionOrderId="0" width="48" height="32" negated="false"> + <position x="288" y="288"/> + <relPosition x="48" y="16"/> + <expression>TRIG</expression> + <xhtml:p><![CDATA[Triggers CSV read FB to refresh output, without reloading CSV files]]></xhtml:p> + <pou name="csv_read_by_string" pouType="functionBlock"> @@ -66,11 +333,6 @@
<derived name="python_eval"/>
- <variable name="R_TRIG0">
- <derived name="R_TRIG"/>
<variable name="R_TRIG1">
@@ -81,6 +343,11 @@
+ <variable name="_csv_update0"> + <derived name="_csv_update"/> @@ -379,7 +646,9 @@
<relPosition x="0" y="64"/>
<connection refLocalId="2">
<position x="552" y="664"/>
- <position x="528" y="664"/>
+ <position x="540" y="664"/> + <position x="540" y="656"/> + <position x="528" y="656"/> @@ -398,13 +667,6 @@
- <inVariable localId="3" height="24" width="152" executionOrderId="0" negated="false">
- <position x="32" y="616"/>
- <relPosition x="152" y="16"/>
- <expression>pyext_csv_update</expression>
<outVariable localId="5" height="24" width="40" executionOrderId="0" negated="false">
<position x="1216" y="632"/>
@@ -435,8 +697,8 @@
<relPosition x="128" y="16"/>
- <continuation name="CodeChange" localId="24" height="24" width="120">
- <position x="64" y="648"/>
+ <continuation name="CodeChange" localId="24" height="32" width="120"> + <position x="24" y="640"/> <relPosition x="120" y="16"/>
@@ -447,9 +709,9 @@
<variable formalParameter="IN1">
<relPosition x="0" y="32"/>
- <connection refLocalId="32" formalParameter="Q">
+ <connection refLocalId="40" formalParameter="TRIG"> <position x="296" y="632"/>
- <position x="272" y="632"/>
+ <position x="264" y="632"/> @@ -458,7 +720,7 @@
<relPosition x="0" y="56"/>
<connection refLocalId="24">
<position x="296" y="656"/>
- <position x="184" y="656"/>
+ <position x="144" y="656"/> @@ -472,28 +734,6 @@
- <block localId="32" typeName="R_TRIG" instanceName="R_TRIG0" executionOrderId="0" height="48" width="64">
- <position x="208" y="600"/>
- <variable formalParameter="CLK">
- <relPosition x="0" y="32"/>
- <connection refLocalId="3">
- <position x="208" y="632"/>
- <position x="184" y="632"/>
- <variable formalParameter="Q">
- <relPosition x="64" y="32"/>
<block localId="33" typeName="LEFT" executionOrderId="0" height="64" width="56">
<position x="736" y="632"/>
@@ -662,18 +902,23 @@
+ <block localId="40" typeName="_csv_update" instanceName="_csv_update0" executionOrderId="0" width="104" height="48"> + <position x="160" y="600"/> + <variable formalParameter="TRIG"> + <relPosition x="104" y="32"/> <pou name="csv_reload" pouType="functionBlock">
- <variable name="pyext_csv_update">
@@ -701,14 +946,9 @@
- <variable name="R_TRIG0">
+ <variable name="csv_refresh0"> - <derived name="R_TRIG"/>
- <variable name="F_TRIG0">
- <derived name="F_TRIG"/>
+ <derived name="csv_refresh"/> @@ -716,14 +956,16 @@
<block localId="1" width="104" height="80" typeName="python_eval" instanceName="py_eval" executionOrderId="0">
- <position x="232" y="328"/>
+ <position x="336" y="96"/> <variable formalParameter="TRIG">
<relPosition x="0" y="32"/>
<connection refLocalId="3">
- <position x="232" y="360"/>
- <position x="200" y="360"/>
+ <position x="336" y="128"/> + <position x="326" y="128"/> + <position x="326" y="128"/> + <position x="304" y="128"/> @@ -731,8 +973,8 @@
<relPosition x="0" y="64"/>
<connection refLocalId="8">
- <position x="232" y="392"/>
- <position x="200" y="392"/>
+ <position x="336" y="160"/> + <position x="224" y="160"/> @@ -751,213 +993,68 @@
- <inVariable localId="3" height="24" width="152" executionOrderId="0" negated="false">
- <position x="48" y="352"/>
+ <inVariable localId="3" height="32" width="56" executionOrderId="0" negated="false"> + <position x="248" y="112"/> - <relPosition x="152" y="8"/>
+ <relPosition x="56" y="16"/> <expression>TRIG</expression>
- <outVariable localId="5" height="24" width="40" executionOrderId="0" negated="false">
- <position x="384" y="344"/>
+ <outVariable localId="5" height="32" width="40" executionOrderId="0" negated="false"> + <position x="568" y="112"/> <relPosition x="0" y="16"/>
<connection refLocalId="1" formalParameter="ACK">
- <position x="384" y="360"/>
- <position x="336" y="360"/>
+ <position x="568" y="128"/> + <position x="440" y="128"/> <expression>ACK</expression>
- <outVariable localId="6" height="24" width="64" executionOrderId="0" negated="false">
- <position x="384" y="376"/>
+ <outVariable localId="6" height="32" width="64" executionOrderId="0" negated="false"> + <position x="488" y="144"/> <relPosition x="0" y="16"/>
<connection refLocalId="1" formalParameter="RESULT">
- <position x="384" y="392"/>
- <position x="336" y="392"/>
+ <position x="488" y="160"/> + <position x="440" y="160"/> <expression>RESULT</expression>
- <inVariable localId="8" executionOrderId="0" height="24" width="176" negated="false">
- <position x="24" y="384"/>
+ <inVariable localId="8" executionOrderId="0" height="32" width="176" negated="false"> + <position x="48" y="144"/> <relPosition x="176" y="16"/>
<expression>'pyext_csv_reload()'</expression>
- <outVariable localId="2" executionOrderId="0" height="24" width="146" negated="false">
- <position x="864" y="320"/>
- <relPosition x="0" y="8"/>
- <connection refLocalId="12" formalParameter="OUT">
- <position x="864" y="328"/>
- <position x="816" y="328"/>
- <expression>pyext_csv_update</expression>
- <block localId="9" typeName="R_TRIG" instanceName="R_TRIG0" executionOrderId="0" height="48" width="64">
- <position x="472" y="224"/>
+ <block localId="15" typeName="csv_refresh" instanceName="csv_refresh0" executionOrderId="0" width="104" height="64"> + <position x="568" y="32"/> - <variable formalParameter="CLK">
+ <variable formalParameter="TRIG"> - <relPosition x="0" y="32"/>
+ <relPosition x="0" y="40"/> <connection refLocalId="1" formalParameter="ACK">
- <position x="472" y="256"/>
- <position x="368" y="256"/>
- <position x="368" y="360"/>
- <position x="336" y="360"/>
- <variable formalParameter="Q">
- <relPosition x="64" y="32"/>
- <block localId="10" typeName="F_TRIG" instanceName="F_TRIG0" executionOrderId="0" height="48" width="64">
- <position x="472" y="296"/>
- <variable formalParameter="CLK">
- <relPosition x="0" y="32"/>
- <connection refLocalId="1" formalParameter="ACK">
- <position x="472" y="328"/>
- <position x="368" y="328"/>
- <position x="368" y="360"/>
- <position x="336" y="360"/>
+ <position x="568" y="72"/> + <position x="472" y="72"/> + <position x="472" y="128"/> + <position x="440" y="128"/>
- <variable formalParameter="Q">
- <relPosition x="64" y="32"/>
- <block localId="11" typeName="OR" executionOrderId="0" height="64" width="64">
- <position x="584" y="272"/>
- <variable formalParameter="IN1">
- <relPosition x="0" y="32"/>
- <connection refLocalId="9" formalParameter="Q">
- <position x="584" y="304"/>
- <position x="560" y="304"/>
- <position x="560" y="256"/>
- <position x="536" y="256"/>
- <variable formalParameter="IN2">
- <relPosition x="0" y="56"/>
- <connection refLocalId="10" formalParameter="Q">
- <position x="584" y="328"/>
- <position x="536" y="328"/>
- <variable formalParameter="OUT">
- <relPosition x="64" y="32"/>
- <block localId="12" typeName="MOVE" executionOrderId="0" height="64" width="56">
- <position x="760" y="272"/>
- <variable formalParameter="EN">
- <relPosition x="0" y="32"/>
- <connection refLocalId="11" formalParameter="OUT">
- <position x="760" y="304"/>
- <position x="648" y="304"/>
- <variable formalParameter="IN">
- <relPosition x="0" y="56"/>
- <connection refLocalId="13" formalParameter="OUT">
- <position x="760" y="328"/>
- <position x="724" y="328"/>
- <position x="724" y="256"/>
- <position x="712" y="256"/>
- <variable formalParameter="ENO">
- <relPosition x="56" y="32"/>
- <variable formalParameter="OUT">
- <relPosition x="56" y="56"/>
- <block localId="13" typeName="NOT" executionOrderId="0" height="48" width="56">
- <position x="656" y="224"/>
- <variable formalParameter="IN">
- <relPosition x="0" y="32"/>
- <connection refLocalId="9" formalParameter="Q">
- <position x="656" y="256"/>
- <position x="536" y="256"/>
- <variable formalParameter="OUT">
- <relPosition x="56" y="32"/>
- <comment localId="14" height="72" width="664">
- <position x="368" y="136"/>
- <xhtml:p><![CDATA[pyext_csv_update initial value is True so that all CSV blocks get at least updated once at start.
-When calling csv_reload, return from python pyext_csv_reload makes a pulse on pyext_csv_update]]></xhtml:p>
+ <xhtml:p><![CDATA[Purge CSV files cache and refresh CSV read FBs outputs, consequently reloading CSV files]]></xhtml:p> <pou name="csv_read_by_int" pouType="functionBlock">
- <variable name="pyext_csv_update">
@@ -998,11 +1095,6 @@
<derived name="python_eval"/>
- <variable name="R_TRIG1">
- <derived name="R_TRIG"/>
<variable name="R_TRIG2">
@@ -1013,6 +1105,11 @@
+ <variable name="_csv_update0"> + <derived name="_csv_update"/> @@ -1388,21 +1485,12 @@
<relPosition x="128" y="16"/>
- <inVariable localId="42" height="24" width="152" executionOrderId="0" negated="false">
- <position x="32" y="656"/>
- <relPosition x="152" y="16"/>
- <expression>pyext_csv_update</expression>
<outVariable localId="43" height="24" width="40" executionOrderId="0" negated="false">
- <position x="1216" y="672"/>
+ <position x="1216" y="664"/> <relPosition x="0" y="16"/>
<connection refLocalId="38" formalParameter="Q1">
- <position x="1216" y="688"/>
- <position x="1192" y="688"/>
- <position x="1192" y="680"/>
+ <position x="1216" y="680"/> <position x="1168" y="680"/>
@@ -1427,9 +1515,9 @@
<variable formalParameter="IN1">
<relPosition x="0" y="32"/>
- <connection refLocalId="46" formalParameter="Q">
+ <connection refLocalId="1" formalParameter="TRIG"> <position x="296" y="672"/>
- <position x="272" y="672"/>
+ <position x="264" y="672"/> @@ -1438,9 +1526,7 @@
<relPosition x="0" y="56"/>
<connection refLocalId="45">
<position x="296" y="696"/>
- <position x="240" y="696"/>
- <position x="240" y="704"/>
- <position x="184" y="704"/>
+ <position x="144" y="696"/> @@ -1454,34 +1540,12 @@
- <continuation name="CodeChange" localId="45" height="24" width="120">
- <position x="64" y="688"/>
+ <continuation name="CodeChange" localId="45" height="32" width="120"> + <position x="24" y="680"/> <relPosition x="120" y="16"/>
- <block localId="46" typeName="R_TRIG" instanceName="R_TRIG1" executionOrderId="0" height="48" width="64">
- <position x="208" y="640"/>
- <variable formalParameter="CLK">
- <relPosition x="0" y="32"/>
- <connection refLocalId="42">
- <position x="208" y="672"/>
- <position x="184" y="672"/>
- <variable formalParameter="Q">
- <relPosition x="64" y="32"/>
<block localId="33" typeName="LEFT" executionOrderId="0" height="64" width="56">
<position x="736" y="672"/>
@@ -1654,6 +1718,18 @@
+ <block localId="1" typeName="_csv_update" instanceName="_csv_update0" executionOrderId="0" width="104" height="48"> + <position x="160" y="640"/> + <variable formalParameter="TRIG"> + <relPosition x="104" y="32"/> @@ -1719,6 +1795,11 @@
+ <variable name="csv_refresh0"> + <derived name="csv_refresh"/> @@ -1995,14 +2076,12 @@
<expression>SAVE</expression>
- <outVariable localId="43" height="24" width="40" executionOrderId="0" negated="false">
- <position x="1216" y="512"/>
+ <outVariable localId="43" height="32" width="40" executionOrderId="0" negated="false"> + <position x="1232" y="504"/> <relPosition x="0" y="16"/>
<connection refLocalId="38" formalParameter="Q1">
- <position x="1216" y="528"/>
- <position x="1192" y="528"/>
- <position x="1192" y="520"/>
+ <position x="1232" y="520"/> <position x="1168" y="520"/>
@@ -2213,6 +2292,24 @@
+ <block localId="53" typeName="csv_refresh" instanceName="csv_refresh0" executionOrderId="0" width="104" height="48"> + <position x="1232" y="440"/> + <variable formalParameter="TRIG"> + <relPosition x="0" y="32"/> + <connection refLocalId="38" formalParameter="Q1"> + <position x="1232" y="472"/> + <position x="1206" y="472"/> + <position x="1206" y="520"/> + <position x="1168" y="520"/> @@ -2649,10 +2746,10 @@
<variable name="pyext_csv_update">
- <simpleValue value="TRUE"/>
+ <simpleValue value="0"/>