This branch holds versions of the ISEG GUI that work with the ISEG in lab 220. Not sure if it will work with others.
This commit is contained in:
parent
57eca380b3
commit
35101bed0d
47
IsegGUI.py
Executable file → Normal file
47
IsegGUI.py
Executable file → Normal file
|
|
@ -134,6 +134,11 @@ class MyWindow(QMainWindow):
|
|||
gLayout.addWidget(self.AllChkOff, 2, 1)
|
||||
self.AllChkOff.clicked.connect(partial(self.SetAllOnOff))
|
||||
|
||||
#-------------------Jake added
|
||||
self.btnReset = QPushButton("Reset Module Faults (Clear 10)")
|
||||
gLayout.addWidget(self.btnReset, 2, 2)
|
||||
self.btnReset.clicked.connect(self.ResetAction)
|
||||
|
||||
#=========== set tab
|
||||
self.tabWidget = QTabWidget(self)
|
||||
layout.addWidget(self.tabWidget)
|
||||
|
|
@ -291,17 +296,22 @@ class MyWindow(QMainWindow):
|
|||
self.timer.start(int(sec * 1000))
|
||||
|
||||
def SetHV(self, mod, ch):
|
||||
# Use the actual channel address from our list
|
||||
ch_addr = modChList[mod][ch]
|
||||
value = float(self.txtV[mod][ch].text())
|
||||
print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(value))
|
||||
mpod.SetHV( mod*100 + ch, value)
|
||||
newValue = mpod.GetHV(mod*100+ch)
|
||||
print(f"Setting Ch {ch_addr} to {value} V")
|
||||
|
||||
mpod.SetHV(ch_addr, value)
|
||||
newValue = mpod.GetHV(ch_addr)
|
||||
self.txtV[mod][ch].setText("{:.1f}".format(newValue))
|
||||
|
||||
def SetI(self, mod, ch):
|
||||
ch_addr = modChList[mod][ch]
|
||||
value = float(self.txtI[mod][ch].text())
|
||||
print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(value))
|
||||
mpod.SetCurrent( mod*100 + ch, value/1000.)
|
||||
newValue = mpod.GetCurrent(mod*100+ch)
|
||||
print(f"Setting Ch {ch_addr} limit to {value} mA")
|
||||
|
||||
mpod.SetCurrent(ch_addr, value/1000.)
|
||||
newValue = mpod.GetCurrent(ch_addr)
|
||||
self.txtI[mod][ch].setText("{:.1f}".format(newValue))
|
||||
|
||||
def SetAllOnOff(self):
|
||||
|
|
@ -316,17 +326,30 @@ class MyWindow(QMainWindow):
|
|||
time.sleep(0.01) # wait 10 mili-sec
|
||||
|
||||
print("========== done")
|
||||
#-------------Jake added
|
||||
def ResetAction(self):
|
||||
print("Clearing faults channel-by-channel...")
|
||||
# Loop through all modules
|
||||
for k in range(0, nMod):
|
||||
# Loop through all channels in this module
|
||||
for i, ch_addr in enumerate(modChList[k]):
|
||||
# Reset each specific channel (e.g., 100, 101, 400...)
|
||||
mpod.ResetChannel(ch_addr)
|
||||
time.sleep(0.01) # 10ms delay to avoid flooding the SNMP bus
|
||||
|
||||
time.sleep(0.5)
|
||||
self.updateTimer()
|
||||
print("Individual channel resets sent. Check if the 'OK' LED is green.")
|
||||
|
||||
def SetOnOff(self, mod, ch):
|
||||
ch_addr = modChList[mod][ch] # Get real address (e.g. 100)
|
||||
state = self.chkON[mod][ch].checkState()
|
||||
|
||||
if state == Qt.CheckState.Checked:
|
||||
if onOffList[sum(nChPerMod[:mod]) + ch] == 3 :
|
||||
mpod.SwitchOnHV(mod*100 + ch, 2)
|
||||
mpod.SwitchOnHV( mod*100 + ch, 1)
|
||||
onOffList[sum(nChPerMod[:mod]) + ch] = 1
|
||||
# Use the address instead of the mod*100 math
|
||||
mpod.SwitchOnHV(ch_addr, 1)
|
||||
else:
|
||||
mpod.SwitchOnHV( mod*100 + ch, 0)
|
||||
onOffList[sum(nChPerMod[:mod]) + ch] = 0
|
||||
mpod.SwitchOnHV(ch_addr, 0)
|
||||
|
||||
value = mpod.IsHVOn(mod*100 + ch)
|
||||
print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(state) + " | " + str(onOffList[sum(nChPerMod[:mod]) + ch]) + " | " + str(value))
|
||||
|
|
|
|||
17
IsegLibrary.py
Executable file → Normal file
17
IsegLibrary.py
Executable file → Normal file
|
|
@ -232,6 +232,20 @@ class Mpod:
|
|||
except:
|
||||
print("either ch is not int or rate is not float")
|
||||
|
||||
#-------------------------Jake added functions for a channel reset:
|
||||
def ResetChannel(self, ch):
|
||||
"""Sends the clear events signal (10) to a specific channel."""
|
||||
if (self.isConnected == False): return 0
|
||||
# 10 is the magic number to clear latched trips/errors
|
||||
return self.SendCmd(1, "outputSwitch.u" + str(ch) + " i " + str(10))
|
||||
|
||||
def ResetModule(self, modIndex):
|
||||
"""Sends the clear events signal to an entire module group."""
|
||||
if (self.isConnected == False): return 0
|
||||
# Try removing the 'u' prefix which is specific to output channels
|
||||
# and using modIndex + 1 since SNMP tables are 1-indexed.
|
||||
return self.SendCmd(1, "groupsSwitch." + str(modIndex + 1) + " i " + str(10))
|
||||
|
||||
|
||||
#===================== Auxliary function
|
||||
def SplitChList(chList):
|
||||
|
|
@ -249,6 +263,9 @@ def SplitChList(chList):
|
|||
for i in range(0, len(sep)-1):
|
||||
newChList.append( chList[sep[i]:sep[i+1]] )
|
||||
return newChList
|
||||
|
||||
|
||||
|
||||
#===================== SandBox
|
||||
|
||||
#mpod = Mpod("128.186.111.101")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user