PLCGenerator.py
changeset 503 52689bda4686
parent 501 edfa63d3c26d
child 507 42150e041dbe
equal deleted inserted replaced
502:8137a7face88 503:52689bda4686
   924                 else:
   924                 else:
   925                     return [("(", ())] + JoinList([(" OR ", ())], vars) + [(")", ())]
   925                     return [("(", ())] + JoinList([(" OR ", ())], vars) + [(")", ())]
   926         elif type(paths) == ListType:
   926         elif type(paths) == ListType:
   927             vars = [self.ComputePaths(path) for path in paths]
   927             vars = [self.ComputePaths(path) for path in paths]
   928             return JoinList([(" AND ", ())], vars)
   928             return JoinList([(" AND ", ())], vars)
       
   929         elif paths is None:
       
   930             return [("TRUE", ())]
   929         else:
   931         else:
   930             return eval(paths)
   932             return eval(paths)
   931 
   933 
   932     def ComputeExpression(self, body, connections, order = False):
   934     def ComputeExpression(self, body, connections, order = False):
   933         paths = self.GeneratePaths(connections, body, order)
   935         paths = self.GeneratePaths(connections, body, order)
   988 
   990 
   989     def ExtractConvergenceInputs(self, convergence, pou):
   991     def ExtractConvergenceInputs(self, convergence, pou):
   990         instances = []
   992         instances = []
   991         for connectionPointIn in convergence.getconnectionPointIn():
   993         for connectionPointIn in convergence.getconnectionPointIn():
   992             connections = connectionPointIn.getconnections()
   994             connections = connectionPointIn.getconnections()
   993             if len(connections) == 1:
   995             if connections is not None and len(connections) == 1:
   994                 instanceLocalId = connections[0].getrefLocalId()
   996                 instanceLocalId = connections[0].getrefLocalId()
   995                 body = pou.getbody()
   997                 body = pou.getbody()
   996                 if isinstance(body, ListType):
   998                 if isinstance(body, ListType):
   997                     body = body[0]
   999                     body = body[0]
   998                 instances.append(body.getcontentInstance(instanceLocalId))
  1000                 instances.append(body.getcontentInstance(instanceLocalId))
  1008                           "transitions" : [], 
  1010                           "transitions" : [], 
  1009                           "actions" : []}
  1011                           "actions" : []}
  1010             if step.connectionPointIn:
  1012             if step.connectionPointIn:
  1011                 instances = []
  1013                 instances = []
  1012                 connections = step.connectionPointIn.getconnections()
  1014                 connections = step.connectionPointIn.getconnections()
  1013                 if len(connections) == 1:
  1015                 if connections is not None and len(connections) == 1:
  1014                     instanceLocalId = connections[0].getrefLocalId()
  1016                     instanceLocalId = connections[0].getrefLocalId()
  1015                     body = pou.getbody()
  1017                     body = pou.getbody()
  1016                     if isinstance(body, ListType):
  1018                     if isinstance(body, ListType):
  1017                         body = body[0]
  1019                         body = body[0]
  1018                     instance = body.getcontentInstance(instanceLocalId)
  1020                     instance = body.getcontentInstance(instanceLocalId)
  1037     def GenerateSFCJump(self, jump, pou):
  1039     def GenerateSFCJump(self, jump, pou):
  1038         jump_target = jump.gettargetName()
  1040         jump_target = jump.gettargetName()
  1039         if jump.connectionPointIn:
  1041         if jump.connectionPointIn:
  1040             instances = []
  1042             instances = []
  1041             connections = jump.connectionPointIn.getconnections()
  1043             connections = jump.connectionPointIn.getconnections()
  1042             if len(connections) == 1:
  1044             if connections is not None and len(connections) == 1:
  1043                 instanceLocalId = connections[0].getrefLocalId()
  1045                 instanceLocalId = connections[0].getrefLocalId()
  1044                 body = pou.getbody()
  1046                 body = pou.getbody()
  1045                 if isinstance(body, ListType):
  1047                 if isinstance(body, ListType):
  1046                     body = body[0]
  1048                     body = body[0]
  1047                 instance = body.getcontentInstance(instanceLocalId)
  1049                 instance = body.getcontentInstance(instanceLocalId)