PLCGenerator.py
changeset 2305 56f1d8aca886
parent 2269 2e38b5ec4753
parent 2277 068ccc02f5f2
child 2429 15f18dc8b56a
equal deleted inserted replaced
2273:a0efe3d9c853 2305:56f1d8aca886
   924         ref_local_id = connections[0].getrefLocalId()
   924         ref_local_id = connections[0].getrefLocalId()
   925         blk = body.getcontentInstance(ref_local_id)
   925         blk = body.getcontentInstance(ref_local_id)
   926         if blk is None:
   926         if blk is None:
   927             return None
   927             return None
   928 
   928 
   929         if not isinstance(blk, (InVariableClass, InOutVariableClass)):
   929         if not hasattr(blk, "inputVariables"):
   930             for invar in blk.inputVariables.getvariable():
   930             return None
   931                 if invar.getformalParameter() == "EN":
   931 
   932                     if len(invar.getconnectionPointIn().getconnections()) > 0:
   932         for invar in blk.inputVariables.getvariable():
   933                         if blk.getinstanceName() is None:
   933             if invar.getformalParameter() == "EN":
   934                             var_name = "%s%d_ENO" % (blk.gettypeName(), blk.getlocalId())
   934                 if len(invar.getconnectionPointIn().getconnections()) > 0:
   935                         else:
   935                     if blk.getinstanceName() is None:
   936                             var_name = "%s.ENO" % blk.getinstanceName()
   936                         var_name = "%s%d_ENO" % (blk.gettypeName(), blk.getlocalId())
   937                         return var_name
   937                     else:
       
   938                         var_name = "%s.ENO" % blk.getinstanceName()
       
   939                     return var_name
   938         return None
   940         return None
   939 
   941 
   940     def ComputeProgram(self, pou):
   942     def ComputeProgram(self, pou):
   941         body = pou.getbody()
   943         body = pou.getbody()
   942         if isinstance(body, ListType):
   944         if isinstance(body, ListType):
  1342                 elif result[0] is not None:
  1344                 elif result[0] is not None:
  1343                     paths.append([variable, result[0]])
  1345                     paths.append([variable, result[0]])
  1344                 else:
  1346                 else:
  1345                     paths.append(variable)
  1347                     paths.append(variable)
  1346             elif isinstance(next, CoilClass):
  1348             elif isinstance(next, CoilClass):
  1347                 paths.append(str(self.GeneratePaths(next.connectionPointIn.getconnections(), body, order)))
  1349                 paths.append(self.GeneratePaths(next.connectionPointIn.getconnections(), body, order))
  1348         return paths
  1350         return paths
  1349 
  1351 
  1350     def ComputePaths(self, paths, first=False):
  1352     def ComputePaths(self, paths, first=False):
  1351         if isinstance(paths, TupleType):
  1353         if isinstance(paths, TupleType):
  1352             if None in paths:
  1354             if None in paths: