author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Fri, 28 Sep 2018 13:07:46 +0300 | |
changeset 2350 | 9f7028ab8294 |
parent 2165 | 02a2b5dee5e3 |
child 2355 | fec77f2b9e07 |
child 2641 | c9deff128c37 |
permissions | -rw-r--r-- |
2165
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
1 |
#!/usr/bin/env python |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
3 |
|
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
4 |
# This file is part of Beremiz |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
5 |
# |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
6 |
# Copyright (C) 2011-2014: Laurent BESSARD, Edouard TISSERANT |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
7 |
# RTES Lab : CRKim, JBLee, youcu |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
8 |
# Higen Motor : Donggu Kang |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
9 |
# |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
10 |
# See COPYING file for copyrights details. |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2164
diff
changeset
|
11 |
|
2111 | 12 |
import os |
13 |
||
14 |
import wx |
|
15 |
||
16 |
from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY |
|
17 |
||
18 |
from MotionLibrary import Headers, AxisXSD |
|
2152
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
19 |
from EthercatSlave import _EthercatSlaveCTN, _CommonSlave |
2111 | 20 |
from ConfigEditor import CIA402NodeEditor |
21 |
||
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
22 |
# Definition of node variables that have to be mapped in PDO |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
23 |
# [(name, index, subindex, type, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
24 |
# direction for master ('I': input, 'Q': output)),...] |
2111 | 25 |
NODE_VARIABLES = [ |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
26 |
("ControlWord", 0x6040, 0x00, "UINT", "Q"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
27 |
("TargetPosition", 0x607a, 0x00, "DINT", "Q"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
28 |
("TargetVelocity", 0x60ff, 0x00, "DINT", "Q"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
29 |
("TargetTorque", 0x6071, 0x00, "INT", "Q"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
30 |
("ModesOfOperation", 0x6060, 0x00, "SINT", "Q"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
31 |
("StatusWord", 0x6041, 0x00, "UINT", "I"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
32 |
("ModesOfOperationDisplay", 0x6061, 0x00, "SINT", "I"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
33 |
("ActualPosition", 0x6064, 0x00, "DINT", "I"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
34 |
("ActualVelocity", 0x606c, 0x00, "DINT", "I"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
35 |
("ActualTorque", 0x6077, 0x00, "INT", "I"), |
2111 | 36 |
] |
37 |
||
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
38 |
# Definition of optional node variables that can be added to PDO mapping. |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
39 |
# A checkbox will be displayed for each section in node configuration panel to |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
40 |
# enable them |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
41 |
# [(section_name, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
42 |
# [{'description', (name, index, subindex, type, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
43 |
# direction for master ('I': input, 'Q': output)), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
44 |
# 'retrieve', string_template_for_retrieve_variable (None: not retrieved, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
45 |
# default string template if not defined), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
46 |
# 'publish', string_template_for_publish_variable (None: not published, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
47 |
# default string template if not defined), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
48 |
# },...] |
2111 | 49 |
EXTRA_NODE_VARIABLES = [ |
50 |
("ErrorCode", [ |
|
51 |
{"description": ("ErrorCode", 0x603F, 0x00, "UINT", "I"), |
|
52 |
"publish": None} |
|
53 |
]), |
|
54 |
("DigitalInputs", [ |
|
55 |
{"description": ("DigitalInputs", 0x60FD, 0x00, "UDINT", "I"), |
|
56 |
"publish": None} |
|
57 |
]), |
|
58 |
("DigitalOutputs", [ |
|
59 |
{"description": ("DigitalOutputs", 0x60FE, 0x00, "UDINT", "Q"), |
|
60 |
"retrieve": None} |
|
2146
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
61 |
]), |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
62 |
("TouchProbe", [ |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
63 |
{"description": ("TouchProbeFunction", 0x60B8, 0x00, "UINT", "Q"), |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
64 |
"retrieve": None}, |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
65 |
{"description": ("TouchProbeStatus", 0x60B9, 0x00, "UINT", "I"), |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
66 |
"publish": None}, |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
67 |
{"description": ("TouchProbePos1PosValue", 0x60BA, 0x00, "DINT", "I"), |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
68 |
"publish": None}, |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
69 |
{"description": ("TouchProbePos1NegValue", 0x60BB, 0x00, "DINT", "I"), |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
70 |
"publish": None}, |
0c65c96a8379
Added mapping for TouchProbe function in CIA402 slave node
Laurent Bessard
parents:
2145
diff
changeset
|
71 |
]), |
2111 | 72 |
] |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
73 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
74 |
# List of parameters name in no configuration panel for optional variable |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
75 |
# sections |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
76 |
EXTRA_NODE_VARIABLES_DICT = { |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
77 |
"Enable" + name: params |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
78 |
for name, params in EXTRA_NODE_VARIABLES} |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
79 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
80 |
# List of block to define to interface MCL to fieldbus for specific functions |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
81 |
FIELDBUS_INTERFACE_GLOBAL_INSTANCES = [ |
2111 | 82 |
{"blocktype": "GetTorqueLimit", |
83 |
"inputs": [], |
|
84 |
"outputs": [{"name": "TorqueLimitPos", "type": "UINT"}, |
|
85 |
{"name": "TorqueLimitNeg", "type": "UINT"}]}, |
|
86 |
{"blocktype": "SetTorqueLimit", |
|
87 |
"inputs": [{"name": "TorqueLimitPos", "type": "UINT"}, |
|
88 |
{"name": "TorqueLimitNeg", "type": "UINT"}], |
|
89 |
"outputs": []}, |
|
90 |
] |
|
91 |
||
92 |
#-------------------------------------------------- |
|
93 |
# Ethercat CIA402 Node |
|
94 |
#-------------------------------------------------- |
|
95 |
||
96 |
class _EthercatCIA402SlaveCTN(_EthercatSlaveCTN): |
|
97 |
XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
98 |
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
|
99 |
<xsd:element name="CIA402SlaveParams"> |
|
100 |
<xsd:complexType> |
|
101 |
%s |
|
102 |
</xsd:complexType> |
|
103 |
</xsd:element> |
|
104 |
</xsd:schema> |
|
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
105 |
""" % ("\n".join(["""\ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
106 |
<xsd:attribute name="Enable%s" type="xsd:boolean" |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
107 |
use="optional" default="false"/>""" % category |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
108 |
for category, variables in EXTRA_NODE_VARIABLES]) + AxisXSD) |
2111 | 109 |
|
110 |
NODE_PROFILE = 402 |
|
111 |
EditorType = CIA402NodeEditor |
|
112 |
||
113 |
ConfNodeMethods = [ |
|
114 |
{"bitmap" : "CIA402AxisRef", |
|
115 |
"name" : _("Axis Ref"), |
|
116 |
"tooltip" : _("Initiate Drag'n drop of Axis ref located variable"), |
|
117 |
"method" : "_getCIA402AxisRef", |
|
118 |
"push": True}, |
|
2154
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
119 |
{"bitmap" : "CIA402NetPos", |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
120 |
"name" : _("Axis Pos"), |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
121 |
"tooltip" : _("Initiate Drag'n drop of Network position located variable"), |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
122 |
"method" : "_getCIA402NetworkPosition", |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
123 |
"push": True}, |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
124 |
] |
2152
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
125 |
|
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
126 |
#-------------------------------------------------- |
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
127 |
# class code |
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
128 |
#-------------------------------------------------- |
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
129 |
|
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
130 |
def __init__(self): |
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
131 |
# ----------- call ethercat mng. function -------------- |
e6946c298a42
Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents:
2148
diff
changeset
|
132 |
self.CommonMethod = _CommonSlave(self) |
2111 | 133 |
|
134 |
def GetIconName(self): |
|
135 |
return "CIA402Slave" |
|
136 |
||
137 |
def SetParamsAttribute(self, path, value): |
|
138 |
if path == "CIA402SlaveParams.Type": |
|
139 |
path = "SlaveParams.Type" |
|
140 |
elif path == "CIA402SlaveParams.Alias": |
|
141 |
path = "SlaveParams.Alias" |
|
142 |
return _EthercatSlaveCTN.SetParamsAttribute(self, path, value) |
|
143 |
||
144 |
def GetVariableLocationTree(self): |
|
145 |
axis_name = self.CTNName() |
|
146 |
current_location = self.GetCurrentLocation() |
|
2155
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
147 |
children = [{"name": name_frmt % (axis_name), |
2154
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
148 |
"type": LOCATION_VAR_INPUT, |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
149 |
"size": "W", |
2155
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
150 |
"IEC_type": iec_type, |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
151 |
"var_name": var_name_frmt % axis_name, |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
152 |
"location": location_frmt % ( |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
153 |
".".join(map(str, current_location))), |
2154
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
154 |
"description": "", |
2155
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
155 |
"children": []} |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
156 |
for name_frmt, iec_type, var_name_frmt, location_frmt in |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
157 |
[("%s Network Position", "UINT", "%s_pos", "%%IW%s"), |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
158 |
("%s Axis Ref", "AXIS_REF", "%s", "%%IW%s.402")]] |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
159 |
children.extend(self.CTNParent.GetDeviceLocationTree( |
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
160 |
self.GetSlavePos(), current_location, axis_name)) |
2111 | 161 |
return {"name": axis_name, |
162 |
"type": LOCATION_CONFNODE, |
|
163 |
"location": self.GetFullIEC_Channel(), |
|
164 |
"children": children, |
|
165 |
} |
|
166 |
||
167 |
def CTNGlobalInstances(self): |
|
168 |
current_location = self.GetCurrentLocation() |
|
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
169 |
return [("%s_%s" % (block_infos["blocktype"], |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
170 |
"_".join(map(str, current_location))), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
171 |
"EtherLab%s" % block_infos["blocktype"], "") |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
172 |
for block_infos in FIELDBUS_INTERFACE_GLOBAL_INSTANCES] |
2111 | 173 |
|
2154
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
174 |
def StartDragNDrop(self, data): |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
175 |
data_obj = wx.TextDataObject(str(data)) |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
176 |
dragSource = wx.DropSource(self.GetCTRoot().AppFrame) |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
177 |
dragSource.SetData(data_obj) |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
178 |
dragSource.DoDragDrop() |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
179 |
|
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
180 |
def _getCIA402NetworkPosition(self): |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
181 |
self.StartDragNDrop( |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
182 |
("%%IW%s" % ".".join(map(str, self.GetCurrentLocation())), |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
183 |
"location", "UINT", self.CTNName() + "_Pos", "")) |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
184 |
|
2111 | 185 |
def _getCIA402AxisRef(self): |
2154
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
186 |
self.StartDragNDrop( |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
187 |
("%%IW%s.402" % ".".join(map(str, self.GetCurrentLocation())), |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
188 |
"location", "AXIS_REF", self.CTNName(), "")) |
6bbe93799956
Replaced location for axis ref from %IW(location).0 to %IW(location).402. Added location for network position at %IW(location).
Laurent Bessard
parents:
2153
diff
changeset
|
189 |
|
2111 | 190 |
def CTNGenerate_C(self, buildpath, locations): |
191 |
current_location = self.GetCurrentLocation() |
|
192 |
||
193 |
location_str = "_".join(map(lambda x:str(x), current_location)) |
|
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
194 |
slave_pos = self.GetSlavePos() |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
195 |
MCL_headers = Headers |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
196 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
197 |
# Open CIA402 node code template file |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
198 |
plc_cia402node_filepath = os.path.join(os.path.split(__file__)[0], |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
199 |
"plc_cia402node.c") |
2111 | 200 |
plc_cia402node_file = open(plc_cia402node_filepath, 'r') |
201 |
plc_cia402node_code = plc_cia402node_file.read() |
|
202 |
plc_cia402node_file.close() |
|
203 |
||
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
204 |
# Init list of generated strings for each code template file section |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
205 |
fieldbus_interface_declaration = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
206 |
fieldbus_interface_definition = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
207 |
init_axis_params = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
208 |
extra_variables_retrieve = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
209 |
extra_variables_publish = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
210 |
extern_located_variables_declaration = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
211 |
entry_variables = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
212 |
init_entry_variables = [] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
213 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
214 |
# Fieldbus interface code sections |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
215 |
for blocktype_infos in FIELDBUS_INTERFACE_GLOBAL_INSTANCES: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
216 |
blocktype = blocktype_infos["blocktype"] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
217 |
ucase_blocktype = blocktype.upper() |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
218 |
blockname = "_".join([ucase_blocktype, location_str]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
219 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
220 |
extract_inputs = "\n".join(["""\ |
2164
7a959b19d5a4
Propagated matiec changes in FB var accessors
Edouard Tisserant
parents:
2156
diff
changeset
|
221 |
__SET_VAR(%s->, %s,, %s);""" % (blockname, input_name, input_value) |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
222 |
for (input_name, input_value) in [ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
223 |
("EXECUTE", "__GET_VAR(data__->EXECUTE)")] + [ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
224 |
(input["name"].upper(), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
225 |
"__GET_VAR(data__->%s)" % input["name"].upper()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
226 |
for input in blocktype_infos["inputs"]] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
227 |
]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
228 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
229 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
230 |
return_outputs = "\n".join(["""\ |
2164
7a959b19d5a4
Propagated matiec changes in FB var accessors
Edouard Tisserant
parents:
2156
diff
changeset
|
231 |
__SET_VAR(data__->,%(output_name)s,, |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
232 |
__GET_VAR(%(blockname)s->%(output_name)s));""" % locals() |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
233 |
for output_name in ["DONE", "BUSY", "ERROR"] + [ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
234 |
output["name"].upper() |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
235 |
for output in blocktype_infos["outputs"]] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
236 |
]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
237 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
238 |
fieldbus_interface_declaration.append(""" |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
239 |
extern void ETHERLAB%(ucase_blocktype)s_body__(ETHERLAB%(ucase_blocktype)s* data__); |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
240 |
void __%(blocktype)s_%(location_str)s(MC_%(ucase_blocktype)s *data__) { |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
241 |
__DECLARE_GLOBAL_PROTOTYPE(ETHERLAB%(ucase_blocktype)s, %(blockname)s); |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
242 |
ETHERLAB%(ucase_blocktype)s* %(blockname)s = __GET_GLOBAL_%(blockname)s(); |
2164
7a959b19d5a4
Propagated matiec changes in FB var accessors
Edouard Tisserant
parents:
2156
diff
changeset
|
243 |
__SET_VAR(%(blockname)s->, POS,, AxsPub.axis->NetworkPosition); |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
244 |
%(extract_inputs)s |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
245 |
ETHERLAB%(ucase_blocktype)s_body__(%(blockname)s); |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
246 |
%(return_outputs)s |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
247 |
}""" % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
248 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
249 |
fieldbus_interface_definition.append("""\ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
250 |
AxsPub.axis->__mcl_func_MC_%(blocktype)s = __%(blocktype)s_%(location_str)s;\ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
251 |
""" % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
252 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
253 |
# Get a copy list of default variables to map |
2111 | 254 |
variables = NODE_VARIABLES[:] |
255 |
||
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
256 |
# Set AxisRef public struct members value |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
257 |
node_params = self.CTNParams[1].getElementInfos(self.CTNParams[0]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
258 |
for param in node_params["children"]: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
259 |
param_name = param["name"] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
260 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
261 |
# Param is optional variables section enable flag |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
262 |
extra_node_variable_infos = EXTRA_NODE_VARIABLES_DICT.get(param_name) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
263 |
if extra_node_variable_infos is not None: |
2156
c8eee6be2da8
Added bug in support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2155
diff
changeset
|
264 |
param_name = param_name.replace("Enable", "") + "Enabled" |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
265 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
266 |
if not param["value"]: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
267 |
continue |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
268 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
269 |
# Optional variables section is enabled |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
270 |
for variable_infos in extra_node_variable_infos: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
271 |
var_name = variable_infos["description"][0] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
272 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
273 |
# Add each variables defined in section description to the |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
274 |
# list of variables to map |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
275 |
variables.append(variable_infos["description"]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
276 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
277 |
# Add code to publish or retrive variable |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
278 |
for var_exchange_dir, str_list, default_template in [ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
279 |
("retrieve", extra_variables_retrieve, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
280 |
" AxsPub.axis->%(var_name)s = *(AxsPub.%(var_name)s);"), |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
281 |
("publish", extra_variables_publish, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
282 |
" *(AxsPub.%(var_name)s) = AxsPub.axis->%(var_name)s;")]: |
2111 | 283 |
|
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
284 |
template = variable_infos.get(var_exchange_dir, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
285 |
default_template) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
286 |
if template is not None: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
287 |
extra_variables_publish.append(template % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
288 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
289 |
# Set AxisRef public struct member value if defined |
2155
d63541200d8e
Added support for set flag for optional variables activation in axis public struct
Laurent Bessard
parents:
2154
diff
changeset
|
290 |
if param["value"] is not None: |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
291 |
param_value = ({True: "1", False: "0"}[param["value"]] |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
292 |
if param["type"] == "boolean" |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
293 |
else str(param["value"])) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
294 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
295 |
init_axis_params.append("""\ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
296 |
AxsPub.axis->%(param_name)s = %(param_value)s;""" % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
297 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
298 |
# Add each variable in list of variables to map to master list of |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
299 |
# variables to add to network configuration |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
300 |
for name, index, subindex, var_type, dir in variables: |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
301 |
var_size = self.GetSizeOfType(var_type) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
302 |
var_name = """\ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
303 |
__%(dir)s%(var_size)s%(location_str)s_%(index)d_%(subindex)d""" % locals() |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
304 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
305 |
extern_located_variables_declaration.append( |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
306 |
"IEC_%(var_type)s *%(var_name)s;" % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
307 |
entry_variables.append( |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
308 |
" IEC_%(var_type)s *%(name)s;" % locals()) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
309 |
init_entry_variables.append( |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
310 |
" AxsPub.%(name)s = %(var_name)s;" % locals()) |
2111 | 311 |
|
312 |
self.CTNParent.FileGenerator.DeclareVariable( |
|
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
313 |
slave_pos, index, subindex, var_type, dir, var_name) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
314 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
315 |
# Add newline between string in list of generated strings for sections |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
316 |
[fieldbus_interface_declaration, fieldbus_interface_definition, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
317 |
init_axis_params, extra_variables_retrieve, extra_variables_publish, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
318 |
extern_located_variables_declaration, entry_variables, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
319 |
init_entry_variables] = map(lambda l: "\n".join(l), [ |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
320 |
fieldbus_interface_declaration, fieldbus_interface_definition, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
321 |
init_axis_params, extra_variables_retrieve, extra_variables_publish, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
322 |
extern_located_variables_declaration, entry_variables, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
323 |
init_entry_variables]) |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
324 |
|
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
325 |
# Write generated content to CIA402 node file |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
326 |
Gen_CIA402Nodefile_path = os.path.join(buildpath, |
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
327 |
"cia402node_%s.c"%location_str) |
2111 | 328 |
cia402nodefile = open(Gen_CIA402Nodefile_path, 'w') |
2153
91c10856adaa
Rewrite CIA402 node specific code generating part
Laurent Bessard
parents:
2152
diff
changeset
|
329 |
cia402nodefile.write(plc_cia402node_code % locals()) |
2111 | 330 |
cia402nodefile.close() |
331 |
||
332 |
return [(Gen_CIA402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True |