--- a/PLCControler.py Wed Jun 12 23:51:33 2013 +0200
+++ b/PLCControler.py Thu Jun 13 09:35:41 2013 +0200
@@ -649,14 +649,38 @@
return self.RecursiveGetPouInstanceTagName(project, vartype, parts[1:], debug)
+ def GetGlobalInstanceTagName(self, project, element, parts, debug = False): + for varlist in element.getglobalVars(): + for variable in varlist.getvariable(): + if variable.getname() == parts[0]: + vartype_content = variable.gettype().getcontent() + if vartype_content["name"] == "derived": + return self.ComputePouName( + vartype_content["value"].getname()) + return self.RecursiveGetPouInstanceTagName( + vartype_content["value"].getname(), def GetPouInstanceTagName(self, instance_path, debug = False):
+ project = self.GetProject(debug) parts = instance_path.split(".")
return self.ComputeConfigurationName(parts[0])
+ for config in project.getconfigurations(): + if config.getname() == parts[0]: + result = self.GetGlobalInstanceTagName(project, return self.ComputeConfigurationResourceName(parts[0], parts[1])
- project = self.GetProject(debug)
for config in project.getconfigurations():
if config.getname() == parts[0]:
for resource in config.getresource():
@@ -674,16 +698,26 @@
pou_instance.gettypeName(),
+ return self.GetGlobalInstanceTagName(project, + return self.GetGlobalInstanceTagName(project, def GetInstanceInfos(self, instance_path, debug = False):
tagname = self.GetPouInstanceTagName(instance_path)
+ print instance_path, tagname infos = self.GetPouVariables(tagname, debug)
pou_path, var_name = instance_path.rsplit(".", 1)
+ print pou_path, tagname tagname = self.GetPouInstanceTagName(pou_path)
pou_infos = self.GetPouVariables(tagname, debug)