Adding support for Debugging in PLCOpenEditor
authorlbessard
Sat, 06 Sep 2008 16:30:57 +0200
changeset 250 e6b58eafef1a
parent 249 d8425712acef
child 251 cc5377a296ea
Adding support for Debugging in PLCOpenEditor
plcopen/structures.py
--- a/plcopen/structures.py	Fri Sep 05 18:13:18 2008 +0200
+++ b/plcopen/structures.py	Sat Sep 06 16:30:57 2008 +0200
@@ -59,11 +59,8 @@
             for i, variable in enumerate(block.inputVariables.getvariable()):
                 input_info = (generator.TagName, "block", block.getlocalId(), "input", i)
                 connections = variable.connectionPointIn.getconnections()
-                if connections and len(connections) == 1:
-                    if body_type == "FBD" or body_type == "SFC":
-                        value = generator.ComputeFBDExpression(body, connections[0], executionOrderId > 0)
-                    elif body_type == "LD":
-                        value = generator.ComputeLDExpression(body, variable.connectionPointIn.getConnections())
+                if connections is not None:
+                    value = generator.ComputeExpression(body, connections, executionOrderId > 0)
                     vars.append(generator.ExtractModifier(variable, value, input_info))
             generator.Program += [(generator.CurrentIndent, ()),
                                   (output_name, output_info),
@@ -80,12 +77,9 @@
             for i, variable in enumerate(block.inputVariables.getvariable()):
                 input_info = (generator.TagName, "block", block.getlocalId(), "input", i)
                 connections = variable.connectionPointIn.getconnections()
-                if connections and len(connections) == 1:
+                if connections is not None:
                     parameter = variable.getformalParameter()
-                    if body_type == "FBD" or body_type == "SFC":
-                        value = generator.ComputeFBDExpression(body, connections[0], executionOrderId > 0)
-                    elif body_type == "LD":
-                        value = generator.ComputeLDExpression(body, variable.connectionPointIn.getconnections())
+                    value = generator.ComputeExpression(body, connections, executionOrderId > 0)
                     vars.append([(parameter, input_info),
                                  (" := ", ())] + generator.ExtractModifier(variable, value, input_info))
             generator.Program += [(generator.CurrentIndent, ()),