Compare commits

..

No commits in common. "101e758c4db0d1a3ece44bd464bfbf14d4735a95" and "785dd86de52b6333698ed88692009146469da2a7" have entirely different histories.

2 changed files with 16 additions and 30 deletions

View File

@ -8,19 +8,19 @@ import socket
import sys
import time
import influxdb_client
from influxdb_client import InfluxDBClient, Point, WritePrecision
from influxdb_client.client.write_api import SYNCHRONOUS, ASYNCHRONOUS
# import influxdb_client
# from influxdb_client import InfluxDBClient, Point, WritePrecision
# from influxdb_client.client.write_api import SYNCHRONOUS, ASYNCHRONOUS
#------ database
with open('ISEG_TOKEN.txt', 'r') as f:
token = f.readline().replace('\n', '')
# #------ database
# with open('ISEG_TOKEN.txt', 'r') as f:
# token = f.readline().replace('\n', '')
org = "FSUFoxLab"
ip = "https://fsunuc.physics.fsu.edu/influx/"
write_client = influxdb_client.InfluxDBClient(url=ip, token=token, org=org)
bucket = "ISEG"
write_api = write_client.write_api(write_options=ASYNCHRONOUS)
# org = "FSUFoxLab"
# ip = "https://fsunuc.physics.fsu.edu/influx/"
# write_client = influxdb_client.InfluxDBClient(url=ip, token=token, org=org)
# bucket = "ISEG"
# write_api = write_client.write_api(write_options=ASYNCHRONOUS)
#assign a port, to prevent the script run mulitple time
s = socket.socket()
@ -61,7 +61,7 @@ nChPerMod = []
for k in range(0, nMod):
nChPerMod.append(len(modChList[k]))
nChannel = len(chList)
updateTime = 3 #sec
updateTime = 1 #sec
# print(onOffList)
@ -322,21 +322,11 @@ class MyWindow(QMainWindow):
outVList = mpod.GetAllOutputHV()
outIList = mpod.GetAllLC()
# print(outVList)
if self.chkDB.checkState() == Qt.CheckState.Checked:
points = []
for k in range(0, nMod):
for i, a in enumerate(modChList[k]) :
self.txtVOut[k][i].setText("{:.2f}".format(outVList[sum(nChPerMod[:k]) + i]))
self.txtIOut[k][i].setText("{:.2f}".format(outIList[sum(nChPerMod[:k]) + i]))
if self.chkDB.checkState() == Qt.CheckState.Checked:
points.append(Point("Voltage").tag("Ch",int(chList[i])).field("value",float(outVList[i])))
points.append(Point("LeakageCurrent").tag("Ch",int(chList[i])).field("value",float(outIList[i])))
if self.chkDB.checkState() == Qt.CheckState.Checked:
write_api.write(bucket=bucket, org=org, record=points)
if __name__ == "__main__":
app = QApplication(sys.argv)

View File

@ -2,20 +2,16 @@
in Ubuntu 20+
~>sudo apt install python3-pyqt6 snmp snmp-mibs-downloader curl python3-pip
~>python3 -m pip install pyqt6 influxdb-client
~>sudo apt install python3-tk snmp snmp-mibs-downloader curl python3-pip
~>python3 -m pip install pysimplegui influxdb-client
also, download the https://fsunuc.physics.fsu.edu/wiki/images/5/53/WIENER-CRATE-MIB.txt and put in /usr/share/snmp/mibs/
# Usage
~>python3 IsegGUI.py <IP>
~>python3 IsegHVController.py <IP>
# DataBase connection
for influxDB V1, simply put the database IP. since 2024, we upgraded to influxDB V2, a token is needed for secure connection. For Token, please check https://fsunuc.physics.fsu.edu/elog/fsunuc/28
# old GUI using PySimpleGUI
Since the PySimpleGUI think user should register, so We use Qt6. The IsegHVController.py is no longer maintain.
for influxDB V1, simply put the database IP. since 2024, we upgraded to influxDB V2, a token is needed for secure connection. For Token, please check https://fsunuc.physics.fsu.edu/elog/fsunuc/28