author | lbessard |
Mon, 10 Sep 2007 18:16:07 +0200 | |
changeset 90 | 2245e8776086 |
parent 78 | 049f2e7090a2 |
child 92 | 76d5001393df |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
4 |
import string, os, sys |
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
5 |
|
0 | 6 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
7 |
#based on the plcopen standard. |
|
8 |
# |
|
58 | 9 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
0 | 10 |
# |
11 |
#See COPYING file for copyrights details. |
|
12 |
# |
|
13 |
#This library is free software; you can redistribute it and/or |
|
5 | 14 |
#modify it under the terms of the GNU General Public |
0 | 15 |
#License as published by the Free Software Foundation; either |
16 |
#version 2.1 of the License, or (at your option) any later version. |
|
17 |
# |
|
18 |
#This library is distributed in the hope that it will be useful, |
|
19 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
58 | 21 |
#General Public License for more details. |
0 | 22 |
# |
5 | 23 |
#You should have received a copy of the GNU General Public |
0 | 24 |
#License along with this library; if not, write to the Free Software |
25 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
26 |
||
27 |
||
9 | 28 |
LANGUAGES = ["IL","ST","FBD","LD","SFC"] |
29 |
||
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
30 |
def generate_block(generator, block, body, link): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
31 |
name = block.getInstanceName() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
32 |
type = block.getTypeName() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
33 |
block_infos = GetBlockType(type) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
34 |
if block_infos["type"] == "function" and link: |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
35 |
generator.GeneratePouProgram(type) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
36 |
vars = [] |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
37 |
for variable in block.inputVariables.getVariable(): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
38 |
connections = variable.connectionPointIn.getConnections() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
39 |
if connections and len(connections) == 1: |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
40 |
value = generator.ComputeFBDExpression(body, connections[0]) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
41 |
vars.append(generator.ExtractModifier(variable, value)) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
42 |
variable = block.outputVariables.getVariable()[0] |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
43 |
return generator.ExtractModifier(variable, "%s(%s)"%(type, ", ".join(vars))) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
44 |
elif block_infos["type"] == "functionBlock": |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
45 |
if not generator.ComputedBlocks.get(name, False): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
46 |
vars = [] |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
47 |
for variable in block.inputVariables.getVariable(): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
48 |
connections = variable.connectionPointIn.getConnections() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
49 |
if connections and len(connections) == 1: |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
50 |
parameter = variable.getFormalParameter() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
51 |
value = generator.ComputeFBDExpression(body, connections[0]) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
52 |
vars.append("%s := %s"%(parameter, generator.ExtractModifier(variable, value))) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
53 |
generator.Program += " %s(%s);\n"%(name, ", ".join(vars)) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
54 |
generator.ComputedBlocks[name] = True |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
55 |
if link: |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
56 |
connectionPoint = link.getPosition()[-1] |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
57 |
else: |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
58 |
connectionPoint = None |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
59 |
for variable in block.outputVariables.getVariable(): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
60 |
blockPointx, blockPointy = variable.connectionPointOut.getRelPosition() |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
61 |
if not connectionPoint or block.getX() + blockPointx == connectionPoint.getX() and block.getY() + blockPointy == connectionPoint.getY(): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
62 |
return generator.ExtractModifier(variable, "%s.%s"%(name, variable.getFormalParameter())) |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
63 |
raise ValueError, "No output variable found" |
21 | 64 |
|
0 | 65 |
#------------------------------------------------------------------------------- |
66 |
# Function Block Types definitions |
|
67 |
#------------------------------------------------------------------------------- |
|
68 |
||
21 | 69 |
|
0 | 70 |
""" |
71 |
Ordored list of common Function Blocks defined in the IEC 61131-3 |
|
72 |
Each block have this attributes: |
|
73 |
- "name" : The block name |
|
74 |
- "type" : The block type. It can be "function", "functionBlock" or "program" |
|
75 |
- "extensible" : Boolean that define if the block is extensible |
|
76 |
- "inputs" : List of the block inputs |
|
77 |
- "outputs" : List of the block outputs |
|
78 |
- "comment" : Comment that will be displayed in the block popup |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
79 |
- "generate" : Method that generator will call for generating ST block code |
0 | 80 |
Inputs and outputs are a tuple of characteristics that are in order: |
81 |
- The name |
|
82 |
- The data type |
|
83 |
- The default modifier which can be "none", "negated", "rising" or "falling" |
|
84 |
""" |
|
85 |
||
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
86 |
BlockTypes = [{"name" : "Standard function blocks", "list": |
0 | 87 |
[{"name" : "SR", "type" : "functionBlock", "extensible" : False, |
88 |
"inputs" : [("S1","BOOL","none"),("R","BOOL","none")], |
|
89 |
"outputs" : [("Q1","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
90 |
"comment" : "SR bistable\nThe SR bistable is a latch where the Set dominates.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
91 |
"generate" : generate_block}, |
0 | 92 |
{"name" : "RS", "type" : "functionBlock", "extensible" : False, |
93 |
"inputs" : [("S","BOOL","none"),("R1","BOOL","none")], |
|
94 |
"outputs" : [("Q1","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
95 |
"comment" : "RS bistable\nThe RS bistable is a latch where the Reset dominates.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
96 |
"generate" : generate_block}, |
0 | 97 |
{"name" : "SEMA", "type" : "functionBlock", "extensible" : False, |
98 |
"inputs" : [("CLAIM","BOOL","none"),("RELEASE","BOOL","none")], |
|
99 |
"outputs" : [("BUSY","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
100 |
"comment" : "Semaphore\nThe semaphore provides a mechanism to allow software elements mutually exclusive access to certain ressources.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
101 |
"generate" : generate_block}, |
0 | 102 |
{"name" : "R_TRIG", "type" : "functionBlock", "extensible" : False, |
103 |
"inputs" : [("CLK","BOOL","none")], |
|
104 |
"outputs" : [("Q","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
105 |
"comment" : "Rising edge detector\nThe output produces a single pulse when a rising edge is detected.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
106 |
"generate" : generate_block}, |
0 | 107 |
{"name" : "F_TRIG", "type" : "functionBlock", "extensible" : False, |
108 |
"inputs" : [("CLK","BOOL","none")], |
|
109 |
"outputs" : [("Q","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
110 |
"comment" : "Falling edge detector\nThe output produces a single pulse when a falling edge is detected.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
111 |
"generate" : generate_block}, |
0 | 112 |
{"name" : "CTU", "type" : "functionBlock", "extensible" : False, |
113 |
"inputs" : [("CU","BOOL","rising"),("R","BOOL","none"),("PV","INT","none")], |
|
114 |
"outputs" : [("Q","BOOL","none"),("CV","INT","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
115 |
"comment" : "Up-counter\nThe up-counter can be used to signal when a count has reached a maximum value.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
116 |
"generate" : generate_block}, |
0 | 117 |
{"name" : "CTD", "type" : "functionBlock", "extensible" : False, |
118 |
"inputs" : [("CD","BOOL","rising"),("LD","BOOL","none"),("PV","INT","none")], |
|
119 |
"outputs" : [("Q","BOOL","none"),("CV","INT","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
120 |
"comment" : "Down-counter\nThe down-counter can be used to signal when a count has reached zero, on counting down from a preset value.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
121 |
"generate" : generate_block}, |
0 | 122 |
{"name" : "CTUD", "type" : "functionBlock", "extensible" : False, |
123 |
"inputs" : [("CU","BOOL","rising"),("CD","BOOL","rising"),("R","BOOL","none"),("LD","BOOL","none"),("PV","INT","none")], |
|
124 |
"outputs" : [("QU","BOOL","none"),("QD","BOOL","none"),("CV","INT","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
125 |
"comment" : "Up-down counter\nThe up-down counter has two inputs CU and CD. It can be used to both count up on one input ans down on the other.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
126 |
"generate" : generate_block}, |
0 | 127 |
{"name" : "TP", "type" : "functionBlock", "extensible" : False, |
128 |
"inputs" : [("IN","BOOL","none"),("PT","TIME","none")], |
|
129 |
"outputs" : [("Q","BOOL","none"),("ET","TIME","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
130 |
"comment" : "Pulse timer\nThe pulse timer can be used to generate output pulses of a given time duration.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
131 |
"generate" : generate_block}, |
0 | 132 |
{"name" : "TOF", "type" : "functionBlock", "extensible" : False, |
133 |
"inputs" : [("IN","BOOL","none"),("PT","TIME","none")], |
|
134 |
"outputs" : [("Q","BOOL","none"),("ET","TIME","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
135 |
"comment" : "On-delay timer\nThe on-delay timer can be used to delay setting an output true, for fixed period after an input becomes true.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
136 |
"generate" : generate_block}, |
0 | 137 |
{"name" : "TON", "type" : "functionBlock", "extensible" : False, |
138 |
"inputs" : [("IN","BOOL","none"),("PT","TIME","none")], |
|
139 |
"outputs" : [("Q","BOOL","none"),("ET","TIME","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
140 |
"comment" : "Off-delay timer\nThe off-delay timer can be used to delay setting an output false, for fixed period after input goes false.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
141 |
"generate" : generate_block}, |
0 | 142 |
{"name" : "RTC", "type" : "functionBlock", "extensible" : False, |
143 |
"inputs" : [("EN","BOOL","none"),("PDT","DATE_AND_TIME","none")], |
|
144 |
"outputs" : [("Q","BOOL","none"),("CDT","DATE_AND_TIME","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
145 |
"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.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
146 |
"generate" : generate_block}, |
0 | 147 |
{"name" : "INTEGRAL", "type" : "functionBlock", "extensible" : False, |
148 |
"inputs" : [("RUN","BOOL","none"),("R1","BOOL","none"),("XIN","REAL","none"),("X0","REAL","none"),("CYCLE","TIME","none")], |
|
149 |
"outputs" : [("Q","BOOL","none"),("XOUT","REAL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
150 |
"comment" : "Integral\nThe integral function block integrates the value of input XIN over time.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
151 |
"generate" : generate_block}, |
0 | 152 |
{"name" : "DERIVATIVE", "type" : "functionBlock", "extensible" : False, |
153 |
"inputs" : [("RUN","BOOL","none"),("XIN","REAL","none"),("CYCLE","TIME","none")], |
|
154 |
"outputs" : [("XOUT","REAL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
155 |
"comment" : "Derivative\nThe derivative function block produces an output XOUT proportional to the rate of change of the input XIN.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
156 |
"generate" : generate_block}, |
0 | 157 |
{"name" : "PID", "type" : "functionBlock", "extensible" : False, |
158 |
"inputs" : [("AUTO","BOOL","none"),("PV","REAL","none"),("SP","REAL","none"),("X0","REAL","none"),("KP","REAL","none"),("TR","REAL","none"),("TD","REAL","none"),("CYCLE","TIME","none")], |
|
159 |
"outputs" : [("XOUT","REAL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
160 |
"comment" : "PID\nThe PID (proportional, Integral, Derivative) function block provides the classical three term controller for closed loop control.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
161 |
"generate" : generate_block}, |
0 | 162 |
{"name" : "RAMP", "type" : "functionBlock", "extensible" : False, |
163 |
"inputs" : [("RUN","BOOL","none"),("X0","REAL","none"),("X1","REAL","none"),("TR","TIME","none"),("CYCLE","TIME","none"),("HOLDBACK","BOOL","none"),("ERROR","REAL","none"),("PV","REAL","none")], |
|
164 |
"outputs" : [("RAMP","BOOL","none"),("XOUT","REAL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
165 |
"comment" : "Ramp\nThe RAMP function block is modelled on example given in the standard but with the addition of a 'Holdback' feature.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
166 |
"generate" : generate_block}, |
0 | 167 |
{"name" : "HYSTERESIS", "type" : "functionBlock", "extensible" : False, |
168 |
"inputs" : [("XIN1","REAL","none"),("XIN2","REAL","none"),("EPS","REAL","none")], |
|
169 |
"outputs" : [("Q","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
170 |
"comment" : "Hysteresis\nThe hysteresis function block provides a hysteresis boolean output driven by the difference of two floating point (REAL) inputs XIN1 and XIN2.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
171 |
"generate" : generate_block}, |
0 | 172 |
{"name" : "RATIO_MONITOR", "type" : "functionBlock", "extensible" : False, |
173 |
"inputs" : [("PV1","REAL","none"),("PV2","REAL","none"),("RATIO","REAL","none"),("TIMON","TIME","none"),("TIMOFF","TIME","none"),("TOLERANCE","BOOL","none"),("RESET","BOOL","none"),("CYCLE","TIME","none")], |
|
174 |
"outputs" : [("ALARM","BOOL","none"),("TOTAL_ERR","BOOL","none")], |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
175 |
"comment" : "Ratio monitor\nThe ratio_monitor function block checks that one process value PV1 is always a given ratio (defined by input RATIO) of a second process value PV2.", |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
176 |
"generate" : generate_block} |
57 | 177 |
]}, |
0 | 178 |
] |
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
179 |
|
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
180 |
PluginTypes = [] |
0 | 181 |
|
182 |
""" |
|
183 |
Function that returns the block definition associated to the block type given |
|
184 |
""" |
|
185 |
||
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
186 |
def GetBlockType(type, inputs = None): |
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
187 |
for category in BlockTypes + PluginTypes: |
0 | 188 |
for blocktype in category["list"]: |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
189 |
if inputs: |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
190 |
block_inputs = tuple([var_type for name, var_type, modifier in blocktype["inputs"]]) |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
191 |
same_inputs = inputs == block_inputs |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
192 |
else: |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
193 |
same_inputs = True |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
27
diff
changeset
|
194 |
if blocktype["name"] == type and same_inputs: |
0 | 195 |
return blocktype |
196 |
return None |
|
197 |
||
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
198 |
""" |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
199 |
Function that add a new plugin to the plugin list |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
200 |
""" |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
201 |
|
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
202 |
def AddPlugin(blocklist): |
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
203 |
PluginTypes.append(blocklist) |
0 | 204 |
|
205 |
#------------------------------------------------------------------------------- |
|
206 |
# Data Types definitions |
|
207 |
#------------------------------------------------------------------------------- |
|
208 |
||
209 |
""" |
|
210 |
Ordored list of common data types defined in the IEC 61131-3 |
|
211 |
Each type is associated to his direct parent type. It defines then a hierarchy |
|
212 |
between type that permits to make a comparison of two types |
|
213 |
""" |
|
18
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
214 |
TypeHierarchy_list = [ |
22 | 215 |
("ANY", None), |
216 |
("ANY_DERIVED", "ANY"), |
|
217 |
("ANY_ELEMENTARY", "ANY"), |
|
218 |
("ANY_MAGNITUDE", "ANY_ELEMENTARY"), |
|
219 |
("ANY_BIT", "ANY_ELEMENTARY"), |
|
25 | 220 |
("ANY_NBIT", "ANY_BIT"), |
22 | 221 |
("ANY_STRING", "ANY_ELEMENTARY"), |
222 |
("ANY_DATE", "ANY_ELEMENTARY"), |
|
223 |
("ANY_NUM", "ANY_MAGNITUDE"), |
|
224 |
("ANY_REAL", "ANY_NUM"), |
|
225 |
("ANY_INT", "ANY_NUM"), |
|
25 | 226 |
("ANY_SINT", "ANY_INT"), |
227 |
("ANY_UINT", "ANY_INT"), |
|
27 | 228 |
("BOOL", "ANY_BIT"), |
25 | 229 |
("SINT", "ANY_SINT"), |
230 |
("INT", "ANY_SINT"), |
|
231 |
("DINT", "ANY_SINT"), |
|
232 |
("LINT", "ANY_SINT"), |
|
233 |
("USINT", "ANY_UINT"), |
|
234 |
("UINT", "ANY_UINT"), |
|
235 |
("UDINT", "ANY_UINT"), |
|
236 |
("ULINT", "ANY_UINT"), |
|
27 | 237 |
("REAL", "ANY_REAL"), |
238 |
("LREAL", "ANY_REAL"), |
|
22 | 239 |
("TIME", "ANY_MAGNITUDE"), |
27 | 240 |
("DATE", "ANY_DATE"), |
241 |
("TOD", "ANY_DATE"), |
|
242 |
("DT", "ANY_DATE"), |
|
243 |
("STRING", "ANY_STRING"), |
|
25 | 244 |
("BYTE", "ANY_NBIT"), |
245 |
("WORD", "ANY_NBIT"), |
|
246 |
("DWORD", "ANY_NBIT"), |
|
27 | 247 |
("LWORD", "ANY_NBIT") |
248 |
#("WSTRING", "ANY_STRING") # TODO |
|
249 |
] |
|
18
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
250 |
|
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
251 |
TypeHierarchy = dict(TypeHierarchy_list) |
0 | 252 |
|
253 |
""" |
|
15 | 254 |
returns true if the given data type is the same that "reference" meta-type or one of its types. |
0 | 255 |
""" |
256 |
||
257 |
def IsOfType(test, reference): |
|
258 |
while test != None: |
|
259 |
if test == reference: |
|
260 |
return True |
|
261 |
test = TypeHierarchy[test] |
|
262 |
return False |
|
263 |
||
15 | 264 |
""" |
265 |
returns list of all types that correspont to the ANY* meta type |
|
266 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
267 |
def GetSubTypes(reference): |
22 | 268 |
return [ typename for typename, parenttype in TypeHierarchy_list if typename[:3] != "ANY" and IsOfType(typename, reference)] |
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
269 |
|
18
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
270 |
|
21 | 271 |
#------------------------------------------------------------------------------- |
272 |
# Test identifier |
|
273 |
#------------------------------------------------------------------------------- |
|
274 |
||
275 |
||
276 |
||
277 |
# Test if identifier is valid |
|
278 |
def TestIdentifier(identifier): |
|
279 |
if identifier[0].isdigit(): |
|
280 |
return False |
|
281 |
words = identifier.split('_') |
|
282 |
for i, word in enumerate(words): |
|
283 |
if len(word) == 0 and i != 0: |
|
284 |
return False |
|
285 |
if len(word) != 0 and not word.isalnum(): |
|
286 |
return False |
|
287 |
return True |
|
288 |
||
289 |
||
290 |
#------------------------------------------------------------------------------- |
|
291 |
# Languages Keywords |
|
292 |
#------------------------------------------------------------------------------- |
|
293 |
||
294 |
||
295 |
# Keywords for Pou Declaration |
|
296 |
POU_KEYWORDS = ["FUNCTION", "END_FUNCTION", "FUNCTION_BLOCK", "END_FUNCTION_BLOCK", |
|
297 |
"PROGRAM", "END_PROGRAM", "EN", "ENO", "F_EDGE", "R_EDGE"] |
|
298 |
for category in BlockTypes: |
|
299 |
for block in category["list"]: |
|
300 |
if block["name"] not in POU_KEYWORDS: |
|
301 |
POU_KEYWORDS.append(block["name"]) |
|
302 |
||
303 |
||
304 |
# Keywords for Type Declaration |
|
305 |
TYPE_KEYWORDS = ["TYPE", "END_TYPE", "STRUCT", "END_STRUCT", "ARRAY", "OF", "T", |
|
306 |
"D", "TIME_OF_DAY", "DATE_AND_TIME"] |
|
307 |
TYPE_KEYWORDS.extend([keyword for keyword in TypeHierarchy.keys() if keyword not in TYPE_KEYWORDS]) |
|
308 |
||
309 |
||
310 |
# Keywords for Variable Declaration |
|
311 |
VAR_KEYWORDS = ["VAR", "VAR_INPUT", "VAR_OUTPUT", "VAR_IN_OUT", "VAR_TEMP", |
|
312 |
"VAR_EXTERNAL", "END_VAR", "AT", "CONSTANT", "RETAIN", "NON_RETAIN"] |
|
313 |
||
314 |
||
315 |
# Keywords for Configuration Declaration |
|
316 |
CONFIG_KEYWORDS = ["CONFIGURATION", "END_CONFIGURATION", "RESOURCE", "ON", "END_RESOURCE", |
|
317 |
"PROGRAM", "WITH", "READ_ONLY", "READ_WRITE", "TASK", "VAR_ACCESS", "VAR_CONFIG", |
|
318 |
"VAR_GLOBAL", "END_VAR"] |
|
319 |
||
320 |
||
321 |
# Keywords for Structured Function Chart |
|
322 |
SFC_KEYWORDS = ["ACTION", "END_ACTION", "INITIAL_STEP", "STEP", "END_STEP", "TRANSITION", |
|
323 |
"FROM", "TO", "END_TRANSITION"] |
|
324 |
||
325 |
||
326 |
# Keywords for Instruction List |
|
47
2b2f8d88e6d3
Interface changed to show pou interface at the bottom of the window
lbessard
parents:
40
diff
changeset
|
327 |
IL_KEYWORDS = ["TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN", |
21 | 328 |
"XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE", |
329 |
"LE", "LT", "JMP", "JMPC", "JMPNC", "CAL", "CALC", "CALNC", "RET", "RETC", "RETNC"] |
|
330 |
||
331 |
||
332 |
# Keywords for Instruction List and Structured Text |
|
47
2b2f8d88e6d3
Interface changed to show pou interface at the bottom of the window
lbessard
parents:
40
diff
changeset
|
333 |
ST_KEYWORDS = ["TRUE", "FALSE", "IF", "THEN", "ELSIF", "ELSE", "END_IF", "CASE", "OF", "END_CASE", |
21 | 334 |
"FOR", "TO", "BY", "DO", "END_FOR", "WHILE", "DO", "END_WHILE", "REPEAT", "UNTIL", |
335 |
"END_REPEAT", "EXIT", "RETURN", "NOT", "MOD", "AND", "XOR", "OR"] |
|
336 |
||
337 |
||
338 |
# All the keywords of IEC |
|
339 |
IEC_KEYWORDS = ["E", "TRUE", "FALSE"] |
|
340 |
IEC_KEYWORDS.extend([keyword for keyword in POU_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
341 |
IEC_KEYWORDS.extend([keyword for keyword in TYPE_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
342 |
IEC_KEYWORDS.extend([keyword for keyword in VAR_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
343 |
IEC_KEYWORDS.extend([keyword for keyword in CONFIG_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
344 |
IEC_KEYWORDS.extend([keyword for keyword in SFC_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
345 |
IEC_KEYWORDS.extend([keyword for keyword in IL_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
346 |
IEC_KEYWORDS.extend([keyword for keyword in ST_KEYWORDS if keyword not in IEC_KEYWORDS]) |
|
347 |
||
18
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
348 |
|
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
349 |
|
15 | 350 |
""" |
351 |
take a .csv file and translate it it a "csv_table" |
|
352 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
353 |
def csv_file_to_table(file): |
22 | 354 |
return [ map(string.strip,line.split(';')) for line in file.xreadlines()] |
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
355 |
|
15 | 356 |
""" |
357 |
seek into the csv table to a section ( section_name match 1st field ) |
|
358 |
return the matching row without first field |
|
359 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
360 |
def find_section(section_name, table): |
22 | 361 |
fields = [None] |
362 |
while(fields[0] != section_name): |
|
363 |
fields = table.pop(0) |
|
364 |
return fields[1:] |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
365 |
|
15 | 366 |
""" |
367 |
extract the standard functions standard parameter names and types... |
|
368 |
return a { ParameterName: Type, ...} |
|
369 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
370 |
def get_standard_funtions_input_variables(table): |
22 | 371 |
variables = find_section("Standard_functions_variables_types", table) |
372 |
standard_funtions_input_variables = {} |
|
373 |
fields = [True,True] |
|
374 |
while(fields[1]): |
|
375 |
fields = table.pop(0) |
|
376 |
variable_from_csv = dict([(champ, val) for champ, val in zip(variables, fields[1:]) if champ!='']) |
|
377 |
standard_funtions_input_variables[variable_from_csv['name']] = variable_from_csv['type'] |
|
378 |
return standard_funtions_input_variables |
|
379 |
||
15 | 380 |
""" |
381 |
translate .csv file input declaration into PLCOpenEditor interessting values |
|
382 |
in : "(ANY_NUM, ANY_NUM)" and { ParameterName: Type, ...} |
|
383 |
return [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")] |
|
384 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
385 |
def csv_input_translate(str_decl, variables, base): |
22 | 386 |
decl = str_decl.replace('(','').replace(')','').replace(' ','').split(',') |
387 |
params = [] |
|
388 |
||
389 |
len_of_not_predifined_variable = len([True for param_type in decl if param_type not in variables]) |
|
390 |
||
391 |
for param_type in decl: |
|
392 |
if param_type in variables.keys(): |
|
393 |
param_name = param_type |
|
394 |
param_type = variables[param_type] |
|
395 |
elif len_of_not_predifined_variable > 1: |
|
396 |
param_name = "IN%d"%base |
|
397 |
base += 1 |
|
398 |
else: |
|
399 |
param_name = "IN" |
|
400 |
params.append((param_name, param_type, "none")) |
|
401 |
return params |
|
402 |
||
403 |
||
25 | 404 |
ANY_TO_ANY_LIST=[ |
405 |
# simple type conv are let as C cast |
|
22 | 406 |
(("ANY_NUM","ANY_BIT"),("ANY_NUM","ANY_BIT"), "(%(return_type)s)%(IN_value)s"), |
25 | 407 |
# TO_TIME |
408 |
(("ANY_INT","ANY_BIT"),("ANY_DATE","TIME"), "(%(return_type)s)__int_to_time(%(IN_value)s)"), |
|
409 |
(("ANY_REAL",),("ANY_DATE","TIME"), "(%(return_type)s)__real_to_time(%(IN_value)s)"), |
|
410 |
(("ANY_STRING",), ("ANY_DATE","TIME"), "(%(return_type)s)__string_to_time(%(IN_value)s)"), |
|
411 |
# FROM_TIME |
|
412 |
(("ANY_DATE","TIME"), ("ANY_REAL",), "(%(return_type)s)__time_to_real(%(IN_value)s)"), |
|
40 | 413 |
(("ANY_DATE","TIME"), ("ANY_INT","ANY_NBIT"), "(%(return_type)s)__time_to_int(%(IN_value)s)"), |
25 | 414 |
(("TIME",), ("ANY_STRING",), "(%(return_type)s)__time_to_string(%(IN_value)s)"), |
415 |
(("DATE",), ("ANY_STRING",), "(%(return_type)s)__date_to_string(%(IN_value)s)"), |
|
416 |
(("TOD",), ("ANY_STRING",), "(%(return_type)s)__tod_to_string(%(IN_value)s)"), |
|
417 |
(("DT",), ("ANY_STRING",), "(%(return_type)s)__dt_to_string(%(IN_value)s)"), |
|
418 |
# TO_STRING |
|
419 |
(("BOOL",), ("ANY_STRING",), "(%(return_type)s)__bool_to_string(%(IN_value)s)"), |
|
420 |
(("ANY_BIT",), ("ANY_STRING",), "(%(return_type)s)__bit_to_string(%(IN_value)s)"), |
|
421 |
(("ANY_REAL",), ("ANY_STRING",), "(%(return_type)s)__real_to_string(%(IN_value)s)"), |
|
422 |
(("ANY_SINT",), ("ANY_STRING",), "(%(return_type)s)__sint_to_string(%(IN_value)s)"), |
|
423 |
(("ANY_UINT",), ("ANY_STRING",), "(%(return_type)s)__uint_to_string(%(IN_value)s)"), |
|
424 |
# FROM_STRING |
|
425 |
(("ANY_STRING",), ("BOOL",), "(%(return_type)s)__string_to_bool(%(IN_value)s)"), |
|
426 |
(("ANY_STRING",), ("ANY_BIT",), "(%(return_type)s)__string_to_bit(%(IN_value)s)"), |
|
427 |
(("ANY_STRING",), ("ANY_SINT",), "(%(return_type)s)__string_to_sint(%(IN_value)s)"), |
|
428 |
(("ANY_STRING",), ("ANY_UINT",), "(%(return_type)s)__string_to_uint(%(IN_value)s)"), |
|
429 |
(("ANY_STRING",), ("ANY_REAL",), "(%(return_type)s)__string_to_real(%(IN_value)s)")] |
|
430 |
||
431 |
||
432 |
BCD_TO_ANY_LIST=[ |
|
433 |
(("BYTE",),("USINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
|
434 |
(("WORD",),("UINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
|
435 |
(("DWORD",),("UDINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
|
436 |
(("LWORD",),("ULINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)")] |
|
437 |
||
438 |
||
439 |
ANY_TO_BCD_LIST=[ |
|
440 |
(("USINT",),("BYTE",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
|
441 |
(("UINT",),("WORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
|
442 |
(("UDINT",),("DWORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
|
443 |
(("ULINT",),("LWORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)")] |
|
444 |
||
445 |
||
446 |
def ANY_TO_ANY_FORMAT_GEN(any_to_any_list, fdecl): |
|
447 |
||
448 |
for (InTypes, OutTypes, Format) in any_to_any_list: |
|
22 | 449 |
outs = reduce(lambda a,b: a or b, map(lambda testtype : IsOfType(fdecl["outputs"][0][1],testtype), OutTypes)) |
450 |
inps = reduce(lambda a,b: a or b, map(lambda testtype : IsOfType(fdecl["inputs"][0][1],testtype), InTypes)) |
|
451 |
if inps and outs and fdecl["outputs"][0][1] != fdecl["inputs"][0][1]: |
|
452 |
return Format |
|
453 |
||
454 |
return None |
|
18
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
455 |
|
ee18a387e80a
Enhanced standard funcrtion declaration from .csv file.
etisserant
parents:
15
diff
changeset
|
456 |
|
15 | 457 |
""" |
458 |
Returns this kind of declaration for all standard functions |
|
459 |
||
460 |
[{"name" : "Numerical", 'list': [ { |
|
461 |
'baseinputnumber': 1, |
|
462 |
'comment': 'Addition', |
|
463 |
'extensible': True, |
|
464 |
'inputs': [ ('IN1', 'ANY_NUM', 'none'), |
|
465 |
('IN2', 'ANY_NUM', 'none')], |
|
466 |
'name': 'ADD', |
|
467 |
'outputs': [('OUT', 'ANY_NUM', 'none')], |
|
468 |
'type': 'function'}, ...... ] },.....] |
|
469 |
""" |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
470 |
def get_standard_funtions(table): |
22 | 471 |
|
472 |
variables = get_standard_funtions_input_variables(table) |
|
473 |
||
474 |
fonctions = find_section("Standard_functions_type",table) |
|
475 |
||
476 |
Standard_Functions_Decl = [] |
|
477 |
Current_section = None |
|
478 |
||
479 |
translate = { |
|
480 |
"extensible" : lambda x: {"yes":True, "no":False}[x], |
|
481 |
"inputs" : lambda x:csv_input_translate(x,variables,baseinputnumber), |
|
482 |
"outputs":lambda x:[("OUT",x,"none")]} |
|
483 |
||
484 |
for fields in table: |
|
485 |
if fields[1]: |
|
486 |
# If function section name given |
|
487 |
if fields[0]: |
|
488 |
Current_section = {"name" : fields[0], "list" : []} |
|
489 |
Standard_Functions_Decl.append(Current_section) |
|
490 |
Function_decl_list = [] |
|
491 |
if Current_section: |
|
492 |
Function_decl = dict([(champ, val) for champ, val in zip(fonctions, fields[1:]) if champ]) |
|
78
049f2e7090a2
Adding support for adding block types with particular behaviour
lbessard
parents:
58
diff
changeset
|
493 |
Function_decl["generate"] = generate_block |
22 | 494 |
baseinputnumber = int(Function_decl.get("baseinputnumber",1)) |
495 |
Function_decl["baseinputnumber"] = baseinputnumber |
|
496 |
for param, value in Function_decl.iteritems(): |
|
497 |
if param in translate: |
|
498 |
Function_decl[param] = translate[param](value) |
|
499 |
Function_decl["type"] = "function" |
|
500 |
||
25 | 501 |
if Function_decl["name"].startswith('*') or Function_decl["name"].endswith('*') : |
22 | 502 |
input_ovrloading_types = GetSubTypes(Function_decl["inputs"][0][1]) |
25 | 503 |
output_types = GetSubTypes(Function_decl["outputs"][0][1]) |
22 | 504 |
else: |
505 |
input_ovrloading_types = [None] |
|
506 |
output_types = [None] |
|
507 |
||
508 |
funcdeclname_orig = Function_decl["name"] |
|
509 |
funcdeclname = Function_decl["name"].strip('*_') |
|
510 |
fdc = Function_decl["inputs"][:] |
|
511 |
for intype in input_ovrloading_types: |
|
512 |
if intype != None: |
|
513 |
Function_decl["inputs"] = [] |
|
514 |
for decl_tpl in fdc: |
|
515 |
if IsOfType(intype, decl_tpl[1]): |
|
516 |
Function_decl["inputs"] += [(decl_tpl[0], intype, decl_tpl[2])] |
|
517 |
else: |
|
518 |
Function_decl["inputs"] += [(decl_tpl)] |
|
519 |
||
520 |
if funcdeclname_orig.startswith('*'): |
|
521 |
funcdeclin = intype + '_' + funcdeclname |
|
522 |
else: |
|
523 |
funcdeclin = funcdeclname |
|
524 |
else: |
|
525 |
funcdeclin = funcdeclname |
|
526 |
||
527 |
for outype in output_types: |
|
528 |
if outype != None: |
|
529 |
decl_tpl = Function_decl["outputs"][0] |
|
530 |
Function_decl["outputs"] = [ (decl_tpl[0] , outype, decl_tpl[2])] |
|
531 |
if funcdeclname_orig.endswith('*'): |
|
532 |
funcdeclout = funcdeclin + '_' + outype |
|
533 |
else: |
|
534 |
funcdeclout = funcdeclin |
|
535 |
else: |
|
536 |
funcdeclout = funcdeclin |
|
537 |
Function_decl["name"] = funcdeclout |
|
538 |
||
539 |
||
540 |
fdecl = Function_decl |
|
541 |
res = eval(Function_decl["python_eval_c_code_format"]) |
|
542 |
||
543 |
if res != None : |
|
544 |
# create the copy of decl dict to be appended to section |
|
545 |
Function_decl_copy = Function_decl.copy() |
|
546 |
# Have to generate type description in comment with freshly redefined types |
|
547 |
Function_decl_copy["comment"] += ( |
|
548 |
"\n (" + |
|
549 |
str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["inputs"]]).strip("[]").replace("'",'') + |
|
550 |
" ) => (" + |
|
551 |
str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["outputs"]]).strip("[]").replace("'",'') + |
|
552 |
" )") |
|
553 |
Current_section["list"].append(Function_decl_copy) |
|
554 |
#pp.pprint(Function_decl_copy) |
|
555 |
else: |
|
556 |
raise "First function must be in a category" |
|
557 |
||
558 |
return Standard_Functions_Decl |
|
14
cd0133ed377b
Standard IEC functions declaration now made from iec_std.csv file for easier maintainance.
etisserant
parents:
9
diff
changeset
|
559 |
|
25 | 560 |
std_decl = get_standard_funtions(csv_file_to_table(open(os.path.join(os.path.split(__file__)[0],"iec_std.csv"))))#, True) |
561 |
||
562 |
BlockTypes.extend(std_decl) |
|
563 |