Bug on SFC debugging fixed
authorlaurent
Tue, 08 Dec 2009 16:29:16 +0100
changeset 477 fd9625f6e92a
parent 476 2e09d2e86a35
child 478 dc403c47af54
Bug on SFC debugging fixed
Viewer.py
--- a/Viewer.py	Mon Dec 07 22:06:04 2009 +0100
+++ b/Viewer.py	Tue Dec 08 16:29:16 2009 +0100
@@ -727,8 +727,8 @@
             iec_path = "%s.%s.X"%(self.InstancePath, element.GetName())
         elif isinstance(element, SFC_Transition):
             connectors = element.GetConnectors()
-            previous_steps = self.GetPreviousSteps(connectors["input"])
-            next_steps = self.GetNextSteps(connectors["output"])
+            previous_steps = self.GetPreviousSteps(connectors["inputs"])
+            next_steps = self.GetNextSteps(connectors["outputs"])
             iec_path = "%s.%s->%s"%(self.InstancePath, ",".join(previous_steps), ",".join(next_steps))
         return iec_path
        
@@ -876,30 +876,30 @@
         self.ShowErrors()
         self.Refresh(False)
     
-    def GetPreviousSteps(self, connector):
+    def GetPreviousSteps(self, connectors):
         steps = []
-        for wire, handle in connector.GetWires():
-            previous = wire.GetOtherConnected(connector).GetParentBlock()
-            if isinstance(previous, SFC_Step):
-                steps.append(previous.GetName())
-            elif isinstance(previous, SFC_Divergence) and previous.GetType() in [SIMULTANEOUS_CONVERGENCE, SELECTION_DIVERGENCE]:
-                connectors = previous.GetConnectors()
-                for input in connectors["inputs"]:
-                    steps.extend(self.GetPreviousSteps(input))
+        for connector in connectors:
+            for wire, handle in connector.GetWires():
+                previous = wire.GetOtherConnected(connector).GetParentBlock()
+                if isinstance(previous, SFC_Step):
+                    steps.append(previous.GetName())
+                elif isinstance(previous, SFC_Divergence) and previous.GetType() in [SIMULTANEOUS_CONVERGENCE, SELECTION_DIVERGENCE]:
+                    connectors = previous.GetConnectors()
+                    steps.extend(self.GetPreviousSteps(connectors["inputs"]))
         return steps
     
-    def GetNextSteps(self, connector):
+    def GetNextSteps(self, connectors):
         steps = []
-        for wire, handle in connector.GetWires():
-            next = wire.GetOtherConnected(connector).GetParentBlock()
-            if isinstance(next, SFC_Step):
-                steps.append(next.GetName())
-            elif isinstance(next, SFC_Jump):
-                steps.append(next.GetTarget())
-            elif isinstance(next, SFC_Divergence) and next.GetType() in [SIMULTANEOUS_DIVERGENCE, SELECTION_CONVERGENCE]:
-                connectors = next.GetConnectors()
-                for output in connectors["outputs"]:
-                    steps.extend(self.GetNextSteps(output))
+        for connector in connectors:
+            for wire, handle in connector.GetWires():
+                next = wire.GetOtherConnected(connector).GetParentBlock()
+                if isinstance(next, SFC_Step):
+                    steps.append(next.GetName())
+                elif isinstance(next, SFC_Jump):
+                    steps.append(next.GetTarget())
+                elif isinstance(next, SFC_Divergence) and next.GetType() in [SIMULTANEOUS_DIVERGENCE, SELECTION_CONVERGENCE]:
+                    connectors = next.GetConnectors()
+                    steps.extend(self.GetNextSteps(connectors["outputs"]))
         return steps
     
     def GetMaxSize(self):