Skip to content

Commit

Permalink
Added Dynamic Interlock tab to Advanced Interlock window
Browse files Browse the repository at this point in the history
  • Loading branch information
João Augusto Rosa Feltran committed Nov 1, 2024
1 parent f25cb63 commit 232e650
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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 Down Expand Up @@ -193,6 +198,81 @@ def _setupByteMonitor(self, lay, labels, channel):
lay.addWidget(SiriusLedState(
self, channel, bit), bit+1, 1, alignment=Qt.AlignCenter)

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

# 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(SiriusSpinbox(
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(SiriusSpinbox(
self, self.prefix+chs['Coeff']+'-SP'),
row, 3, alignment=Qt.AlignCenter)
lay.addWidget(lb_coeff, row, 4, alignment=Qt.AlignCenter)
lay.addWidget(SiriusSpinbox(
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)
Expand Down
50 changes: 50 additions & 0 deletions pyqt-apps/siriushla/as_rf_control/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4153,6 +4153,31 @@
'Out': 'RA-RaSIA01:RF-LLRF:GPIOOut-Mon'
}
},
'Dynamic': {
'Curr': 'RA-RaSIA01:RF-LLRF:Current-Mon',
'Curr Delta': 'RA-RaSIA01:RF-LLRF:CurrentDelta',
'Rev Cav': {
'Label': 'Rev Cav',
'Value': 'RA-RaSIA01:RF-LLRF:LimRevCav-RB',
'Enable': 'RA-RaSIA01:RF-LLRF:LimRevCavEn',
'Coeff': 'RA-RaSIA01:RF-LLRF:LimRevCavCoeff',
'Offset': 'RA-RaSIA01:RF-LLRF:LimRevCavOffset'
},
'Fwd Cav': {
'Label': 'Fwd Cav',
'Value': 'RA-RaSIA01:RF-LLRF:LimFwdCav-RB',
'Enable': 'RA-RaSIA01:RF-LLRF:LimFwdCavEn',
'Coeff': 'RA-RaSIA01:RF-LLRF:LimFwdCavCoeff',
'Offset': 'RA-RaSIA01:RF-LLRF:LimFwdCavOffset'
},
'Quench': {
'Label': 'Quench Cond 1 Ratio',
'Value': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatio-RB',
'Enable': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioEn',
'Coeff': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioCoeff',
'Offset': 'RA-RaSIA01:RF-LLRF:QuenchCond1RvRatioOffset'
},
},
'Bypass': {
'806': ['Rev SSA 1', 'RA-RaSIA01:RF-LLRF:FIMRevSSA1'],
'807': ['Rev SSA 2', 'RA-RaSIA01:RF-LLRF:FIMRevSSA2'],
Expand Down Expand Up @@ -4221,6 +4246,31 @@
'Out': 'RA-RaSIB01:RF-LLRF:GPIOOut-Mon'
}
},
'Dynamic': {
'Curr': 'RA-RaSIB01:RF-LLRF:Current-Mon',
'Curr Delta': 'RA-RaSIB01:RF-LLRF:CurrentDelta',
'Rev Cav': {
'Label': 'Rev Cav',
'Value': 'RA-RaSIB01:RF-LLRF:LimRevCav-RB',
'Enable': 'RA-RaSIB01:RF-LLRF:LimRevCavEn',
'Coeff': 'RA-RaSIB01:RF-LLRF:LimRevCavCoeff',
'Offset': 'RA-RaSIB01:RF-LLRF:LimRevCavOffset'
},
'Fwd Cav': {
'Label': 'Fwd Cav',
'Value': 'RA-RaSIB01:RF-LLRF:LimFwdCav-RB',
'Enable': 'RA-RaSIB01:RF-LLRF:LimFwdCavEn',
'Coeff': 'RA-RaSIB01:RF-LLRF:LimFwdCavCoeff',
'Offset': 'RA-RaSIB01:RF-LLRF:LimFwdCavOffset'
},
'Quench': {
'Label': 'Quench Cond 1 Ratio',
'Value': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatio-RB',
'Enable': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioEn',
'Coeff': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioCoeff',
'Offset': 'RA-RaSIB01:RF-LLRF:QuenchCond1RvRatioOffset'
},
},
'Bypass': {
'806': ['Rev SSA 1', 'RA-RaSIB01:RF-LLRF:FIMRevSSA1'],
'807': ['Rev SSA 2', 'RA-RaSIB01:RF-LLRF:FIMRevSSA2'],
Expand Down

0 comments on commit 232e650

Please sign in to comment.