Пример #1
0
    def __init__(self):
        super().__init__()
        self.extractionDone = cda.InstSignal()
        self.unexpectedShot = cda.InstSignal()
        self.trainingShot = cda.InstSignal()
        self.trainingStopped = cda.InstSignal()

        self.extract_request = False
        self.training_shots = False
        self.training_interval = 3

        self.clock_src = 0

        self.c_clock_src = cda.IChan("canhw:19.ic.extractor.clockSrc",
                                     on_update=True)
        self.c_do_shot = cda.IChan("canhw:19.xfr_d16_20.do_shot",
                                   on_update=True)
        self.c_was_shot = cda.IChan("canhw:19.xfr_d16_20.was_start",
                                    on_update=True)
        self.c_stop = cda.IChan("canhw:19.xfr_d16_20.ones_stop",
                                on_update=True)

        self.c_was_shot.valueMeasured.connect(self.was_shot_proc)
        self.c_clock_src.valueChanged.connect(self.clock_src_update)

        self.timer = cda.Timer()
Пример #2
0
    def __init__(self):
        self.runmodeChanged = cda.InstSignal(str)
        self.nshotsChanged = cda.InstSignal(int)
        self.runDone = cda.InstSignal()

        # state variables.
        self.runmode = None
        self.runmode_req = False
        self.running = False
        self.run_req = False
        self.nshots = 0  # number of requested shots
        self.nshots_req = False
        self.eshots = 5
        self.pshots = 10
        self.particles = 'e'

        self.c_runmode = cda.DChan(prefix + 'syn_ie4.mode', on_update=True)
        self.c_start = cda.DChan(prefix + 'syn_ie4.bum_start', on_update=True)
        self.c_stop = cda.DChan(prefix + 'syn_ie4.bum_stop', on_update=True)
        self.c_lamsig = cda.DChan(prefix + 'syn_ie4.lam_sig', on_update=True)
        self.c_nshots = cda.DChan(prefix + 'syn_ie4.re_bum', on_update=True)

        self.c_runmode.valueMeasured.connect(self.runmode_update)
        self.c_nshots.valueChanged.connect(self.nshots_update)
        self.c_lamsig.valueMeasured.connect(self.done_proc)

        self.c_eshots = cda.DChan('cxhw:0.ddm.eshots')
        self.c_pshots = cda.DChan('cxhw:0.ddm.pshots')
        self.c_eshots.valueChanged.connect(self.shots_update)
        self.c_pshots.valueChanged.connect(self.shots_update)
Пример #3
0
    def __init__(self):
        super(K500Director, self).__init__()
        self.done = cda.InstSignal()
        self.modeTargUpdate = cda.InstSignal(str)
        self.modeCurUpdate = cda.InstSignal(str)
        self.progressing = cda.InstSignal(int)

        self.mode_ctl = mode_ser.ModesClient()

        self.walkers = {
            name: MagWalker(remag_srv + '.' + name, name)
            for name in remag_devs
        }

        for k in self.walkers:
            w = self.walkers[k]
            w.done.connect(self.check_done)
            w.started.connect(self.check_started)
            w.progressing.connect(self.all_progress)
            w.iset_chan.valueMeasured.connect(self.target_mode)
            w.imeas_chan.valueMeasured.connect(self.current_mode)

        self.running = False
        self.cur_mode = None
        self.mode_targ = None
        self.progress = 0

        self.swc_time = 0
        self.start_time = 0
Пример #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args)
        self.switching_done = cda.InstSignal()

        self.mode_ctl = kwargs.get('mode_ctl', ModesClient())
        self.k500ctl = kwargs.get('k500ctl', K500Director())

        self.c_k500mode = cda.StrChan('cxhw:0.k500.modet', max_nelems=4)
        self.c_k500user_mode = cda.StrChan('cxout:1.ic_out.mode', max_nelems=4)
        self.c_mode_progress = cda.IChan('cxhw:0.k500.mode_progress')
        self.c_k500_mag_state = cda.StrChan('cxhw:0.k500.mag_state',
                                            max_nelems=4)

        self.k500ctl.progressing.connect(self.c_mode_progress.setValue)

        #self.k500ctl.modeCurUpdate.connect(self.update_cur_mode)
        self.k500ctl.done.connect(self.switched)

        self.req_mode = None
        self.all_mode = None

        self.modes = {
            'syn': None,
            'linac': None,
            'ring': None,
            'syn.transfer': None,
            'K500.e.ext': None,
            'K500.p.ext': None,
            'K500.com': None,
            'K500.cBEP': None,
            'K500.cVEPP3': None,
        }

        self.wait_remag = False
        self.timer = cda.Timer()
Пример #5
0
    def __init__(self):
        super(LinBeamCtl, self).__init__()
        self.stateRequested = cda.InstSignal(str)
        self.stateChanged = cda.InstSignal(str)
        self.stateMeas = cda.InstSignal(str)

        self.cav_h_iset_chan = cda.DChan('canhw:11.rst1.CAV_H.Iset',
                                         on_update=True)
        self.cav_h_imeas_chan = cda.DChan('canhw:11.rst1.CAV_H.Imes',
                                          on_update=True)

        self.cav_h_iset_chan.valueChanged.connect(self.iset_cb)
        self.cav_h_imeas_chan.valueChanged.connect(self.imeas_cb)

        self.iset_saved = None
        self.state = None
        self.state_meas = None
Пример #6
0
    def __init__(self, devname, name=None):
        super(MagWalker, self).__init__()
        self.done = cda.InstSignal(str)
        self.progressing = cda.InstSignal(str, int)
        self.started = cda.InstSignal(str)

        self.devname = devname
        self.name = name
        if name is None:
            self.name = devname

        # channels:
        # walker.list - requested list of points to go through
        # walker.start - run process
        # walker.stop - stop running
        # walker.cur_step - current step, -1 when stopped (or finished)
        self.list_chan = cda.VChan(devname + '.walker.list',
                                   dtype=cda.DTYPE_DOUBLE,
                                   max_nelems=20,
                                   on_update=True)
        self.start_chan = cda.DChan(devname + '.walker.start', on_update=True)
        self.stop_chan = cda.DChan(devname + '.walker.stop', on_update=True)
        self.cur_step_chan = cda.DChan(devname + '.walker.cur_step',
                                       on_update=True)
        self.iset_cur_chan = cda.DChan(devname + '.iset_cur', on_update=True)
        self.iset_chan = cda.DChan(devname + '.iset', on_update=True)

        # just for some control
        self.imeas_chan = cda.DChan(devname + '.imes', on_update=True)

        self.initialized = False
        self.cur_list = None
        self.requested_list = None
        self.run_requested = False
        self.running = False
        self.progress = 0
        self.step = -1
        self.step_pos = 0
        self.path_length = 0
        self.start_iset = 0
        self.ext_cur_list = None

        self.list_chan.valueMeasured.connect(self.list_update)
        self.cur_step_chan.valueChanged.connect(self.step_update)
        self.iset_cur_chan.valueChanged.connect(self.iset_cur_update)
Пример #7
0
 def __init__(self):
     super(ModesServer, self).__init__()
     self.save = cda.InstSignal(str, str)
     self.load = cda.InstSignal(int, list, list)
     self.loadMarked = cda.InstSignal(str, list, list)
     self.setZeros = cda.InstSignal(list, list)
     self.markMode = cda.InstSignal(int, str, str, str)
     self.walkerLoad = cda.InstSignal(dict, dict)
Пример #8
0
    def __init__(self, use_modeswitcher=False):
        super(ModesClient, self).__init__()
        # signals for mode save/load
        self.modeSaved = cda.InstSignal(
            dict)  # emited when recieved deamon mesage "mode saved"
        self.modeLoaded = cda.InstSignal(
            dict)  # emited when recieved deamon mesage "mode"
        self.zerosDone = cda.InstSignal(dict)
        # signals for automatic control
        self.markedLoaded = cda.InstSignal(
            str)  # emited when switched to marked mode
        self.markedReady = cda.InstSignal()
        self.walkerDone = cda.InstSignal(str)
        # auxilary signals
        self.update = cda.InstSignal(
        )  # emited when server instructs clients to update DB info

        self.mode_mark = None
        self.timer = cda.Timer()
        self.delay = 100

        self.proto_ver = 0.901