Fix bug in PLCGenerator connection types not computed for SFC actions and transitions body
authorlaurent
Tue, 11 Sep 2012 16:33:39 +0200
changeset 822 050045c32d98
parent 821 3667bb14aeca
child 823 c6ed7b933617
Fix bug in PLCGenerator connection types not computed for SFC actions and transitions body
PLCGenerator.py
--- a/PLCGenerator.py	Tue Sep 11 16:30:42 2012 +0200
+++ b/PLCGenerator.py	Tue Sep 11 16:33:39 2012 +0200
@@ -637,7 +637,10 @@
                 if isinstance(instance, (plcopen.fbdObjects_inVariable, plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable)):
                     expression = instance.getexpression()
                     var_type = self.GetVariableType(expression)
-                    if pou.getpouType() == "function" and expression == pou.getname():
+                    if isinstance(pou, plcopen.transitions_transition) and expression == pou.getname():
+                        var_type = "BOOL"
+                    elif (not isinstance(pou, (plcopen.transitions_transition, plcopen.actions_action)) and
+                          pou.getpouType() == "function" and expression == pou.getname()):
                         returntype_content = pou.interface.getreturnType().getcontent()
                         if returntype_content["name"] == "derived":
                             var_type = returntype_content["value"].getname()
@@ -742,6 +745,15 @@
                     self.ComputeBlockInputTypes(instance, block_infos, body)
                 else:
                     raise PLCGenException, _("No informations found for \"%s\" block")%(instance.gettypeName())
+            if body_type == "SFC":
+                previous_tagname = self.TagName
+                for action in pou.getactionList():
+                    self.TagName = self.ParentGenerator.Controler.ComputePouActionName(self.Name, action.getname())
+                    self.ComputeConnectionTypes(action)
+                for transition in pou.gettransitionList():
+                    self.TagName = self.ParentGenerator.Controler.ComputePouTransitionName(self.Name, transition.getname())
+                    self.ComputeConnectionTypes(transition)
+                self.TagName = previous_tagname
                 
     def ComputeBlockInputTypes(self, instance, block_infos, body):
         undefined = {}