plcopen/definitions.py
changeset 1625 be3f68731798
parent 1511 91538d0c242c
child 1680 6db967480b7d
equal deleted inserted replaced
1624:bc84d659894f 1625:be3f68731798
    46 StdTC6Libs = [(_("Standard function blocks"),  join(sd, "Standard_Function_Blocks.xml")),
    46 StdTC6Libs = [(_("Standard function blocks"),  join(sd, "Standard_Function_Blocks.xml")),
    47               (_("Additional function blocks"),join(sd, "Additional_Function_Blocks.xml"))]
    47               (_("Additional function blocks"),join(sd, "Additional_Function_Blocks.xml"))]
    48 
    48 
    49 StdFuncsCSV = join(sd,"iec_std.csv")
    49 StdFuncsCSV = join(sd,"iec_std.csv")
    50 
    50 
    51 # FIXME : since std fb now loaded from TC6 file, is that still necessary ?
       
    52 StdBlockComments = {
       
    53     "SR": _("SR bistable\nThe SR bistable is a latch where the Set dominates."),
       
    54     "RS": _("RS bistable\nThe RS bistable is a latch where the Reset dominates."),
       
    55     "SEMA": _("Semaphore\nThe semaphore provides a mechanism to allow software elements mutually exclusive access to certain ressources."),
       
    56     "R_TRIG": _("Rising edge detector\nThe output produces a single pulse when a rising edge is detected."),
       
    57     "F_TRIG": _("Falling edge detector\nThe output produces a single pulse when a falling edge is detected."),
       
    58     "CTU": _("Up-counter\nThe up-counter can be used to signal when a count has reached a maximum value."),
       
    59     "CTD": _("Down-counter\nThe down-counter can be used to signal when a count has reached zero, on counting down from a preset value."),
       
    60     "CTUD": _("Up-down counter\nThe up-down counter has two inputs CU and CD. It can be used to both count up on one input and down on the other."),
       
    61     "TP": _("Pulse timer\nThe pulse timer can be used to generate output pulses of a given time duration."),
       
    62     "TON": _("On-delay timer\nThe on-delay timer can be used to delay setting an output true, for fixed period after an input becomes true."),
       
    63     "TOF": _("Off-delay timer\nThe off-delay timer can be used to delay setting an output false, for fixed period after input goes false."),
       
    64     "RTC": _("Real time clock\nThe real time clock has many uses including time stamping, setting dates and times of day in batch reports, in alarm messages and so on."),
       
    65     "INTEGRAL": _("Integral\nThe integral function block integrates the value of input XIN over time."),
       
    66     "DERIVATIVE": _("Derivative\nThe derivative function block produces an output XOUT proportional to the rate of change of the input XIN."),
       
    67     "PID": _("PID\nThe PID (proportional, Integral, Derivative) function block provides the classical three term controller for closed loop control."),
       
    68     "RAMP": _("Ramp\nThe RAMP function block is modelled on example given in the standard."),
       
    69     "HYSTERESIS": _("Hysteresis\nThe hysteresis function block provides a hysteresis boolean output driven by the difference of two floating point (REAL) inputs XIN1 and XIN2."),
       
    70 }
       
    71 
       
    72 for block_type in ["CTU", "CTD", "CTUD"]:
       
    73     for return_type in ["DINT", "LINT", "UDINT", "ULINT"]:
       
    74         StdBlockComments["%s_%s" % (block_type, return_type)] = StdBlockComments[block_type]
       
    75 
       
    76 def GetBlockInfos(pou):
    51 def GetBlockInfos(pou):
    77     infos = pou.getblockInfos()
    52     infos = pou.getblockInfos()
    78     # FIXME : as well
       
    79     infos["comment"] = StdBlockComments[infos["name"]]
       
    80     infos["inputs"] = [
    53     infos["inputs"] = [
    81         (var_name, var_type, "rising")
    54         (var_name, var_type, "rising")
    82         if var_name in ["CU", "CD"]
    55         if var_name in ["CU", "CD"]
    83         else (var_name, var_type, var_modifier)
    56         else (var_name, var_type, var_modifier)
    84         for var_name, var_type, var_modifier in infos["inputs"]]
    57         for var_name, var_type, var_modifier in infos["inputs"]]