author | lbessard |
Thu, 16 Aug 2007 10:40:27 +0200 | |
changeset 72 | 73212220ad22 |
parent 71 | 0578bc212c20 |
child 78 | 049f2e7090a2 |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
|
5 |
#based on the plcopen standard. |
|
6 |
# |
|
58 | 7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
0 | 8 |
# |
9 |
#See COPYING file for copyrights details. |
|
10 |
# |
|
11 |
#This library is free software; you can redistribute it and/or |
|
5 | 12 |
#modify it under the terms of the GNU General Public |
0 | 13 |
#License as published by the Free Software Foundation; either |
14 |
#version 2.1 of the License, or (at your option) any later version. |
|
15 |
# |
|
16 |
#This library is distributed in the hope that it will be useful, |
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
58 | 19 |
#General Public License for more details. |
0 | 20 |
# |
5 | 21 |
#You should have received a copy of the GNU General Public |
0 | 22 |
#License along with this library; if not, write to the Free Software |
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 |
||
25 |
from plcopen import plcopen |
|
26 |
from plcopen.structures import * |
|
27 |
from types import * |
|
28 |
||
29 |
varTypeNames = {"localVars" : "VAR", "tempVars" : "VAR_TEMP", "inputVars" : "VAR_INPUT", |
|
30 |
"outputVars" : "VAR_OUTPUT", "inOutVars" : "VAR_IN_OUT", "externalVars" : "VAR_EXTERNAL", |
|
31 |
"globalVars" : "VAR_GLOBAL", "accessVars" : "VAR_ACCESS"} |
|
1 | 32 |
|
6 | 33 |
pouTypeNames = {"function" : "FUNCTION", "functionBlock" : "FUNCTION_BLOCK", "program" : "PROGRAM"} |
34 |
||
71 | 35 |
currentProject = None |
36 |
currentProgram = "" |
|
37 |
pouComputed = {} |
|
38 |
||
1 | 39 |
def ReIndentText(text, nb_spaces): |
40 |
compute = "" |
|
41 |
lines = text.splitlines() |
|
42 |
if len(lines) > 0: |
|
43 |
spaces = 0 |
|
44 |
while lines[0][spaces] == " ": |
|
45 |
spaces += 1 |
|
46 |
indent = "" |
|
47 |
for i in xrange(spaces, nb_spaces): |
|
48 |
indent += " " |
|
49 |
for line in lines: |
|
2 | 50 |
if line != "": |
51 |
compute += "%s%s\n"%(indent, line) |
|
52 |
else: |
|
53 |
compute += "\n" |
|
1 | 54 |
return compute |
55 |
||
0 | 56 |
""" |
57 |
Module implementing methods for generating PLC programs in ST or IL |
|
58 |
""" |
|
59 |
||
60 |
class PouProgram: |
|
61 |
||
62 |
def __init__(self, name, type): |
|
63 |
self.Name = name |
|
64 |
self.Type = type |
|
1 | 65 |
self.ReturnType = None |
66 |
self.Interface = [] |
|
67 |
self.InitialSteps = [] |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
68 |
self.ComputedBlocks = {} |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
69 |
self.ComputedConnectors = {} |
1 | 70 |
self.SFCNetworks = {"Steps":{}, "Transitions":{}, "Actions":{}} |
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
71 |
self.SFCComputedBlocks = "" |
46 | 72 |
self.ActionNumber = 0 |
0 | 73 |
self.Program = "" |
74 |
||
46 | 75 |
def GetActionNumber(self): |
76 |
self.ActionNumber += 1 |
|
77 |
return self.ActionNumber |
|
78 |
||
1 | 79 |
def IsAlreadyDefined(self, name): |
33 | 80 |
for list_type, retain, constant, located, vars in self.Interface: |
30 | 81 |
for var_type, var_name, var_address, var_initial in vars: |
1 | 82 |
if name == var_name: |
83 |
return True |
|
84 |
return False |
|
85 |
||
0 | 86 |
def GenerateInterface(self, interface): |
87 |
if self.Type == "FUNCTION": |
|
1 | 88 |
self.ReturnType = interface.getReturnType().getValue() |
0 | 89 |
for varlist in interface.getContent(): |
1 | 90 |
variables = [] |
33 | 91 |
located = False |
0 | 92 |
for var in varlist["value"].getVariable(): |
93 |
type = var.getType().getValue() |
|
68
66308e07402c
Adding support for allowing declarations of function block into POU interface
lbessard
parents:
66
diff
changeset
|
94 |
if not isinstance(type, (StringType, UnicodeType)): |
66308e07402c
Adding support for allowing declarations of function block into POU interface
lbessard
parents:
66
diff
changeset
|
95 |
type = type.getName() |
71 | 96 |
GeneratePouProgram(type) |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
97 |
initial = var.getInitialValue() |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
98 |
if initial: |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
99 |
initial_value = initial.getValue() |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
100 |
else: |
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
101 |
initial_value = None |
30 | 102 |
address = var.getAddress() |
68
66308e07402c
Adding support for allowing declarations of function block into POU interface
lbessard
parents:
66
diff
changeset
|
103 |
if address: |
33 | 104 |
located = True |
30 | 105 |
variables.append((type, var.getName(), address, initial_value)) |
1 | 106 |
self.Interface.append((varTypeNames[varlist["name"]], varlist["value"].getRetain(), |
33 | 107 |
varlist["value"].getConstant(), located, variables)) |
0 | 108 |
|
109 |
def GenerateProgram(self, pou): |
|
110 |
body = pou.getBody() |
|
111 |
body_content = body.getContent() |
|
112 |
body_type = body_content["name"] |
|
113 |
if body_type in ["IL","ST"]: |
|
1 | 114 |
self.Program = ReIndentText(body_content["value"].getText(), 2) |
0 | 115 |
elif body_type == "FBD": |
116 |
for instance in body.getContentInstances(): |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
117 |
if isinstance(instance, (plcopen.outVariable, plcopen.inOutVariable)): |
0 | 118 |
var = instance.getExpression() |
119 |
connections = instance.connectionPointIn.getConnections() |
|
120 |
if connections and len(connections) == 1: |
|
121 |
expression = self.ComputeFBDExpression(body, connections[0]) |
|
122 |
self.Program += " %s := %s;\n"%(var, expression) |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
123 |
if isinstance(instance, plcopen.connector): |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
124 |
connector = instance.getName() |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
125 |
if self.ComputedConnectors.get(connector, None): |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
126 |
continue |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
127 |
connections = instance.connectionPointIn.getConnections() |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
128 |
if connections and len(connections) == 1: |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
129 |
self.ComputedConnectors[connector] = self.ComputeFBDExpression(body, connections[0]) |
0 | 130 |
elif body_type == "LD": |
131 |
for instance in body.getContentInstances(): |
|
132 |
if isinstance(instance, plcopen.coil): |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
133 |
paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), body) |
0 | 134 |
variable = self.ExtractModifier(instance, instance.getVariable()) |
135 |
expression = self.ComputeLDExpression(paths, True) |
|
136 |
self.Program += " %s := %s;\n"%(variable, expression) |
|
137 |
elif body_type == "SFC": |
|
138 |
for instance in body.getContentInstances(): |
|
139 |
if isinstance(instance, plcopen.step): |
|
1 | 140 |
self.GenerateSFCStep(instance, pou) |
0 | 141 |
elif isinstance(instance, plcopen.actionBlock): |
1 | 142 |
self.GenerateSFCStepActions(instance, pou) |
0 | 143 |
elif isinstance(instance, plcopen.transition): |
1 | 144 |
self.GenerateSFCTransition(instance, pou) |
0 | 145 |
elif isinstance(instance, plcopen.jumpStep): |
146 |
self.GenerateSFCJump(instance, pou) |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
147 |
if len(self.InitialSteps) > 0 and self.SFCComputedBlocks != "": |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
148 |
action_name = "COMPUTE_FUNCTION_BLOCKS" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
149 |
action_infos = {"qualifier" : "S", "content" : action_name} |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
150 |
self.SFCNetworks["Steps"][self.InitialSteps[0]]["actions"].append(action_infos) |
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
151 |
self.SFCNetworks["Actions"][action_name] = ReIndentText(self.SFCComputedBlocks, 4) |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
152 |
self.Program = "" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
153 |
else: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
154 |
raise Exception |
1 | 155 |
for initialstep in self.InitialSteps: |
156 |
self.ComputeSFCStep(initialstep) |
|
0 | 157 |
|
158 |
def ComputeFBDExpression(self, body, link): |
|
159 |
localid = link.getRefLocalId() |
|
160 |
instance = body.getContentInstance(localid) |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
161 |
if isinstance(instance, (plcopen.inVariable, plcopen.inOutVariable)): |
0 | 162 |
return instance.getExpression() |
163 |
elif isinstance(instance, plcopen.block): |
|
164 |
name = instance.getInstanceName() |
|
165 |
type = instance.getTypeName() |
|
166 |
block_infos = GetBlockType(type) |
|
167 |
if block_infos["type"] == "function": |
|
71 | 168 |
GeneratePouProgram(type) |
0 | 169 |
vars = [] |
170 |
for variable in instance.inputVariables.getVariable(): |
|
171 |
connections = variable.connectionPointIn.getConnections() |
|
172 |
if connections and len(connections) == 1: |
|
173 |
value = self.ComputeFBDExpression(body, connections[0]) |
|
174 |
vars.append(self.ExtractModifier(variable, value)) |
|
175 |
variable = instance.outputVariables.getVariable()[0] |
|
176 |
return self.ExtractModifier(variable, "%s(%s)"%(type, ", ".join(vars))) |
|
177 |
elif block_infos["type"] == "functionBlock": |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
178 |
if not self.ComputedBlocks.get(name, False): |
0 | 179 |
vars = [] |
180 |
for variable in instance.inputVariables.getVariable(): |
|
181 |
connections = variable.connectionPointIn.getConnections() |
|
182 |
if connections and len(connections) == 1: |
|
183 |
parameter = variable.getFormalParameter() |
|
184 |
value = self.ComputeFBDExpression(body, connections[0]) |
|
185 |
vars.append(self.ExtractModifier(variable, "%s := %s"%(parameter, value))) |
|
186 |
self.Program += " %s(%s);\n"%(name, ", ".join(vars)) |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
187 |
self.ComputedBlocks[name] = True |
0 | 188 |
connectionPoint = link.getPosition()[-1] |
189 |
for variable in instance.outputVariables.getVariable(): |
|
190 |
blockPointx, blockPointy = variable.connectionPointOut.getRelPosition() |
|
191 |
if instance.getX() + blockPointx == connectionPoint.getX() and instance.getY() + blockPointy == connectionPoint.getY(): |
|
192 |
return self.ExtractModifier(variable, "%s.%s"%(name, variable.getFormalParameter())) |
|
193 |
raise ValueError, "No output variable found" |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
194 |
elif isinstance(instance, plcopen.continuation): |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
195 |
name = instance.getName() |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
196 |
computed_value = self.ComputedConnectors.get(name, None) |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
197 |
if computed_value != None: |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
198 |
return computed_value |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
199 |
for tmp_instance in body.getContentInstances(): |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
200 |
if isinstance(tmp_instance, plcopen.connector): |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
201 |
if tmp_instance.getName() == name: |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
202 |
connections = tmp_instance.connectionPointIn.getConnections() |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
203 |
if connections and len(connections) == 1: |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
204 |
expression = self.ComputeFBDExpression(body, connections[0]) |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
205 |
self.ComputedConnectors[name] = expression |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
206 |
return expression |
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
207 |
raise ValueError, "No connector found" |
0 | 208 |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
209 |
def GenerateLDPaths(self, connections, body): |
0 | 210 |
paths = [] |
211 |
for connection in connections: |
|
212 |
localId = connection.getRefLocalId() |
|
213 |
next = body.getContentInstance(localId) |
|
214 |
if isinstance(next, plcopen.leftPowerRail): |
|
215 |
paths.append(None) |
|
216 |
else: |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
217 |
variable = self.ExtractModifier(next, next.getVariable()) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
218 |
result = self.GenerateLDPaths(next.connectionPointIn.getConnections(), body) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
219 |
if len(result) > 1: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
220 |
paths.append([variable, tuple(result)]) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
221 |
elif type(result[0]) == ListType: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
222 |
paths.append([variable] + result[0]) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
223 |
elif result[0]: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
224 |
paths.append([variable, result[0]]) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
225 |
else: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
226 |
paths.append(variable) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
227 |
return paths |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
228 |
|
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
229 |
def GetNetworkType(self, connections, body): |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
230 |
network_type = "FBD" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
231 |
for connection in connections: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
232 |
localId = connection.getRefLocalId() |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
233 |
next = body.getContentInstance(localId) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
234 |
if isinstance(next, plcopen.leftPowerRail) or isinstance(next, plcopen.contact): |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
235 |
return "LD" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
236 |
elif isinstance(next, plcopen.block): |
70 | 237 |
for variable in next.inputVariables.getVariable(): |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
238 |
result = self.GetNetworkType(variable.connectionPointIn.getConnections(), body) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
239 |
if result != "FBD": |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
240 |
return result |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
241 |
elif isinstance(next, plcopen.inVariable): |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
242 |
return "FBD" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
243 |
elif isinstance(next, plcopen.inOutVariable): |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
244 |
return self.GetNetworkType(next.connectionPointIn.getConnections(), body) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
245 |
else: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
246 |
return None |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
247 |
return "FBD" |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
248 |
|
2 | 249 |
def ExtractDivergenceInput(self, divergence, pou): |
250 |
connectionPointIn = divergence.getConnectionPointIn() |
|
251 |
if connectionPointIn: |
|
252 |
connections = connectionPointIn.getConnections() |
|
253 |
if len(connections) == 1: |
|
254 |
instanceLocalId = connections[0].getRefLocalId() |
|
255 |
return pou.body.getContentInstance(instanceLocalId) |
|
256 |
return None |
|
257 |
||
258 |
def ExtractConvergenceInputs(self, convergence, pou): |
|
259 |
instances = [] |
|
260 |
for connectionPointIn in convergence.getConnectionPointIn(): |
|
261 |
connections = connectionPointIn.getConnections() |
|
262 |
if len(connections) == 1: |
|
263 |
instanceLocalId = connections[0].getRefLocalId() |
|
264 |
instances.append(pou.body.getContentInstance(instanceLocalId)) |
|
265 |
return instances |
|
266 |
||
1 | 267 |
def GenerateSFCStep(self, step, pou): |
0 | 268 |
step_name = step.getName() |
1 | 269 |
if step_name not in self.SFCNetworks["Steps"].keys(): |
270 |
if step.getInitialStep(): |
|
271 |
self.InitialSteps.append(step_name) |
|
0 | 272 |
step_infos = {"initial" : step.getInitialStep(), "transitions" : [], "actions" : []} |
273 |
if step.connectionPointIn: |
|
274 |
instances = [] |
|
275 |
connections = step.connectionPointIn.getConnections() |
|
276 |
if len(connections) == 1: |
|
277 |
instanceLocalId = connections[0].getRefLocalId() |
|
278 |
instance = pou.body.getContentInstance(instanceLocalId) |
|
279 |
if isinstance(instance, plcopen.transition): |
|
280 |
instances.append(instance) |
|
281 |
elif isinstance(instance, plcopen.selectionConvergence): |
|
2 | 282 |
instances.extend(self.ExtractConvergenceInputs(instance, pou)) |
283 |
elif isinstance(instance, plcopen.simultaneousDivergence): |
|
284 |
transition = self.ExtractDivergenceInput(instance, pou) |
|
285 |
if transition: |
|
286 |
if isinstance(transition, plcopen.transition): |
|
1 | 287 |
instances.append(transition) |
2 | 288 |
elif isinstance(transition, plcopen.selectionConvergence): |
289 |
instances.extend(self.ExtractConvergenceInputs(transition, pou)) |
|
0 | 290 |
for instance in instances: |
2 | 291 |
self.GenerateSFCTransition(instance, pou) |
1 | 292 |
if instance in self.SFCNetworks["Transitions"].keys(): |
293 |
self.SFCNetworks["Transitions"][instance]["to"].append(step_name) |
|
294 |
self.SFCNetworks["Steps"][step_name] = step_infos |
|
0 | 295 |
|
296 |
def GenerateSFCJump(self, jump, pou): |
|
297 |
jump_target = jump.getTargetName() |
|
298 |
if jump.connectionPointIn: |
|
299 |
instances = [] |
|
300 |
connections = jump.connectionPointIn.getConnections() |
|
301 |
if len(connections) == 1: |
|
302 |
instanceLocalId = connections[0].getRefLocalId() |
|
303 |
instance = pou.body.getContentInstance(instanceLocalId) |
|
304 |
if isinstance(instance, plcopen.transition): |
|
305 |
instances.append(instance) |
|
306 |
elif isinstance(instance, plcopen.selectionConvergence): |
|
2 | 307 |
instances.extend(self.ExtractConvergenceInputs(instance, pou)) |
308 |
elif isinstance(instance, plcopen.simultaneousDivergence): |
|
309 |
transition = self.ExtractDivergenceInput(instance, pou) |
|
310 |
if transition: |
|
311 |
if isinstance(transition, plcopen.transition): |
|
1 | 312 |
instances.append(transition) |
2 | 313 |
elif isinstance(transition, plcopen.selectionConvergence): |
314 |
instances.extend(self.ExtractConvergenceInputs(transition, pou)) |
|
0 | 315 |
for instance in instances: |
2 | 316 |
self.GenerateSFCTransition(instance, pou) |
1 | 317 |
if instance in self.SFCNetworks["Transitions"].keys(): |
318 |
self.SFCNetworks["Transitions"][instance]["to"].append(jump_target) |
|
319 |
||
320 |
def GenerateSFCStepActions(self, actionBlock, pou): |
|
0 | 321 |
connections = actionBlock.connectionPointIn.getConnections() |
322 |
if len(connections) == 1: |
|
323 |
stepLocalId = connections[0].getRefLocalId() |
|
324 |
step = pou.body.getContentInstance(stepLocalId) |
|
1 | 325 |
self.GenerateSFCStep(step, pou) |
0 | 326 |
step_name = step.getName() |
1 | 327 |
if step_name in self.SFCNetworks["Steps"].keys(): |
0 | 328 |
actions = actionBlock.getActions() |
329 |
for action in actions: |
|
1 | 330 |
action_infos = {"qualifier" : action["qualifier"], "content" : action["value"]} |
331 |
if "duration" in action: |
|
332 |
action_infos["duration"] = action["duration"] |
|
333 |
if "indicator" in action: |
|
334 |
action_infos["indicator"] = action["indicator"] |
|
335 |
if action["type"] == "reference": |
|
336 |
self.GenerateSFCAction(action["value"], pou) |
|
46 | 337 |
else: |
338 |
action_name = "INLINE%d"%self.GetActionNumber() |
|
339 |
self.SFCNetworks["Actions"][action_name] = " %s\n"%action["value"] |
|
340 |
action_infos["content"] = action_name |
|
1 | 341 |
self.SFCNetworks["Steps"][step_name]["actions"].append(action_infos) |
342 |
||
343 |
def GenerateSFCAction(self, action_name, pou): |
|
344 |
if action_name not in self.SFCNetworks["Actions"].keys(): |
|
345 |
actionContent = pou.getAction(action_name) |
|
346 |
if actionContent: |
|
347 |
actionType = actionContent.getBodyType() |
|
348 |
actionBody = actionContent.getBody() |
|
349 |
if actionType in ["ST", "IL"]: |
|
350 |
self.SFCNetworks["Actions"][action_name] = ReIndentText(actionContent.getText(), 4) |
|
351 |
elif actionType == "FBD": |
|
352 |
for instance in actionBody.getContentInstances(): |
|
353 |
if isinstance(instance, plcopen.outVariable): |
|
354 |
var = instance.getExpression() |
|
355 |
connections = instance.connectionPointIn.getConnections() |
|
356 |
if connections and len(connections) == 1: |
|
357 |
expression = self.ComputeFBDExpression(actionBody, connections[0]) |
|
70 | 358 |
action_content = self.Program + " %s := %s;\n"%(var, expression) |
1 | 359 |
self.Program = "" |
70 | 360 |
self.SFCNetworks["Actions"][action_name] = ReIndentText(action_content, 4) |
1 | 361 |
elif actionType == "LD": |
362 |
for instance in actionbody.getContentInstances(): |
|
363 |
if isinstance(instance, plcopen.coil): |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
364 |
paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), actionBody) |
1 | 365 |
variable = self.ExtractModifier(instance, instance.getVariable()) |
366 |
expression = self.ComputeLDExpression(paths, True) |
|
70 | 367 |
action_content = self.Program + " %s := %s;\n"%(variable, expression) |
1 | 368 |
self.Program = "" |
70 | 369 |
self.SFCNetworks["Actions"][action_name] = ReIndentText(action_content, 4) |
1 | 370 |
|
371 |
def GenerateSFCTransition(self, transition, pou): |
|
372 |
if transition not in self.SFCNetworks["Transitions"].keys(): |
|
373 |
steps = [] |
|
0 | 374 |
connections = transition.connectionPointIn.getConnections() |
375 |
if len(connections) == 1: |
|
376 |
instanceLocalId = connections[0].getRefLocalId() |
|
377 |
instance = pou.body.getContentInstance(instanceLocalId) |
|
378 |
if isinstance(instance, plcopen.step): |
|
2 | 379 |
steps.append(instance) |
0 | 380 |
elif isinstance(instance, plcopen.selectionDivergence): |
2 | 381 |
step = self.ExtractDivergenceInput(instance, pou) |
382 |
if step: |
|
383 |
if isinstance(step, plcopen.step): |
|
384 |
steps.append(step) |
|
385 |
elif isinstance(step, plcopen.simultaneousConvergence): |
|
386 |
steps.extend(self.ExtractConvergenceInputs(step, pou)) |
|
387 |
elif isinstance(instance, plcopen.simultaneousConvergence): |
|
388 |
steps.extend(self.ExtractConvergenceInputs(instance, pou)) |
|
1 | 389 |
transition_infos = {"from": [], "to" : []} |
390 |
transitionValues = transition.getConditionContent() |
|
391 |
if transitionValues["type"] == "inline": |
|
392 |
transition_infos["content"] = "\n := %s;\n"%transitionValues["value"] |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
393 |
elif transitionValues["type"] == "reference": |
1 | 394 |
transitionContent = pou.getTransition(transitionValues["value"]) |
395 |
transitionType = transitionContent.getBodyType() |
|
396 |
transitionBody = transitionContent.getBody() |
|
397 |
if transitionType == "IL": |
|
2 | 398 |
transition_infos["content"] = ":\n%s"%ReIndentText(transitionBody.getText(), 4) |
1 | 399 |
elif transitionType == "ST": |
2 | 400 |
transition_infos["content"] = "\n%s"%ReIndentText(transitionBody.getText(), 4) |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
401 |
elif transitionType == "FBD": |
1 | 402 |
for instance in transitionBody.getContentInstances(): |
403 |
if isinstance(instance, plcopen.outVariable): |
|
404 |
connections = instance.connectionPointIn.getConnections() |
|
405 |
if connections and len(connections) == 1: |
|
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
406 |
expression = self.ComputeFBDExpression(transitionBody, connections[0]) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
407 |
transition_infos["content"] = "\n := %s;\n"%expression |
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
408 |
self.SFCComputedBlocks += self.Program |
70 | 409 |
self.Program = "" |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
410 |
elif transitionType == "LD": |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
411 |
for instance in transitionBody.getContentInstances(): |
1 | 412 |
if isinstance(instance, plcopen.coil): |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
413 |
paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), transitionBody) |
1 | 414 |
expression = self.ComputeLDExpression(paths, True) |
415 |
transition_infos["content"] = "\n := %s;\n"%expression |
|
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
416 |
self.SFCComputedBlocks += self.Program |
70 | 417 |
self.Program = "" |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
418 |
elif transitionValues["type"] == "connection": |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
419 |
body = pou.getBody() |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
420 |
connections = transition.getConnections() |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
421 |
network_type = self.GetNetworkType(connections, body) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
422 |
if network_type == None: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
423 |
raise Exception |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
424 |
if len(connections) > 1 or network_type == "LD": |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
425 |
paths = self.GenerateLDPaths(connections, body) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
426 |
expression = self.ComputeLDExpression(paths, True) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
427 |
transition_infos["content"] = "\n := %s;\n"%expression |
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
428 |
self.SFCComputedBlocks += self.Program |
70 | 429 |
self.Program = "" |
66
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
430 |
else: |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
431 |
expression = self.ComputeFBDExpression(body, connections[0]) |
fd138fc77510
Adding support for generating network and rung connected to transitions into SFC
lbessard
parents:
58
diff
changeset
|
432 |
transition_infos["content"] = "\n := %s;\n"%expression |
72
73212220ad22
Adding support for generating FBD with connectors and continuations
lbessard
parents:
71
diff
changeset
|
433 |
self.SFCComputedBlocks += self.Program |
70 | 434 |
self.Program = "" |
2 | 435 |
for step in steps: |
436 |
self.GenerateSFCStep(step, pou) |
|
437 |
step_name = step.getName() |
|
1 | 438 |
if step_name in self.SFCNetworks["Steps"].keys(): |
439 |
transition_infos["from"].append(step_name) |
|
440 |
self.SFCNetworks["Steps"][step_name]["transitions"].append(transition) |
|
441 |
self.SFCNetworks["Transitions"][transition] = transition_infos |
|
442 |
||
443 |
def ComputeSFCStep(self, step_name): |
|
444 |
if step_name in self.SFCNetworks["Steps"].keys(): |
|
445 |
step_infos = self.SFCNetworks["Steps"].pop(step_name) |
|
446 |
if step_infos["initial"]: |
|
447 |
self.Program += " INITIAL_STEP %s:\n"%step_name |
|
448 |
else: |
|
449 |
self.Program += " STEP %s:\n"%step_name |
|
450 |
actions = [] |
|
451 |
for action_infos in step_infos["actions"]: |
|
452 |
actions.append(action_infos["content"]) |
|
453 |
self.Program += " %(content)s(%(qualifier)s"%action_infos |
|
454 |
if "duration" in action_infos: |
|
455 |
self.Program += ", %(duration)s"%action_infos |
|
456 |
if "indicator" in action_infos: |
|
457 |
self.Program += ", %(indicator)s"%action_infos |
|
458 |
self.Program += ");\n" |
|
459 |
self.Program += " END_STEP\n\n" |
|
460 |
for action in actions: |
|
461 |
self.ComputeSFCAction(action) |
|
462 |
for transition in step_infos["transitions"]: |
|
463 |
self.ComputeSFCTransition(transition) |
|
464 |
||
465 |
def ComputeSFCAction(self, action_name): |
|
466 |
if action_name in self.SFCNetworks["Actions"].keys(): |
|
467 |
action_content = self.SFCNetworks["Actions"].pop(action_name) |
|
468 |
self.Program += " ACTION %s:\n%s END_ACTION\n\n"%(action_name, action_content) |
|
469 |
||
470 |
def ComputeSFCTransition(self, transition): |
|
471 |
if transition in self.SFCNetworks["Transitions"].keys(): |
|
472 |
transition_infos = self.SFCNetworks["Transitions"].pop(transition) |
|
473 |
self.Program += " TRANSITION FROM " |
|
474 |
if len(transition_infos["from"]) > 1: |
|
475 |
self.Program += "(%s)"%", ".join(transition_infos["from"]) |
|
476 |
else: |
|
477 |
self.Program += "%s"%transition_infos["from"][0] |
|
478 |
self.Program += " TO " |
|
479 |
if len(transition_infos["to"]) > 1: |
|
480 |
self.Program += "(%s)"%", ".join(transition_infos["to"]) |
|
481 |
else: |
|
482 |
self.Program += "%s"%transition_infos["to"][0] |
|
483 |
self.Program += transition_infos["content"] |
|
484 |
self.Program += " END_TRANSITION\n\n" |
|
485 |
for step_name in transition_infos["to"]: |
|
486 |
self.ComputeSFCStep(step_name) |
|
487 |
||
0 | 488 |
def ComputeLDExpression(self, paths, first = False): |
489 |
if type(paths) == TupleType: |
|
490 |
if None in paths: |
|
491 |
return "TRUE" |
|
492 |
else: |
|
493 |
var = [self.ComputeLDExpression(path) for path in paths] |
|
494 |
if first: |
|
495 |
return " OR ".join(var) |
|
496 |
else: |
|
497 |
return "(%s)"%" OR ".join(var) |
|
498 |
elif type(paths) == ListType: |
|
499 |
var = [self.ComputeLDExpression(path) for path in paths] |
|
500 |
return " AND ".join(var) |
|
501 |
else: |
|
502 |
return paths |
|
503 |
||
504 |
def ExtractModifier(self, variable, text): |
|
505 |
if variable.getNegated(): |
|
506 |
return "NOT(%s)"%text |
|
507 |
else: |
|
508 |
edge = variable.getEdge() |
|
509 |
if edge: |
|
510 |
if edge.getValue() == "rising": |
|
511 |
return self.AddTrigger("R_TRIG", text) |
|
512 |
elif edge.getValue() == "falling": |
|
513 |
return self.AddTrigger("F_TRIG", text) |
|
514 |
return text |
|
515 |
||
516 |
def AddTrigger(self, edge, text): |
|
33 | 517 |
if self.Interface[-1][0] != "VAR" or self.Interface[-1][1] or self.Interface[-1][2] or self.Interface[-1][3]: |
518 |
self.Interface.append(("VAR", False, False, False, [])) |
|
0 | 519 |
i = 1 |
520 |
name = "%s%d"%(edge, i) |
|
1 | 521 |
while self.IsAlreadyDefined(name): |
0 | 522 |
i += 1 |
523 |
name = "%s%d"%(edge, i) |
|
33 | 524 |
self.Interface[-1][4].append((edge, name, None, None)) |
0 | 525 |
self.Program += " %s(CLK := %s);\n"%(name, text) |
526 |
return "%s.Q"%name |
|
527 |
||
528 |
def GenerateSTProgram(self): |
|
1 | 529 |
if self.ReturnType: |
29 | 530 |
program = "%s %s : %s\n"%(self.Type, self.Name, self.ReturnType) |
0 | 531 |
else: |
29 | 532 |
program = "%s %s\n"%(self.Type, self.Name) |
33 | 533 |
for list_type, retain, constant, located, variables in self.Interface: |
1 | 534 |
program += " %s"%list_type |
535 |
if retain: |
|
536 |
program += " RETAIN" |
|
537 |
if constant: |
|
538 |
program += " CONSTANT" |
|
539 |
program += "\n" |
|
30 | 540 |
for var_type, var_name, var_address, var_initial in variables: |
541 |
program += " %s "%var_name |
|
542 |
if var_address != None: |
|
31 | 543 |
program += "AT %s "%var_address |
30 | 544 |
program += ": %s"%var_type |
28
fc23e1f415d8
Adding support for concurrent overriden standard function
lbessard
parents:
6
diff
changeset
|
545 |
if var_initial != None: |
33 | 546 |
value = {"TRUE":"0","FALSE":"1"}.get(str(var_initial).upper(), str(var_initial)) |
37
256eedd275d0
Adding support for disable interface variable change if a POU is used
lbessard
parents:
33
diff
changeset
|
547 |
if var_type == "STRING": |
256eedd275d0
Adding support for disable interface variable change if a POU is used
lbessard
parents:
33
diff
changeset
|
548 |
program += " := '%s'"%value |
256eedd275d0
Adding support for disable interface variable change if a POU is used
lbessard
parents:
33
diff
changeset
|
549 |
elif var_type == "WSTRING": |
33 | 550 |
program += " := \"%s\""%value |
551 |
else: |
|
552 |
program += " := %s"%value |
|
30 | 553 |
program += ";\n" |
4
2de7fd952fdd
Adding File Dialog for choosing path to generated program
lbessard
parents:
2
diff
changeset
|
554 |
program += " END_VAR\n" |
0 | 555 |
program += "\n" |
556 |
program += self.Program |
|
557 |
program += "END_%s\n\n"%self.Type |
|
558 |
return program |
|
71 | 559 |
|
560 |
def GeneratePouProgram(pou_name): |
|
561 |
if not pouComputed.get(pou_name, True): |
|
562 |
pouComputed[pou_name] = True |
|
563 |
global currentProject, currentProgram |
|
564 |
pou = currentProject.getPou(pou_name) |
|
0 | 565 |
pou_type = pou.getPouType().getValue() |
6 | 566 |
if pou_type in pouTypeNames: |
567 |
pou_program = PouProgram(pou.getName(), pouTypeNames[pou_type]) |
|
0 | 568 |
else: |
569 |
raise ValueError, "Undefined pou type" |
|
570 |
pou_program.GenerateInterface(pou.getInterface()) |
|
571 |
pou_program.GenerateProgram(pou) |
|
71 | 572 |
currentProgram += pou_program.GenerateSTProgram() |
573 |
||
574 |
def GenerateConfiguration(configuration): |
|
575 |
config = "\nCONFIGURATION %s\n"%configuration.getName() |
|
576 |
for varlist in configuration.getGlobalVars(): |
|
577 |
config += " VAR_GLOBAL" |
|
578 |
if varlist.getRetain(): |
|
579 |
config += " RETAIN" |
|
580 |
if varlist.getConstant(): |
|
581 |
config += " CONSTANT" |
|
582 |
config += "\n" |
|
583 |
for var in varlist.getVariable(): |
|
584 |
var_type = var.getType().getValue() |
|
585 |
config += " %s "%var.getName() |
|
586 |
address = var.getAddress() |
|
587 |
if address: |
|
588 |
config += "AT %s "%address |
|
589 |
config += ": %s"%var_type |
|
590 |
initial = var.getInitialValue() |
|
591 |
if initial: |
|
592 |
value = str(initial.getValue()) |
|
593 |
value = {"TRUE":"0","FALSE":"1"}.get(value.upper(), value) |
|
594 |
if var_type == "STRING": |
|
595 |
config += " := '%s'"%value |
|
596 |
elif var_type == "WSTRING": |
|
597 |
config += " := \"%s\""%value |
|
598 |
else: |
|
599 |
config += " := %s"%value |
|
600 |
config += ";\n" |
|
601 |
config += " END_VAR\n" |
|
602 |
for resource in configuration.getResource(): |
|
603 |
config += GenerateResource(resource) |
|
604 |
config += "END_CONFIGURATION\n" |
|
605 |
return config |
|
606 |
||
607 |
def GenerateResource(resource): |
|
608 |
resrce = "\n RESOURCE %s ON BEREMIZ\n"%resource.getName() |
|
609 |
for varlist in resource.getGlobalVars(): |
|
610 |
resrce += " VAR_GLOBAL" |
|
611 |
if varlist.getRetain(): |
|
612 |
resrce += " RETAIN" |
|
613 |
if varlist.getConstant(): |
|
614 |
resrce += " CONSTANT" |
|
615 |
resrce += "\n" |
|
616 |
for var in varlist.getVariable(): |
|
617 |
var_type = var.getType().getValue() |
|
618 |
resrce += " %s "%var.getName() |
|
619 |
address = var.getAddress() |
|
620 |
if address: |
|
621 |
resrce += "AT %s "%address |
|
622 |
resrce += ": %s"%var.getType().getValue() |
|
623 |
initial = var.getInitialValue() |
|
624 |
if initial: |
|
625 |
value = str(initial.getValue()) |
|
626 |
value = {"TRUE":"0","FALSE":"1"}.get(value.upper(), value) |
|
627 |
if var_type == "STRING": |
|
628 |
resrce += " := '%s'"%value |
|
629 |
elif var_type == "WSTRING": |
|
630 |
resrce += " := \"%s\""%value |
|
631 |
else: |
|
632 |
resrce += " := %s"%value |
|
633 |
resrce += ";\n" |
|
634 |
resrce += " END_VAR\n" |
|
635 |
tasks = resource.getTask() |
|
636 |
for task in tasks: |
|
637 |
resrce += " TASK %s("%task.getName() |
|
638 |
args = [] |
|
639 |
single = task.getSingle() |
|
640 |
if single: |
|
641 |
args.append("SINGLE := %s"%single) |
|
642 |
interval = task.getInterval() |
|
643 |
if interval: |
|
644 |
text = "t#" |
|
645 |
if interval.hour != 0: |
|
646 |
text += "%dh"%interval.hour |
|
647 |
if interval.minute != 0: |
|
648 |
text += "%dm"%interval.minute |
|
649 |
if interval.second != 0: |
|
650 |
text += "%ds"%interval.second |
|
651 |
if interval.microsecond != 0: |
|
652 |
text += "%dms"%(interval.microsecond / 1000) |
|
653 |
args.append("INTERVAL := %s"%text) |
|
654 |
args.append("PRIORITY := %s"%str(task.priority.getValue())) |
|
655 |
resrce += ",".join(args) + ");\n" |
|
656 |
for task in tasks: |
|
657 |
for instance in task.getPouInstance(): |
|
658 |
resrce += " PROGRAM %s WITH %s : %s;\n"%(instance.getName(), task.getName(), instance.getType()) |
|
659 |
for instance in resource.getPouInstance(): |
|
660 |
resrce += " PROGRAM %s : %s;\n"%(instance.getName(), instance.getType()) |
|
661 |
resrce += " END_RESOURCE\n" |
|
662 |
return resrce |
|
663 |
||
664 |
def GenerateCurrentProgram(project): |
|
665 |
global currentProject, currentProgram |
|
666 |
currentProject = project |
|
667 |
currentProgram = "" |
|
668 |
for pou in project.getPous(): |
|
669 |
pouComputed[pou.getName()] = False |
|
670 |
for pou_name in pouComputed.keys(): |
|
671 |
GeneratePouProgram(pou_name) |
|
29 | 672 |
for config in project.getConfigurations(): |
71 | 673 |
currentProgram += GenerateConfiguration(config) |
674 |
return currentProgram |
|
675 |