Enable RTC in standard FB lib
authorEdouard Tisserant
Mon, 20 Feb 2012 00:37:01 +0100
changeset 649 ea237e1431ec
parent 648 95d165193770
child 650 aaa3b02d42b1
Enable RTC in standard FB lib
PLCControler.py
plcopen/structures.py
--- a/PLCControler.py	Fri Feb 17 00:13:19 2012 +0100
+++ b/PLCControler.py	Mon Feb 20 00:37:01 2012 +0100
@@ -1285,7 +1285,7 @@
                 if blocktype["name"] == type:
                     if inputs is not None and inputs != "undefined":
                         block_inputs = tuple([var_type for name, var_type, modifier in blocktype["inputs"]])
-                        if reduce(lambda x, y: x and y, map(lambda x: x[0] == "ANY" or self.IsOfType(*x), zip(inputs, block_inputs))):
+                        if reduce(lambda x, y: x and y, map(lambda x: x[0] == "ANY" or self.IsOfType(*x), zip(inputs, block_inputs)), True):
                             return blocktype
                     else:
                         if result_blocktype is not None:
--- a/plcopen/structures.py	Fri Feb 17 00:13:19 2012 +0100
+++ b/plcopen/structures.py	Mon Feb 20 00:37:01 2012 +0100
@@ -219,12 +219,12 @@
                     "generate" : generate_block, "initialise" : initialise_block},
                 ]},
               {"name" : _("Additional function blocks"), "list":
-##                {"name" : "RTC", "type" : "functionBlock", "extensible" : False, 
-##                    "inputs" : [("EN","BOOL","none"),("PDT","DATE_AND_TIME","none")], 
-##                    "outputs" : [("Q","BOOL","none"),("CDT","DATE_AND_TIME","none")],
-##                    "comment" : _("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."),
-##                    "generate" : generate_block, "initialise" : initialise_block},
-               [{"name" : "INTEGRAL", "type" : "functionBlock", "extensible" : False, 
+               [{"name" : "RTC", "type" : "functionBlock", "extensible" : False, 
+                    "inputs" : [("IN","BOOL","none"),("PDT","DATE_AND_TIME","none")], 
+                    "outputs" : [("Q","BOOL","none"),("CDT","DATE_AND_TIME","none")],
+                    "comment" : _("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."),
+                    "generate" : generate_block, "initialise" : initialise_block},
+                {"name" : "INTEGRAL", "type" : "functionBlock", "extensible" : False, 
                     "inputs" : [("RUN","BOOL","none"),("R1","BOOL","none"),("XIN","REAL","none"),("X0","REAL","none"),("CYCLE","TIME","none")], 
                     "outputs" : [("Q","BOOL","none"),("XOUT","REAL","none")],
                     "comment" : _("Integral\nThe integral function block integrates the value of input XIN over time."),