-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopc_get_values.py
75 lines (63 loc) · 3.76 KB
/
opc_get_values.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
#!/usr/bin/env python
from PyOPC.OPCContainers import *
from PyOPC.XDAClient import XDAClient
from config import paths
def print_options((ilist,options)):
print ilist; print options; print
relay1=paths['relay1']
relay2=paths['relay2']
gen1=paths['gen1']
gen2=paths['gen2']
pump0=paths['pump0']
pump1=paths['pump1']
pump2=paths['pump2']
pump3=paths['pump3']
pump4=paths['pump4']
pump5=paths['pump5']
wtc=paths['wtc']
xda_relay1 = XDAClient(OPCServerAddress=relay1,ReturnErrorText=False)
xda_relay2 = XDAClient(OPCServerAddress=relay2,ReturnErrorText=False)
xda_gen1 = XDAClient(OPCServerAddress=gen1,ReturnErrorText=False)
xda_gen2 = XDAClient(OPCServerAddress=gen2,ReturnErrorText=False)
xda_pump0 = XDAClient(OPCServerAddress=pump0,ReturnErrorText=False)
xda_pump1 = XDAClient(OPCServerAddress=pump1,ReturnErrorText=False)
xda_pump2 = XDAClient(OPCServerAddress=pump2,ReturnErrorText=False)
xda_pump3 = XDAClient(OPCServerAddress=pump3,ReturnErrorText=False)
xda_pump4 = XDAClient(OPCServerAddress=pump4,ReturnErrorText=False)
xda_pump5 = XDAClient(OPCServerAddress=pump5,ReturnErrorText=False)
xda_wtc = XDAClient(OPCServerAddress=wtc,ReturnErrorText=False)
print xda_relay1.Read([ItemContainer(ItemName='relay1_breaker')])[0][0].Value
print xda_relay1.Read([ItemContainer(ItemName='relay1_load')])[0][0].Value
print xda_relay1.Read([ItemContainer(ItemName='relay1_flow')])[0][0].Value
print xda_relay2.Read([ItemContainer(ItemName='relay2_breaker')])[0][0].Value
print xda_relay2.Read([ItemContainer(ItemName='relay2_load')])[0][0].Value
print xda_relay2.Read([ItemContainer(ItemName='relay2_flow')])[0][0].Value
print xda_gen1.Read([ItemContainer(ItemName='gen1_breaker')])[0][0].Value
print xda_gen1.Read([ItemContainer(ItemName='gen1_generation')])[0][0].Value
print xda_gen2.Read([ItemContainer(ItemName='gen2_breaker')])[0][0].Value
print xda_gen2.Read([ItemContainer(ItemName='gen2_generation')])[0][0].Value
print xda_pump0.Read([ItemContainer(ItemName='PS0_PUMP_0')])[0][0].Value
print xda_pump0.Read([ItemContainer(ItemName='PS0_PUMP_1')])[0][0].Value
print xda_pump0.Read([ItemContainer(ItemName='PS0_VALVE_0')])[0][0].Value
print xda_pump0.Read([ItemContainer(ItemName='PS0_VALVE_1')])[0][0].Value
print xda_pump1.Read([ItemContainer(ItemName='PS1_PUMP_0')])[0][0].Value
print xda_pump1.Read([ItemContainer(ItemName='PS1_PUMP_1')])[0][0].Value
print xda_pump1.Read([ItemContainer(ItemName='PS1_VALVE_0')])[0][0].Value
print xda_pump1.Read([ItemContainer(ItemName='PS1_VALVE_1')])[0][0].Value
print xda_pump2.Read([ItemContainer(ItemName='PS2_PUMP_0')])[0][0].Value
print xda_pump2.Read([ItemContainer(ItemName='PS2_PUMP_1')])[0][0].Value
print xda_pump2.Read([ItemContainer(ItemName='PS2_VALVE_0')])[0][0].Value
print xda_pump2.Read([ItemContainer(ItemName='PS2_VALVE_1')])[0][0].Value
print xda_pump3.Read([ItemContainer(ItemName='PS3_PUMP_0')])[0][0].Value
print xda_pump3.Read([ItemContainer(ItemName='PS3_PUMP_1')])[0][0].Value
print xda_pump3.Read([ItemContainer(ItemName='PS3_VALVE_0')])[0][0].Value
print xda_pump3.Read([ItemContainer(ItemName='PS3_VALVE_1')])[0][0].Value
print xda_pump4.Read([ItemContainer(ItemName='PS4_PUMP_0')])[0][0].Value
print xda_pump4.Read([ItemContainer(ItemName='PS4_PUMP_1')])[0][0].Value
print xda_pump4.Read([ItemContainer(ItemName='PS4_VALVE_0')])[0][0].Value
print xda_pump4.Read([ItemContainer(ItemName='PS4_VALVE_1')])[0][0].Value
print xda_pump5.Read([ItemContainer(ItemName='PS5_PUMP_0')])[0][0].Value
print xda_pump5.Read([ItemContainer(ItemName='PS5_PUMP_1')])[0][0].Value
print xda_pump5.Read([ItemContainer(ItemName='PS5_VALVE_0')])[0][0].Value
print xda_pump5.Read([ItemContainer(ItemName='PS5_VALVE_1')])[0][0].Value
print xda_wtc.Read([ItemContainer(ItemName='H20_QUALITY')])[0][0].Value