esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

SLITSET.MAC
See other macros in category: All
Description:
    Macros for operating slits with independent blades. This macro set allows you to define pseudo motors on slits. Since version 4.0 (Feb 2006) this macro file allows also to define new style calculation macro motors on slits. To define new style macro motors you must define: a slit controller in config (one controller will work on one or two pair of blades): %PRE% MOTORS DEVICE ADDR <>MODE NUM <>TYPE YES slit 4 Macro Motors %PRE% motors in config referring to that controller. Channel assignment will decide on the motor role as follow: %PRE% Channel 0 - gap 1 - offset %PRE% Different pairs of slits can be defined by using additional module numbers in the motor unit/module/channel assignment. Config file The following motor parameters have to be associated in config file to the channel 0 of the controller/module. Example: %PRE% MOT000 = MAXE:0/0 [...] psu MOT001 = MAXE:0/1 [...] psd MOT002 = MAXE:0/2 [...] psl MOT003 = MAXE:0/3 [...] psr MOT004 = MAXE:0/4 [...] ssu MOT005 = MAXE:0/5 [...] ssd MOT006 = MAC_MOT:0/0/0 [....] psvg MOTPAR:blade1 = psu MOTPAR:blade2 = psd MOT007 = MAC_MOT:0/0/1 [....] psvo MOT008 = MAC_MOT:0/1/0 [....] pshg MOTPAR:blade1 = psl MOTPAR:blade2 = psr MOT009 = MAC_MOT:0/1/1 [....] psho MOT010 = MAC_MOT:0/2/0 [....] ssvg MOTPAR:blade1 = ssu MOTPAR:blade2 = ssd MOT011 = MAC_MOT:0/2/1 [....] ssvo %PRE%
Documentation:
    OVERVIEW
    These macros implement pseudomotors for slitsets with independent blades. Each set is composed by one or two slits (two or four blades). You will be able to use offset and gap motors that will move the corresponding blades. The main features are:
    • Limits are consistently checked on all motors (blades and pseudomotors).
    • The set macro lets change the user position of the pseudomotors as if they were ordinary motors. Actually the user position of the blades are corrected to set the pseudomotors to the desired values.
    • Automatic search of mechanical reference (some additional setup required).
    • A `where' macro that displays the position of the slitset is automatically defined.
    • The unsetup procedure is implemented.


    EXAMPLE
    slitsetup ps pho phg pr pl pvo pvg pu pd
    Configures a slitset called `ps' that consists of a vertical and a horizontal slit. Two logical motors (`pho' and `phg') are associated to the offset and gap of the slit defined by the blades `pr' and `pl'. In the same way `pvo' and `pvg' are logical motors associated to `pu' and `pd'.
    mv phg 1
    Moves the horizontal gap to 1 mm.
    dscan pho -5 5 80 1
    Scans the slit in the horizontal direction (horizontal offset).
    wps
    Displays the current position of the slits in the set `ps'.
    set phg 0
    Changes the user position of `pr' and `pl' to zero the gap.
    slitshow ps
    Displays the current configuration of the slitset `ps'.
    slithome ps
    Moves the blades of the slitset `ps' to the mechanical reference and set their dials to the values in the configuration file.
    slitzero ps
    Moves the slitset `ps' to the zero position defined in the configuration file.

    MCD 02/05/11: add a scale factor on the gap or offset, so that the resulting gap or offset original value is multiplied by this scale factor.
    This is implemented when the
    MOTPAR:scale = <a value>
    is added to the macromotor
    This is useful in particular when moving the gap executes a rotational movement on the plate and we want the gap to reflect the angular rotation.

    SETUP
    The slitsetup macro has to be executed with the proper parameters and the logical motors must be defined in the configuration file (controller set to `NONE').
    In order to use slithome the `generic parameters' 1 and 2 must be properly set up in the configuration file for the blade motors. Generic parameter 1 must be set to `1' or `-1' to indicate if the mechanical reference is `lim+' or `lim-' respectively. Generic parameter 2 must be set to the desired dial value at the position of the limit switch.
    To use slitzero the Generic parameter 3 of the blade motors must be set to the dial value at the zero position.

    BUGS
    In the present version if a pseudomotor (gap or offset) is moved too close of the software limit, it might occur that when the movement is finished and due to small inaccuracies (encoder discrepancies, etc..) the recalculated position of the pseudomotor is slightly out of limits. If this happens and one tries to move a different motor an error message is issued and the movement is cancelled. Is this happens one should move first the pseudomotor to a valid position (in between the software limits) and then all the other movements will be allowed.
    There are two ways to avoid the previous problem. The first and obvious one is not to move a pseudomotor to the limit position. The second one is to set the software limits of the real motors (the blades) to values such that the limits of the pseudomotors will never be reached. This last solution is the best but it is not always possible or convenient.
    If someone thinks that there should be possible to get rid of this annoying behaviour by a third solution consisting on modifying the code, I must say that all the possible solutions I can imagine would weaken or break some other important features of these macros or would complicate excessively the code. What I want to state is that this problem is not simply the result of the laziness of the programmer (what does not necessarily mean that the programmer is no lazy or incompetent).

Macros:
    slitsetup
    Usage: slitsetup <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>]
    Configures a slitset with one or two slits. Each slit consists of two real motors (<bld1>, <bld2>) that move the independent blades and two logical motors <offs> and <gap> associated respectively to the position (offset) and aperture (gap) of the resulting slit. The setup of <bld1> and <bld2> must be such that moving both blades in the positive direction the slit opens. The sign of <offs> is that of the first blade (<bld1>).
    More than one slitset can be defined by using different names. A macro called `w<name>' is internally defined for each slitset. This macro displays the current position of the slitset. If a slitset includes two slits, it is assumed that the first one is the horizontal and the second one the vertical.
    All the motors must be defined in the configuration file, the logical motors having their controllers selected to `NONE'.


    slitshow
    Usage: slitshow
    Shows the current position of the configured slitsets.

    slitzero
    Usage: slitzero <slitset_name>
    Moves the blades to the zero position defined in the configuration file.
    The slitset is at `zero position' when the dials of the blades are at the values defined in the configuration file as Generic parameter 3.
    This macro moves the blades but does not modify their `user' position. To change the user positions to zero or other desired value, one has to explicitely use the set macro.

    slithome
    Usage: slithome <slitset_name>
    Moves the physical motors in the slitset to a mechanical reference and sets the dial positions.
    This macro needs special parameters in the configuration file as explained in the %{%<A HREF=#SETUP>%}%SETUP%{%</A>%}% section.

Internal Macros:
    slit_config
    Usage: slit_config(mne,type,unit,module,chan)


    slit_calc
    Usage: slit_calc(mne,mode,master0)


    slit_checkmove
    Usage: slit_checkmove(master)


    slit
    Usage: slit


    slitunsetup
    Usage: slitunsetup "slit<name>" "w<name>"
    Undoes the configuration of a slitset.

    slitset_config
    Usage: slitset_config <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>]
    Checks the validity of the motor mnemonics and enable or disable the whole slitset.

    slit_move
    Usage: slit_move <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>]


    slit_getangles
    Usage: slit_getangles <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>]


    slit_setuser
    Usage: slit_setuser <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>] <motor> <position>


    slitset_chgoff
    Usage: slitset_chgoff <offs> <gap> <bld1> <bld2>


    slitset_move
    Usage: slitset_move (<offs>, <gap>, <bld1>, <bld2>)


    slitset_getangles
    Usage: slitset_getangles (<offs>, <gap>, <bld1>, <bld2>)


    slit_where
    Usage: slit_where 0|1 <name> <offs> <gap> <bld1> <bld2> [<offsV> <gapV> <bldV1> <bldV2>]
    Displays the current position of a slitset. If the first parameter is 1 more detailed information is presented.

    slit_disp
    Usage: slit_disp (<format>, <label>, <offs>, <gap>, <bld1>, <bld2>)


    slit_params
    Usage: slit_params (<slitset_name>, <param_array>)
    Loads the parameters of the slitset into an array.

    slitlist
    Usage: slitlist
    Lists the slitsets currently configured.


    _chg_slt_dial
    Usage: _chg_slt_dial (<motor>, <new_dial>)


    _chk_slt_home
    Usage: _chk_slt_home <motor> <lim> <position>


    mot_prot
    Usage: mot_prot (<motor>)
    Returns true if <motor> is protected.

Filename: slitset.mac
Author: P.Fajardo, (Original 1/96). $Revision: 4.7 $ / $Date: 2014/02/27 17:03:50 $
Last mod.: 27/02/2014 18:03 by witsch