PLCControler.py
changeset 827 a2ce084fb598
parent 826 098f822ef308
child 853 0f97bddb5a30
equal deleted inserted replaced
826:098f822ef308 827:a2ce084fb598
   619             if len(parts) == 0:
   619             if len(parts) == 0:
   620                 return self.ComputePouName(pou_type)
   620                 return self.ComputePouName(pou_type)
   621             
   621             
   622             for varlist_type, varlist in pou.getvars():
   622             for varlist_type, varlist in pou.getvars():
   623                 for variable in varlist.getvariable():
   623                 for variable in varlist.getvariable():
   624                     vartype_content = variable.gettype().getcontent()
   624                     if variable.getname() == parts[0]:
   625                     if vartype_content["name"] == "derived":
   625                         vartype_content = variable.gettype().getcontent()
   626                         return self.RecursiveGetPouInstanceTagName(
   626                         if vartype_content["name"] == "derived":
   627                                         project, 
   627                             return self.RecursiveGetPouInstanceTagName(
   628                                         vartype_content["value"].getname(),
   628                                             project, 
   629                                         parts[1:])
   629                                             vartype_content["value"].getname(),
       
   630                                             parts[1:])
       
   631             
       
   632             if pou.getbodyType() == "SFC" and len(parts) == 1:
       
   633                 for action in pou.getactionList():
       
   634                     if action.getname() == parts[0]:
       
   635                         return self.ComputePouActionName(pou_type, parts[0])
       
   636                 for transition in pou.gettransitionList():
       
   637                     if transition.getname() == parts[0]:
       
   638                         return self.ComputePouTransitionName(pou_type, parts[0])
   630         return None
   639         return None
   631     
   640     
   632     def GetPouInstanceTagName(self, instance_path, debug = False):
   641     def GetPouInstanceTagName(self, instance_path, debug = False):
   633         parts = instance_path.split(".")
   642         parts = instance_path.split(".")
   634         if len(parts) == 1:
   643         if len(parts) == 1:
   657         return None
   666         return None
   658     
   667     
   659     def GetInstanceInfos(self, instance_path, debug = False):
   668     def GetInstanceInfos(self, instance_path, debug = False):
   660         tagname = self.GetPouInstanceTagName(instance_path)
   669         tagname = self.GetPouInstanceTagName(instance_path)
   661         if tagname is not None:
   670         if tagname is not None:
   662             return self.GetPouVariables(tagname, debug)
   671             infos = self.GetPouVariables(tagname, debug)
       
   672             infos["type"] = tagname
       
   673             return infos
   663         else:
   674         else:
   664             pou_path, var_name = instance_path.rsplit(".", 1)
   675             pou_path, var_name = instance_path.rsplit(".", 1)
   665             tagname = self.GetPouInstanceTagName(pou_path)
   676             tagname = self.GetPouInstanceTagName(pou_path)
   666             if tagname is not None:
   677             if tagname is not None:
   667                 pou_infos = self.GetPouVariables(tagname, debug)
   678                 pou_infos = self.GetPouVariables(tagname, debug)