increase snmp precision. added IsegHVDataBase.py

This commit is contained in:
daq 2022-07-14 19:55:08 -05:00
parent 1aedd58726
commit ed59e33df7
6 changed files with 42 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.csv
*.dat
__pycache__

View File

@ -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
View 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)

View File

@ -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

Binary file not shown.

View File

@ -2,4 +2,4 @@ request packages
sudo apt install python3-tk snmp snmp-mibs-downloader
python3 -m pip pysimplegui
python3 -m pip install pysimplegui