Compare commits

..

2 Commits

Author SHA1 Message Date
Ryan Tang 101e758c4d edit README 2024-05-16 18:14:57 -04:00
Ryan Tang e14c99cbe1 complete the new IsegGUI.py 2024-05-16 18:12:42 -04:00
2 changed files with 30 additions and 16 deletions

View File

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

View File

@ -2,16 +2,20 @@
in Ubuntu 20+ in Ubuntu 20+
~>sudo apt install python3-tk snmp snmp-mibs-downloader curl python3-pip ~>sudo apt install python3-pyqt6 snmp snmp-mibs-downloader curl python3-pip
~>python3 -m pip install pysimplegui influxdb-client ~>python3 -m pip install pyqt6 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/ also, download the https://fsunuc.physics.fsu.edu/wiki/images/5/53/WIENER-CRATE-MIB.txt and put in /usr/share/snmp/mibs/
# Usage # Usage
~>python3 IsegHVController.py <IP> ~>python3 IsegGUI.py <IP>
# DataBase connection # 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 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.