--- a/PLCGenerator.py Tue Aug 13 14:04:13 2019 +0200
+++ b/PLCGenerator.py Wed Aug 14 11:05:17 2019 +0200
@@ -1160,7 +1160,7 @@
if variable.getformalParameter() == "":
variable_name = "%s%d" % (type, block.getlocalId())
- variable_name = "%s%d_%s" % (type, block.getlocalId(), parameter)
+ variable_name = "_TMP_%s%d_%s" % (type, block.getlocalId(), parameter) if self.Interface[-1][0] != "VAR" or self.Interface[-1][1] is not None or self.Interface[-1][2]:
self.Interface.append(("VAR", None, False, []))
if variable.connectionPointOut in self.ConnectionTypes:
@@ -1253,7 +1253,7 @@
if output_parameter == "":
output_name = "%s%d" % (type, block.getlocalId())
- output_name = "%s%d_%s" % (type, block.getlocalId(), output_parameter)
+ output_name = "_TMP_%s%d_%s" % (type, block.getlocalId(), output_parameter) output_value = [(output_name, output_info)]
return self.ExtractModifier(output_variable, output_value, output_info)
if block_infos["type"] == "functionBlock":
--- a/svghmi/svghmi.py Tue Aug 13 14:04:13 2019 +0200
+++ b/svghmi/svghmi.py Wed Aug 14 11:05:17 2019 +0200
@@ -113,9 +113,8 @@
hmi_types_instances = [v for v in varlist if v["derived"] in HMI_TYPES]
- # TODO XXX !!! filter intermediate variables added for FBD feedback loop
- hmi_tree_root = HMITreeNode(None, "hmi0", "HMI_ROOT")
+ hmi_tree_root = HMITreeNode(None, "/", "HMI_ROOT") # TODO add always available variables here ?
@@ -125,6 +124,9 @@
# deduce HMI tree from PLC HMI_* instances
for v in hmi_types_instances:
path = v["IEC_path"].split(".")
+ # ignores variables starting with _TMP_ + if path[-1].startswith("_TMP_"): new_node = HMITreeNode(path, path[-1], v["derived"])
hmi_tree_root.place_node(new_node)
--- a/tests/svghmi/plc.xml Tue Aug 13 14:04:13 2019 +0200
+++ b/tests/svghmi/plc.xml Wed Aug 14 11:05:17 2019 +0200
@@ -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="2019-08-06T14:23:42"/>
- <contentHeader name="Unnamed" modificationDateTime="2019-08-13T10:34:09">
+ <contentHeader name="Unnamed" modificationDateTime="2019-08-14T10:55:12"> @@ -27,7 +27,7 @@
+ <derived name="PumpControl"/> @@ -92,7 +92,7 @@
<expression>1</expression>
- <block localId="4" typeName="Pump" instanceName="Pump0" executionOrderId="0" height="20" width="45">
+ <block localId="4" typeName="PumpControl" instanceName="Pump0" executionOrderId="0" height="20" width="98"> <position x="595" y="50"/>
@@ -101,10 +101,10 @@
- <pou name="Pump" pouType="functionBlock">
+ <pou name="PumpControl" pouType="functionBlock">
<derived name="HMI_LABEL"/>
@@ -114,6 +114,11 @@
<derived name="HMI_INT"/>
+ <variable name="AddOut"> + <derived name="HMI_INT"/> @@ -178,6 +183,19 @@
<expression>23</expression>
+ <outVariable localId="4" executionOrderId="0" height="30" width="60" negated="false"> + <position x="640" y="135"/> + <relPosition x="0" y="15"/> + <connection refLocalId="2" formalParameter="OUT"> + <position x="640" y="150"/> + <position x="590" y="150"/> + <position x="590" y="135"/> + <position x="540" y="135"/> + <expression>AddOut</expression> @@ -190,6 +208,13 @@
<task name="task0" priority="0" interval="T#20ms">
<pouInstance name="instance0" typeName="program0"/>
+ <variable name="LocalVar0"> + <derived name="HMI_LABEL"/>