예제 #1
0
    def _create_pvs(self):
        """Create PVs."""
        Timing._pvs = dict()
        for dict_ in Timing.properties.values():
            for pvname in dict_.keys():
                if pvname in Timing._pvs.keys():
                    continue
                pvname = _PVName(pvname)
                Timing._pvs[pvname] = _PV(
                    VACA_PREFIX+pvname, connection_timeout=TIMEOUT_CONNECTION)

                if pvname.propty_suffix in ('Cmd', 'Mon'):
                    continue

                self._initial_state[pvname] = Timing._pvs[pvname].value

                if pvname.propty_suffix == 'SP':
                    pvname_sts = pvname.substitute(propty_suffix='RB')
                elif pvname.propty_suffix == 'Sel':
                    pvname_sts = pvname.substitute(propty_suffix='Sts')
                else:
                    continue
                Timing._pvs[pvname_sts] = _PV(
                    VACA_PREFIX+pvname_sts,
                    connection_timeout=TIMEOUT_CONNECTION)
예제 #2
0
    def __init__(self):
        """Class constructor."""
        super().__init__()

        # consts
        self._pvs_database = _get_database('BO')
        self._dcct = 'BO-35D:DI-DCCT'

        # initialize vars
        self._samplecnt = None
        self._measperiod = None
        self._reliablemeas = None
        self._last_raw_reading = None

        currthold_db = self._pvs_database['CurrThold-SP']
        self._currthold = currthold_db['value']
        self._currthold_lolim = currthold_db['lolim']
        self._currthold_hilim = currthold_db['hilim']

        self._rampeff = None
        self._currents = dict()
        self._charges = dict()
        for k in self.ENERGY2TIME:
            # currents
            self._currents[k] = 0.0
            # charges
            ppty = 'Charge' + k + '-Mon'
            data = self._get_value_from_arch('BO-Glob:AP-CurrInfo:' + ppty)
            if data is None:
                charge = 0.0
            else:
                charge = data[1][0]
            self._charges[k] = charge

        data = self._get_value_from_arch(
            'BO-Glob:AP-CurrInfo:IntCurrent3GeV-Mon')
        if data is None:
            self._intcurrent3gev = 0.0
        else:
            self._intcurrent3gev = data[1][0]

        # PVs
        self._rawreadings_pv = _PV(_vaca_prefix + self._dcct +
                                   ':RawReadings-Mon',
                                   connection_timeout=0.05,
                                   callback=self._callback_get_rawreadings,
                                   auto_monitor=True)
        self._samplecnt_pv = _PV(_vaca_prefix + self._dcct +
                                 ':FastSampleCnt-RB',
                                 connection_timeout=0.05,
                                 callback=self._callback_get_samplecnt)
        self._measperiod_pv = _PV(_vaca_prefix + self._dcct +
                                  ':FastMeasPeriod-RB',
                                  connection_timeout=0.05,
                                  callback=self._callback_get_measperiod)
        self._reliablemeas_pv = _PV(_vaca_prefix + self._dcct +
                                    ':ReliableMeas-Mon',
                                    connection_timeout=0.05,
                                    callback=self._callback_get_reliablemeas)
예제 #3
0
    def __init__(self):
        """Class constructor."""
        super().__init__()

        self._init_time = _time.time()

        self._pvs_database = _get_database()
        self._mode = _Const.Fit.Linear
        self._current_offset = 0.0
        self._frst_smpl_ts = self._init_time
        self._last_smpl_ts = -1
        self._frst_smpl_ts_dcct = self._init_time
        self._last_smpl_ts_dcct = -1
        self._smpl_intvl_mon_dcct = 0.0
        self._frst_smpl_ts_bpm = self._init_time
        self._last_smpl_ts_bpm = -1
        self._smpl_intvl_mon_bpm = 0.0
        self._last_ts_set = 'last'
        self._sampling_interval = 500.0
        self._min_intvl_btw_spl = 0.0
        self._rstbuff_cmd_count = 0
        self._buffautorst_mode = _Const.BuffAutoRst.Off
        self._buffautorst_dcurr = 0.1
        self._is_stored = 0
        self._lifetime = 0
        self._lifetime_bpm = 0

        self._current_pv = _PV(_vaca_prefix +
                               'SI-Glob:AP-CurrInfo:Current-Mon',
                               connection_timeout=0.05)
        self._bpmsum_pv = _PV(_vaca_prefix + 'SI-01M1:DI-BPM:Sum-Mon',
                              connection_timeout=0.05)
        self._storedebeam_pv = _PV(_vaca_prefix +
                                   'SI-Glob:AP-CurrInfo:StoredEBeam-Mon',
                                   connection_timeout=0.05)

        self._current_buffer = _SiriusPVTimeSerie(
            pv=self._current_pv,
            mode=0,
            nr_max_points=_MAX_BUFFER_SIZE,
            use_pv_timestamp=False)
        self._bpmsum_buffer = _SiriusPVTimeSerie(
            pv=self._bpmsum_pv,
            mode=0,
            nr_max_points=_MAX_BUFFER_SIZE,
            use_pv_timestamp=False)

        self._current_pv.add_callback(self._callback_calclifetime)
        self._bpmsum_pv.add_callback(self._callback_calclifetime)
        self._storedebeam_pv.add_callback(self._callback_get_storedebeam)
예제 #4
0
    def _create_pvs():
        pvs = dict()
        for trig in BOTIRampFactory._triggers:
            for ppty in {'Src-Sts', 'Delay-RB'}:
                pvname = trig + ':' + ppty
                pvs[pvname] = _PV(pvname, connection_timeout=TIMEOUT_CONN)

        for ev in BOTIRampFactory._events:
            pvname = ev + 'Delay-RB'
            pvs[pvname] = _PV(pvname, connection_timeout=TIMEOUT_CONN)

        egun_sb_sts_pvname = 'LI-01:EG-PulsePS:singleselstatus'
        pvs[egun_sb_sts_pvname] = _PV(
            egun_sb_sts_pvname, connection_timeout=TIMEOUT_CONN)

        BOTIRampFactory._PVs = pvs
예제 #5
0
    def __init__(self,
                 cyclers=None,
                 timing=None,
                 is_bo=False,
                 ramp_config=None,
                 logger=None):
        """Initialize."""
        # initialize auxiliar variables
        self._mode = None
        self._sections = list()
        self._only_linac = None
        self._cycle_duration = 0
        self._aux_cyclers = dict()
        self._cycle_trims_duration = 0
        self._checks_result = dict()

        # in case cyclers are not set and user wants to cycle bo
        self._is_bo = is_bo
        self._ramp_config = ramp_config

        # cyclers
        self.cyclers = cyclers

        # timing connector
        self.timing = timing

        # logger
        self._logger_message = ''
        self.logger = logger

        # egun pv
        if 'LI-01:PS-Spect' in self.psnames:
            self._pv_egun = _PV('LI-01:EG-TriggerPS:enablereal',
                                connection_timeout=0.05)
예제 #6
0
    def __init__(self, callback=None):
        """."""
        self.image_processor = _ProcessImage(callback=callback)
        self._profile = self.DEF_PROFILE
        self.image_processor.px2mmscalex = self.DEF_COEFX
        self.image_processor.px2mmscaley = self.DEF_COEFY

        self._width_source = _PV(self._profile + 'cam1:ArraySizeX_RBV')
        self._image_source = _PV(self._profile + 'image1:ArrayData',
                                 auto_monitor=True)
        super().__init__(callback=callback)
        self._thread = _Repeater(1 / self.DEF_RATE,
                                 self.process_image,
                                 niter=0)
        self._thread.pause()
        self._thread.start()
예제 #7
0
 def __init__(self, callback=None):
     """."""
     self.energy_calculator = CalcEnergy(callback=callback)
     self.image_processor = _ProcessImage(callback=callback)
     self._profile = self.DEFAULT_PROFILE
     self._coefx = _PV(self.DEFAULT_PROFILE + ':X:Gauss:Coef',
                       callback=self._update_coefx)
     self._coefy = _PV(self.DEFAULT_PROFILE + ':Y:Gauss:Coef',
                       callback=self._update_coefy)
     self._width_source = _PV(self.DEFAULT_PROFILE + ':ROI:MaxSizeX_RBV')
     self._image_source = _PV(self.DEFAULT_PROFILE + ':RAW:ArrayData',
                              auto_monitor=False)
     self._current_source = _PV(self.DEFAULT_SPECT + ':Current-Mon')
     super().__init__(callback=callback)
     self._thread = _Repeater(0.5, self.meas_energy, niter=0)
     self._thread.pause()
     self._thread.start()
예제 #8
0
파일: HLPosAng.py 프로젝트: lnls-sirius/hla
    def __init__(self, parent=None, prefix='', tl=None):
        """Class construc."""
        super(PosAngCorr, self).__init__(parent)
        if not prefix:
            self._prefix = _VACA_PREFIX
        else:
            self._prefix = prefix
        self._tl = tl.upper()
        base_name = _PVName('TL-Glob:AP-PosAng')
        self.posang_prefix = base_name.substitute(
            prefix=self._prefix, sec=self._tl)
        self.setObjectName(self._tl+'App')
        self.setWindowTitle(self._tl + ' Position and Angle Correction Window')

        if self._tl == 'TS':
            self._is_chsept = False
            ch3_pv = _PV(self.posang_prefix.substitute(propty='CH3-Cte'),
                         connection_timeout=1)
            if not ch3_pv.wait_for_connection():
                self._is_chsept = True

        if tl == 'ts':
            corr_h = (Const.TS_CORRH_POSANG_CHSEPT if self._is_chsept
                      else Const.TS_CORRH_POSANG_SEPTSEPT)
            corr_v = Const.TS_CORRV_POSANG
        elif tl == 'tb':
            corr_h = Const.TB_CORRH_POSANG
            corr_v = Const.TB_CORRV_POSANG

        self.corrs = dict()
        self.corrs['CH1'] = _PVName(corr_h[0])
        self.corrs['CH2'] = _PVName(corr_h[1])
        if len(corr_h) == 3:
            self.corrs['CH3'] = _PVName(corr_h[2])
        self.corrs['CV1'] = _PVName(corr_v[0])
        self.corrs['CV2'] = _PVName(corr_v[1])
        if len(corr_v) == 4:
            self.corrs['CV3'] = _PVName(corr_v[2])
            self.corrs['CV4'] = _PVName(corr_v[3])

        self._just_need_update = False
        self._update_ref_action = False
        self._my_input_widgets = list()
        self._setupUi()
        self.setFocus(True)
        self.setFocusPolicy(Qt.StrongFocus)

        self._ask_message = QMessageBox(self)
        self._ask_message.setWindowTitle('Message')
        self._ask_message.setText(
            'The '+self._tl+' PosAng IOC indicates reference needs to '
            'be updated! Do you want to update the reference?')
        self._ask_message.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
        self._ask_message.setDefaultButton(QMessageBox.No)
        self.app = QApplication.instance()
        self.app.focusChanged.connect(self._spinbox_onfocus)
예제 #9
0
 def _create_primary_pvs_list(self, pvs):
     # get list of primary pvs
     ppvs = list()  # List with PVs used by the computed PV
     for pvobj in pvs:
         if isinstance(pvobj, str):  # give up string option.
             tpv = _PV(pvobj, connection_timeout=_CONN_TIMEOUT)
             ppvs.append(tpv)
         else:
             ppvs.append(pvobj)
     return ppvs
예제 #10
0
 def __init__(self, psname):
     """Constructor."""
     self._psname = psname
     self._waveform = None
     self._cycle_duration = None
     self._times = None
     self._pvs = dict()
     for prop in LinacPSCycler.properties:
         if prop not in self._pvs.keys():
             self._pvs[prop] = _PV(
                 VACA_PREFIX + self._psname + ':' + prop,
                 connection_timeout=TIMEOUT_CONNECTION)
예제 #11
0
파일: tasks.py 프로젝트: lnls-sirius/hla
    def __init__(self,
                 parent=None,
                 restore_initial_value=False,
                 dis='PS',
                 state='on',
                 devices=list()):
        """Constructor."""
        super().__init__(parent)
        self._dis = dis
        filt = {'dev': 'Mags'} if dis == 'PS' else {'dev': '.*(Kckr|Sept).*'}
        self._triggers = _HLTimeSearch.get_hl_triggers(filters=filt)
        self._pvs_sp = {
            trg: _PV(trg + ':State-Sel', connection_timeout=0.05)
            for trg in self._triggers
        }
        self._pvs_rb = {
            trg: _PV(trg + ':State-Sts', connection_timeout=0.05)
            for trg in self._triggers
        }

        for trg, pv in self._pvs_rb.items():
            pv.wait_for_connection(TIMEOUT_CONN)
            if trg not in TriggerTask.initial_triggers_state.keys():
                TriggerTask.initial_triggers_state[trg] = pv.value

        if restore_initial_value:
            self.trig2val = {
                k: v
                for k, v in TriggerTask.initial_triggers_state.items()
                if k in self._triggers
            }
        else:
            val = Const.DsblEnbl.Enbl if state == 'on' else Const.DsblEnbl.Dsbl
            self.trig2val = {trig: val for trig in self._triggers}

        self._devices = devices
        self._trig2ctrl = self._get_trigger_by_psname(self._devices)

        self._quit_task = False
예제 #12
0
    def __init__(self, device):
        """Init."""
        super().__init__(device)

        self.properties = [
            'Reset-Cmd', 'GenIntlk-Mon', 'GenWarn-Mon', 'OpMode-Sts',
            'PwrState-Sel', 'PwrState-Sts',
            'Voltage-SP', 'VoltageRef-Mon', 'Voltage-Mon']

        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)
예제 #13
0
 def __init__(self, psname, ramp_config=None):
     """Constructor."""
     self._psname = psname
     self._ramp_config = ramp_config
     self._waveform = None
     self._siggen = None
     self._init_wfm_pulsecnt = None
     self._pvs = dict()
     for prop in PSCycler.properties:
         if prop not in self._pvs.keys():
             self._pvs[prop] = _PV(
                 VACA_PREFIX + self._psname + ':' + prop,
                 connection_timeout=TIMEOUT_CONNECTION)
예제 #14
0
    def __init__(self, device):
        super().__init__(device)
        self.properties = [
            'StatusIntlk-Mon', 'IntlkWarn-Mon',
            'PwrState-Sel', 'PwrState-Sts',
            'Current-SP', 'Current-Mon',
            'Connected-Mon']
        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)

        self.intlkwarn_bit = _PSE.LINAC_INTLCK_WARN.index('LoadI Over Thrs')

        splims = PSSearch.conv_psname_2_splims(device)
        self.test_current = splims['TSTV']
        self.test_tol = splims['TSTR']
예제 #15
0
    def __init__(self, device):
        """Init."""
        super().__init__(device)

        self.properties = [
            'Reset-Cmd',
            'OpMode-Sel', 'OpMode-Sts',
            'PwrState-Sel', 'PwrState-Sts',
            'CtrlLoop-Sel', 'CtrlLoop-Sts',
            'CapacitorBankVoltage-SP', 'CapacitorBankVoltageRef-Mon',
            'CapacitorBankVoltage-Mon']
        self._intlk_pvs = get_ps_interlocks(psname=self.device)
        self.properties.extend(self._intlk_pvs)

        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)
예제 #16
0
        def _applyconfig(self):
            sender_text = self.sender().text()
            if 'Standby' in sender_text:
                config_name = 'standby'
            elif 'TurnOff' in sender_text:
                config_name = 'turnoff'

            ans = QMessageBox.question(
                self, 'Are you Sure?',
                "Do you really want to apply the Configuration '" +
                config_name + "' to the machine?", QMessageBox.Yes,
                QMessageBox.Cancel)
            if ans != QMessageBox.Yes:
                return

            current, ok = QInputDialog.getDouble(
                self,
                'Enter value: ', 'Enter FilaPS standby current [A]\n'
                'or cancel to not set it: ',
                value=0.7,
                min=0.0,
                max=1.5,
                decimals=3)
            if ok:
                fila_pv = _PV(_prefix + 'LI-01:EG-FilaPS:currentoutsoft',
                              connection_timeout=0.05)
                fila_pv.get()  # force connection
                if fila_pv.connected:
                    fila_pv.put(current)
                else:
                    QMessageBox.warning(
                        self, 'Message',
                        'Could not connect to LI-01:EG-FilaPS!')

            client = ConfigDBClient()

            WinClass = create_window_from_widget(
                SelectAndApplyPVsWidget, 'Select PVs to Apply Standby')
            wind = WinClass(self, client)
            wind.widget.settingFinished.connect(wind.close)
            wind.widget.fill_config('global_config', config_name)
            wind.exec_()
예제 #17
0
    def __init__(self, device):
        """Init."""
        super().__init__(device)
        self.properties = [
            'PSAmpOverCurrFlagL-Sts', 'PSAmpOverTempFlagL-Sts',
            'PSAmpOverCurrFlagR-Sts', 'PSAmpOverTempFlagR-Sts',
            'PwrState-Sel', 'PwrState-Sts',
            'CtrlLoop-Sel', 'CtrlLoop-Sts',
            'Current-SP', 'Current-RB',
            'TestOpenLoopTriang-Sel', 'TestOpenLoopTriang-Sts',
            'TestOpenLoopSquare-Sel', 'TestOpenLoopSquare-Sts',
            'TestClosedLoopSquare-Sel', 'TestClosedLoopSquare-Sts',
        ]
        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)

        splims = PSSearch.conv_psname_2_splims(device)
        self.test_current = splims['TSTV']
        self.test_tol = splims['TSTR']
예제 #18
0
    def __init__(self, device):
        """Init."""
        super().__init__(device)

        self.properties = [
            'Reset-Cmd',
            'Intlk1-Mon', 'Intlk2-Mon', 'Intlk3-Mon', 'Intlk4-Mon',
            'Intlk5-Mon', 'Intlk6-Mon', 'Intlk7-Mon',
            'PwrState-Sel', 'PwrState-Sts',
            'Pulse-Sel', 'Pulse-Sts',
            'Voltage-SP', 'Voltage-RB', 'Voltage-Mon']
        if 'Kckr' in self.device:
            self.properties.append('Intlk8-Mon')

        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)

        splims = PSSearch.conv_psname_2_splims(device)
        self.test_voltage = splims['TSTV']
        self.test_tol = splims['TSTR']
예제 #19
0
    def __init__(self, acc):
        """Class constructor."""
        super().__init__(acc)

        # consts
        self._delta_tunex = 0.0
        self._delta_tuney = 0.0

        self._set_new_refkl_cmd_count = 0

        if self._acc == 'SI':
            self._meas_config_dkl_qf = 0.020
            self._meas_config_dkl_qd = 0.020

        # Connect to Quadrupoles Families
        self._psfam_refkl = {fam: 0 for fam in self._psfams}
        self._lastcalc_deltakl = {fam: 0 for fam in self._psfams}
        for fam in self._psfams:
            self._psfam_intstr_rb_pvs[fam] = _PV(
                _vaca_prefix + self._acc + '-Fam:PS-' + fam + ':KL-RB',
                callback=[
                    self._callback_init_refkl,
                    self._callback_estimate_deltatune
                ],
                connection_timeout=0.05)

        self.map_pv2write.update({
            'DeltaTuneX-SP':
            self.set_dtune_x,
            'DeltaTuneY-SP':
            self.set_dtune_y,
            'SetNewRefKL-Cmd':
            self.cmd_set_newref,
            'MeasConfigDeltaKLFamQF-SP':
            self.set_meas_config_dkl_qf,
            'MeasConfigDeltaKLFamQD-SP':
            self.set_meas_config_dkl_qd,
        })
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)

        # setup the ui
        uifile = _getUiFile(self)
        self.ui = _uic.loadUi(uifile, self)

        self.updating_couple_flag = False
        self.coupling_master = _PV('und:CouplingMaster')
        self.coupling_slaves = _PV('und:CouplingSlaves')
        self.en_coupling = _PV('und:EnGeneralCoupling')
        self.coupling_direction = {'slv1': _PV('und:CouplingDirection[0]'),
                                   'slv2': _PV('und:CouplingDirection[1]'),
                                   'slv3': _PV('und:CouplingDirection[2]')}

        # connect signals and slots
        self.connect_signals_slots()
예제 #21
0
    def __init__(self, device):
        """Init."""
        super().__init__(device)

        self.properties = [
            'Reset-Cmd',
            'OpMode-Sel', 'OpMode-Sts',
            'PwrState-Sel', 'PwrState-Sts',
            'CtrlLoop-Sel', 'CtrlLoop-Sts',
            'Current-SP', 'CurrentRef-Mon', 'Current-Mon']
        self._intlk_pvs = get_ps_interlocks(psname=self.device)
        self.properties.extend(self._intlk_pvs)

        if PSSearch.conv_psname_2_psmodel(self.device) == 'FBP':
            self.properties.extend(['SOFBMode-Sel', 'SOFBMode-Sts'])

        for ppty in self.properties:
            self._pvs[ppty] = _PV(
                _PVName(device).substitute(prefix=VACA_PREFIX, propty=ppty),
                connection_timeout=TIMEOUT_CONN)

        splims = PSSearch.conv_psname_2_splims(device)
        self.test_current = splims['TSTV']
        self.test_tol = splims['TSTR']
예제 #22
0
    def __init__(self, callback=None):
        """."""
        self.image_processor = _ProcessImage(callback=callback)
        self.image_processor.px2mmscalex = self.DEF_COEFX
        self.image_processor.px2mmscaley = self.DEF_COEFY
        self.image_processor.roiautocenter = self.AutoCenter.Manual
        self.image_processor.imageflipx = self.image_processor.ImgFlip.On
        self.image_processor.imageflipy = self.image_processor.ImgFlip.Off
        self.image_processor.roisizex = self.DEF_ROISIZE
        self.image_processor.roisizey = self.DEF_ROISIZE
        self.image_processor.roicenterx = self.TARGETX
        self.image_processor.roicentery = self.TARGETY
        self.image_processor.method = self.Method.Moments
        self._profile = self.DEF_PROFILE
        self._target_posx = self.TARGETX
        self._target_posy = self.TARGETY
        self._needed_dbumpx = 0.0
        self._needed_dbumpy = 0.0
        self._applied_bumpx = 0.0
        self._applied_bumpy = 0.0
        self._need_update = True
        self._apply_status = self.ApplyStatus.Idle
        conf = _ConfigDBClient(config_type='si_orbit')
        self._refs = conf.get_config_value('ref_orb')
        self._sofb_pvs = dict(refx_sp=_PV('SI-Glob:AP-SOFB:RefOrbX-SP'),
                              refy_sp=_PV('SI-Glob:AP-SOFB:RefOrbY-SP'),
                              refx_rb=_PV('SI-Glob:AP-SOFB:RefOrbX-RB',
                                          callback=self._set_need_update),
                              refy_rb=_PV('SI-Glob:AP-SOFB:RefOrbY-RB',
                                          callback=self._set_need_update))

        self._width_source = _PV(self._profile + 'cam1:ArraySizeX_RBV')
        self._image_source = _PV(self._profile + 'image1:ArrayData',
                                 auto_monitor=True)
        super().__init__(callback=callback)
        self._thread = _Repeater(1 / self.DEF_RATE,
                                 self.process_image,
                                 niter=0)
        self._thread.pause()
        self._thread.start()
예제 #23
0
 def _create_pvs(self):
     pvs = dict()
     for param, pvname in BORFRampFactory._ppties.items():
         pvs[param] = _PV(pvname, connection_timeout=TIMEOUT_CONN)
     BORFRampFactory._PVs = pvs
예제 #24
0
    def __init__(self, acc):
        """Class constructor."""
        super().__init__()
        self._acc = acc.upper()

        # consts
        if self._optics_param == 'tune':
            self._pvs_database = _get_tune_database(self._acc)
            if self._acc == 'BO':
                self._psfams = _Const.BO_QFAMS_TUNECORR
                self._psfam_nelm = _Const.BO_QFAMS_NELM
            else:
                self._psfams = _Const.SI_QFAMS_TUNECORR
                self._psfam_nelm = _Const.SI_QFAMS_NELM
                self._trigger_name = 'SI-Glob:TI-Mags-Quads'
                self._event_name = 'TunSI'
        else:
            self._pvs_database = _get_chrom_database(self._acc)
            if self._acc == 'BO':
                self._psfams = _Const.BO_SFAMS_CHROMCORR
                self._psfam_nelm = _Const.BO_SFAMS_NELM
            else:
                self._psfams = _Const.SI_SFAMS_CHROMCORR
                self._psfam_nelm = _Const.SI_SFAMS_NELM
                self._trigger_name = 'SI-Glob:TI-Mags-Sexts'
                self._event_name = 'ChromSI'

        self._status = ALLSET if self._acc == 'SI' else 0x0f

        self._optprm_est = [0.0, 0.0]

        self._apply_corr_cmd_count = 0
        self._config_ps_cmd_count = 0

        self._psfam_check_connection = {fam: 0 for fam in self._psfams}
        self._psfam_check_pwrstate_sts = {fam: 0 for fam in self._psfams}
        self._psfam_check_opmode_sts = {fam: -1 for fam in self._psfams}
        self._psfam_check_ctrlmode_mon = {fam: 1 for fam in self._psfams}
        self._psfam_intstr_rb = {fam: 0 for fam in self._psfams}

        if self._acc == 'SI':
            self._corr_method = _Const.CorrMeth.Proportional
            self._corr_group = _Const.CorrGroup.TwoKnobs
            self._sync_corr = _Const.SyncCorr.Off

            self._config_ti_cmd_count = 0
            self._timing_check_config = 9*[0]

            self._measuring_config = False
            self._meas_config_status = _Const.MeasMon.Idle
            self._meas_config_lastcomm = _Const.MeasCmd.Reset
            self._meas_config_wait = 1
            self._meas_config_name = 'UNDEF'
            self._meas_config_2_save = None
            self._meas_config_save_cmd_count = 0

            self._is_storedebeam = 0
        else:
            self._corr_method = _Const.CorrMeth.Additional
            self._corr_group = _Const.CorrGroup.TwoKnobs
            self._sync_corr = _Const.SyncCorr.Off

        # Get focusing and defocusing families
        psfam_focusing = []
        psfam_defocusing = []
        ps_focus_type = 'QF' if self._optics_param == 'tune' else 'SF'
        for fam in self._psfams:
            if ps_focus_type in fam:
                psfam_focusing.append(fam)
            else:
                psfam_defocusing.append(fam)
        psfam_focusing = tuple(psfam_focusing)
        psfam_defocusing = tuple(psfam_defocusing)

        # Initialize correction parameters from local file and configdb
        self.cn_handler = _HandleConfigNameFile(self._acc, self._optics_param)
        self.cdb_client = _ConfigDBClient(
            config_type=self._acc.lower()+'_'+self._optics_param+'corr_params')
        [done, corrparams] = self._get_corrparams()
        if done:
            self._config_name = corrparams[0]
            self._nominal_matrix = corrparams[1]
            self._psfam_nom_intstr = corrparams[2]
            self._nominal_opticsparam = corrparams[3]
            self._opticscorr = _OpticsCorr(
                magnetfams_ordering=self._psfams,
                nominal_matrix=self._nominal_matrix,
                nominal_intstrengths=self._psfam_nom_intstr,
                nominal_opticsparam=self._nominal_opticsparam,
                magnetfams_focusing=psfam_focusing,
                magnetfams_defocusing=psfam_defocusing)
        else:
            raise Exception(
                "Could not read correction parameters from configdb.")

        # Connect to Quadrupoles Families
        self._psfam_intstr_sp_pvs = dict()
        self._psfam_intstr_rb_pvs = dict()
        self._psfam_pwrstate_sel_pvs = dict()
        self._psfam_pwrstate_sts_pvs = dict()
        self._psfam_opmode_sel_pvs = dict()
        self._psfam_opmode_sts_pvs = dict()
        self._psfam_ctrlmode_mon_pvs = dict()
        for fam in self._psfams:
            pss = _SiriusPVName(_vaca_prefix+self._acc+'-Fam:PS-'+fam)
            intstr = 'KL' if self._optics_param == 'tune' else 'SL'
            self._psfam_intstr_sp_pvs[fam] = _PV(
                pss.substitute(propty_name=intstr, propty_suffix='SP'),
                connection_callback=self._callback_conn_psfam,
                connection_timeout=0.05)

            self._psfam_pwrstate_sel_pvs[fam] = _PV(
                pss.substitute(propty_name='PwrState', propty_suffix='Sel'),
                connection_timeout=0.05)
            self._psfam_pwrstate_sts_pvs[fam] = _PV(
                pss.substitute(propty_name='PwrState', propty_suffix='Sts'),
                callback=self._callback_psfam_pwrstate_sts,
                connection_timeout=0.05)

            self._psfam_opmode_sel_pvs[fam] = _PV(
                pss.substitute(propty_name='OpMode', propty_suffix='Sel'),
                connection_timeout=0.05)
            self._psfam_opmode_sts_pvs[fam] = _PV(
                pss.substitute(propty_name='OpMode', propty_suffix='Sts'),
                callback=self._callback_psfam_opmode_sts,
                connection_timeout=0.05)

            self._psfam_ctrlmode_mon_pvs[fam] = _PV(
                pss.substitute(propty_name='CtrlMode', propty_suffix='Mon'),
                callback=self._callback_psfam_ctrlmode_mon,
                connection_timeout=0.05)

        if self._acc == 'SI':
            # Connect to Timing
            trig_name = self._trigger_name
            evt_name = self._event_name
            try:
                trig_db = _get_trig_db(trig_name)
                self._evt_src_idx = trig_db['Src-Sel']['enums'].index(evt_name)
            except (KeyError, ValueError):
                self._evt_src_idx = 1

            self._trigger_state_sel = _PV(
                _vaca_prefix+trig_name+':State-Sel', connection_timeout=0.05)
            self._trigger_state_sts = _PV(
                _vaca_prefix+trig_name+':State-Sts',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._trigger_polarity_sel = _PV(
                _vaca_prefix+trig_name+':Polarity-Sel',
                connection_timeout=0.05)
            self._trigger_polarity_sts = _PV(
                _vaca_prefix+trig_name+':Polarity-Sts',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._trigger_src_sel = _PV(
                _vaca_prefix+trig_name+':Src-Sel', connection_timeout=0.05)
            self._trigger_src_sts = _PV(
                _vaca_prefix+trig_name+':Src-Sts',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._trigger_nrpulses_sp = _PV(
                _vaca_prefix+trig_name+':NrPulses-SP',
                connection_timeout=0.05)
            self._trigger_nrpulses_rb = _PV(
                _vaca_prefix+trig_name+':NrPulses-RB',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._trigger_duration_sp = _PV(
                _vaca_prefix+trig_name+':Duration-SP',
                connection_timeout=0.05)
            self._trigger_duration_rb = _PV(
                _vaca_prefix+trig_name+':Duration-RB',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._trigger_delay_sp = _PV(
                _vaca_prefix+trig_name+':Delay-SP', connection_timeout=0.05)
            self._trigger_delay_rb = _PV(
                _vaca_prefix+trig_name+':Delay-RB',
                callback=self._callback_timing_state, connection_timeout=0.05)

            evg = _LLTimeSearch.get_evg_name()
            self._event_mode_sel = _PV(
                _vaca_prefix+evg+':'+evt_name+'Mode-Sel',
                connection_timeout=0.05)
            self._event_mode_sts = _PV(
                _vaca_prefix+evg+':'+evt_name+'Mode-Sts',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._event_delaytype_sel = _PV(
                _vaca_prefix+evg+':'+evt_name+'DelayType-Sel',
                connection_timeout=0.05)
            self._event_delaytype_sts = _PV(
                _vaca_prefix+evg+':'+evt_name+'DelayType-Sts',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._event_delay_sp = _PV(
                _vaca_prefix+evg+':'+evt_name+'Delay-SP',
                connection_timeout=0.05)
            self._event_delay_rb = _PV(
                _vaca_prefix+evg+':'+evt_name+'Delay-RB',
                callback=self._callback_timing_state, connection_timeout=0.05)

            self._event_exttrig_cmd = _PV(
                _vaca_prefix+evg+':'+evt_name+'ExtTrig-Cmd',
                connection_timeout=0.05)

            # Connect to CurrInfo
            self._storedebeam_pv = _PV(
                _vaca_prefix+'SI-Glob:AP-CurrInfo:StoredEBeam-Mon',
                callback=self._callback_get_storedebeam,
                connection_timeout=0.05)

            # Connect to Tunes
            self._tune_x_pv = _PV(
                _vaca_prefix+'SI-Glob:DI-Tune-H:TuneFrac-Mon',
                connection_timeout=0.05)
            self._tune_y_pv = _PV(
                _vaca_prefix+'SI-Glob:DI-Tune-V:TuneFrac-Mon',
                connection_timeout=0.05)

        # Create map of pv -> write function
        self.map_pv2write = {
            'ApplyDelta-Cmd': self.cmd_apply_corr,
            'ConfigName-SP': self.set_config_name,
            'CorrMeth-Sel': self.set_corr_meth,
            'CorrGroup-Sel': self.set_corr_group,
            'SyncCorr-Sel': self.set_sync_corr,
            'ConfigPS-Cmd': self.cmd_config_ps,
            'ConfigTiming-Cmd': self.cmd_config_ti,
            'MeasConfigWait-SP': self.set_meas_config_wait,
            'MeasConfig-Cmd': self.cmd_meas_config,
            'MeasConfigName-SP': self.set_meas_config_name,
            'MeasConfigSave-Cmd': self.cmd_meas_config_save,
        }
예제 #25
0
    def __init__(self, tl, corrs_type):
        """Class constructor."""
        super().__init__()
        self._pvs_database = _get_database(tl, corrs_type)

        # consts
        self._TL = tl.upper()
        self._CORRSTYPE = corrs_type
        if self._TL == 'TS':
            corrh = (_PAConst.TS_CORRH_POSANG_CHSEPT if self._CORRSTYPE
                     == 'ch-sept' else _PAConst.TS_CORRH_POSANG_SEPTSEPT)
            corrv = _PAConst.TS_CORRV_POSANG
        elif self._TL == 'TB':
            corrh = _PAConst.TB_CORRH_POSANG
            corrv = _PAConst.TB_CORRV_POSANG

        self._status = _ALLSET
        self._ref_check_update = _PAConst.NeedRefUpdate.NeedUpdate
        self._orbx_deltapos = 0
        self._orby_deltapos = 0
        self._orbx_deltaang = 0
        self._orby_deltaang = 0
        self._setnewrefkick_cmd_count = 0
        self._config_ps_cmd_count = 0

        self.cn_handler = _HandleConfigNameFile(self._TL, self._CORRSTYPE)
        self.cdb_client = _ConfigDBClient(config_type=self._TL.lower() +
                                          '_posang_respm')
        [done, corrparams] = self._get_corrparams()
        if done:
            self._config_name = corrparams[0]
            self._respmat_x = corrparams[1]
            self._respmat_y = corrparams[2]
        else:
            raise Exception(
                "Could not read correction parameters from configdb.")

        self._correctors = dict()
        self._correctors['CH1'] = _SiriusPVName(corrh[0])
        self._correctors['CH2'] = _SiriusPVName(corrh[1])
        if len(corrh) == 3:
            self._correctors['CH3'] = _SiriusPVName(corrh[2])
        self._correctors['CV1'] = _SiriusPVName(corrv[0])
        self._correctors['CV2'] = _SiriusPVName(corrv[1])
        if len(corrv) == 4:
            self._correctors['CV3'] = _SiriusPVName(corrv[2])
            self._correctors['CV4'] = _SiriusPVName(corrv[3])
        self._corrs2id = {v: k for k, v in self._correctors.items()}

        self._corr_check_connection = dict()
        self._corr_check_pwrstate_sts = dict()
        self._corr_check_opmode_sts = dict()
        self._corr_check_ctrlmode_mon = dict()
        # obs: ignore PU on OpMode and CtrlMode checks
        for corr_id, corr in self._correctors.items():
            self._corr_check_connection[corr_id] = 0
            self._corr_check_pwrstate_sts[corr_id] = 0
            if 'Sept' in corr.dev:
                self._corr_check_opmode_sts[corr_id] = _PSC.States.SlowRef
                self._corr_check_ctrlmode_mon[corr_id] = _PSC.Interface.Remote
            else:
                self._corr_check_opmode_sts[corr_id] = 1
                self._corr_check_ctrlmode_mon[corr_id] = 1

        # Connect to correctors
        self._corr_kick_sp_pvs = dict()
        self._corr_kick_rb_pvs = dict()
        self._corr_pwrstate_sel_pvs = dict()
        self._corr_pwrstate_sts_pvs = dict()
        self._corr_opmode_sel_pvs = dict()
        self._corr_opmode_sts_pvs = dict()
        self._corr_ctrlmode_mon_pvs = dict()
        self._corr_refkick = dict()
        self._corr_unit_factor = dict()
        self._corr_kick_rb_impl = dict()
        self._corr_last_delta = dict()

        for corr in self._correctors.values():
            pss = corr.substitute(prefix=_vaca_prefix)
            self._corr_kick_sp_pvs[corr] = _PV(pss.substitute(
                propty_name='Kick', propty_suffix='SP'),
                                               connection_timeout=0.05)

            self._corr_refkick[corr] = 0
            self._corr_last_delta[corr] = 0
            self._corr_kick_rb_impl[corr] = 0
            self._corr_kick_rb_pvs[corr] = _PV(
                pss.substitute(propty_name='Kick', propty_suffix='RB'),
                callback=[
                    self._callback_init_refkick, self._callback_corr_kick_rb
                ],
                connection_callback=self._connection_callback_corr_kick_pvs,
                connection_timeout=0.05)

            self._corr_pwrstate_sel_pvs[corr] = _PV(pss.substitute(
                propty_name='PwrState', propty_suffix='Sel'),
                                                    connection_timeout=0.05)
            self._corr_pwrstate_sts_pvs[corr] = _PV(
                pss.substitute(propty_name='PwrState', propty_suffix='Sts'),
                callback=self._callback_corr_pwrstate_sts,
                connection_timeout=0.05)

            if 'Sept' not in corr.dev:
                self._corr_opmode_sel_pvs[corr] = _PV(pss.substitute(
                    propty_name='OpMode', propty_suffix='Sel'),
                                                      connection_timeout=0.05)
                self._corr_opmode_sts_pvs[corr] = _PV(
                    pss.substitute(propty_name='OpMode', propty_suffix='Sts'),
                    callback=self._callback_corr_opmode_sts,
                    connection_timeout=0.05)

                self._corr_ctrlmode_mon_pvs[corr] = _PV(
                    pss.substitute(propty_name='CtrlMode',
                                   propty_suffix='Mon'),
                    callback=self._callback_corr_ctrlmode_mon,
                    connection_timeout=0.05)
                self._corr_unit_factor[corr] = 1e-6  # urad to rad
            else:
                self._corr_unit_factor[corr] = 1e-3  # mrad to rad
예제 #26
0
    def __init__(self,
                 cyclers=dict(),
                 timing=None,
                 is_bo=False,
                 ramp_config=None,
                 logger=None):
        """Initialize."""
        self._mode = None
        self._is_bo = is_bo
        self._ramp_config = ramp_config
        self._checks_result = dict()
        self._aux_cyclers = dict()

        # cyclers
        self.cyclers = cyclers

        self._sections = _get_sections(self.psnames)
        self._only_linac = self._sections == [
            'LI',
        ]

        # timing connector
        self._timing = timing if timing is not None else Timing()
        self._triggers = _get_trigger_by_psname(self.psnames)

        # egun pv
        if 'LI-01:PS-Spect' in self.psnames:
            self._pv_egun = _PV('LI-01:EG-TriggerPS:enablereal',
                                connection_timeout=0.05)

        # cycle duration
        duration = 0
        for psname in self.psnames:
            duration = max(duration,
                           self._cyclers[psname].cycle_duration(self._mode))
        self._cycle_duration = duration

        # task sizes
        self.prepare_timing_size = 3
        self.prepare_timing_max_duration = 10

        self.prepare_ps_size = 2 * len(self.psnames) + 1
        self.prepare_ps_max_duration = 20

        self.cycle_size = (
            2 +  # check timing
            len(self.psnames) + 3 +  # check params
            len(self.psnames) +  # check opmode
            2 +  # set and check triggers enable
            3 + round(self._cycle_duration) +  # cycle
            len(self.psnames) +  # check final
            len(self.psnames) + 2)  # reset subsystems
        self.cycle_max_duration = (
            8 +  # check timing
            TIMEOUT_CHECK +  # check params
            2 * TIMEOUT_CHECK +  # check opmode
            6 +  # set and check triggers enable
            60 +  # wait for timing trigger
            round(self._cycle_duration) +  # cycle
            12 +  # check final
            5)  # reset subsystems

        if 'SI' in self._sections:
            # trims psnames
            trims = set(
                _PSSearch.get_psnames({
                    'sec': 'SI',
                    'sub': '[0-2][0-9].*',
                    'dis': 'PS',
                    'dev': '(CH|CV|QS|QD.*|QF.*|Q[1-4])'
                }))
            cv2_c2 = set(
                _PSSearch.get_psnames({
                    'sec': 'SI',
                    'sub': '[0-2][0-9]C2',
                    'dis': 'PS',
                    'dev': 'CV',
                    'idx': '2'
                }))
            qs_c2 = set(
                _PSSearch.get_psnames({
                    'sec': 'SI',
                    'sub': '[0-2][0-9]C2',
                    'dis': 'PS',
                    'dev': 'QS'
                }))
            self.trims_psnames = list(trims - cv2_c2 - qs_c2)

            # connect to trims
            self.prepare_ps_size += len(self.psnames)
            self.prepare_ps_max_duration += 2 * TIMEOUT_CHECK
            # set and check currents to zero
            self.prepare_ps_size += 2 * len(self.psnames)
            self.prepare_ps_max_duration += TIMEOUT_CHECK_SI_CURRENTS

        # logger
        self._logger = logger
        self._logger_message = ''
        if not logger:
            _log.basicConfig(format='%(asctime)s | %(message)s',
                             datefmt='%F %T',
                             level=_log.INFO,
                             stream=_sys.stdout)
예제 #27
0
 def _select_experimental_setup(self):
     """."""
     self.emittance_calculator.place = self._place
     if self._place.lower().startswith('li'):
         prof = 'LA-BI:PRF5'
         self._image_source = _PV(prof + ':RAW:ArrayData')
         self._width_source = _PV(prof + ':ROI:MaxSizeX_RBV',
                                  callback=self._update_width)
         self._coefx = _PV(prof + ':X:Gauss:Coef',
                           callback=self._update_coefx)
         self._coefy = _PV(prof + ':Y:Gauss:Coef',
                           callback=self._update_coefy)
         self.quad_I_sp = _PV('LI-01:PS-QF3:Current-SP')
         self.quad_I_rb = _PV('LI-01:PS-QF3:Current-Mon')
     elif self._place.lower().startswith('tb'):
         self._image_source = _PV('TB-02:DI-Scrn-2:ImgData-Mon')
         self._width_source = _PV('TB-02:DI-Scrn-2:ImgMaxWidth-Cte',
                                  callback=self._update_width)
         self._coefx = _PV('TB-02:DI-ScrnCam-2:ImgScaleFactorX-RB',
                           callback=self._update_coefx)
         self._coefy = _PV('TB-02:DI-ScrnCam-2:ImgScaleFactorY-RB',
                           callback=self._update_coefy)
         quad = self.emittance_calculator.quadname
         self.quad_I_sp = _PV(quad + ':Current-SP')
         self.quad_I_rb = _PV(quad + ':Current-RB')
예제 #28
0
    def __init__(self, test_pos=None, comments='', mode=0, wtime=10):
        """Initizalizes the thread.

        Args:
            test_pos (list): list with the points to be scanned.
            comments (str): test description.
            mode (int): 0 for discrete mode;
                        1 for continuous mode;
                        2 for manual mode.
            wtime (float): wainting time (in seconds) between two points.
        """
        super().__init__()
        self.setDaemon = True
        self.name = "ThdTestAxis"

        if test_pos is None:
            self.test_pos = [-1, 1, 0]
        else:
            self.test_pos = test_pos
        self.wtime = wtime
        self.comments = comments
        if mode in [0, 1, 2]:
            self.mode = mode
        else:
            self.mode = 0

        self.continuous_flag = False
        self.manual_flag = False
        self.acquire_flag = False

        self.motorA = {
            'ActualPos': _PV('und:AxisA:ActualPosition'),
            'ActualSpd': _PV('und:AxisA:ActualVelocity'),
            'Current': _PV('und:AxisA:OutputCurrent'),
            'PosError': _PV('und:AxisA:PositionError'),
            'Torque': _PV('und:AxisA:TorqueReference'),
            'Status': _PV('und:AxisA:AxisStatus'),
            'MotionStatus': _PV('und:AxisA:MotionStatus'),
            'HomePos': _PV('und:AxisA:HomePos'),
            'MovePos': _PV('und:AxisA:MovePos'),
            'MoveFlag': _PV('und:AxisA:Move'),
            'OvertravelN': _PV('und:OvertravelN1'),
            'OvertravelP': _PV('und:OvertravelP1'),
            'Moving': _PV('und:AxisA:MoveStatus'),
            'ServoOn': _PV('und:AxisA:DriveEnableStatus'),
            'BrakeOff': _PV('und:AxisA:BrakeStatus')
        }

        self.motorB = {
            'ActualPos': _PV('und:AxisB:ActualPosition'),
            'ActualSpd': _PV('und:AxisB:ActualVelocity'),
            'Current': _PV('und:AxisB:OutputCurrent'),
            'PosError': _PV('und:AxisB:PositionError'),
            'Torque': _PV('und:AxisB:TorqueReference'),
            'Status': _PV('und:AxisB:AxisStatus'),
            'MotionStatus': _PV('und:AxisB:MotionStatus'),
            'HomePos': _PV('und:AxisB:HomePos'),
            'MovePos': _PV('und:AxisB:MovePos'),
            'MoveFlag': _PV('und:AxisB:Move'),
            'OvertravelN': _PV('und:OvertravelN2'),
            'OvertravelP': _PV('und:OvertravelP2'),
            'Moving': _PV('und:AxisB:MoveStatus'),
            'ServoOn': _PV('und:AxisB:DriveEnableStatus'),
            'BrakeOff': _PV('und:AxisB:BrakeStatus')
        }

        self.motorC = {
            'ActualPos': _PV('und:AxisC:ActualPosition'),
            'ActualSpd': _PV('und:AxisC:ActualVelocity'),
            'Current': _PV('und:AxisC:OutputCurrent'),
            'PosError': _PV('und:AxisC:PositionError'),
            'Torque': _PV('und:AxisC:TorqueReference'),
            'Status': _PV('und:AxisC:AxisStatus'),
            'MotionStatus': _PV('und:AxisC:MotionStatus'),
            'HomePos': _PV('und:AxisC:HomePos'),
            'MovePos': _PV('und:AxisC:MovePos'),
            'MoveFlag': _PV('und:AxisC:Move'),
            'OvertravelN': _PV('und:OvertravelN3'),
            'OvertravelP': _PV('und:OvertravelP3'),
            'Moving': _PV('und:AxisC:MoveStatus'),
            'ServoOn': _PV('und:AxisC:DriveEnableStatus'),
            'BrakeOff': _PV('und:AxisC:BrakeStatus')
        }

        self.motorD = {
            'ActualPos': _PV('und:AxisD:ActualPosition'),
            'ActualSpd': _PV('und:AxisD:ActualVelocity'),
            'Current': _PV('und:AxisD:OutputCurrent'),
            'PosError': _PV('und:AxisD:PositionError'),
            'Torque': _PV('und:AxisD:TorqueReference'),
            'Status': _PV('und:AxisD:AxisStatus'),
            'MotionStatus': _PV('und:AxisD:MotionStatus'),
            'HomePos': _PV('und:AxisD:HomePos'),
            'MovePos': _PV('und:AxisD:MovePos'),
            'MoveFlag': _PV('und:AxisD:Move'),
            'OvertravelN': _PV('und:OvertravelN4'),
            'OvertravelP': _PV('und:OvertravelP4'),
            'Moving': _PV('und:AxisD:MoveStatus'),
            'ServoOn': _PV('und:AxisD:DriveEnableStatus'),
            'BrakeOff': _PV('und:AxisD:BrakeStatus')
        }

        self.en_flags = {
            'EnContactor': _PV('und:EnContactor'),
            'EnClear': _PV('und:EnClear'),
            'EnServo': _PV('und:EnServo'),
            'DisServo': _PV('und:DisServo'),
            'EnHome': _PV('und:EnHome'),
            'EnCmsMode': _PV('und:EnCmsMode'),
            'EnVIMode': _PV('und:EnVIMode'),
            'EnHIMode': _PV('und:EnHIMode'),
            'EnEPMode': _PV('und:EnEPMode'),
            'EnLPMode': _PV('und:EnLPMode'),
            'EnMove': _PV('und:EnMove'),
            'EnCam': _PV('und:EnCam'),
            'EnContactor': _PV('und:EnContactor'),
            'EnCoupling': _PV('und:EnGeneralCoupling')
        }
    def __init__(self):
        self.pv_hv_volt_sp = _PV('LI-01:EG-HVPS:voltoutsoft')
        self.pv_hv_volt_rb = _PV('LI-01:EG-HVPS:voltinsoft')
        self.pv_hv_curlim_sp = _PV('LI-01:EG-HVPS:currentoutsoft')
        self.pv_hv_curleak_mon = _PV('LI-01:EG-HVPS:currentinsoft')
        self.pv_hv_enbl_sp = _PV('LI-01:EG-HVPS:enable')
        self.pv_hv_enbl_rb = _PV('LI-01:EG-HVPS:enstatus')
        self.pv_hv_switch_sp = _PV('LI-01:EG-HVPS:switch')
        self.pv_hv_switch_rb = _PV('LI-01:EG-HVPS:swstatus')

        self.pv_fila_cur_sp = _PV('LI-01:EG-FilaPS:currentoutsoft')
        self.pv_fila_cur_rb = _PV('LI-01:EG-FilaPS:currentinsoft')
        self.pv_fila_volt_mon = _PV('LI-01:EG-FilaPS:voltinsoft')
        self.pv_fila_switch_sp = _PV('LI-01:EG-FilaPS:switch')
        self.pv_fila_switch_rb = _PV('LI-01:EG-FilaPS:swstatus')

        self.pv_bias_volt_sp = _PV('LI-01:EG-BiasPS:voltoutsoft')
        self.pv_bias_volt_rb = _PV('LI-01:EG-BiasPS:voltinsoft')
        self.pv_bias_cur_mon = _PV('LI-01:EG-BiasPS:currentinsoft')
        self.pv_bias_switch_sp = _PV('LI-01:EG-BiasPS:switch')
        self.pv_bias_switch_rb = _PV('LI-01:EG-BiasPS:swstatus')

        self.pv_pulse_power_sp = _PV('LI-01:EG-PulsePS:poweroutsoft')
        self.pv_pulse_power_rb = _PV('LI-01:EG-PulsePS:powerinsoft')

        self.pv_mult_sel_sp = _PV('LI-01:EG-PulsePS:multiselect')
        self.pv_mult_sel_rb = _PV('LI-01:EG-PulsePS:multiselstatus')
        self.pv_mult_swt_sp = _PV('LI-01:EG-PulsePS:multiswitch')
        self.pv_mult_swt_rb = _PV('LI-01:EG-PulsePS:multiswstatus')

        self.pv_sngl_sel_sp = _PV('LI-01:EG-PulsePS:singleselect')
        self.pv_sngl_sel_rb = _PV('LI-01:EG-PulsePS:singleselstatus')
        self.pv_sngl_swt_sp = _PV('LI-01:EG-PulsePS:singleswitch')
        self.pv_sngl_swt_rb = _PV('LI-01:EG-PulsePS:singleswstatus')

        self.pv_sys_start_sp = _PV('LI-01:EG-System:start')
        self.pv_sys_valve_mon = _PV('LI-01:EG-Valve:status')
        self.pv_sys_gate_mon = _PV('LI-01:EG-Gate:status')
        self.pv_sys_vacuum_mon = _PV('LI-01:EG-Vacuum:status')

        self.pv_trig_state_sp = _PV('LI-01:EG-TriggerPS:enable')
        self.pv_trig_state_rb = _PV('LI-01:EG-TriggerPS:status')
        self.pv_trig_allow_mon = _PV('LI-01:EG-TriggerPS:allow')

        self.pv_mps_permit = _PV('LA-CN:H1MPS-1:GunPermit')
        self.pv_vacuum_ccg1 = _PV('LA-VA:H1VGC-01:RdPrs-1')

        self.names = ['LA-CN:H1MPS-1:CCG1', 'LA-CN:H1MPS-1:CCG2']
        self.pvs_mps_resets = []
        self.pvs_mps_status_raw = []
        self.pvs_mps_status_proc = []
        for name in self.names:
            self.pvs_mps_resets.append(_PV(name + 'Warn_R'))
            self.pvs_mps_status_raw.append(_PV(name + 'Warn_I'))
            self.pvs_mps_status_proc.append(_PV(name + 'Warn_L'))

        self.opmode = self.MULTIBUNCH
        self.goal_volt = 0.0
        self.goal_pressure = 1.0e-9
        self.fila_curr = 0.0
        self._fila_ramp_dur = 10  # min
        self.bias_volt = -60
        self.leak_curr = 0.0
        self.beam_pulse = True

        self.fila_ishot = False

        self.total_duration = -1
        self._stop_running = False
        self._thread = _Thread(target=self._set_stop, daemon=True)
        self._thread.start()
예제 #30
0
 def _create_pvs(self):
     pvs = dict()
     for psname in self.psnames:
         pvs[psname] = _PV(
             psname + ':Wfm-SP', connection_timeout=TIMEOUT_CONN)
     BONormListFactory._PVs = pvs