42 - The name |
44 - The name |
43 - The data type |
45 - The data type |
44 - The default modifier which can be "none", "negated", "rising" or "falling" |
46 - The default modifier which can be "none", "negated", "rising" or "falling" |
45 """ |
47 """ |
46 |
48 |
47 BlockTypes = [{"name" : "Numerical functions", "list": |
49 BlockTypes = [{"name" : "Standard function blocks", "list": |
48 [{"name" : "ADD", "type" : "function", "extensible" : True, |
|
49 "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], |
|
50 "outputs" : [("OUT","ANY_NUM","none")], |
|
51 "comment" : "Addition,\nresult := I1 + I2 + ..."}, |
|
52 {"name" : "MUL", "type" : "function", "extensible" : True, |
|
53 "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], |
|
54 "outputs" : [("OUT","ANY_NUM","none")], |
|
55 "comment" : "Multiplication,\nresult := I1 * I2 * ..."}, |
|
56 {"name" : "SUB", "type" : "function", "extensible" : False, |
|
57 "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], |
|
58 "outputs" : [("OUT","ANY_NUM","none")], |
|
59 "comment" : "Substration,\nresult := I1 - I2"}, |
|
60 {"name" : "DIV", "type" : "function", "extensible" : False, |
|
61 "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], |
|
62 "outputs" : [("OUT","ANY_NUM","none")], |
|
63 "comment" : "Division,\nresult := I1 / I2\n(with integer division, any fractional remainder is truncated)"}, |
|
64 {"name" : "MOD", "type" : "function", "extensible" : False, |
|
65 "inputs" : [("IN1","ANY_INT","none"),("IN2","ANY_INT","none")], |
|
66 "outputs" : [("OUT","ANY_INT","none")], |
|
67 "comment" : "Modulus,\nresult := I1 MOD I2\n(only valid with integer values)"}, |
|
68 {"name" : "EXPT", "type" : "function", "extensible" : False, |
|
69 "inputs" : [("IN1","ANY_REAL","none"),("IN2","ANY_INT","none")], |
|
70 "outputs" : [("OUT","ANY_REAL","none")], |
|
71 "comment" : "Exponential,\nresult := I1 ^ I2\n(can only take integer exponents)"}, |
|
72 {"name" : "ABS", "type" : "function", "extensible" : False, |
|
73 "inputs" : [("IN","ANY_NUM","none")], |
|
74 "outputs" : [("OUT","ANY_NUM","none")], |
|
75 "comment" : "Absolute value (negative values become positive)"}, |
|
76 {"name" : "SQRT", "type" : "function", "extensible" : False, |
|
77 "inputs" : [("IN","ANY_REAL","none")], |
|
78 "outputs" : [("OUT","ANY_REAL","none")], |
|
79 "comment" : "Square root"}, |
|
80 {"name" : "LOG", "type" : "function", "extensible" : False, |
|
81 "inputs" : [("IN","ANY_REAL","none")], |
|
82 "outputs" : [("OUT","ANY_REAL","none")], |
|
83 "comment" : "Logarithm"}, |
|
84 {"name" : "LN", "type" : "function", "extensible" : False, |
|
85 "inputs" : [("IN","ANY_REAL","none")], |
|
86 "outputs" : [("OUT","ANY_REAL","none")], |
|
87 "comment" : "Natural logarithm"}, |
|
88 {"name" : "EXP", "type" : "function", "extensible" : False, |
|
89 "inputs" : [("IN","ANY_REAL","none")], |
|
90 "outputs" : [("OUT","ANY_REAL","none")], |
|
91 "comment" : "Natural exponential"}, |
|
92 {"name" : "SIN", "type" : "function", "extensible" : False, |
|
93 "inputs" : [("IN","ANY_REAL","none")], |
|
94 "outputs" : [("OUT","ANY_REAL","none")], |
|
95 "comment" : "Sine of input as radians"}, |
|
96 {"name" : "COS", "type" : "function", "extensible" : False, |
|
97 "inputs" : [("IN","ANY_REAL","none")], |
|
98 "outputs" : [("OUT","ANY_REAL","none")], |
|
99 "comment" : "Cosine of input as radians"}, |
|
100 {"name" : "TAN", "type" : "function", "extensible" : False, |
|
101 "inputs" : [("IN","ANY_REAL","none")], |
|
102 "outputs" : [("OUT","ANY_REAL","none")], |
|
103 "comment" : "Tangent of input as radians"}, |
|
104 {"name" : "ASIN", "type" : "function", "extensible" : False, |
|
105 "inputs" : [("IN","ANY_REAL","none")], |
|
106 "outputs" : [("OUT","ANY_REAL","none")], |
|
107 "comment" : "Principal arc-sine, result in radians"}, |
|
108 {"name" : "ACOS", "type" : "function", "extensible" : False, |
|
109 "inputs" : [("IN","ANY_REAL","none")], |
|
110 "outputs" : [("OUT","ANY_REAL","none")], |
|
111 "comment" : "Principal arc-cosine, result in radians"}, |
|
112 {"name" : "ATAN", "type" : "function", "extensible" : False, |
|
113 "inputs" : [("IN","ANY_REAL","none")], |
|
114 "outputs" : [("OUT","ANY_REAL","none")], |
|
115 "comment" : "Principal arc-tangent, result in radians"} |
|
116 ]}, |
|
117 {"name" : "Boolean and bit functions", "list": |
|
118 [{"name" : "AND", "type" : "function", "extensible" : True, |
|
119 "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], |
|
120 "outputs" : [("OUT","ANY_BIT","none")], |
|
121 "comment" : "Result := I1 & I2 & ..."}, |
|
122 {"name" : "OR", "type" : "function", "extensible" : True, |
|
123 "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], |
|
124 "outputs" : [("OUT","ANY_BIT","none")], |
|
125 "comment" : "Result := I1 OR I2 OR ..."}, |
|
126 {"name" : "XOR", "type" : "function", "extensible" : True, |
|
127 "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], |
|
128 "outputs" : [("OUT","ANY_BIT","none")], |
|
129 "comment" : "Result := I1 XOR I2 XOR ..."}, |
|
130 {"name" : "NOT", "type" : "function", "extensible" : False, |
|
131 "inputs" : [("IN","BIT","none")], |
|
132 "outputs" : [("OUT","BIT","none")], |
|
133 "comment" : "Result := NOT I1"}, |
|
134 {"name" : "SHL", "type" : "function", "extensible" : False, |
|
135 "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], |
|
136 "outputs" : [("OUT","ANY_BIT","none")], |
|
137 "comment" : "Shift bit-string n bit positions left, zero fill on the right."}, |
|
138 {"name" : "SHR", "type" : "function", "extensible" : False, |
|
139 "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], |
|
140 "outputs" : [("OUT","ANY_BIT")], |
|
141 "comment" : "Shift bit-string right n bit positions, zero fill on the left."}, |
|
142 {"name" : "ROR", "type" : "function", "extensible" : False, |
|
143 "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], |
|
144 "outputs" : [("OUT","ANY_BIT","none")], |
|
145 "comment" : "Shift bit-string right, rotate by n bit positions."}, |
|
146 {"name" : "ROL", "type" : "function", "extensible" : False, |
|
147 "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], |
|
148 "outputs" : [("OUT","ANY_BIT","none")], |
|
149 "comment" : "Shift bit-string left, rotate by n bit positions."} |
|
150 ]}, |
|
151 {"name" : "Selection functions", "list": |
|
152 [{"name" : "SEL", "type" : "function", "extensible" : False, |
|
153 "inputs" : [("G","BOOL","none"),("IN0","ANY","none"),("IN1","ANY","none")], |
|
154 "outputs" : [("OUT","ANY","none")], |
|
155 "comment" : "Selection\nIf G = TRUE then\nResult := IN1 else\nResult := IN2"}, |
|
156 {"name" : "MAX", "type" : "function", "extensible" : True, |
|
157 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
158 "outputs" : [("OUT","ANY","none")], |
|
159 "comment" : "Maximum\nResult := maximum value of all inputs"}, |
|
160 {"name" : "MIN", "type" : "function", "extensible" : True, |
|
161 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
162 "outputs" : [("","ANY","none")], |
|
163 "comment" : "Minimum\nResult := minimum value of all inputs"}, |
|
164 {"name" : "LIMIT", "type" : "function", "extensible" : False, |
|
165 "inputs" : [("MN","ANY","none"),("IN","ANY","none"),("MX","ANY","none")], |
|
166 "outputs" : [("OUT","ANY","none")], |
|
167 "comment" : "Limit\nResult is the value of IN limited between a minimum value of MN and a maximum value of MX."}, |
|
168 {"name" : "MUX", "type" : "function", "extensible" : True, |
|
169 "inputs" : [("K","ANY_INT","none"),("IN1","ANY","none"),("IN2","ANY","none")], |
|
170 "outputs" : [("OUT","ANY","none")], |
|
171 "comment" : "Multiplexer\nResult is the value of the input selected by the value of K."} |
|
172 ]}, |
|
173 {"name" : "Comparison functions", "list": |
|
174 [{"name" : "GT", "type" : "function", "extensible" : True, |
|
175 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
176 "outputs" : [("OUT","ANY","none")], |
|
177 "comment" : "Greater than\nResult := IN1 > IN2"}, |
|
178 {"name" : "GE", "type" : "function", "extensible" : True, |
|
179 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
180 "outputs" : [("OUT","ANY","none")], |
|
181 "comment" : "Greater than or equal\nResult := IN1 >= IN2"}, |
|
182 {"name" : "EQ", "type" : "function", "extensible" : True, |
|
183 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
184 "outputs" : [("OUT","ANY","none")], |
|
185 "comment" : "Equality\nResult := IN1 = IN2"}, |
|
186 {"name" : "LE", "type" : "function", "extensible" : True, |
|
187 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
188 "outputs" : [("OUT","ANY","none")], |
|
189 "comment" : "Lesser than or equal\nResult := IN1 <= IN2"}, |
|
190 {"name" : "LT", "type" : "function", "extensible" : True, |
|
191 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
192 "outputs" : [("OUT","ANY","none")], |
|
193 "comment" : "Lesser than\nResult := IN1 < IN2"}, |
|
194 {"name" : "NE", "type" : "function", "extensible" : False, |
|
195 "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], |
|
196 "outputs" : [("OUT","ANY","none")], |
|
197 "comment" : "Not equal\nResult := IN1 <> IN2"} |
|
198 ]}, |
|
199 {"name" : "Character string functions", "list": |
|
200 [{"name" : "LEFT", "type" : "function", "extensible" : False, |
|
201 "inputs" : [("IN","STRING","none"),("L","ANY_INT","none")], |
|
202 "outputs" : [("OUT","STRING","none")], |
|
203 "comment" : "Extract left string\nResult is the string formed from L characters from the leftmost character of string IN."}, |
|
204 {"name" : "RIGHT", "type" : "function", "extensible" : False, |
|
205 "inputs" : [("IN","STRING","none"),("L","ANY_INT","none")], |
|
206 "outputs" : [("OUT","STRING","none")], |
|
207 "comment" : "Extract right string\nResult is the string formed from L characters from the rightmost part of string IN."}, |
|
208 {"name" : "MID", "type" : "function", "extensible" : False, |
|
209 "inputs" : [("IN","ANY","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], |
|
210 "outputs" : [("OUT","STRING","none")], |
|
211 "comment" : "Extract mid string\nResult is a string extracted from the input string IN starting at character position P, and L characters long."}, |
|
212 {"name" : "CONCAT", "type" : "function", "extensible" : True, |
|
213 "inputs" : [("IN1","STRING","none"),("IN2","STRING","none")], |
|
214 "outputs" : [("OUT","STRING","none")], |
|
215 "comment" : "Concatenate strings\nResult is a string formed by joining the input strings together. This is an extensible function that can take two or more input strings."}, |
|
216 {"name" : "INSERT", "type" : "function", "extensible" : False, |
|
217 "inputs" : [("IN1","STRING","none"),("IN2","STRING","none"),("P","ANY_INT","none")], |
|
218 "outputs" : [("OUT","STRING","none")], |
|
219 "comment" : "Insert string\nThe result is formed by the string IN2 being inserted into string IN1, P character positions from the start of IN1."}, |
|
220 {"name" : "DELETE", "type" : "function", "extensible" : False, |
|
221 "inputs" : [("IN","STRING","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], |
|
222 "outputs" : [("OUT","STRING","none")], |
|
223 "comment" : "Delete string\nThe result is formed by a string of characters L in length, being deleted from the input string IN, starting from character position P."}, |
|
224 {"name" : "REPLACE", "type" : "function", "extensible" : False, |
|
225 "inputs" : [("IN1","STRING","none"),("IN2","STRING","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], |
|
226 "outputs" : [("OUT","STRING","none")], |
|
227 "comment" : "Replace string\nThe result is formed by replacing L characters in string IN1, starting at position P, with character string in IN2."}, |
|
228 {"name" : "LEN", "type" : "function", "extensible" : False, |
|
229 "inputs" : [("IN","STRING","none")], |
|
230 "outputs" : [("OUT","INT","none")], |
|
231 "comment" : "Length\nResult is length of the input string."}, |
|
232 {"name" : "FIND", "type" : "function", "extensible" : False, |
|
233 "inputs" : [("IN1","STRING","none"),("IN2","STRING","none")], |
|
234 "outputs" : [("OUT","INT","none")], |
|
235 "comment" : "Find string\nResult is the position where string IN2 is first found in string IN1.\nIf string IN2 is not found in IN1, the result is 0."}, |
|
236 ]}, |
|
237 {"name" : "Standard function blocks", "list": |
|
238 [{"name" : "SR", "type" : "functionBlock", "extensible" : False, |
50 [{"name" : "SR", "type" : "functionBlock", "extensible" : False, |
239 "inputs" : [("S1","BOOL","none"),("R","BOOL","none")], |
51 "inputs" : [("S1","BOOL","none"),("R","BOOL","none")], |
240 "outputs" : [("Q1","BOOL","none")], |
52 "outputs" : [("Q1","BOOL","none")], |
241 "comment" : "SR bistable\nThe SR bistable is a latch where the Set dominates."}, |
53 "comment" : "SR bistable\nThe SR bistable is a latch where the Set dominates."}, |
242 {"name" : "RS", "type" : "functionBlock", "extensible" : False, |
54 {"name" : "RS", "type" : "functionBlock", "extensible" : False, |