From ed59e33df7a097a9cf02c22c5c059f1d47bed107 Mon Sep 17 00:00:00 2001 From: daq Date: Thu, 14 Jul 2022 19:55:08 -0500 Subject: [PATCH] increase snmp precision. added IsegHVDataBase.py --- .gitignore | 1 + IsegHVController.py | 4 ++-- IsegHVDataBase.py | 36 ++++++++++++++++++++++++++++++++++++ IsegLibrary.py | 3 ++- IsegLibrary.pyc | Bin 0 -> 6554 bytes README.md | 2 +- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100755 IsegHVDataBase.py create mode 100644 IsegLibrary.pyc diff --git a/.gitignore b/.gitignore index 7631a5d..65b9e35 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.csv *.dat +__pycache__ diff --git a/IsegHVController.py b/IsegHVController.py index 3ca5b2b..df83ff3 100755 --- a/IsegHVController.py +++ b/IsegHVController.py @@ -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() diff --git a/IsegHVDataBase.py b/IsegHVDataBase.py new file mode 100755 index 0000000..68ecd09 --- /dev/null +++ b/IsegHVDataBase.py @@ -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) + diff --git a/IsegLibrary.py b/IsegLibrary.py index 2b42ff9..9b92df0 100755 --- a/IsegLibrary.py +++ b/IsegLibrary.py @@ -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 : diff --git a/IsegLibrary.pyc b/IsegLibrary.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8bc3c23366627c70cdba8aab1430694a58631cc GIT binary patch literal 6554 zcmdT}TW=dx5T0W@7duYUq@|`Ug)JqjOKT?%2$hJUmh_THiBqjh0+kTjcsKDT>$SUQ z-BPK2K&^Py)5{TZ``C&p~mDAbK>Ym0Zwcg@1QdHdnr!t&xbMxknKwt|*Xn!Qmh z-T0zdDwT?*nUYZjC@Fph_?hQN|HkCGfU}*T;35DCiE_^s76vTLnP*Iqmtt35XoQEk)(MzRXDtf^+N!ntB(_BMa+&|N1M!;0^S(dHr zG9f(-;@6v-PH4Dlca263mZj5ipQo0$ZRjgpa;mk4(P)Nl!=E!|jDo?#uNx(1c+_=c zmKk&ofrhR*o~JR<`W1~|h-fB1#C!-+t=lt|FbI>(Ykp_&ZmlEt}z`)ThFU&JXLi8uhP1hQA zXWF(NPcLd`vr=AuaR1vy;g{U?zzUufo6kh%isRe!b;g}Vox~g}t0vk{VlZ(*Rk2nq zX~!gB7pzG(IT(Y2l35+OmkD~o1y+@87_NeLS&LlBH7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