|
|
@ -195,7 +195,6 @@ class Graphs:
|
|
|
|
ld_i_set_axis.showLabel()
|
|
|
|
ld_i_set_axis.showLabel()
|
|
|
|
ld_i_set_graph.setAxisItems({'left': ld_i_set_axis})
|
|
|
|
ld_i_set_graph.setAxisItems({'left': ld_i_set_axis})
|
|
|
|
ld_i_set_graph.addItem(self._ld_i_set_plot)
|
|
|
|
ld_i_set_graph.addItem(self._ld_i_set_plot)
|
|
|
|
ld_i_set_graph.y_range_controller = LiveAxisRange(fixed_range=[0.0, 0.4])
|
|
|
|
|
|
|
|
self.ld_i_set_connector = DataConnector(self._ld_i_set_plot, max_points=self.max_samples)
|
|
|
|
self.ld_i_set_connector = DataConnector(self._ld_i_set_plot, max_points=self.max_samples)
|
|
|
|
self.connectors += [self.ld_i_set_connector]
|
|
|
|
self.connectors += [self.ld_i_set_connector]
|
|
|
|
|
|
|
|
|
|
|
@ -219,6 +218,7 @@ class Graphs:
|
|
|
|
tec_i_axis.showLabel()
|
|
|
|
tec_i_axis.showLabel()
|
|
|
|
tec_i_graph.setAxisItems({'left': tec_i_axis})
|
|
|
|
tec_i_graph.setAxisItems({'left': tec_i_axis})
|
|
|
|
tec_i_graph.addLegend(brush=(50, 50, 200, 150))
|
|
|
|
tec_i_graph.addLegend(brush=(50, 50, 200, 150))
|
|
|
|
|
|
|
|
tec_i_graph.y_range_controller = LiveAxisRange(fixed_range=[-1.0, 1.0])
|
|
|
|
tec_i_graph.addItem(self._tec_i_target_plot)
|
|
|
|
tec_i_graph.addItem(self._tec_i_target_plot)
|
|
|
|
tec_i_graph.addItem(self._tec_i_measure_plot)
|
|
|
|
tec_i_graph.addItem(self._tec_i_measure_plot)
|
|
|
|
self.tec_i_target_connector = DataConnector(self._tec_i_target_plot, max_points=self.max_samples)
|
|
|
|
self.tec_i_target_connector = DataConnector(self._tec_i_target_plot, max_points=self.max_samples)
|
|
|
@ -400,11 +400,17 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
DEFAULT_IP_ADDR = '192.168.1.128'
|
|
|
|
DEFAULT_IP_ADDR = '192.168.1.128'
|
|
|
|
DEFAULT_PORT = 1337
|
|
|
|
DEFAULT_PORT = 1337
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LASER_DIODE_STATUS = [
|
|
|
|
|
|
|
|
{'name': 'Status', 'title': 'Status: Power Off', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
|
|
|
|
{'name': 'Color', 'title': '', 'type': 'color', 'value': 'w', 'readonly': True, "compactHeight": False},
|
|
|
|
|
|
|
|
]}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
LASER_DIODE_PARAMETERS = [
|
|
|
|
LASER_DIODE_PARAMETERS = [
|
|
|
|
{'name': 'Readings', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Readings', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'LD Current Set', 'type': 'float', 'unit': 'mA', 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'LD Current Set', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'PD Current', 'type': 'float', 'unit': 'uA', 'siPrefix': True, 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'PD Current', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'PD Power', 'type': 'float', 'unit': 'mW', 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'PD Power', 'type': 'float', 'suffix': 'W', 'siPrefix': True, 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'LF Mod Termination (50 Ohm)', 'type': 'list', 'limits': ['On', 'Off'], 'readonly': True, "compactHeight": False}
|
|
|
|
{'name': 'LF Mod Termination (50 Ohm)', 'type': 'list', 'limits': ['On', 'Off'], 'readonly': True, "compactHeight": False}
|
|
|
|
]},
|
|
|
|
]},
|
|
|
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
|
|
@ -424,10 +430,16 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
]},
|
|
|
|
]},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
THERMOSTAT_STATUS = [
|
|
|
|
|
|
|
|
{'name': 'Status', 'title': 'Status: Power Off', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
|
|
|
|
{'name': 'Color', 'title': '', 'type': 'color', 'value': 'w', 'readonly': True, "compactHeight": False},
|
|
|
|
|
|
|
|
]}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
THERMOSTAT_PARAMETERS = [
|
|
|
|
THERMOSTAT_PARAMETERS = [
|
|
|
|
{'name': 'Readings', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Readings', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Temperature', 'type': 'float', 'unit': '℃', 'format': '{value:.4f}', 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'Temperature', 'type': 'float', 'format': '{value:.4f} ℃', 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'Current through TEC', 'type': 'float', 'unit': 'mA', 'decimals': 6, 'readonly': True, "compactHeight": False},
|
|
|
|
{'name': 'Current through TEC', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'decimals': 6, 'readonly': True, "compactHeight": False},
|
|
|
|
]},
|
|
|
|
]},
|
|
|
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
|
|
|
{'name': 'Control Method', 'type': 'mutex', 'limits': ['Constant Current', 'Temperature PID'],
|
|
|
|
{'name': 'Control Method', 'type': 'mutex', 'limits': ['Constant Current', 'Temperature PID'],
|
|
|
@ -547,11 +559,15 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
_traverse(param_tree)
|
|
|
|
_traverse(param_tree)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_add_unit_to_title(self.LASER_DIODE_STATUS)
|
|
|
|
_add_unit_to_title(self.LASER_DIODE_PARAMETERS)
|
|
|
|
_add_unit_to_title(self.LASER_DIODE_PARAMETERS)
|
|
|
|
|
|
|
|
_add_unit_to_title(self.THERMOSTAT_STATUS)
|
|
|
|
_add_unit_to_title(self.THERMOSTAT_PARAMETERS)
|
|
|
|
_add_unit_to_title(self.THERMOSTAT_PARAMETERS)
|
|
|
|
|
|
|
|
|
|
|
|
self.params = [
|
|
|
|
self.params = [
|
|
|
|
|
|
|
|
Parameter.create(name=f"Laser Diode Status", type='group', value=0, children=self.LASER_DIODE_STATUS),
|
|
|
|
Parameter.create(name=f"Laser Diode Parameters", type='group', value=1, children=self.LASER_DIODE_PARAMETERS),
|
|
|
|
Parameter.create(name=f"Laser Diode Parameters", type='group', value=1, children=self.LASER_DIODE_PARAMETERS),
|
|
|
|
|
|
|
|
Parameter.create(name=f"Thermostat Status", type='group', value=2, children=self.THERMOSTAT_STATUS),
|
|
|
|
Parameter.create(name=f"Thermostat Parameters", type='group', value=3, children=self.THERMOSTAT_PARAMETERS),
|
|
|
|
Parameter.create(name=f"Thermostat Parameters", type='group', value=3, children=self.THERMOSTAT_PARAMETERS),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
self._set_param_tree()
|
|
|
|
self._set_param_tree()
|
|
|
@ -643,8 +659,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
self.menu_action_update_net_settings.triggered.connect(show_update_net_settings_form)
|
|
|
|
self.menu_action_update_net_settings.triggered.connect(show_update_net_settings_form)
|
|
|
|
|
|
|
|
|
|
|
|
def update_pd_mon_form_readings(self, ld_settings):
|
|
|
|
def update_pd_mon_form_readings(self, ld_settings):
|
|
|
|
pwr_unit = self.params[0].child('Photodiode Monitor Config', 'LD Power Limit').opts.get("unit", None)
|
|
|
|
pwr_unit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').opts.get("unit", None)
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'LD Power Limit').setOpts(limits= (0, siConvert(ld_settings["ld_pwr_limit"]["max"], pwr_unit)))
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setOpts(limits= (0, siConvert(ld_settings["ld_pwr_limit"]["max"], pwr_unit)))
|
|
|
|
self.cfg_pd_mon_form.settable_pwr_range_display_lbl.setText(f" 0 - {siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit):.4f}")
|
|
|
|
self.cfg_pd_mon_form.settable_pwr_range_display_lbl.setText(f" 0 - {siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit):.4f}")
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setMaximum(siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit))
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setMaximum(siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit))
|
|
|
|
|
|
|
|
|
|
|
@ -776,19 +792,19 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.laser.set_ld_pwr_limit(settings['laser']['ld_pwr_limit']['max']))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.laser.set_ld_pwr_limit(settings['laser']['ld_pwr_limit']['max']))
|
|
|
|
self.cfg_pd_mon_form.apply_pwr_limit_max_btn.clicked.connect(apply_ld_pwr_limit_max)
|
|
|
|
self.cfg_pd_mon_form.apply_pwr_limit_max_btn.clicked.connect(apply_ld_pwr_limit_max)
|
|
|
|
|
|
|
|
|
|
|
|
ld_pwr_limit_unit = self.params[0].child('Photodiode Monitor Config', 'LD Power Limit').opts["unit"]
|
|
|
|
ld_pwr_limit_unit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').opts["unit"]
|
|
|
|
ld_pwr_limit_text = self.cfg_pd_mon_form.cfg_pwr_limit_lbl.text()
|
|
|
|
ld_pwr_limit_text = self.cfg_pd_mon_form.cfg_pwr_limit_lbl.text()
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_lbl.setText(ld_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_lbl.setText(ld_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.unit = ld_pwr_limit_unit
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.unit = ld_pwr_limit_unit
|
|
|
|
settable_pwr_limit_text = self.cfg_pd_mon_form.settable_pwr_range_lbl.text()
|
|
|
|
settable_pwr_limit_text = self.cfg_pd_mon_form.settable_pwr_range_lbl.text()
|
|
|
|
self.cfg_pd_mon_form.settable_pwr_range_lbl.setText(settable_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.settable_pwr_range_lbl.setText(settable_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):"))
|
|
|
|
|
|
|
|
|
|
|
|
pd_responsitivity_unit = self.params[0].child('Photodiode Monitor Config', 'Responsitivity').opts["unit"]
|
|
|
|
pd_responsitivity_unit = self.params[1].child('Photodiode Monitor Config', 'Responsitivity').opts["unit"]
|
|
|
|
pd_responsitivity_text = self.cfg_pd_mon_form.cfg_responsitivity_lbl.text()
|
|
|
|
pd_responsitivity_text = self.cfg_pd_mon_form.cfg_responsitivity_lbl.text()
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_lbl.setText(pd_responsitivity_text.replace(":", f" ({pd_responsitivity_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_lbl.setText(pd_responsitivity_text.replace(":", f" ({pd_responsitivity_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_spinbox.unit = pd_responsitivity_unit
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_spinbox.unit = pd_responsitivity_unit
|
|
|
|
|
|
|
|
|
|
|
|
pd_dark_current_unit = self.params[0].child('Photodiode Monitor Config', 'Dark Current').opts["unit"]
|
|
|
|
pd_dark_current_unit = self.params[1].child('Photodiode Monitor Config', 'Dark Current').opts["unit"]
|
|
|
|
pd_dark_current_text = self.cfg_pd_mon_form.cfg_dark_current_lbl.text()
|
|
|
|
pd_dark_current_text = self.cfg_pd_mon_form.cfg_dark_current_lbl.text()
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_lbl.setText(pd_dark_current_text.replace(":", f" ({pd_dark_current_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_lbl.setText(pd_dark_current_text.replace(":", f" ({pd_dark_current_unit}):"))
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_spinbox.unit = pd_dark_current_unit
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_spinbox.unit = pd_dark_current_unit
|
|
|
@ -801,18 +817,23 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
self.cfg_adc_filter_form.apply_btn.clicked.connect(apply_adc_filter_settings)
|
|
|
|
self.cfg_adc_filter_form.apply_btn.clicked.connect(apply_adc_filter_settings)
|
|
|
|
|
|
|
|
|
|
|
|
def _set_param_tree(self):
|
|
|
|
def _set_param_tree(self):
|
|
|
|
self.ld_status.setStyleSheet("border: 3px solid #A1A1A1;") # Light Gray
|
|
|
|
status = self.ld_status
|
|
|
|
self.tec_status.setStyleSheet("border: 3px solid #A1A1A1;") # Light Gray
|
|
|
|
status.setHeaderHidden(True)
|
|
|
|
|
|
|
|
status.setParameters(self.params[0], showTop=False)
|
|
|
|
|
|
|
|
|
|
|
|
tree = self.ld_tree
|
|
|
|
tree = self.ld_tree
|
|
|
|
tree.setHeaderHidden(True)
|
|
|
|
tree.setHeaderHidden(True)
|
|
|
|
tree.setParameters(self.params[0], showTop=False)
|
|
|
|
tree.setParameters(self.params[1], showTop=False)
|
|
|
|
self.params[0].sigTreeStateChanged.connect(self.send_command)
|
|
|
|
self.params[1].sigTreeStateChanged.connect(self.send_command)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = self.tec_status
|
|
|
|
|
|
|
|
status.setHeaderHidden(True)
|
|
|
|
|
|
|
|
status.setParameters(self.params[2], showTop=False)
|
|
|
|
|
|
|
|
|
|
|
|
tree = self.tec_tree
|
|
|
|
tree = self.tec_tree
|
|
|
|
tree.setHeaderHidden(True)
|
|
|
|
tree.setHeaderHidden(True)
|
|
|
|
tree.setParameters(self.params[1], showTop=False)
|
|
|
|
tree.setParameters(self.params[3], showTop=False)
|
|
|
|
self.params[1].sigTreeStateChanged.connect(self.send_command)
|
|
|
|
self.params[3].sigTreeStateChanged.connect(self.send_command)
|
|
|
|
|
|
|
|
|
|
|
|
@asyncSlot()
|
|
|
|
@asyncSlot()
|
|
|
|
async def autotune(param):
|
|
|
|
async def autotune(param):
|
|
|
@ -840,20 +861,20 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
|
self.loading_spinner.stop()
|
|
|
|
self.loading_spinner.stop()
|
|
|
|
self.loading_spinner.hide()
|
|
|
|
self.loading_spinner.hide()
|
|
|
|
self.params[1].child('PID Config', 'PID Auto Tune', 'Run').sigActivated.connect(autotune)
|
|
|
|
self.params[3].child('PID Config', 'PID Auto Tune', 'Run').sigActivated.connect(autotune)
|
|
|
|
|
|
|
|
|
|
|
|
@pyqtSlot()
|
|
|
|
@pyqtSlot()
|
|
|
|
def show_pd_mon_cfg_form(param):
|
|
|
|
def show_pd_mon_cfg_form(param):
|
|
|
|
ld_pwr_limit = self.params[0].child('Photodiode Monitor Config', 'LD Power Limit').value()
|
|
|
|
ld_pwr_limit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').value()
|
|
|
|
pd_responsitivity = self.params[0].child('Photodiode Monitor Config', 'Responsitivity').value()
|
|
|
|
pd_responsitivity = self.params[1].child('Photodiode Monitor Config', 'Responsitivity').value()
|
|
|
|
pd_dark_current = self.params[0].child('Photodiode Monitor Config', 'Dark Current').value()
|
|
|
|
pd_dark_current = self.params[1].child('Photodiode Monitor Config', 'Dark Current').value()
|
|
|
|
|
|
|
|
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_spinbox.setValue(pd_responsitivity)
|
|
|
|
self.cfg_pd_mon_form.cfg_responsitivity_spinbox.setValue(pd_responsitivity)
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setValue(ld_pwr_limit)
|
|
|
|
self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setValue(ld_pwr_limit)
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_spinbox.setValue(pd_dark_current)
|
|
|
|
self.cfg_pd_mon_form.cfg_dark_current_spinbox.setValue(pd_dark_current)
|
|
|
|
|
|
|
|
|
|
|
|
self.cfg_pd_mon_form.show()
|
|
|
|
self.cfg_pd_mon_form.show()
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'Configure Photodiode Monitor').sigActivated.connect(show_pd_mon_cfg_form)
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'Configure Photodiode Monitor').sigActivated.connect(show_pd_mon_cfg_form)
|
|
|
|
|
|
|
|
|
|
|
|
@asyncSlot()
|
|
|
|
@asyncSlot()
|
|
|
|
async def show_adc_filter_cfg_form(param):
|
|
|
|
async def show_adc_filter_cfg_form(param):
|
|
|
@ -870,7 +891,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
self.cfg_adc_filter_form.filter_sampling_rate_cbox.setCurrentIndex(self.cfg_adc_filter_form.filter_sampling_rate_cbox.findText(filter_rate))
|
|
|
|
self.cfg_adc_filter_form.filter_sampling_rate_cbox.setCurrentIndex(self.cfg_adc_filter_form.filter_sampling_rate_cbox.findText(filter_rate))
|
|
|
|
self.cfg_adc_filter_form.show()
|
|
|
|
self.cfg_adc_filter_form.show()
|
|
|
|
|
|
|
|
|
|
|
|
self.params[1].child('Temperature ADC Filter Settings', 'Configure ADC Filter').sigActivated.connect(show_adc_filter_cfg_form)
|
|
|
|
self.params[3].child('Temperature ADC Filter Settings', 'Configure ADC Filter').sigActivated.connect(show_adc_filter_cfg_form)
|
|
|
|
|
|
|
|
|
|
|
|
@pyqtSlot(str)
|
|
|
|
@pyqtSlot(str)
|
|
|
|
def cmd_cannot_execute(self, kirdy_msg):
|
|
|
|
def cmd_cannot_execute(self, kirdy_msg):
|
|
|
@ -887,12 +908,12 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
case PIDAutotuneState.STATE_SUCCEEDED:
|
|
|
|
case PIDAutotuneState.STATE_SUCCEEDED:
|
|
|
|
kp, ki, kd = self.autotuner.get_tec_pid()
|
|
|
|
kp, ki, kd = self.autotuner.get_tec_pid()
|
|
|
|
self.autotuner.setOff()
|
|
|
|
self.autotuner.setOff()
|
|
|
|
self.params[1].child('PID Config', 'PID Auto Tune', 'Run').setOpts(title="Run")
|
|
|
|
self.params[3].child('PID Config', 'PID Auto Tune', 'Run').setOpts(title="Run")
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_kp(kp))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_kp(kp))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_ki(ki))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_ki(ki))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_kd(kd))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_kd(kd))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_control_mode())
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_pid_control_mode())
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_temperature_setpoint(self.params[1].child('PID Config', 'PID Auto Tune', 'Target Temperature').value()))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_temperature_setpoint(self.params[3].child('PID Config', 'PID Auto Tune', 'Target Temperature').value()))
|
|
|
|
self.kirdy_handler.report_update_sig.disconnect(self.autotune_tick)
|
|
|
|
self.kirdy_handler.report_update_sig.disconnect(self.autotune_tick)
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
|
self.loading_spinner.stop()
|
|
|
|
self.loading_spinner.stop()
|
|
|
@ -903,7 +924,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
|
|
case PIDAutotuneState.STATE_FAILED:
|
|
|
|
case PIDAutotuneState.STATE_FAILED:
|
|
|
|
self.autotuner.setOff()
|
|
|
|
self.autotuner.setOff()
|
|
|
|
self.params[1].child('PID Config', 'PID Auto Tune', 'Run').setOpts(title="Run")
|
|
|
|
self.params[3].child('PID Config', 'PID Auto Tune', 'Run').setOpts(title="Run")
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_tec_i_out(0.0))
|
|
|
|
self.kirdy.task_dispatcher(self.kirdy.thermostat.set_tec_i_out(0.0))
|
|
|
|
self.kirdy_handler.report_update_sig.disconnect(self.autotune_tick)
|
|
|
|
self.kirdy_handler.report_update_sig.disconnect(self.autotune_tick)
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
|
self.background_task_lbl.setText("Ready.")
|
|
|
@ -982,17 +1003,17 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
def update_ld_ctrl_panel_settings(self, settings):
|
|
|
|
def update_ld_ctrl_panel_settings(self, settings):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
settings = settings['laser']
|
|
|
|
settings = settings['laser']
|
|
|
|
with QSignalBlocker(self.params[0]):
|
|
|
|
with QSignalBlocker(self.params[1]):
|
|
|
|
self.params[0].child('Output Config', 'LD Current Set').setValuewithLock(settings["ld_drive_current"]['value'])
|
|
|
|
self.params[1].child('Output Config', 'LD Current Set').setValuewithLock(settings["ld_drive_current"]['value'])
|
|
|
|
self.params[0].child('Output Config', 'LD Terminals Short').setValuewithLock(settings["ld_terms_short"])
|
|
|
|
self.params[1].child('Output Config', 'LD Terminals Short').setValuewithLock(settings["ld_terms_short"])
|
|
|
|
self.params[0].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
|
|
|
|
self.params[1].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"]["value"])
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"]["value"])
|
|
|
|
self.update_pd_mon_form_readings(settings)
|
|
|
|
self.update_pd_mon_form_readings(settings)
|
|
|
|
if settings["pd_mon_params"]["responsitivity"] is not None:
|
|
|
|
if settings["pd_mon_params"]["responsitivity"] is not None:
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'Responsitivity').setValuewithLock(settings["pd_mon_params"]["responsitivity"])
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'Responsitivity').setValuewithLock(settings["pd_mon_params"]["responsitivity"])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'Responsitivity').setValuewithLock(0)
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'Responsitivity').setValuewithLock(0)
|
|
|
|
self.params[0].child('Photodiode Monitor Config', 'Dark Current').setValuewithLock(settings["pd_mon_params"]["i_dark"])
|
|
|
|
self.params[1].child('Photodiode Monitor Config', 'Dark Current').setValuewithLock(settings["pd_mon_params"]["i_dark"])
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{settings}", exc_info=True)
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{settings}", exc_info=True)
|
|
|
|
|
|
|
|
|
|
|
@ -1002,24 +1023,20 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
report = report['laser']
|
|
|
|
report = report['laser']
|
|
|
|
with QSignalBlocker(self.params[0]):
|
|
|
|
with QSignalBlocker(self.params[0]):
|
|
|
|
if report['pwr_excursion']:
|
|
|
|
if report['pwr_excursion']:
|
|
|
|
self.ld_status.setStyleSheet("border: 3px solid red;")
|
|
|
|
self.params[0].child('Status', 'Color').setValuewithLock('r')
|
|
|
|
self.ld_status.setText(' Status: OverPower Alarm')
|
|
|
|
self.params[0].child('Status').setOpts(title='Status: OverPower Alarm')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if report['pwr_on']:
|
|
|
|
self.params[0].child('Status', 'Color').setValuewithLock('g' if report['pwr_on'] else 'w')
|
|
|
|
self.ld_status.setStyleSheet("border: 3px solid #44E62C;") # Light Green
|
|
|
|
self.params[0].child('Status').setOpts(title='Status: Power On' if report['pwr_on'] else 'Status: Power Off')
|
|
|
|
self.ld_status.setText(' Status: Power On')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.ld_status.setStyleSheet("border: 3px solid #A1A1A1;") # Light Gray
|
|
|
|
|
|
|
|
self.ld_status.setText(' Status: Power Off')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with QSignalBlocker(self.params[0]):
|
|
|
|
with QSignalBlocker(self.params[1]):
|
|
|
|
self.params[0].child('Readings', 'LD Current Set').setValuewithLock(report["ld_i_set"])
|
|
|
|
self.params[1].child('Readings', 'LD Current Set').setValuewithLock(report["ld_i_set"])
|
|
|
|
self.params[0].child('Readings', 'PD Current').setValuewithLock(report["pd_i"])
|
|
|
|
self.params[1].child('Readings', 'PD Current').setValuewithLock(report["pd_i"])
|
|
|
|
if report["pd_pwr"] is not None:
|
|
|
|
if report["pd_pwr"] is not None:
|
|
|
|
self.params[0].child('Readings', 'PD Power').setValuewithLock(report["pd_pwr"])
|
|
|
|
self.params[1].child('Readings', 'PD Power').setValuewithLock(report["pd_pwr"])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.params[0].child('Readings', 'PD Power').setValuewithLock(0)
|
|
|
|
self.params[1].child('Readings', 'PD Power').setValuewithLock(0)
|
|
|
|
self.params[0].child('Readings', 'LF Mod Termination (50 Ohm)').setValuewithLock(report["term_50ohm"])
|
|
|
|
self.params[1].child('Readings', 'LF Mod Termination (50 Ohm)').setValuewithLock(report["term_50ohm"])
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)
|
|
|
|
|
|
|
|
|
|
|
@ -1027,29 +1044,29 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
def update_thermostat_ctrl_panel_settings(self, settings):
|
|
|
|
def update_thermostat_ctrl_panel_settings(self, settings):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
settings = settings['thermostat']
|
|
|
|
settings = settings['thermostat']
|
|
|
|
with QSignalBlocker(self.params[1]):
|
|
|
|
with QSignalBlocker(self.params[3]):
|
|
|
|
self.params[1].child('Output Config', 'Control Method').setValuewithLock("Temperature PID" if settings["pid_engaged"] else "Constant Current")
|
|
|
|
self.params[3].child('Output Config', 'Control Method').setValuewithLock("Temperature PID" if settings["pid_engaged"] else "Constant Current")
|
|
|
|
self.params[1].child('Output Config', 'Control Method', 'Set Current').setValuewithLock(settings["tec_settings"]['i_set']['value'])
|
|
|
|
self.params[3].child('Output Config', 'Control Method', 'Set Current').setValuewithLock(settings["tec_settings"]['i_set']['value'])
|
|
|
|
self.params[1].child('Output Config', 'Control Method', 'Set Temperature').setValuewithLock(float(settings["temperature_setpoint"]))
|
|
|
|
self.params[3].child('Output Config', 'Control Method', 'Set Temperature').setValuewithLock(float(settings["temperature_setpoint"]))
|
|
|
|
self.params[1].child('Output Config', 'Limits', 'Max Cooling Current').setValuewithLock(settings["tec_settings"]['max_i_pos']['value'])
|
|
|
|
self.params[3].child('Output Config', 'Limits', 'Max Cooling Current').setValuewithLock(settings["tec_settings"]['max_i_pos']['value'])
|
|
|
|
self.params[1].child('Output Config', 'Limits', 'Max Heating Current').setValuewithLock(settings["tec_settings"]['max_i_neg']['value'])
|
|
|
|
self.params[3].child('Output Config', 'Limits', 'Max Heating Current').setValuewithLock(settings["tec_settings"]['max_i_neg']['value'])
|
|
|
|
self.params[1].child('Output Config', 'Limits', 'Max Voltage Difference').setValuewithLock(settings["tec_settings"]['max_v']['value'])
|
|
|
|
self.params[3].child('Output Config', 'Limits', 'Max Voltage Difference').setValuewithLock(settings["tec_settings"]['max_v']['value'])
|
|
|
|
self.params[1].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
|
|
|
|
self.params[3].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
|
|
|
|
filter_type = settings['temp_adc_settings']['filter_type']
|
|
|
|
filter_type = settings['temp_adc_settings']['filter_type']
|
|
|
|
filter_rate = settings['temp_adc_settings'][getattr(getattr(FilterConfig, filter_type), "_odr_type")]
|
|
|
|
filter_rate = settings['temp_adc_settings'][getattr(getattr(FilterConfig, filter_type), "_odr_type")]
|
|
|
|
self.update_adc_filter_form_readings(filter_type, filter_rate)
|
|
|
|
self.update_adc_filter_form_readings(filter_type, filter_rate)
|
|
|
|
self.params[1].child('Temperature ADC Filter Settings', 'Filter Type').setValue(filter_type)
|
|
|
|
self.params[3].child('Temperature ADC Filter Settings', 'Filter Type').setValue(filter_type)
|
|
|
|
self.params[1].child('Temperature ADC Filter Settings', 'Sampling Rate').setValue(settings['temp_adc_settings']['rate'])
|
|
|
|
self.params[3].child('Temperature ADC Filter Settings', 'Sampling Rate').setValue(settings['temp_adc_settings']['rate'])
|
|
|
|
self.params[1].child('Temperature Monitor Config', 'Upper Limit').setValuewithLock(settings["temp_mon_settings"]['upper_limit'])
|
|
|
|
self.params[3].child('Temperature Monitor Config', 'Upper Limit').setValuewithLock(settings["temp_mon_settings"]['upper_limit'])
|
|
|
|
self.params[1].child('Temperature Monitor Config', 'Lower Limit').setValuewithLock(settings["temp_mon_settings"]['lower_limit'])
|
|
|
|
self.params[3].child('Temperature Monitor Config', 'Lower Limit').setValuewithLock(settings["temp_mon_settings"]['lower_limit'])
|
|
|
|
self.params[1].child('PID Config', 'Kp').setValuewithLock(settings["pid_params"]['kp'])
|
|
|
|
self.params[3].child('PID Config', 'Kp').setValuewithLock(settings["pid_params"]['kp'])
|
|
|
|
self.params[1].child('PID Config', 'Ki').setValuewithLock(settings["pid_params"]['ki'])
|
|
|
|
self.params[3].child('PID Config', 'Ki').setValuewithLock(settings["pid_params"]['ki'])
|
|
|
|
self.params[1].child('PID Config', 'Kd').setValuewithLock(settings["pid_params"]['kd'])
|
|
|
|
self.params[3].child('PID Config', 'Kd').setValuewithLock(settings["pid_params"]['kd'])
|
|
|
|
self.params[1].child('PID Config', 'PID Output Clamping', 'Minimum').setValuewithLock(settings["pid_params"]['output_min'])
|
|
|
|
self.params[3].child('PID Config', 'PID Output Clamping', 'Minimum').setValuewithLock(settings["pid_params"]['output_min'])
|
|
|
|
self.params[1].child('PID Config', 'PID Output Clamping', 'Maximum').setValuewithLock(settings["pid_params"]['output_max'])
|
|
|
|
self.params[3].child('PID Config', 'PID Output Clamping', 'Maximum').setValuewithLock(settings["pid_params"]['output_max'])
|
|
|
|
self.params[1].child('Thermistor Settings', 'T₀').setValuewithLock(settings["thermistor_params"]['t0'])
|
|
|
|
self.params[3].child('Thermistor Settings', 'T₀').setValuewithLock(settings["thermistor_params"]['t0'])
|
|
|
|
self.params[1].child('Thermistor Settings', 'R₀').setValuewithLock(settings["thermistor_params"]['r0'])
|
|
|
|
self.params[3].child('Thermistor Settings', 'R₀').setValuewithLock(settings["thermistor_params"]['r0'])
|
|
|
|
self.params[1].child('Thermistor Settings', 'B').setValuewithLock(settings["thermistor_params"]['b'])
|
|
|
|
self.params[3].child('Thermistor Settings', 'B').setValuewithLock(settings["thermistor_params"]['b'])
|
|
|
|
self.graphs.set_temp_setpoint_line(temp=round(settings["temperature_setpoint"], 4))
|
|
|
|
self.graphs.set_temp_setpoint_line(temp=round(settings["temperature_setpoint"], 4))
|
|
|
|
self.graphs.set_temp_setpoint_line(visible=settings['pid_engaged'])
|
|
|
|
self.graphs.set_temp_setpoint_line(visible=settings['pid_engaged'])
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
@ -1059,25 +1076,23 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
def update_thermostat_ctrl_panel_readings(self, report):
|
|
|
|
def update_thermostat_ctrl_panel_readings(self, report):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
report = report['thermostat']
|
|
|
|
report = report['thermostat']
|
|
|
|
|
|
|
|
with QSignalBlocker(self.params[2]):
|
|
|
|
if report['temp_mon_status']['over_temp_alarm']:
|
|
|
|
if report['temp_mon_status']['over_temp_alarm']:
|
|
|
|
self.tec_status.setStyleSheet("border: 3px solid red;")
|
|
|
|
self.params[2].child('Status', 'Color').setValuewithLock('r')
|
|
|
|
self.tec_status.setText(' Status: OverTemperature Alarm')
|
|
|
|
self.params[2].child('Status').setOpts(title='Status: OverTemperature Alarm')
|
|
|
|
else:
|
|
|
|
|
|
|
|
if report['pwr_on']:
|
|
|
|
|
|
|
|
self.tec_status.setStyleSheet("border: 3px solid #44E62C;") # Light Green
|
|
|
|
|
|
|
|
self.tec_status.setText(' Status: Power On')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.tec_status.setStyleSheet("border: 3px solid #A1A1A1;") # Light Gray
|
|
|
|
|
|
|
|
self.tec_status.setText(' Status: Power Off')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with QSignalBlocker(self.params[1]):
|
|
|
|
|
|
|
|
if report["temperature"] == None:
|
|
|
|
|
|
|
|
self.params[1].child('Readings', 'Temperature').setValuewithLock(-273.15)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.params[1].child('Readings', 'Temperature').setValuewithLock(report["temperature"])
|
|
|
|
self.params[2].child('Status', 'Color').setValuewithLock('g' if report['pwr_on'] else 'w')
|
|
|
|
self.params[1].child('Readings', 'Current through TEC').setValuewithLock(report["tec_i"])
|
|
|
|
self.params[2].child('Status').setOpts(title='Status: Power On' if report['pwr_on'] else 'Status: Power Off')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with QSignalBlocker(self.params[3]):
|
|
|
|
|
|
|
|
if report["temperature"] == None:
|
|
|
|
|
|
|
|
self.params[3].child('Readings', 'Temperature').setValuewithLock(-273.15)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.params[3].child('Readings', 'Temperature').setValuewithLock(report["temperature"])
|
|
|
|
|
|
|
|
self.params[3].child('Readings', 'Current through TEC').setValuewithLock(report["tec_i"])
|
|
|
|
rate = 1 / (report['interval']['ms'] / 1e3 + report['interval']['us'] / 1e6)
|
|
|
|
rate = 1 / (report['interval']['ms'] / 1e3 + report['interval']['us'] / 1e6)
|
|
|
|
self.params[1].child('Temperature ADC Filter Settings', 'Recorded Sampling Rate').setValue(rate)
|
|
|
|
self.params[3].child('Temperature ADC Filter Settings', 'Recorded Sampling Rate').setValue(rate)
|
|
|
|
self.cfg_adc_filter_form.recorded_sampling_rate_reading_lbl.setText(f"{rate:.2f}")
|
|
|
|
self.cfg_adc_filter_form.recorded_sampling_rate_reading_lbl.setText(f"{rate:.2f}")
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)
|
|
|
|
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)
|
|
|
|