diff --git a/siriuspy/siriuspy/csdevice/pwrsupply.py b/siriuspy/siriuspy/csdevice/pwrsupply.py index ff701c055..0f38fe99d 100644 --- a/siriuspy/siriuspy/csdevice/pwrsupply.py +++ b/siriuspy/siriuspy/csdevice/pwrsupply.py @@ -655,8 +655,8 @@ def get_pu_propty_database(pstype): return database -def get_pu_conv_propty_database(pstype): - """Return database definition for a pulsed power supply type.""" +def get_conv_propty_database(pstype): + """Return strength database definition for a power supply type.""" dbase = dict() dbase = _insert_strengths(dbase, pstype) return dbase @@ -756,7 +756,6 @@ def _get_ps_LINAC_propty_database(): """Return LINAC pwrsupply props.""" # NOTE: This is a mirror of the PS IOC database in linac-ioc-ps repo. version = '2020/02/12' - propty_db = { # --- ioc metapvs 'Version-Cte': {'type': 'string', 'value': version}, @@ -1635,6 +1634,7 @@ def _insert_strengths(database, pstype): 'ts-ejeseptum-thin', 'ts-ejeseptum-thick', 'ts-injseptum-thin', 'ts-injseptum-thick', 'si-injdpk', 'si-injnlk', 'si-hping', 'si-vping') + # pulsed if pstype in pulsed_pstypes: database['Kick-SP'] = { 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'mrad'} @@ -1643,6 +1643,15 @@ def _insert_strengths(database, pstype): database['Kick-Mon'] = { 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'mrad'} return database + # linac spectrometer + if pstype.startswith('li-spect'): + database['Kick-SP'] = { + 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'deg'} + database['Kick-RB'] = { + 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'deg'} + database['Kick-Mon'] = { + 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'deg'} + return database magfunc = _PSSearch.conv_pstype_2_magfunc(pstype) if magfunc in {'quadrupole', 'quadrupole-skew'}: @@ -1673,7 +1682,6 @@ def _insert_strengths(database, pstype): database['Energy-Mon'] = { 'type': 'float', 'value': 0.0, 'prec': prec_energy, 'unit': 'GeV'} elif magfunc in {'corrector-horizontal', 'corrector-vertical'}: - prec = 3 database['Kick-SP'] = { 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'urad'} database['Kick-RB'] = { @@ -1683,4 +1691,12 @@ def _insert_strengths(database, pstype): database['Kick-Mon'] = { 'type': 'float', 'value': 0.0, 'prec': prec_kick, 'unit': 'urad'} + if pstype.startswith('li-'): + if 'KickRef-Mon' in database: + del database['KickRef-Mon'] + if 'KLRef-Mon' in database: + del database['KLRef-Mon'] + if 'SLRef-Mon' in database: + del database['SLRef-Mon'] + return database diff --git a/siriuspy/siriuspy/magnet/normalizer.py b/siriuspy/siriuspy/magnet/normalizer.py index 298cf289b..fd101992d 100644 --- a/siriuspy/siriuspy/magnet/normalizer.py +++ b/siriuspy/siriuspy/magnet/normalizer.py @@ -140,9 +140,15 @@ def _calc_conv_coef(self): if unit == 'mrad': self._coef_def2edb = 1e3 return - elif unit == 'urad': + if unit == 'urad': self._coef_def2edb = 1e6 return + if unit == 'rad': + self._coef_def2edb = 1 + return + if unit == 'deg': + self._coef_def2edb = 180.0 / _np.pi + return self._coef_def2edb = 1.0 def _conv_intfield_2_strength(self, intfields, **kwargs): diff --git a/siriuspy/siriuspy/magnet/util.py b/siriuspy/siriuspy/magnet/util.py index 9170764ff..1757f62e4 100644 --- a/siriuspy/siriuspy/magnet/util.py +++ b/siriuspy/siriuspy/magnet/util.py @@ -181,7 +181,7 @@ def magnet_class(maname): raise ValueError("Cannot classify {}".format(maname)) if 'PM' == maname.dis: return 'pulsed' - if maname.dev.startswith('B') or maname.dev.startswith('Spect'): + if maname.dev.startswith('B'): return 'dipole' if 'QS' not in maname.dev and \ 'SI' == maname.sec and \ diff --git a/siriuspy/siriuspy/pwrsupply/psconv.py b/siriuspy/siriuspy/pwrsupply/psconv.py index fb5e6fa10..40a9a3442 100644 --- a/siriuspy/siriuspy/pwrsupply/psconv.py +++ b/siriuspy/siriuspy/pwrsupply/psconv.py @@ -5,7 +5,6 @@ from siriuspy.envars import VACA_PREFIX as _VACA_PREFIX from siriuspy.factory import NormalizerFactory as _NormalizerFactory from siriuspy.namesys import SiriusPVName as _SiriusPVName -from siriuspy.magnet import util as _mutil class PSEpicsConn: @@ -225,6 +224,9 @@ def _create_connectors(self, proptype, connection_timeout): 'SI-Fam:PS-B1B2-1', proptype, 'Energy', connection_timeout) psname = self._psname.replace(sub, 'Fam') conn_fam = PSEpicsConn(psname, proptype, 'KL', connection_timeout) + elif self._psname.startswith('LI'): + conn_dip = PSEpicsConn( + 'TB-Fam:PS-B', proptype, 'Energy', connection_timeout) elif self._psname.startswith('TB'): # all TB ps other than dipoles need dipole connectors conn_dip = PSEpicsConn( diff --git a/siriuspy/tests/csdevice/test_pwrsupply.py b/siriuspy/tests/csdevice/test_pwrsupply.py index 93dd55065..c6b30d0d6 100755 --- a/siriuspy/tests/csdevice/test_pwrsupply.py +++ b/siriuspy/tests/csdevice/test_pwrsupply.py @@ -32,7 +32,7 @@ 'get_common_pu_SI_InjKicker_propty_database', 'get_ps_propty_database', 'get_pu_propty_database', - 'get_pu_conv_propty_database', + 'get_conv_propty_database', 'get_li_ma_propty_database', 'get_pm_propty_database', )