PLCGenerator.py
changeset 1134 1c7a4ad86aa1
parent 1048 b450202605ab
child 1181 21e6db77eb29
equal deleted inserted replaced
1133:d81d99fd1932 1134:1c7a4ad86aa1
   900                     block_infos = self.GetBlockType(block_type, tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in instance.inputVariables.getvariable() if variable.getformalParameter() != "EN"]))
   900                     block_infos = self.GetBlockType(block_type, tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in instance.inputVariables.getvariable() if variable.getformalParameter() != "EN"]))
   901                     if block_infos is None:
   901                     if block_infos is None:
   902                         block_infos = self.GetBlockType(block_type)
   902                         block_infos = self.GetBlockType(block_type)
   903                     if block_infos is None:
   903                     if block_infos is None:
   904                         raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
   904                         raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
   905                     block_infos["generate"](self, instance, block_infos, body, None)
   905                     try:
       
   906                         block_infos["generate"](self, instance, block_infos, body, None)
       
   907                     except ValueError, e:
       
   908                         raise PLCGenException, e.message
   906                 elif isinstance(instance, plcopen.commonObjects_connector):
   909                 elif isinstance(instance, plcopen.commonObjects_connector):
   907                     connector = instance.getname()
   910                     connector = instance.getname()
   908                     if self.ComputedConnectors.get(connector, None):
   911                     if self.ComputedConnectors.get(connector, None):
   909                         continue 
   912                         continue 
   910                     self.ComputedConnectors[connector] = self.ComputeExpression(body, instance.connectionPointIn.getconnections())
   913                     self.ComputedConnectors[connector] = self.ComputeExpression(body, instance.connectionPointIn.getconnections())
   959                 block_infos = self.GetBlockType(block_type, tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in next.inputVariables.getvariable() if variable.getformalParameter() != "EN"]))
   962                 block_infos = self.GetBlockType(block_type, tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in next.inputVariables.getvariable() if variable.getformalParameter() != "EN"]))
   960                 if block_infos is None:
   963                 if block_infos is None:
   961                     block_infos = self.GetBlockType(block_type)
   964                     block_infos = self.GetBlockType(block_type)
   962                 if block_infos is None:
   965                 if block_infos is None:
   963                     raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
   966                     raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
   964                 paths.append(str(block_infos["generate"](self, next, block_infos, body, connection, order, to_inout)))
   967                 try:
       
   968                     paths.append(str(block_infos["generate"](self, next, block_infos, body, connection, order, to_inout)))
       
   969                 except ValueError, e:
       
   970                     raise PLCGenException, e.message
   965             elif isinstance(next, plcopen.commonObjects_continuation):
   971             elif isinstance(next, plcopen.commonObjects_continuation):
   966                 name = next.getname()
   972                 name = next.getname()
   967                 computed_value = self.ComputedConnectors.get(name, None)
   973                 computed_value = self.ComputedConnectors.get(name, None)
   968                 if computed_value != None:
   974                 if computed_value != None:
   969                     paths.append(str(computed_value))
   975                     paths.append(str(computed_value))