# HG changeset patch # User Edouard Tisserant # Date 1565773517 -7200 # Node ID 5f79b194fa638b93c8305f807f355b755896be79 # Parent c901baa36bb3f41ef5ed5762a1d20a959822fee2 SVGHMI: filter out temporary variables created while generating ST code out of FBD. diff -r c901baa36bb3 -r 5f79b194fa63 PLCGenerator.py --- 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()) else: - 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()) else: - 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": diff -r c901baa36bb3 -r 5f79b194fa63 svghmi/svghmi.py --- 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 @@ # Filter known HMI types 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 ? # - plc status @@ -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_"): + continue new_node = HMITreeNode(path, path[-1], v["derived"]) hmi_tree_root.place_node(new_node) diff -r c901baa36bb3 -r 5f79b194fa63 tests/svghmi/plc.xml --- 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 @@ - + @@ -27,7 +27,7 @@ - + @@ -92,7 +92,7 @@ 1 - + @@ -101,10 +101,10 @@ - + - + @@ -114,6 +114,11 @@ + + + + + @@ -178,6 +183,19 @@ 23 + + + + + + + + + + + + AddOut + @@ -190,6 +208,13 @@ + + + + + + +