Skip to content

Commit

Permalink
Merge pull request #311 from OSU-CMS/Laudastuff
Browse files Browse the repository at this point in the history
Lauda Stuff
  • Loading branch information
mlj5j authored Oct 30, 2024
2 parents f872ed7 + 043a8b7 commit dc9cd29
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 11 deletions.
91 changes: 91 additions & 0 deletions Gui/QtGUIutils/LaudaApp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QWidget
import Gui.siteSettings as site_settings
from icicle.icicle.lauda import Lauda
import os


class LaudaWidget(QWidget):

def __init__(self, dimension):

self.myLauda = Lauda(resource=site_settings.lauda_resource)

super(LaudaWidget, self).__init__()
self.Ph2ACFDirectory = os.getenv("GUI_dir")
self.setupUi()
self.show()

def setupUi(self):
kMinimumWidth = 150
kMaximumWidth = 150
kMinimumHeight = 30
kMaximumHeight = 100

self.StartChillerButton = QtWidgets.QPushButton("Start")
self.StartChillerButton.setMinimumWidth(kMinimumWidth)
self.StartChillerButton.setMaximumWidth(kMaximumWidth)
self.StartChillerButton.setMinimumHeight(kMinimumHeight)
self.StartChillerButton.setMaximumHeight(kMaximumHeight)
self.StartChillerButton.clicked.connect(self.startChiller)
self.StartChillerButton.setCheckable(True)

self.StopChillerButton = QtWidgets.QPushButton("Stop")
self.StopChillerButton.setMinimumWidth(kMinimumWidth)
self.StopChillerButton.setMaximumWidth(kMaximumWidth)
self.StopChillerButton.setMinimumHeight(kMinimumHeight)
self.StopChillerButton.setMaximumHeight(kMaximumHeight)
self.StopChillerButton.clicked.connect(self.stopChiller)
self.StopChillerButton.setCheckable(True)

self.SetTempButton = QtWidgets.QPushButton("Set Temperature")
self.SetTempButton.setMinimumWidth(kMinimumWidth)
self.SetTempButton.setMaximumWidth(kMaximumWidth)
self.SetTempButton.setMinimumHeight(kMinimumHeight)
self.SetTempButton.setMaximumHeight(kMaximumHeight)
self.SetTempButton.clicked.connect(self.setTemperature)
self.SetTempButton.setCheckable(True)

self.SetTempEdit = QtWidgets.QLineEdit("")
self.SetTempEdit.setMinimumWidth(140)
self.SetTempEdit.setEchoMode(QtWidgets.QLineEdit.Normal)
self.SetTempEdit.setPlaceholderText("Set Temperature")
self.SetTempEdit.textChanged.connect(lambda : self.SetTempButton.setChecked(False))

self.ChillerLayout = QtWidgets.QGridLayout(self)
self.ChillerLayout.addWidget(self.StartChillerButton, 0, 0, 1, 1)
self.ChillerLayout.addWidget(self.StopChillerButton,1,0,1,1)
self.ChillerLayout.addWidget(self.SetTempButton,2,0,1,1)
self.ChillerLayout.addWidget(self.SetTempEdit,2,1,1,2)

self.setLayout(self.ChillerLayout)

def resourceExists(self):
return False if self.lauda_resource == None else True

def startChiller(self):
self.StartChillerButton.setChecked(True)
self.StopChillerButton.setChecked(False)

self.myLauda.set("START","START")

def stopChiller(self):
self.StartChillerButton.setChecked(False)
self.StopChillerButton.setChecked(True)

self.myLauda.set("STOP", "STOP")

def setTemperature(self):
self.SetTempButton.setChecked(True)

try:
self.myLauda.set("TEMPERATURE_TARGET",float(self.setTempEdit.text()))
except ValueError:
print("Temperature target must be a float.")

if __name__ == "__main__":
import sys

app = QtWidgets.QApplication(sys.argv)
ui = LaudaWidget(500)
sys.exit(app.exec_())
43 changes: 32 additions & 11 deletions Gui/QtGUIutils/QtApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import Gui.siteSettings as site_settings
from Gui.GUIutils.FirmwareUtil import fwStatusParser, FwStatusCheck
from Gui.GUIutils.guiUtils import isActive
from Gui.QtGUIutils.LaudaApp import LaudaWidget
from Gui.QtGUIutils.PeltierCoolingApp import Peltier
from Gui.QtGUIutils.QtFwCheckWindow import QtFwCheckWindow
from Gui.QtGUIutils.QtFwStatusWindow import QtFwStatusWindow
Expand All @@ -52,6 +53,7 @@




from Gui.python.logging_config import logger


Expand Down Expand Up @@ -707,7 +709,7 @@ def createMain(self):
kMaximumWidth = 150
kMinimumHeight = 30
kMaximumHeight = 100

self.SummaryButton = QPushButton("&Status summary")
if not self.expertMode:
self.SummaryButton.setDisabled(True)
Expand Down Expand Up @@ -811,6 +813,12 @@ def createMain(self):
layout.addWidget(ReviewLabel, 2, 1, 1, 2)
layout.addWidget(self.ReviewModuleButton, 3, 0, 1, 1)
layout.addWidget(self.ReviewModuleEdit, 3, 1, 1, 2)


self.ChillerOption = QGroupBox("Chiller", self)
self.ChillerLayout = QGridLayout()
self.ChillerOption.setLayout(self.ChillerLayout)

layout.addWidget(self.ThermalTestButton, 4, 0, 1, 1)
layout.addWidget(self.ThermalProfileEdit, 4, 1, 1, 1)
layout.addWidget(self.AbortThermalTestButton, 5, 0, 1, 1)
Expand All @@ -835,7 +843,7 @@ def createMain(self):
####################################################
# Functions for expert mode (END)
####################################################

self.MainOption.setLayout(layout)

self.AppOption = QGroupBox()
Expand Down Expand Up @@ -888,17 +896,28 @@ def createMain(self):
#self.mainLayout.addWidget(self.HVPowerRemoteControl, 2, 0, 1, 1)
self.mainLayout.addWidget(self.HVPowerGroup, 2, 0, 1, 1)
#self.mainLayout.addWidget(self.LVPowerRemoteControl, 2, 1, 1, 1)
self.mainLayout.addWidget(self.LVPowerGroup, 2, 1, 1, 1)
self.mainLayout.addWidget(self.LVPowerGroup, 2, 1, 1, 3)
#self.mainLayout.addWidget(self.relay_remote_control, 4, 0, 1, 1)
self.mainLayout.addWidget(self.relay_group, 3, 0, 1, 1)
#self.mainLayout.addWidget(self.multimeter_remote_control, 4, 1, 1, 1)
self.mainLayout.addWidget(self.multimeter_group, 3, 1, 1, 1)
self.mainLayout.addWidget(self.ArduinoGroup, 5, 1, 1, 1)
self.mainLayout.addWidget(self.ArduinoControl, 4, 1, 1, 1)
self.mainLayout.addWidget(self.MainOption, 0, 1, 2, 1)
self.mainLayout.addWidget(self.PeltierBox, 4, 0, 4, 1)
self.mainLayout.addWidget(self.AppOption, 6, 1, 1, 1)
self.mainLayout.addWidget(self.LogoGroupBox, 7, 1, 1, 1)
self.mainLayout.addWidget(self.multimeter_group, 3, 1, 1, 3)
self.mainLayout.addWidget(self.MainOption, 0, 1, 2, 3)
self.mainLayout.addWidget(self.PeltierBox, 4, 0, 3, 1)
self.mainLayout.addWidget(self.LogoGroupBox, 7, 0, 1, 4)

# Placing in try/except to avoid needing to change siteConfig
try:
self.MyLauda = LaudaWidget(100)
self.ChillerLayout.addWidget(self.MyLauda)

self.mainLayout.addWidget(self.ChillerOption, 4, 1, 3, 2)
self.mainLayout.addWidget(self.ArduinoControl, 4, 3, 1, 1)
self.mainLayout.addWidget(self.ArduinoGroup, 5, 3, 1, 2)
self.mainLayout.addWidget(self.AppOption, 6, 3, 1, 1)
except AttributeError:
self.mainLayout.addWidget(self.ArduinoControl, 4, 1, 1, 3)
self.mainLayout.addWidget(self.ArduinoGroup, 5, 1, 1, 3)
self.mainLayout.addWidget(self.AppOption, 6, 1, 1, 3)

self.setDefault()

Expand Down Expand Up @@ -1038,6 +1057,7 @@ def destroyMain(self):
self.ArduinoControl.deleteLater()
self.PeltierBox.deleteLater()
self.MainOption.deleteLater()
self.ChillerOption.deleteLater()
self.AppOption.deleteLater()
self.LogoGroupBox.deleteLater()
self.mainLayout.removeWidget(self.FirmwareStatus)
Expand All @@ -1054,6 +1074,7 @@ def destroyMain(self):
self.mainLayout.removeWidget(self.ArduinoControl)
self.mainLayout.removeWidget(self.PeltierBox)
self.mainLayout.removeWidget(self.MainOption)
self.mainLayout.removeWidget(self.ChillerOption)
self.mainLayout.removeWidget(self.AppOption)
self.mainLayout.removeWidget(self.LogoGroupBox)
QApplication.closeAllWindows()
Expand Down Expand Up @@ -1290,7 +1311,7 @@ def goExpert(self):
self.destroyMain()
self.createMain()
self.checkFirmware()

###############################################################
## Global stop signal
###############################################################
Expand Down

0 comments on commit dc9cd29

Please sign in to comment.