Exemplo n.º 1
0
def slims_llm_reject(mot: et.EpicsMotor, **kwargs):
    """
    SFT_LMT
    requests outside the softlims shall be rejected
    """
    """    
    A value of 1 indicates that the dial-value drive field, DVAL, 
    or the dial-value readback field, DRBV, is outside of the limits (DHLM, DLLM), 
    and this prevents the motor from moving. 
    If the backlash distance, BDST, is non-zero, it further restricts the allowable 
    range of DVAL. When a JOG button is hit, LVIO goes to 1 and stops the motor 
    if/when DVAL gets to within one second's travel time of either limit

    """

    pos_inc = kwargs.pop("pos_inc", -1)
    # setting llm so that the requested move is outside the limit
    mot._d_llm.value = mot._d_rbv.value + pos_inc + mot._d_llm.default_tolerance

    # new val shall be rejected, reverted back to: old val, or rbv?
    mot._d_val.expected_value = mot._d_val.value

    # soft limit flag shall be raised
    mot._d_lvio.expected_value = 1

    # val to rbv value shall not change
    mot._d_rdif.expected_value = mot._d_rdif.value

    mot.move(pos_inc=pos_inc, override_slims=False, expect_success=False)
Exemplo n.º 2
0
def move_to_lim(mot: et.EpicsMotor, **kwargs):
    """move to hardware mlim using preset range information (not JREV)
    """

    move_dial_direction = kwargs.pop("move_dial_direction", None)

    usr_direction = 2 * (0.5 - mot._d_dir.value) * move_dial_direction

    # move indefinitely reverse towards mlim
    mot._d_lls.expected_value = 1 if usr_direction < 0 else 0
    mot._d_hls.expected_value = 0 if usr_direction < 0 else 1

    mot.move(
        usr_direction * mot.travel_range,
        override_slims=True,
        expect_success=False,
    )

    # move indefinitely reverse towards mlim
    mot._d_msta.expected_value = ("$x10xx0xx0xxx0xxx"
                                  if move_dial_direction < -1 else
                                  "$x00xx0xx0xxx1xxx")

    # wait for the flags to come back, in addition to motors default wait
    sleep(0.5)
Exemplo n.º 3
0
def scaling_req(mot: et.EpicsMotor, **kwargs):
    """CHANGE OF SCALING

    """
    passed1, msg1 = change_mres(mot, **kwargs)
    passed2, msg2 = change_mscf(mot, **kwargs)
    mot.reset_expected_values()

    return passed1 and passed2, msg1 + msg2
Exemplo n.º 4
0
def home_on_mlim(mot: et.EpicsMotor, **kwargs):
    """home using extras
    """
    mot._d_hls.expected_value = 0
    mot._d_lls.expected_value = 0
    mot._d_msta.expected_value = "$100xx0xx0xxx0xxx"  # bit 15 (HOMED)

    mot._c_homing = 1
Exemplo n.º 5
0
def slims_hlm_reject(mot: et.EpicsMotor, **kwargs):
    """
    SFT_LMT
    requests outside the softlims shall be rejected
    """
    pos_inc = kwargs.pop("pos_inc", 1)
    mot._d_hlm.value = mot._d_rbv.value + pos_inc - mot._d_hlm.default_tolerance

    mot.move(pos_inc=pos_inc, override_slims=False, expect_success=False)

    # new val shall be rejected, reverted back to sync rbv
    mot._d_val.expected_value = mot._d_rbv.value

    # sof limit flag raised
    mot._d_lvio.expected_value = 1

    # val and rbv synced
    mot._d_rdif.expected_value = 0
Exemplo n.º 6
0
def small_move(mot: et.EpicsMotor, **kwargs):
    """ A small move via changing .VAL shall be accepted if
        - SPMG in Go or Move 
        - distance allows for backlash
        - not within backlash distance of slims
        - more than mres value
    """
    """
    small move to check baclash and LVIO (soft limits)
    these were failing asof Mar/21, fixed as of 10/Apr/21
    """

    direction = kwargs.pop("direction", 1)
    jog_dist = (direction *
                max(mot._d_mres.value, mot._d_rdbd.value, mot._d_bdst.value) *
                1.05)

    mot.move(pos_inc=jog_dist, **kwargs)

    mot._d_rbv.tolerance = mot._d_mres.value
Exemplo n.º 7
0
def move_to_mlim(mot: et.EpicsMotor, **kwargs):
    """move to hardware mlim using preset range information (not JREV)
    """
    # move indefinitely reverse towards mlim
    mot._d_lls.expected_value = 1 - mot._d_dir.value
    mot._d_hls.expected_value = mot._d_dir.value

    mlim_direction = -2 * (0.5 - mot._d_dir.value)

    mot.move(
        mlim_direction * mot.travel_range,
        override_slims=True,
        expect_success=False,
    )

    # move indefinitely reverse towards mlim
    mot._d_msta.expected_value = "$x10xx0xx0xxx0xxx"

    # wait for the flags to come back, in addition to motors default wait
    sleep(0.5)
Exemplo n.º 8
0
def stop(mot: et.EpicsMotor, **kwargs):
    """STOP
       verify that motor comes to stop in expected time
    """
    move_time = 0.5
    pos_inc = mot._d_velo.value * 2 * move_time

    mot._d_dmov.expected_value = 1

    mot._d_rdif.expected_value = mot._d_rdif.value
    mot._d_rbv.expected_value = mot._d_rbv.value + pos_inc / 2

    mot._d_msta.expected_value = "$x00xx0xx0xxx0xxx"

    mot.move(pos_inc=pos_inc)
    sleep(move_time)  # almost half way through

    mot._d_stop.value = 1
    sleep(0.5)  # wait until .DMOV is on
    # VAL will be syncved after STOP
    mot._d_val.expected_value = mot._d_rbv.value
Exemplo n.º 9
0
def base_setting(mot: et.EpicsMotor, **kwargs):
    """  set/reset to the baseline settings and reset all expected values
    """

    mot._d_lvio.expected_value = 0

    # to check if the motor is initialised with no faults:
    realistic_microsteps = 32
    mot._d_mres.value = (mot.base_settings["mres"] *
                         mot.base_settings["micro_steps"] /
                         realistic_microsteps)

    mot._d_rdbd = mot._d_mres

    mot._d_mscf.value = mot.base_settings["motor_unit_per_rev"]

    mot._d_eres.value = mot.base_settings["encoder_res"]
    mot._d_rscf.value = mot.base_settings["encoder_res"]
    # mot._d_off.value = 0

    mot._d_vmax.value = mot.base_settings["JogSpeed_EGU"]
    mot._d_velo.value = mot._d_vmax.value - mot._d_velo.default_tolerance * 5
    mot._d_bvel.value = mot._d_velo.value / 2

    mot._d_bdst.value = 0

    # a baseline tweak is set to take less than 100ms to complete
    mot._d_twv.value = mot._d_velo.value * 0.05

    mot._d_hlm.value = mot.base_settings["fullrange_egu"] * (1.01)
    mot._d_llm.value = 0 - mot.base_settings["fullrange_egu"] * (0.01)

    mot._d_set.value = 0
    # good to make all the tests direction agnostic!
    mot._d_dir.value = 0

    mot._d_set.value = 0
    mot._d_foff.value = 0

    mot.reset_expected_values()
Exemplo n.º 10
0
def move(mot: et.EpicsMotor, **kwargs):
    """move incremental using .VAL

    """
    mot.move(**kwargs)