added Input to database
This commit is contained in:
parent
d607c27c42
commit
e5c1cf88ee
|
@ -31,41 +31,60 @@ OPEN = 0
|
||||||
CLOSED = 1
|
CLOSED = 1
|
||||||
|
|
||||||
input_normal= [
|
input_normal= [
|
||||||
OPEN, #// Reset switch
|
OPEN, #// 1 Reset switch
|
||||||
CLOSED, #// Emergency source trip switch
|
CLOSED, #// 2 Emergency source trip switch
|
||||||
CLOSED, #// Cage door contact
|
CLOSED, #// 3 Cage door contact
|
||||||
CLOSED, #// Fume hood flow switch
|
CLOSED, #// 4 Fume hood flow switch
|
||||||
OPEN, #// Vacuum condition - gnd
|
OPEN, #// 5 Vacuum condition - gnd
|
||||||
CLOSED, #// Tritium monitor
|
CLOSED, #// 6 Tritium monitor
|
||||||
OPEN, #// UNUSED
|
OPEN, #// 7 UNUSED
|
||||||
CLOSED, #// Power failure
|
CLOSED, #// 8 Power failure
|
||||||
CLOSED, #// Coolant flow - gnd
|
CLOSED, #// 9 Coolant flow - gnd
|
||||||
OPEN, #// Vacuum condition - mid
|
OPEN, #//10 Vacuum condition - mid
|
||||||
OPEN, #// UNUSED
|
OPEN, #//11 UNUSED
|
||||||
CLOSED, #// Coolant flow - high
|
CLOSED, #//12 Coolant flow - high
|
||||||
OPEN, #// Smoke detector - high
|
OPEN, #//13 Smoke detector - high
|
||||||
OPEN, #// UNUSED
|
OPEN, #//14 UNUSED
|
||||||
OPEN, #// UNUSED
|
OPEN, #//15 UNUSED
|
||||||
OPEN #// UNUSED
|
OPEN #//16 UNUSED
|
||||||
]
|
]
|
||||||
|
|
||||||
in_txt = [ "Reset Button",
|
in_txt = [ "Reset Button", #1
|
||||||
"Emergency Switch",
|
"Emergency Switch", #2
|
||||||
"Cage Door Open",
|
"Cage Door Open", #3
|
||||||
"Fume Hood Flow",
|
"Fume Hood Flow", #4
|
||||||
"Vacuum Gauge 2",
|
"Vacuum Gauge 2", #5
|
||||||
"Tritium Monitor",
|
"Tritium Monitor", #6
|
||||||
"error: port map",
|
"error: port map", #7
|
||||||
"Bldg Power Fail",
|
"Bldg Power Fail", #8
|
||||||
"Coolant Flow 2",
|
"Coolant Flow 2", #9
|
||||||
"Vacuum Gauge 1",
|
"Vacuum Gauge 1", #10
|
||||||
"error: port map",
|
"error: port map", #11
|
||||||
"Coolant Flow 1",
|
"Coolant Flow 1", #12
|
||||||
"Smoke at Source",
|
"Smoke at Source", #13
|
||||||
"error: port map",
|
"error: port map", #14
|
||||||
"error: port map",
|
"error: port map", #15
|
||||||
"error: port map",
|
"error: port map" #16
|
||||||
""]
|
]
|
||||||
|
|
||||||
|
in_short_txt = [
|
||||||
|
"ResetButton", #1
|
||||||
|
"EmergencySwitch", #2
|
||||||
|
"CageDoorOpen", #3
|
||||||
|
"FumeHoodFlow", #4
|
||||||
|
"VacuumGauge2", #5
|
||||||
|
"TritiumMonitor", #6
|
||||||
|
"NotUsed", #7
|
||||||
|
"BldgPowerFail", #8
|
||||||
|
"CoolantFlow2", #9
|
||||||
|
"VacuumGauge1", #10
|
||||||
|
"NotUsed", #11
|
||||||
|
"CoolantFlow1", #12
|
||||||
|
"SmokeAtSource", #13
|
||||||
|
"NotUsed", #14
|
||||||
|
"NotUsed", #15
|
||||||
|
"NotUsed" #16
|
||||||
|
]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if ser.in_waiting > 0:
|
if ser.in_waiting > 0:
|
||||||
|
@ -93,6 +112,7 @@ while True:
|
||||||
# print(line)
|
# print(line)
|
||||||
point = Point("Measurement")
|
point = Point("Measurement")
|
||||||
point2 = Point("Status")
|
point2 = Point("Status")
|
||||||
|
point3 = Point("Input")
|
||||||
|
|
||||||
for key, value in format_value.items():
|
for key, value in format_value.items():
|
||||||
# print(f"{key} value={value}")
|
# print(f"{key} value={value}")
|
||||||
|
@ -143,6 +163,9 @@ while True:
|
||||||
point2.field("preaccl", 0).field("valve1", 0).field("valve2", 0).field("hv", 0).field("boiler", 0).field("ion",0)
|
point2.field("preaccl", 0).field("valve1", 0).field("valve2", 0).field("hv", 0).field("boiler", 0).field("ion",0)
|
||||||
|
|
||||||
for i in range(16):
|
for i in range(16):
|
||||||
|
if in_short_txt[i] == "NotUsed" :
|
||||||
|
continue
|
||||||
|
point3.field(in_short_txt[i], int(list[i]))
|
||||||
if int(list[i]) != input_normal[i]:
|
if int(list[i]) != input_normal[i]:
|
||||||
file.write(f"#{i}--{in_txt[i]}\n")
|
file.write(f"#{i}--{in_txt[i]}\n")
|
||||||
|
|
||||||
|
@ -150,7 +173,9 @@ while True:
|
||||||
# os.system(cmd)
|
# os.system(cmd)
|
||||||
print(point)
|
print(point)
|
||||||
print(point2)
|
print(point2)
|
||||||
|
print(point3)
|
||||||
write_api.write(bucket=bucket, org=org, record=point)
|
write_api.write(bucket=bucket, org=org, record=point)
|
||||||
write_api.write(bucket=bucket, org=org, record=point2)
|
write_api.write(bucket=bucket, org=org, record=point2)
|
||||||
|
write_api.write(bucket=bucket, org=org, record=point3)
|
||||||
except:
|
except:
|
||||||
print("problem pushing data")
|
print("problem pushing data")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user