increase snmp precision. added IsegHVDataBase.py
This commit is contained in:
parent
1aedd58726
commit
ed59e33df7
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.csv
|
||||
*.dat
|
||||
__pycache__
|
||||
|
|
|
@ -25,7 +25,7 @@ iList = iseg.GetAllCurrent() # get all current
|
|||
outVList = iseg.GetAllOutputHV()
|
||||
outIList = iseg.GetAllLC()
|
||||
|
||||
nChannel = 10 #len(chList)
|
||||
nChannel = len(chList)
|
||||
updateTime = 60 #sec
|
||||
|
||||
fileName = ''
|
||||
|
@ -158,7 +158,7 @@ while True:
|
|||
window[("b%d" % chList[i])].update("%.3f" % (outIList[i]*1e6))
|
||||
#==== To DataBase
|
||||
tempFile.write("Voltage,Ch=%d value=%f\n" % (chList[i], outVList[i]))
|
||||
tempFile.write("LeakageCurrent,Ch=%d value=%f\n" % (chList[i], outIList[i]))
|
||||
tempFile.write("LeakageCurrent,Ch=%d value=%f\n" % (chList[i], outIList[i]*1e6))
|
||||
|
||||
tempFile.close()
|
||||
|
||||
|
|
36
IsegHVDataBase.py
Executable file
36
IsegHVDataBase.py
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import IsegLibrary as iseg
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
|
||||
#assign a port, to prevent the script run mulitple time
|
||||
s = socket.socket()
|
||||
host = socket.gethostname()
|
||||
port = 4305
|
||||
s.bind((host,port))
|
||||
|
||||
|
||||
chList = iseg.GetChList()
|
||||
nChannel = len(chList)
|
||||
|
||||
updateTime = 2 #sec
|
||||
|
||||
# Event Loop to process "events" and get the "values" of the inputs
|
||||
while True:
|
||||
outVList = iseg.GetAllOutputHV()
|
||||
outIList = iseg.GetAllLC()
|
||||
|
||||
tempFile = open("temp.dat", "w")
|
||||
|
||||
for i in range(0, nChannel):
|
||||
tempFile.write("Voltage,Ch=%d value=%f\n" % (chList[i], outVList[i]))
|
||||
tempFile.write("LeakageCurrent,Ch=%d value=%f\n" % (chList[i], outIList[i]*1e6))
|
||||
|
||||
tempFile.close()
|
||||
|
||||
os.system("curl -XPOST http://128.186.111.107:8086/write?db=testing --data-binary @temp.dat")
|
||||
|
||||
time.sleep(updateTime)
|
||||
|
|
@ -3,7 +3,8 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
cmd0Str = "-v 2c -m +WIENER-CRATE-MIB -c guru 128.186.111.101 "
|
||||
#cmd0Str = "-v2c -m +WIENER-CRATE-MIB -c guru 128.186.111.101 "
|
||||
cmd0Str = "-v2c -Op .12 -m +WIENER-CRATE-MIB -c guru 128.186.111.101 "
|
||||
|
||||
def SendCmd(option,cmd):
|
||||
if option == 0 :
|
||||
|
|
BIN
IsegLibrary.pyc
Normal file
BIN
IsegLibrary.pyc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user