PLCGenerator.py
changeset 1782 5b6ad7a7fd9d
parent 1775 b45f2768fab1
child 1831 56b48961cc68
equal deleted inserted replaced
1781:b112bfdde5cc 1782:5b6ad7a7fd9d
    83     if len(mylist) > 0:
    83     if len(mylist) > 0:
    84         return reduce(lambda x, y: x + separator + y, mylist)
    84         return reduce(lambda x, y: x + separator + y, mylist)
    85     else:
    85     else:
    86         return mylist
    86         return mylist
    87 
    87 
    88 #-------------------------------------------------------------------------------
    88 # -------------------------------------------------------------------------------
    89 #                  Specific exception for PLC generating errors
    89 #                  Specific exception for PLC generating errors
    90 #-------------------------------------------------------------------------------
    90 # -------------------------------------------------------------------------------
    91 
    91 
    92 
    92 
    93 class PLCGenException(Exception):
    93 class PLCGenException(Exception):
    94     pass
    94     pass
    95 
    95 
    96 
    96 
    97 #-------------------------------------------------------------------------------
    97 # -------------------------------------------------------------------------------
    98 #                           Generator of PLC program
    98 #                           Generator of PLC program
    99 #-------------------------------------------------------------------------------
    99 # -------------------------------------------------------------------------------
   100 
   100 
   101 
   101 
   102 class ProgramGenerator:
   102 class ProgramGenerator:
   103 
   103 
   104     # Create a new PCL program generator
   104     # Create a new PCL program generator
   478     # Return generated program
   478     # Return generated program
   479     def GetGeneratedProgram(self):
   479     def GetGeneratedProgram(self):
   480         return self.Program
   480         return self.Program
   481 
   481 
   482 
   482 
   483 #-------------------------------------------------------------------------------
   483 # -------------------------------------------------------------------------------
   484 #                           Generator of POU programs
   484 #                           Generator of POU programs
   485 #-------------------------------------------------------------------------------
   485 # -------------------------------------------------------------------------------
   486 
   486 
   487 [ConnectorClass, ContinuationClass, ActionBlockClass] = [
   487 [ConnectorClass, ContinuationClass, ActionBlockClass] = [
   488     PLCOpenParser.GetElementClass(instance_name, "commonObjects")
   488     PLCOpenParser.GetElementClass(instance_name, "commonObjects")
   489     for instance_name in ["connector", "continuation", "actionBlock"]]
   489     for instance_name in ["connector", "continuation", "actionBlock"]]
   490 [InVariableClass, InOutVariableClass, OutVariableClass, BlockClass] = [
   490 [InVariableClass, InOutVariableClass, OutVariableClass, BlockClass] = [