Newer
Older
###################################################################################################
# TANGO DB ATTRIBUTE CONFIG
###################################################################################################
#
# This file contains crude functions to configure the attributes of the OPCUAProxy tango devices.
#
###################################################################################################
# Get the module logger
logger = logging.getLogger("FofbTool")
"""
Apply CellNode attribute configuration on the Tango Device cnp.
This does not check the kind of proxy passed. Expect exception if misuse.
PARAMETERS
----------
cnp: tango.DeviceProxy
Device Proxy to the target device
"""
logger.info("Apply CellNode attribute configuration on device {}".format(cnp.name()))
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
c = cnp.get_attribute_config("app_version")
c.description = "FPGA firmware version\n" +c.description
c.format = '0x%X'
c.unit = ' '
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_gt_reset")
c.description = "ComCellNode transceiver reset register, write 1 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='7'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_reset")
c.description = "ComCellNode data & serdes reset register, write 0xE0000001 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_rx_framerate")
c.description = "ComCellNode RX frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.min_warning='10000'
c.alarms.max_warning='11000'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_tx_framerate")
c.description = "ComCellNode TX frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.min_warning='10000'
c.alarms.max_warning='11000'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_tx_errorrate")
c.description = "ComCellNode TX erroneous frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth0_gt_status")
c.description = "ComCellNode ethernet status. Expected value 0x70 or 0x71\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.min_warning=str(0x6f)
c.alarms.max_warning=str(0x72)
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack0_npackets")
c.description = "ComCellNode number of packet to send -1. Usually 31 for C14 and 29 for others.\n" +c.description
c.format = '%d'
c.unit = 'packets'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='28'
c.alarms.max_warning='32'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack0_control")
c.description = "ComCellNode packeter control, write 1 to start.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
c.alarms.min_warning='0'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack0_framesize")
c.description = "ComCellNode output frame size. 330 for C14 else 310.\n" +c.description
c.format = '%d'
c.unit = 'bytes'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='309'
c.alarms.max_warning='331'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack0_error")
c.description = "ComCellNode packeter protocol error flags.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack0_framecount")
c.description = "ComCellNode number of frame sent.\n" +c.description
c.format = '%d'
c.unit = 'frames'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack0_framecount")
c.description = "ComCellNode number of frame received.\n" +c.description
c.format = '%d'
c.unit = 'frames'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack0_control")
c.description = "ComCellNode unpacketer control, write 1 to start.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='1'
c.alarms.min_warning='0'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack0_error")
c.description = "ComCellNode unpacketer protocol error flags.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack0_framesize")
c.description = "ComCellNode input frame size. Usual value = 610.\n" +c.description
c.format = '%d'
c.unit = 'bytes'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='609'
c.alarms.max_warning='611'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_protocol_status")
c.description = "ComCellNode ethernet status. Expected value 0x00\n" +c.description
c.format = '0x%X'
c.unit = ' '
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_sfp")
c.description = "ComBPM SFP status. Expected value 0x00\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_gt_status")
c.description = "ComBPM transceiver status.\n" +c.description
c.format = '0x%X'
c.unit = ' '
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_valid_framerate")
c.description = "ComBPM RX frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.min_warning='1220000'
c.alarms.max_warning='1230000'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_invalid_framecount")
c.description = "ComBPM RX invalid frame rate. Should not increase to quickly (<1/s)\n" +c.description
c.format = '%d'
c.unit = 'frames'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_frameseq")
c.description = "ComBPM number of frames received -1 in last sequence.\n" +c.description
c.format = '%d'
c.unit = 'frames'
c.alarms.min_warning='121'
c.alarms.max_warning='123'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_reset")
c.description = "ComBPM protocol reset register, write 1 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='1'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("combpm_gt_control")
c.description = "ComBPM transceiver reset register, 1 to enable, 5 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='7'
c.alarms.min_warning='0'
c.alarms.max_warning='2'
cnp.set_attribute_config(c)
def set_attr_config_centralnode(cnp):
"""
Apply Centralnode attribute configuration on the Tango Device cnp.
This does not check the kind of proxy passed. Expect exception if misuse.
PARAMETERS
----------
cnp: tango.DeviceProxy
Device Proxy to the target device
"""
logger.info("Apply CentralNode attribute configuration on device {}".format(cnp.name()))
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
c = cnp.get_attribute_config("app_version")
c.description = "FPGA firmware version\n" +c.description
c.format = '0x%X'
c.unit = ' '
cnp.set_attribute_config(c)
for n in range(4):
c = cnp.get_attribute_config("ccneth{}_gt_reset".format(n))
c.description = "ComCellNode transceiver reset register, write 1 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='7'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth{}_reset".format(n))
c.description = "ComCellNode data & serdes reset register, write 0xE0000001 to reset.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth{}_rx_framerate".format(n))
c.description = "ComCellNode RX frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.min_warning='10000'
c.alarms.max_warning='11000'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth{}_tx_framerate".format(n))
c.description = "ComCellNode TX frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.min_warning='10000'
c.alarms.max_warning='11000'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth{}_tx_errorrate".format(n))
c.description = "ComCellNode TX erroneous frame rate.\n" +c.description
c.format = '%d'
c.unit = 'fps'
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccneth{}_gt_status".format(n))
c.description = "ComCellNode ethernet status. Expected value 0x70 or 0x71\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.min_warning=str(0x6f)
c.alarms.max_warning=str(0x72)
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack{}_npackets".format(n))
c.description = "ComCellNode number of packet to send -1. Usual value 99.\n" +c.description
c.format = '%d'
c.unit = 'packets'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='98'
c.alarms.max_warning='100'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack{}_control".format(n))
c.description = "ComCellNode packeter control, write 1 to start.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
c.alarms.min_warning='0'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack{}_framesize".format(n))
c.description = "ComCellNode output frame size. Usual value 610.\n" +c.description
c.format = '%d'
c.unit = 'bytes'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='609'
c.alarms.max_warning='611'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack{}_error".format(n))
c.description = "ComCellNode packeter protocol error flags.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnpack{}_framecount".format(n))
c.description = "ComCellNode number of frame sent.\n" +c.description
c.format = '%d'
c.unit = 'frames'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack{}_framecount".format(n))
c.description = "ComCellNode number of frame received.\n" +c.description
c.format = '%d'
c.unit = 'frames'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack{}_control".format(n))
c.description = "ComCellNode unpacketer control, write 1 to start.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='1'
c.alarms.min_warning='0'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack{}_error".format(n))
c.description = "ComCellNode unpacketer protocol error flags.\n" +c.description
c.format = '0x%X'
c.unit = ' '
c.alarms.max_warning='1'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("ccnunpack{}_framesize".format(n))
c.description = "ComCellNode input frame size. 330 from C14 else 310.\n" +c.description
c.format = '%d'
c.unit = 'bytes'
c.min_value='0'
c.max_value='999'
c.alarms.min_warning='309'
c.alarms.max_warning='331'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("corr_num_bpm")
c.description = "Number of expected bpm packets for the matrix multiplication."+c.description
c.format = '%d'
c.unit = ' '
c.alarms.min_warning='121'
c.alarms.max_warning='123'
cnp.set_attribute_config(c)
for p in "xy":
c = cnp.get_attribute_config("corr_control_{}".format(p))
c.description = "Correction controller for {} plan. 1 is feedback running, 2 is reset correctors.\n".format(p.upper()) +c.description
c.format = '0x%X'
c.unit = ' '
c.min_value='0'
c.max_value='2'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("corr_command_{}".format(p))
c.description = "Correction command sent for {} plan, in Ampers. Mobile mean on 1 second.\n".format(p.upper()) +c.description
c.format = '%f'
c.unit = 'A'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("orbit_error_{}".format(p))
c.description = "Orbit error read from BPMs, in nm. Mobile mean on 1 second.\n".format(p.upper()) +c.description
c.format = '%d'
c.unit = 'nm'
cnp.set_attribute_config(c)
c = cnp.get_attribute_config("corr_ref_{}".format(p))
c.description = "Orbit reference, in nm.\n".format(p.upper()) +c.description
c.format = '%d'
c.unit = 'nm'
cnp.set_attribute_config(c)
for n in "12":
for cf in ("a","b","ic","d"):
c = cnp.get_attribute_config("corr_k{}{}_{}".format(n,cf,p))
c.description = "Correction controller coefficient {}, filter {} plan\n".format(n,cf,p) +c.description
c.format = '%d'
c.unit = ' '
cnp.set_attribute_config(c)