Compare commits
No commits in common. "101e758c4db0d1a3ece44bd464bfbf14d4735a95" and "785dd86de52b6333698ed88692009146469da2a7" have entirely different histories.
101e758c4d
...
785dd86de5
34
IsegGUI.py
34
IsegGUI.py
|
@ -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 = 3 #sec
|
updateTime = 1 #sec
|
||||||
|
|
||||||
# print(onOffList)
|
# print(onOffList)
|
||||||
|
|
||||||
|
@ -322,21 +322,11 @@ 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)
|
||||||
|
|
10
README.md
10
README.md
|
@ -2,20 +2,16 @@
|
||||||
|
|
||||||
in Ubuntu 20+
|
in Ubuntu 20+
|
||||||
|
|
||||||
~>sudo apt install python3-pyqt6 snmp snmp-mibs-downloader curl python3-pip
|
~>sudo apt install python3-tk snmp snmp-mibs-downloader curl python3-pip
|
||||||
~>python3 -m pip install pyqt6 influxdb-client
|
~>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/
|
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 IsegGUI.py <IP>
|
~>python3 IsegHVController.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.
|
|
Loading…
Reference in New Issue
Block a user