-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from lnls-sirius/PR-migrate-csdevice
Migrate databases to csdevice
- Loading branch information
Showing
7 changed files
with
616 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
"""Define PVs, contants and properties of all CurrInfo SoftIOCs.""" | ||
import collections as _collections | ||
|
||
|
||
OFFONTYP = ('Off', 'On') | ||
DCCTSELECTIONTYP = ('Avg', 'DCCT13C4', 'DCCT14C4') | ||
BUFFAUTORSTTYP = ('PVsTrig', 'DCurrCheck', 'Off') | ||
|
||
|
||
class Const: | ||
"""Const class defining CurrInfo constants and Enum types.""" | ||
|
||
@staticmethod | ||
def _init(): | ||
"""Create class constants.""" | ||
for i in range(len(DCCTSELECTIONTYP)): | ||
Const._add_const('DCCT', DCCTSELECTIONTYP[i], i) | ||
for i in range(len(OFFONTYP)): | ||
Const._add_const('DCCTFltCheck', OFFONTYP[i], i) | ||
for i in range(len(BUFFAUTORSTTYP)): | ||
Const._add_const('BuffAutoRst', BUFFAUTORSTTYP[i], i) | ||
|
||
@staticmethod | ||
def _add_const(group, const, i): | ||
if not hasattr(Const, group): | ||
setattr(Const, group, _collections.namedtuple(group, '')) | ||
obj = getattr(Const, group) | ||
setattr(obj, const, i) | ||
|
||
|
||
Const._init() # create class constants | ||
|
||
|
||
def get_charge_database(): | ||
"""Return CurrentInfo-Charge Soft IOC database.""" | ||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF'}, | ||
'Charge-Mon': {'type': 'float', 'value': 0.0, 'prec': 10, | ||
'unit': 'A.h'}, | ||
'ChargeCalcIntvl-SP': {'type': 'float', 'value': 100.0, 'prec': 1, | ||
'unit': 's'}, | ||
'ChargeCalcIntvl-RB': {'type': 'float', 'value': 100.0, 'prec': 1, | ||
'unit': 's'}, | ||
} | ||
return pvs_database | ||
|
||
|
||
def get_current_database(acc): | ||
"""Return CurrentInfo-Current Soft IOC database.""" | ||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF'}, | ||
'Current-Mon': {'type': 'float', 'value': 0.0, 'prec': 3, | ||
'unit': 'mA'}, | ||
'StoredEBeam-Mon': {'type': 'int', 'value': 0}, | ||
} | ||
|
||
if acc == 'SI': | ||
pvs_database['DCCT-Sel'] = {'type': 'enum', 'value': Const.DCCT.Avg, | ||
'enums': DCCTSELECTIONTYP} | ||
pvs_database['DCCT-Sts'] = {'type': 'enum', 'value': Const.DCCT.Avg, | ||
'enums': DCCTSELECTIONTYP} | ||
pvs_database['DCCTFltCheck-Sel'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.DCCTFltCheck.On} | ||
pvs_database['DCCTFltCheck-Sts'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.DCCTFltCheck.On} | ||
return pvs_database | ||
|
||
|
||
def get_lifetime_database(): | ||
"""Return CurrentInfo-Lifetime Soft IOC database.""" | ||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF'}, | ||
'Lifetime-Mon': {'type': 'float', 'value': 0.0, 'prec': 0, | ||
'unit': 's'}, | ||
'BuffSizeMax-SP': {'type': 'int', 'lolim': 0, 'hilim': 360000, | ||
'value': 0}, | ||
'BuffSizeMax-RB': {'type': 'int', 'value': 0}, | ||
'BuffSize-Mon': {'type': 'int', 'value': 0}, | ||
'SplIntvl-SP': {'type': 'int', 'unit': 's', 'lolim': 0, | ||
'hilim': 360000, 'low': 0, 'high': 3600, | ||
'lolo': 0, 'hihi': 3600, 'value': 10}, | ||
'SplIntvl-RB': {'type': 'int', 'value': 10, 'unit': 's'}, | ||
'BuffRst-Cmd': {'type': 'int', 'value': 0}, | ||
'BuffAutoRst-Sel': {'type': 'enum', 'enums': BUFFAUTORSTTYP, | ||
'value': Const.BuffAutoRst.DCurrCheck}, | ||
'BuffAutoRst-Sts': {'type': 'enum', 'enums': BUFFAUTORSTTYP, | ||
'value': Const.BuffAutoRst.DCurrCheck}, | ||
'DCurrFactor-Cte': {'type': 'float', 'value': 0.003, 'prec': 2, | ||
'unit': 'mA'} | ||
} | ||
return pvs_database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
"""Define PVs, contants and properties of all OpticsCorr SoftIOCs.""" | ||
import collections as _collections | ||
|
||
|
||
OFFONTYP = ('Off', 'On') | ||
PROPADDTYP = ('Proportional', 'Additional') | ||
|
||
|
||
class Const: | ||
"""Const class defining OpticsCorr constants and Enum types.""" | ||
|
||
BO_SFAMS_CHROMCORR = ('SF', 'SD') | ||
SI_SFAMS_CHROMCORR = ('SFA1', 'SFA2', 'SDA1', 'SDA2', 'SDA3', | ||
'SFB1', 'SFB2', 'SDB1', 'SDB2', 'SDB3', | ||
'SFP1', 'SFP2', 'SDP1', 'SDP2', 'SDP3') | ||
BO_QFAMS_TUNECORR = ('QF', 'QD') | ||
SI_QFAMS_TUNECORR = ('QFA', 'QFB', 'QFP', | ||
'QDA', 'QDB1', 'QDB2', 'QDP1', 'QDP2') | ||
STATUSLABELS = ('MA Connection', 'MA PwrState', 'MA OpMode', | ||
'MA CtrlMode', 'Timing Config') | ||
|
||
@staticmethod | ||
def _init(): | ||
"""Create class constants.""" | ||
for i in range(len(PROPADDTYP)): | ||
Const._add_const('CorrMeth', PROPADDTYP[i], i) | ||
for i in range(len(OFFONTYP)): | ||
Const._add_const('SyncCorr', OFFONTYP[i], i) | ||
|
||
@staticmethod | ||
def _add_const(group, const, i): | ||
if not hasattr(Const, group): | ||
setattr(Const, group, _collections.namedtuple(group, '')) | ||
obj = getattr(Const, group) | ||
setattr(obj, const, i) | ||
|
||
|
||
Const._init() # create class constants | ||
|
||
|
||
def get_chrom_database(acc): | ||
"""Return OpticsCorr-Chrom Soft IOC database.""" | ||
if acc == 'BO': | ||
sfams = Const.BO_SFAMS_CHROMCORR | ||
elif acc == 'SI': | ||
sfams = Const.SI_SFAMS_CHROMCORR | ||
|
||
corrmat_size = len(sfams)*2 | ||
|
||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF', 'scan': 0.25}, | ||
|
||
'Log-Mon': {'type': 'string', 'value': 'Starting...'}, | ||
|
||
'ChromX-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 10, 'lolim': -10, 'high': 10, | ||
'low': -10, 'hihi': 10, 'lolo': -10}, | ||
'ChromX-RB': {'type': 'float', 'value': 0, 'prec': 6}, | ||
'ChromY-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 10, 'lolim': -10, 'high': 10, | ||
'low': -10, 'hihi': 10, 'lolo': -10}, | ||
'ChromY-RB': {'type': 'float', 'value': 0, 'prec': 6}, | ||
|
||
'ApplyCorr-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'ConfigName-SP': {'type': 'string', 'value': ''}, | ||
'ConfigName-RB': {'type': 'string', 'value': ''}, | ||
'RespMat-Mon': {'type': 'float', 'count': corrmat_size, | ||
'value': corrmat_size*[0], 'prec': 6, 'unit': | ||
'Chrom x SFams (Matrix of add method)'}, | ||
'NominalChrom-Mon': {'type': 'float', 'count': 2, 'value': 2*[0], | ||
'prec': 6}, | ||
'NominalSL-Mon': {'type': 'float', 'count': len(sfams), | ||
'value': len(sfams)*[0], 'prec': 6}, | ||
|
||
'ConfigMA-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'Status-Mon': {'type': 'int', 'value': 0b11111}, | ||
'StatusLabels-Cte': {'type': 'string', 'count': 5, | ||
'value': Const.STATUSLABELS}, | ||
} | ||
|
||
for fam in sfams: | ||
pvs_database['SL' + fam + '-Mon'] = { | ||
'type': 'float', 'value': 0, 'prec': 4, 'unit': '1/m^2', | ||
'lolim': 0, 'hilim': 0, 'low': 0, 'high': 0, 'lolo': 0, 'hihi': 0} | ||
|
||
if acc == 'SI': | ||
pvs_database['CorrMeth-Sel'] = {'type': 'enum', 'enums': PROPADDTYP, | ||
'value': Const.CorrMeth.Proportional} | ||
pvs_database['CorrMeth-Sts'] = {'type': 'enum', 'enums': PROPADDTYP, | ||
'value': Const.CorrMeth.Proportional} | ||
pvs_database['SyncCorr-Sel'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.SyncCorr.Off} | ||
pvs_database['SyncCorr-Sts'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.SyncCorr.Off} | ||
pvs_database['ConfigTiming-Cmd'] = {'type': 'int', 'value': 0} | ||
|
||
return pvs_database | ||
|
||
|
||
def get_tune_database(acc): | ||
"""Return OpticsCorr-Tune Soft IOC database.""" | ||
if acc == 'BO': | ||
qfams = Const.BO_QFAMS_TUNECORR | ||
elif acc == 'SI': | ||
qfams = Const.SI_QFAMS_TUNECORR | ||
|
||
corrmat_size = len(qfams)*2 | ||
|
||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF'}, | ||
|
||
'Log-Mon': {'type': 'string', 'value': 'Starting...'}, | ||
|
||
'DeltaTuneX-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 1, 'lolim': -1, 'high': 1, 'low': -1, | ||
'hihi': 1, 'lolo': -1}, | ||
'DeltaTuneX-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 1, 'lolim': -1, 'high': 1, 'low': -1, | ||
'hihi': 1, 'lolo': -1}, | ||
'DeltaTuneY-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 1, 'lolim': -1, 'high': 1, 'low': -1, | ||
'hihi': 1, 'lolo': -1}, | ||
'DeltaTuneY-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'hilim': 1, 'lolim': -1, 'high': 1, 'low': -1, | ||
'hihi': 1, 'lolo': -1}, | ||
|
||
'ApplyCorr-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'ConfigName-SP': {'type': 'string', 'value': ''}, | ||
'ConfigName-RB': {'type': 'string', 'value': ''}, | ||
'RespMat-Mon': {'type': 'float', 'count': corrmat_size, | ||
'value': corrmat_size*[0], 'prec': 6, 'unit': | ||
'Tune x QFams (Nominal Response Matrix)'}, | ||
'NominalKL-Mon': {'type': 'float', 'count': len(qfams), | ||
'value': len(qfams)*[0], 'prec': 6}, | ||
|
||
'CorrFactor-SP': {'type': 'float', 'value': 0, 'unit': '%', | ||
'prec': 1, 'hilim': 1000, 'lolim': -1000, | ||
'high': 1000, 'low': -1000, 'hihi': 1000, | ||
'lolo': -1000}, | ||
'CorrFactor-RB': {'type': 'float', 'value': 0, 'unit': '%', | ||
'prec': 1, 'hilim': 1000, 'lolim': -1000, | ||
'high': 1000, 'low': -1000, 'hihi': 1000, | ||
'lolo': -1000}, | ||
|
||
'ConfigMA-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'SetNewRefKL-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'Status-Mon': {'type': 'int', 'value': 0b11111}, | ||
'StatusLabels-Cte': {'type': 'string', 'count': 5, | ||
'value': Const.STATUSLABELS}, | ||
} | ||
|
||
for fam in qfams: | ||
pvs_database['RefKL' + fam + '-Mon'] = {'type': 'float', 'value': 0, | ||
'prec': 6, 'unit': '1/m'} | ||
|
||
pvs_database['DeltaKL' + fam + '-Mon'] = { | ||
'type': 'float', 'value': 0, 'prec': 6, 'unit': '1/m', | ||
'lolim': 0, 'hilim': 0, 'low': 0, 'high': 0, 'lolo': 0, 'hihi': 0} | ||
|
||
if acc == 'SI': | ||
pvs_database['CorrMeth-Sel'] = {'type': 'enum', 'enums': PROPADDTYP, | ||
'value': Const.CorrMeth.Proportional} | ||
pvs_database['CorrMeth-Sts'] = {'type': 'enum', 'enums': PROPADDTYP, | ||
'value': Const.CorrMeth.Proportional} | ||
pvs_database['SyncCorr-Sel'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.SyncCorr.Off} | ||
pvs_database['SyncCorr-Sts'] = {'type': 'enum', 'enums': OFFONTYP, | ||
'value': Const.SyncCorr.Off} | ||
pvs_database['ConfigTiming-Cmd'] = {'type': 'int', 'value': 0} | ||
|
||
return pvs_database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"""Define PVs, contants and properties of all PosAng SoftIOCs.""" | ||
|
||
|
||
class Const: | ||
"""Const class defining PosAng constants.""" | ||
|
||
TB_CORRH_POSANG = ('TB-03:MA-CH', 'TB-04:PM-InjSept') | ||
TB_CORRV_POSANG = ('TB-04:MA-CV-1', 'TB-04:MA-CV-2') | ||
TS_CORRH_POSANG = ('TS-04:MA-CH', 'TS-04:PM-InjSeptF') | ||
TS_CORRV_POSANG = ('TS-04:MA-CV-1', 'TS-04:MA-CV-2') | ||
|
||
STATUSLABELS = ('MA Connection', 'MA PwrState', 'MA OpMode', 'MA CtrlMode') | ||
|
||
|
||
def get_posang_database(): | ||
"""Return Soft IOC database.""" | ||
pvs_database = { | ||
'Version-Cte': {'type': 'string', 'value': 'UNDEF'}, | ||
|
||
'Log-Mon': {'type': 'string', 'value': 'Starting...'}, | ||
|
||
'DeltaPosX-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mm', 'hilim': 5, 'lolim': -5}, | ||
'DeltaPosX-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mm'}, | ||
'DeltaAngX-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad', 'hilim': 4, 'lolim': -4}, | ||
'DeltaAngX-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
|
||
'DeltaPosY-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mm', 'hilim': 5, 'lolim': -5}, | ||
'DeltaPosY-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mm'}, | ||
'DeltaAngY-SP': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad', 'hilim': 4, 'lolim': -4}, | ||
'DeltaAngY-RB': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
|
||
'ConfigName-SP': {'type': 'string', 'value': ''}, | ||
'ConfigName-RB': {'type': 'string', 'value': ''}, | ||
'RespMatX-Mon': {'type': 'float', 'value': 4*[0], 'prec': 3, | ||
'count': 4}, | ||
'RespMatY-Mon': {'type': 'float', 'value': 4*[0], 'prec': 3, | ||
'count': 4}, | ||
|
||
'RefKickCH1-Mon': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
'RefKickCH2-Mon': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
'RefKickCV1-Mon': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
'RefKickCV2-Mon': {'type': 'float', 'value': 0, 'prec': 6, | ||
'unit': 'mrad'}, | ||
'SetNewRefKick-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'ConfigMA-Cmd': {'type': 'int', 'value': 0}, | ||
|
||
'Status-Mon': {'type': 'int', 'value': 0b1111}, | ||
'StatusLabels-Cte': {'type': 'string', 'count': 4, | ||
'value': Const.STATUSLABELS}, | ||
} | ||
return pvs_database |
Oops, something went wrong.