PLCControler.py
changeset 46 4379e98a30aa
parent 45 42637f721b5b
child 47 2b2f8d88e6d3
equal deleted inserted replaced
45:42637f721b5b 46:4379e98a30aa
   540     def GetPouBodyType(self, name):
   540     def GetPouBodyType(self, name):
   541         # Found the pou correponding to name and return its body language
   541         # Found the pou correponding to name and return its body language
   542         pou = self.Project.getPou(name)
   542         pou = self.Project.getPou(name)
   543         return pou.getBodyType()
   543         return pou.getBodyType()
   544     
   544     
       
   545     # Return the actions of a pou
       
   546     def GetPouTransitions(self, pou_name):
       
   547         transitions = []
       
   548         pou = self.Project.getPou(pou_name)
       
   549         if pou.getBodyType() == "SFC":
       
   550             for transition in pou.getTransitionList():
       
   551                 transitions.append(transition.getName())
       
   552         return transitions
       
   553     
   545     # Return the body language of the transition given by its name
   554     # Return the body language of the transition given by its name
   546     def GetTransitionBodyType(self, pou_name, pou_transition):
   555     def GetTransitionBodyType(self, pou_name, pou_transition):
   547         # Found the pou correponding to name and return its body language
   556         # Found the pou correponding to name and return its body language
   548         pou = self.Project.getPou(pou_name)
   557         pou = self.Project.getPou(pou_name)
   549         transition = pou.getTransition(pou_transition)
   558         transition = pou.getTransition(pou_transition)
   550         return transition.getBodyType()
   559         return transition.getBodyType()
   551     
   560     
       
   561     # Return the actions of a pou
       
   562     def GetPouActions(self, pou_name):
       
   563         actions = []
       
   564         pou = self.Project.getPou(pou_name)
       
   565         if pou.getBodyType() == "SFC":
       
   566             for action in pou.getActionList():
       
   567                 actions.append(action.getName())
       
   568         return actions
       
   569     
   552     # Return the body language of the pou given by its name
   570     # Return the body language of the pou given by its name
   553     def GetActionBodyType(self, pou_name, pou_action):
   571     def GetActionBodyType(self, pou_name, pou_action):
   554         # Found the pou correponding to name and return its body language
   572         # Found the pou correponding to name and return its body language
   555         pou = self.Project.getPou(pou_name)
   573         pou = self.Project.getPou(pou_name)
   556         action = pou.getAction(pou_action)
   574         action = pou.getAction(pou_action)
   557         return action.getBodyType()
   575         return action.getBodyType()
       
   576     
       
   577     # Add a Transition to a Project Pou
       
   578     def ProjectRemovePouTransition(self, pou_name, transition_name):
       
   579         pou = self.Project.getPou(pou_name)
       
   580         pou.removeTransition(transition_name)
       
   581     
       
   582     # Add a Transition to a Project Pou
       
   583     def ProjectRemovePouAction(self, pou_name, action_name):
       
   584         pou = self.Project.getPou(pou_name)
       
   585         pou.removeAction(action_name)
   558     
   586     
   559     # Extract varlists from a list of vars
   587     # Extract varlists from a list of vars
   560     def ExtractVarLists(self, vars):
   588     def ExtractVarLists(self, vars):
   561         varlist_list = []
   589         varlist_list = []
   562         current_varlist = None
   590         current_varlist = None