-
Notifications
You must be signed in to change notification settings - Fork 0
/
VN3000.py
602 lines (526 loc) · 18.3 KB
/
VN3000.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
98
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
161
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
219
220
221
222
223
224
225
226
227
228
229
230
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
302
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
import can
import os
import threading
import json
import time
from pprint import pprint
from blockUpr import BlockUPR
from blockRasp import BlockRasp
from blockDC import BlockDC
from blockRF import BlockRF
from Parser import Parser
class VN3000:
"""Class for installation"""
def __init__(self):
"""
Load settings for VN3000
"""
with open("vn3000.json") as f_obj:
templates = json.load(f_obj)
self.dcBlock = templates["presetting"].get("dcBlock")
self.rfBlock = templates["presetting"].get("rfBlock")
self.highVoltageBlock = templates["presetting"].get("highVoltageBlock")
self.pressureTurbine_start = templates["pressureSettings"].get(
"pressureTurbine"
)
self.pressureSensorPG_enable = templates["pressureSettings"].get(
"pressureIonVacuumi"
)
try:
if os.name == "nt":
self.bus = can.ThreadSafeBus(
bustype="systec", channel="0", bitrate=1000000
)
else:
os.system(
"echo password|sudo -S ip link set can0 type can bitrate 1000000"
)
os.system("echo password|sudo -S ip link set up can0")
self.bus = can.ThreadSafeBus(channel="can0", bustype="socketcan")
except can.CanError:
print("Hardware or CAN interface initialization failed.")
input()
self.blk_upr = BlockUPR(self.bus)
self.blk_rasp = BlockRasp(self.bus)
self.blk_dc = BlockDC(self.bus)
self.blk_rf = BlockRF(self.bus)
self.parser = Parser(
blockUpr=self.blk_upr,
blockRasp=self.blk_rasp,
blockDc=self.blk_dc,
blockRf=self.blk_rf,
)
def star_work(self):
"""Getting started, the foundation of the program"""
print("VN3000 init:")
self.blk_upr.get_states()
self.blk_upr.get_measurements()
self.blk_rasp.get_states()
self.blk_rasp.get_measurements()
self.blk_dc.get_states()
self.blk_dc.get_measurements()
self.blk_rf.get_states()
self.blk_rf.get_measurements()
self.reader_m4()
time.sleep(1)
upr = self.blk_upr.return_states_mes()
ras = self.blk_rasp.return_states_mes()
dc = self.blk_dc.return_states_mes()
rf = self.blk_rf.return_states_mes()
print("Status block Upr:")
pprint(upr)
print("Status block Rasp:")
pprint(ras)
print("Status block DC")
pprint(dc)
print("Status block RF")
pprint(rf)
# self.periodic_send()
def get_measurements(self):
self.blk_upr.get_measurements()
self.blk_rasp.get_measurements()
if self.blk_dc.block_dc_enable:
self.blk_dc.get_measurements()
if self.blk_rf.block_rf_enable:
self.blk_rf.get_measurements()
def periodic_send(self):
self.get_measurements()
self.t = threading.Timer(0.5, self.periodic_send)
self.t.start()
def end_work(self):
"""Close CAN-USB bus and clear other stuff"""
self.noti.stop()
# self.t.cancel()
self.bus.shutdown()
if os.name == "posix":
os.system("echo password|sudo -S ip link set down can0")
def check_phase(self):
"""Checking electrical phase"""
if self.blk_rasp.phase_electric == False:
return -11
def enable_NF(self):
"""Enable pump NF:
| Cheking: NF, VE4.
"""
if self.blk_rasp.state_NF == False and (
self.blk_rasp.state_VE4_close == True
or self.blk_rasp.state_VE4_open == True
):
self.blk_rasp.set_pump("NF", True)
elif (
self.blk_rasp.state_VE4_close == False
and self.blk_rasp.state_VE4_open == False
):
return -1
def disable_NF(self):
"""Disable pump NF:
| Cheking: NT, NF, VE2, VE3.
"""
if (
self.blk_rasp.state_NF == True
and self.blk_rasp.state_NT == False
and self.blk_upr.state_VE3 == False
and self.blk_upr.state_VE2 == False
):
self.blk_rasp.set_pump("NF", False)
elif self.blk_rasp.state_NT == True:
return -2
elif self.blk_upr.state_VE2 == True:
return -3
elif self.blk_upr.state_VE3 == True:
return -4
def enable_NT(self):
"""Enable pump NT:
| Cheking: NT, Preasure P2, Water 1.
"""
if (
self.blk_rasp.state_NT == False
and self.blk_upr.pressure_pmp < self.pressureTurbine_start
and self.blk_upr.water_1 == True
):
self.blk_rasp.set_pump("NT", True)
elif self.blk_upr.water_1 == False:
self.blk_upr.set_sound(True)
return -5
elif self.blk_upr.pressure_pmp > self.pressureTurbine_start:
return -6
def disable_NT(self):
"""Disable pump NT:
| Cheking: NT.
"""
if self.blk_rasp.state_NT == True:
self.blk_rasp.set_pump("NT", False)
return -13
def open_VE4(self):
"""Open butterfly valve VE4:
| Cheking: VE4, VE1, Chamber, VE3, Pressure
"""
if (
(
self.blk_rasp.state_VE4_close == True
or (
self.blk_rasp.state_VE4_open == False
and self.blk_rasp.state_VE4_close == False
)
)
and self.blk_upr.state_VE1 == False
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE3 == False
and self.blk_upr.pressure_ch < self.pressureTurbine_start
):
self.blk_rasp.set_valve_VE4(True)
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_upr.state_VE3 == True:
return -4
elif self.blk_upr.pressure_ch > self.pressureTurbine_start:
return -12
def close_VE4(self):
"""Close butterfly valve VE4:
| Cheking: VE4
"""
if self.blk_rasp.state_VE4_open == True or (
self.blk_rasp.state_VE4_open == False
and self.blk_rasp.state_VE4_close == False
):
self.blk_rasp.set_valve_VE4(False)
def open_VE1(self):
"""Open valve VE1:
| Cheking: VE1, VE4, VE3
"""
if (
self.blk_rasp.state_VE4_close == True
and self.blk_upr.state_VE3 == False
and self.blk_upr.state_VE1 == False
):
self.blk_upr.set_valve("VE1", True)
elif self.blk_rasp.state_VE4_close == False:
return -7
elif self.blk_upr.state_VE3 == True:
return -4
def close_VE1(self):
"""Close valve VE1:
| Cheking: VE1
"""
if self.blk_upr.state_VE1 == True:
self.blk_upr.set_valve("VE1", False)
def open_VE2(self):
"""Open valve VE2:
| Cheking: VE2, VE3.
"""
if self.blk_upr.state_VE2 == False and self.blk_upr.state_VE3 == False:
self.blk_upr.set_valve("VE2", True)
elif self.blk_upr.state_VE3 == True:
return -4
def close_VE2(self):
"""Close valve VE2.
| Cheking: VE2
"""
if self.blk_upr.state_VE2 == True:
self.blk_upr.set_valve("VE2", False)
def open_VE3(self):
"""Open valve VE3:
| Cheking: VE3, VE2, VE1, Chamber.
"""
if (
self.blk_upr.state_VE3 == False
and self.blk_upr.state_VE2 == False
and self.blk_upr.state_VE1 == False
and self.blk_rasp.state_chmb_open == False
and self.blk_rasp.state_VE4_close == True
):
self.blk_upr.set_valve("VE3", True)
elif self.blk_upr.state_VE2 == True:
return -3
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_rasp.state_chmb_open == True:
return -9
def close_VE3(self):
"""Close valve VE3.
| Cheking: VE3
"""
if self.blk_upr.state_VE3 == True:
self.blk_upr.set_valve("VE3", False)
def disable_sound(self):
"""Disable sound
| Cheking: sound
"""
self.blk_upr.set_sound(False)
def enable_PG(self):
"""Enable sensor PG:
| Cheking: PG, Presure for sensor.
"""
if (
self.blk_upr.state_PG == False
and self.blk_upr.pressure_ch < self.pressureSensorPG_enable
):
self.blk_upr.set_sensor_PG(True)
elif self.blk_upr.pressure_ch > self.pressureSensorPG_enable:
return -10
def disable_PG(self):
"""Disable sensor PG:
| Cheking: PG
"""
if self.blk_upr.state_PG == True:
self.blk_upr.set_sensor_PG(False)
def enable_inlent_ZQ1(self, value):
"""Open ZQ1 valve
"""
self.blk_upr.set_gas_inlet("ZQ1", True, value)
def change_ZQ1(self, value):
"""Change ZQ1 value
"""
if 0 <= value <= 255:
self.blk_upr.set_voltage_ZQ1 = value
def get_ZQ1(self):
return self.blk_upr.set_voltage_ZQ1
def close_ZQ1(self):
"""Close ZQ1 valve
"""
self.blk_upr.set_gas_inlet("ZQ1", False)
def enable_inlent_ZQ2(self, value):
"""Open ZQ2 valve
"""
self.blk_upr.set_gas_inlet("ZQ2", True, value)
def change_ZQ2(self, value):
"""Change ZQ2 value
"""
if 0 <= value <= 255:
self.blk_upr.set_voltage_ZQ2 = value
def get_ZQ2(self):
return self.blk_upr.set_voltage_ZQ2
def close_ZQ2(self):
"""Close ZQ2 valve
"""
self.blk_upr.set_gas_inlet("ZQ2", False)
def enable_heat_sub(self, value):
"""Enable heat of substrate
"""
self.blk_rasp.set_heat(True, value)
def change_heat_sub(self, value):
"""Chnage heat of substrate
"""
if 0 <= value <= 5500:
self.blk_rasp.seted_cur_heat = value
def get_heat_sub(self):
return self.blk_rasp.seted_cur_heat
def disable_heat_sub(self):
"""Disable heat of substrate
"""
self.blk_rasp.set_heat(False)
def enable_rotation_sub(self, value):
"""Enable rotation of substrate
"""
self.blk_rasp.set_rotation(True, value)
def change_rotation_sub(self, value):
"""Change rotation of substrate
"""
if 0 <= value <= 100:
self.blk_rasp.seted_rot_speed = value
def get_rotation_sub(self):
return self.blk_rasp.seted_rot_speed
def disable_rotation_sub(self):
"""Disable rotation of substrate
"""
self.blk_rasp.set_rotation(False)
def enable_dc_block(self):
"""Enable dc block
| Cheking: block state, chamber, VE1, water
"""
if (
self.blk_dc.block_dc_state == True
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE1 == False
and self.blk_upr.water_2 == True
and self.blk_dc.block_dc_enable == False
):
self.blk_dc.state_block_dc(True)
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_upr.water_2 == False:
return -14
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_dc.block_dc_state == False:
return -16
def disable_dc_block(self):
"""Disable dc block
"""
if self.blk_dc.block_dc_enable == True:
self.disable_dc_sputtering()
self.blk_dc.state_block_dc(False)
def enable_dc_sputtering(self, value):
"""Enable sputtering:
| Cheking: block enable, water, VE1, chamber
"""
if (
self.blk_dc.block_dc_enable == True
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE1 == False
and self.blk_upr.water_2 == True
):
self.blk_dc.current_dc(True, value)
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_upr.water_2 == False:
return -14
elif self.blk_dc.block_dc_enable == False:
return -15
def change_dc_sputtering(self, value):
"""Change current for dc block
"""
if 0 <= value <= 255:
self.blk_dc.range_current = value
def get_dc_sputtering(self):
return self.blk_dc.range_current
def disable_dc_sputtering(self):
"""Disable sputtering
"""
self.blk_dc.current_dc(False)
def enable_rf_block(self):
"""Enable rf block
| Cheking: block state, chamber, VE1, water
"""
if (
self.blk_rf.block_rf_state == True
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE1 == False
and self.blk_upr.water_2 == True
and self.blk_rf.block_rf_enable == False
):
self.blk_rf.state_block_rf(True)
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_upr.water_2 == False:
return -14
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_rf.block_rf_state == False:
return -17
def disable_rf_block(self):
"""Disable rf block
"""
if self.blk_rf.block_rf_enable == True:
self.disable_rf_sputtering()
self.blk_rf.state_block_rf(False)
def cheking_rf_sputtering(self):
"""Cheking rf magnetron by pre- sputtering process
"""
if (
self.blk_rf.block_rf_enable == True
and self.blk_rf.block_rf_ready == True
and self.blk_rf.block_rf_sputtering == False
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE1 == False
and self.blk_upr.water_2 == True
):
self.blk_rf.check_rf(True)
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_upr.water_2 == False:
return -14
elif self.blk_rf.block_rf_enable == False:
return -18
elif self.blk_rf.block_rf_ready == False:
return -19
def disable_cheking_rf_sputtering(self):
"""Disable pre- sputtering
"""
if self.blk_rf.block_rf_sputtering:
self.blk_rf.check_rf(False)
def enable_rf_sputtering(self, value):
"""Enable sputtering:
| Cheking: block enable, water, VE1, chamber
"""
if (
self.blk_rf.block_rf_enable == True
and self.blk_rf.block_rf_ready == True
and self.blk_rasp.state_chmb_open == False
and self.blk_upr.state_VE1 == False
and self.blk_upr.water_2 == True
):
self.blk_rf.power_rf(True, value)
elif self.blk_rasp.state_chmb_open == True:
return -9
elif self.blk_upr.state_VE1 == True:
return -8
elif self.blk_upr.water_2 == False:
return -14
elif self.blk_rf.block_rf_enable == False:
return -18
elif self.blk_rf.block_rf_ready == False:
return -19
def change_rf_sputtering(self, value):
"""Change current for dc block
"""
if 0 <= value <= 500:
self.blk_rf.range_power = value
def get_rf_sputtering(self):
return self.blk_rf.range_power
def disable_rf_sputtering(self):
"""Disable sputtering
"""
self.blk_rf.power_rf(False)
def reset_rf_error(self):
"""reset error bool
"""
self.blk_rf.error = False
"""
Enable/disable capacity С1/2 increase/reduction
"""
def Cap1upStart(self):
self.blk_rf.cap_state("C1", "up", True)
def Cap2upStart(self):
self.blk_rf.cap_state("C2", "up", True)
def Cap1upStop(self):
self.blk_rf.cap_state("C1", "up", False)
def Cap2upStop(self):
self.blk_rf.cap_state("C2", "up", False)
def Cap1downStart(self):
self.blk_rf.cap_state("C1", "down", True)
def Cap2downStart(self):
self.blk_rf.cap_state("C2", "down", True)
def Cap1downStop(self):
self.blk_rf.cap_state("C1", "down", False)
def Cap2downStop(self):
self.blk_rf.cap_state("C2", "down", False)
"""
Reading methodes
"""
def reader_m2(self):
"""Method 2 for read recv msg from bus
"""
print("Read from Bus: M2")
msg = self.bus.recv(0.02)
if msg is not None:
print(msg.data)
def reader_m4(self):
"""Method 4
"""
print("Read from Bus: M4")
self.noti = can.Notifier(self.bus, [self.parser.read_input])
def get_values_for_update(self):
"""
Return ALL Measurement
"""
rasp = self.blk_rasp.return_mes()
upr = self.blk_upr.return_mes()
dc = self.blk_dc.return_mes()
rf = self.blk_rf.return_mes()
return {**rasp, **upr, **dc, **rf}
def get_values_for_states(self):
"""
Return ALL States
"""
rasp = self.blk_rasp.return_states()
upr = self.blk_upr.return_states()
dc = self.blk_dc.return_states()
rf = self.blk_rf.return_states()
return {**rasp, **upr, **dc, **rf}