Pou execution order id management fixed
authorlbessard
Wed, 16 Apr 2008 09:45:15 +0200
changeset 200 8a1ed1959c69
parent 199 85d721b33574
child 201 d5b778dab4b0
Pou execution order id management fixed
Adding help for text when ST or IL transition created
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Wed Apr 16 09:42:11 2008 +0200
+++ b/plcopen/plcopen.py	Wed Apr 16 09:45:15 2008 +0200
@@ -583,6 +583,10 @@
         transition = PLCOpenClasses["transitions_transition"]()
         transition.setname(name)
         transition.setbodyType(type)
+        if type == "ST":
+            transition.settext(":= ;")
+        elif type == "IL":
+            transition.settext("\tST\t%s"%name)
         self.transitions.appendtransition(transition)
     setattr(cls, "addtransition", addtransition)
     
@@ -721,11 +725,11 @@
     cls.currentExecutionOrderId = 0
     
     def resetcurrentExecutionOrderId(self):
-        self.currentExecutionOrderId = 0
+        object.__setattr__(self, "currentExecutionOrderId", 0)
     setattr(cls, "resetcurrentExecutionOrderId", resetcurrentExecutionOrderId)
     
     def getnewExecutionOrderId(self):
-        self.currentExecutionOrderId += 1
+        object.__setattr__(self, "currentExecutionOrderId", self.currentExecutionOrderId + 1)
         return self.currentExecutionOrderId
     setattr(cls, "getnewExecutionOrderId", getnewExecutionOrderId)
     
@@ -745,7 +749,7 @@
             self.resetexecutionOrder()
             self.resetcurrentExecutionOrderId()
             for element in self.content["value"].getcontent():
-                if isinstance(element["value"], PLCOpenClasses.get("fbdObjects_outVariable", None)) and element["value"].getExecutionOrderId() == 0:
+                if isinstance(element["value"], PLCOpenClasses.get("fbdObjects_outVariable", None)) and element["value"].getexecutionOrderId() == 0:
                     connections = element["value"].connectionPointIn.getconnections()
                     if connections and len(connections) == 1:
                         self.compileelementExecutionOrder(connections[0])