Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizes RF Windows and Adds Dynamic Interlock. #721

Merged
merged 13 commits into from
Nov 1, 2024
9 changes: 3 additions & 6 deletions pyqt-apps/scripts/sirius-hla-bo-rf-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
import argparse as _argparse
import sys

from siriuspy.envars import VACA_PREFIX

from siriushla.as_rf_control.advanced_details import ADCDACDetails, \
AutoStartDetails, CalEqDetails, CalSysDetails, ConditioningDetails, \
HardwareDetails, LoopsDetails, RampsDetails, RFInputsDetails, \
TuningDetails
AutoStartDetails, CalEqDetails, CalSysDetails, HardwareDetails, \
LoopsDetails, RampsDetails, RFInputsDetails, TuningDetails
from siriushla.as_rf_control.control import RFMainControl
from siriushla.as_rf_control.details import CavityStatusDetails, FDLDetails, \
LLRFInterlockDetails, SlowLoopErrorDetails, SlowLoopParametersDetails, \
SSADetailsBO, TempMonitor, TransmLineStatusDetails
from siriushla.sirius_application import SiriusApplication
from siriuspy.envars import VACA_PREFIX

parser = _argparse.ArgumentParser(
description="Run RF Control Interface.")
Expand All @@ -31,7 +29,6 @@
'auto-start': AutoStartDetails,
'cal-eq': CalEqDetails,
'cal-sys': CalSysDetails,
'conditioning': ConditioningDetails,
'hardware': HardwareDetails,
'loops': LoopsDetails,
'ramps': RampsDetails,
Expand Down
9 changes: 3 additions & 6 deletions pyqt-apps/scripts/sirius-hla-si-rf-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
import argparse as _argparse
import sys

from siriuspy.envars import VACA_PREFIX

from siriushla.as_rf_control.advanced_details import ADCDACDetails, \
AutoStartDetails, CalEqDetails, CalSysDetails, ConditioningDetails, \
HardwareDetails, LoopsDetails, RampsDetails, RFInputsDetails, \
TuningDetails
AutoStartDetails, CalEqDetails, CalSysDetails, HardwareDetails, \
LoopsDetails, RampsDetails, RFInputsDetails, TuningDetails
from siriushla.as_rf_control.control import RFMainControl
from siriushla.as_rf_control.details import CavityStatusDetails, FDLDetails, \
LLRFInterlockDetails, SlowLoopErrorDetails, SlowLoopParametersDetails, \
SSADetailsSI, TempMonitor, TransmLineStatusDetails
from siriushla.sirius_application import SiriusApplication
from siriuspy.envars import VACA_PREFIX

parser = _argparse.ArgumentParser(
description="Run RF Control Interface.")
Expand All @@ -35,7 +33,6 @@
'auto-start': AutoStartDetails,
'cal-eq': CalEqDetails,
'cal-sys': CalSysDetails,
'conditioning': ConditioningDetails,
'hardware': HardwareDetails,
'loops': LoopsDetails,
'ramps': RampsDetails,
Expand Down
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.5.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from .auto_start import AutoStartDetails
from .cal_eq import CalEqDetails
from .cal_sys import CalSysDetails
from .conditioning import ConditioningDetails
from .hardware import HardwareDetails
from .loops import LoopsDetails
from .ramps import RampsDetails
Expand Down
149 changes: 123 additions & 26 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/adv_interlock.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Advanced details related to interlocks."""

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QFrame, QGridLayout, QGroupBox, QHBoxLayout, \
QLabel, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, QVBoxLayout, \
QWidget
from qtpy.QtWidgets import QGridLayout, QGroupBox, QHBoxLayout, QLabel, \
QScrollArea, QSizePolicy as QSzPlcy, QSpacerItem, QTabWidget, \
QVBoxLayout, QWidget

from ...widgets import PyDMStateButton, SiriusDialog, SiriusLabel, \
SiriusLedAlert, SiriusLedState, SiriusPushButton, SiriusSpinbox
SiriusLedAlert, SiriusLedState, SiriusLineEdit, SiriusPushButton, \
SiriusSpinbox
from ..util import DEFAULT_STYLESHEET, SEC_2_CHANNELS


Expand Down Expand Up @@ -48,6 +49,11 @@ def _setupUi(self):
self._diagnosticsLayout(self.syst_dict['Diagnostics']))
dtls.addTab(wid_diag, 'Diagnostics')

wid_dyn = QWidget(self)
wid_dyn.setLayout(
self._dynamicInterlockLayout(self.syst_dict['Dynamic']))
dtls.addTab(wid_dyn, 'Dynamic Interlock')

wid_bypass = QWidget(self)
wid_bypass.setLayout(self._bypassLayout(self.syst_dict['Bypass']))
dtls.addTab(wid_bypass, 'Interlock Bypass')
Expand All @@ -62,9 +68,8 @@ def _diagnosticsLayout(self, chs_dict):
lay.setSpacing(9)

# General
frame_gen = QFrame(self)
frame_gen.setFrameShape(QFrame.NoFrame)
frame_gen.setLayout(self._genDiagLayout(chs_dict['General']))
gbox_gen = QGroupBox('General Controls')
gbox_gen.setLayout(self._genDiagLayout(chs_dict['General']))

# Levels
gbox_lvls = QGroupBox('Levels')
Expand Down Expand Up @@ -146,7 +151,7 @@ def _diagnosticsLayout(self, chs_dict):
lay.addWidget(gbox_inp, 0, 1)
lay.addWidget(gbox_intlk, 0, 2)
lay.addWidget(gbox_out, 0, 3)
lay.addWidget(frame_gen, 1, 0)
lay.addWidget(gbox_gen, 1, 0, 1, 2)

return lay

Expand All @@ -172,15 +177,19 @@ def _genDiagLayout(self, chs_dict):
# Manual Interlock, End Switches and Logic Inversions
keys = ['Manual', 'EndSw', 'Beam Inv',
'Vacuum Inv', 'SSA Bypass', 'Bypass']
row = 3
row = 2
column = 0
for key in keys:
lay.addWidget(QLabel(chs_dict[key][0]), row, 0)
lay.addWidget(QLabel(chs_dict[key][0]), row, column)
lay.addWidget(PyDMStateButton(
self, self.prefix+chs_dict[key][1]+'-Sel'), row, 1)
self, self.prefix+chs_dict[key][1]+'-Sel'), row, column+1)
lay.addWidget(SiriusLedState(
self, self.prefix+chs_dict[key][1]+'-Sts'),
row, 2, alignment=Qt.AlignCenter)
row, column+2, alignment=Qt.AlignCenter)
row += 1
if row == 4:
row = 0
column += 3

return lay

Expand All @@ -190,45 +199,133 @@ def _setupByteMonitor(self, lay, labels, channel):
lay.addWidget(SiriusLedState(
self, channel, bit), bit+1, 1, alignment=Qt.AlignCenter)

def _bypassLayout(self, chs_dict):
def _dynamicInterlockLayout(self, chs_dict):
lay = QGridLayout()
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)

labels = ['Diagnostics', 'Ext LLRF', 'Tx PLC', 'FDL Trigger',
# Current
lb_curr = SiriusLabel(self, self.prefix+chs_dict['Curr'])
lb_curr.showUnits = True
lb_delta = SiriusLabel(self, self.prefix+chs_dict['Curr Delta']+'-RB')
lb_delta.showUnits = True
lb_delta.setStyleSheet('background-color: white')

lay.addWidget(QLabel(
'<h4>Readback</h4>', alignment=Qt.AlignCenter), 0, 1)
lay.addWidget(QLabel(
'<h4>Delta</h4>', alignment=Qt.AlignCenter), 0, 2, 1, 2)
lay.addWidget(QLabel(
'<h4>Current</h4>',
alignment=Qt.AlignRight | Qt.AlignVCenter), 1, 0)
lay.addWidget(lb_curr, 1, 1, alignment=Qt.AlignCenter)
lay.addWidget(SiriusLineEdit(
self, self.prefix+chs_dict['Curr Delta']+'-SP'),
1, 2, alignment=Qt.AlignCenter)
lay.addWidget(lb_delta, 1, 3, alignment=Qt.AlignCenter)
lay.addItem(QSpacerItem(0, 20, QSzPlcy.Ignored, QSzPlcy.Fixed), 2, 0)

# Rev Cav, Fwd Cav and Quench Cond 1 Ratio
# # Header
lay.addWidget(QLabel(
'<h4>Readback</h4>', alignment=Qt.AlignCenter), 3, 1)
lay.addWidget(QLabel(
'<h4>Enable</h4>', alignment=Qt.AlignCenter), 3, 2)
lay.addWidget(QLabel(
'<h4>Coeff</h4>', alignment=Qt.AlignCenter), 3, 3, 1, 2)
lay.addWidget(QLabel(
'<h4>Offset</h4>', alignment=Qt.AlignCenter), 3, 5, 1, 2)

# # Body
keys = ['Rev Cav', 'Fwd Cav', 'Quench']
row = 4
for key in keys:
chs = chs_dict[key]

lb_value = SiriusLabel(self, self.prefix+chs['Value'])
lb_value.showUnits = True
lb_coeff = SiriusLabel(self, self.prefix+chs['Coeff']+'-RB')
lb_coeff.showUnits = True
lb_ofs = SiriusLabel(self, self.prefix+chs['Offset']+'-RB')
lb_ofs.showUnits = True

lay_enable = QHBoxLayout()
lay_enable.addWidget(PyDMStateButton(
self, self.prefix+chs['Enable']+'-SP'),
alignment=Qt.AlignCenter)
lay_enable.addWidget(SiriusLedState(
self, self.prefix+chs['Enable']+'-RB'),
alignment=Qt.AlignCenter)

lay.addWidget(QLabel(f'<h4>{chs["Label"]}</h4>',
alignment=Qt.AlignRight | Qt.AlignVCenter), row, 0)
lay.addWidget(lb_value, row, 1)
lay.addLayout(lay_enable, row, 2)
lay.addWidget(SiriusLineEdit(
self, self.prefix+chs['Coeff']+'-SP'),
row, 3, alignment=Qt.AlignCenter)
lay.addWidget(lb_coeff, row, 4, alignment=Qt.AlignCenter)
lay.addWidget(SiriusLineEdit(
self, self.prefix+chs['Offset']+'-SP'),
row, 5, alignment=Qt.AlignCenter)
lay.addWidget(lb_ofs, row, 6, alignment=Qt.AlignCenter)

row += 1

return lay

def _bypassLayout(self, chs_dict):
lay = QGridLayout()
lay.setAlignment(Qt.AlignTop)
lay.setSpacing(9)
scarea = QScrollArea(self)
scarea.setSizeAdjustPolicy(scarea.AdjustToContents)
scarea.setWidgetResizable(True)
scr_ar_wid = QWidget()
scarea.setWidget(scr_ar_wid)
scr_ar_wid.setObjectName('scrollarea')
scr_ar_wid.setStyleSheet(
'#scrollarea {background-color: transparent;}')
lay.addWidget(scarea)

lay_scr = QGridLayout(scr_ar_wid)
lay_scr.setSpacing(9)

lbs_header = ['Diagnostics', 'Ext LLRF', 'Tx PLC', 'FDL Trigger',
'Pin Diode', 'Loops Standby']

column = 2
for lb in labels:
lay.addWidget(QLabel(
lb, alignment=Qt.AlignCenter), 0, column)
for lb in lbs_header:
label = QLabel(lb, alignment=Qt.AlignCenter)
label.setStyleSheet('min-width: 8em')
lay_scr.addWidget(label, 0, column)
column += 2

for i in range(1, column):
if i % 2 == 0 or i == 1:
lay.setColumnStretch(i, 1)
lay.setColumnMinimumWidth(1, 120)
lay_scr.setColumnStretch(i, 1)
lay_scr.setColumnMinimumWidth(1, 120)

row = 1
for key, val in chs_dict.items():
lay.addWidget(QLabel(key.split()[0]), row, 0)
lay.addWidget(QLabel(val[0]), row, 1)
lay_scr.addWidget(QLabel(key.split()[0]), row, 0)
lay_scr.addWidget(QLabel(val[0]), row, 1)
column = 2
for bit in reversed(range(len(labels))):
for bit in reversed(range(len(lbs_header))):
lay_state = QHBoxLayout()
pb = PyDMStateButton(self, self.prefix+val[1]+'-Sel', bit=bit)
lay_state.addWidget(pb, alignment=Qt.AlignRight)
lay_state.addWidget(SiriusLedState(
self, self.prefix+val[1]+'-Sts', bit),
alignment=Qt.AlignLeft)
lay.addLayout(lay_state, row, column)
lay.addItem(QSpacerItem(
lay_scr.addLayout(lay_state, row, column)
lay_scr.addItem(QSpacerItem(
9, 0, QSzPlcy.Ignored, QSzPlcy.Fixed), row, column+1)
column += 2
lay.addWidget(SiriusPushButton(
lay_scr.addWidget(SiriusPushButton(
self, self.prefix+val[1]+'-Sel', 'All Zero', releaseValue=0),
row, column)
lay.addWidget(SiriusPushButton(
lay_scr.addWidget(SiriusPushButton(
self, self.prefix+val[1]+'-Sel', 'All One', releaseValue=63),
row, column+1)
row += 1
Expand Down
99 changes: 0 additions & 99 deletions pyqt-apps/siriushla/as_rf_control/advanced_details/conditioning.py

This file was deleted.

Loading
Loading