esrf

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

ICE_TRAJ.MAC
See other macros in category: All
Description:
    Macros to handle IcePAP trajectories.
Documentation:
    DESCRIPTION
    These macros allow to create and download an IcePAP trajectory. The aim is to move a set of IcePAP motors synchronously and following a pre-loaded trajectory. The trajectory is a list of positions for a given parameter value. To move over the trajectory, a macro motor has to be configured and it's position value will be the parameter value. Note that the parameter value can be inbetween parameter values loaded (the IcePAP DRIVER does interpolation). The macro motor velocity/acctime of the config are used during trajectory motion.
    Configuring macro motor:
    1) You must have an entry in "MOTORS" table:
    - The "DEVICE" field must be set to string "icepap_traj"
    - The "ADDR" must be set to the MASTER network name. (ex: "iceid033")
    - The "NUM" should be set to at least 1
    - The "TYPE" field must be set to "Macro Motors"
    2) Declare on macro motor with:
    - The "Controller" field set to "MAC_MOT"
    - The "Unit" field, numbered from 0, must be set to the MOTORS entry.
    - The "Module"/"Chan" fields don't mind.
    - Add a Custom Parameter "axis_list" with the list of IcePAP motors mnemonics that will be part of the trajectory (ex: "del gam mu")
    Extra motor_par() parameters:
    motor_par(motor, "sync")
    motor_par(motor, "sync", par_val)
    Try to put the concerned motors on the trajectory at the given parameter value if given. WARNING: the motors will move. Always returns if all the motors are on the trajectory ("1") or not ("0")
    motor_par(motor, "power")
    motor_par(motor, "power", 1)
    Try to enable the power on all the motors concerned by the trajectory. Always returns if all the motors are powered ("1") or not ("0")
    motor_par(motor, "traj_infos")
    Returns a string with "interpolation par_min par_max npoints" corresponding to the current loaded trajectory. Note: if trajectory is defined for several motors, the info returns is the first one motor only.
    motor_par(motor, "slew_rate_max")
    Returns the maximum parameter velocity for the trajectory currenltly loaded.


    EXAMPLE
    Macro motor usage:
     icepap_traj_load mytraj parmot
     icepap_traj_sync parmot 0.0
     mv parmot 3.5
    
    
    Low level commands:
    short array mypar[4] short array mypos[4] array_op("fill", mypar) array_op("fill", mypos, 10) icepap_traj_build mytraj PARAMETER mypar 6 icepap_traj_build mytraj POSITION mypos 6 icepap_traj_info mytraj icepap_traj_load mytraj iceid321 6 icepap_traj_delete mytraj icepap_traj_build mytraj2 PARAMETER mypar 255 icepap_traj_build mytraj2 POSITION mypos 6 icepap_traj_load mytraj2 iceid321 icepap_traj_sync parmot 0.0 mv parmot 3.5


Macros:
    icepap_traj_build
    Usage: icepap_traj_build trajectory type array [addr]
    Update a trajectory with the content of the given data array. If the trajectory does not exist, it will be created, otherwise it will be enlarged with the new data. The type describe the kind of vector data which could be "PARAMETER", "POSITION", "SLOPE" The address given is the destination DRIVER address. When giving the parameter, the address is not mandatory. Then the parameter will be used for all afterward DRIVERs. Example: icepap_traj_build mytraj1 PARAMETER mypar icepap_traj_build mytraj1 POSITION mypos 6

    icepap_traj_delete
    Usage: icepap_traj_delete trajectory
    Delete a trajectory. Example: icepap_traj_delete mytraj1

    icepap_traj_info
    Usage: icepap_traj_info trajectory
    Example: icepap_traj_info mytraj1

    icepap_traj_load
    Usage: icepap_traj_load trajectory { param_motor } | { hostname [address] }
    Download the given trajectroy into the specified IcePAP system. If an address is given, the trajectory will be sent directly to the concerned DRIVER. Example: icepap_traj_load mytraj1 iceid321 6 icepap_traj_load mytraj1 m0

    icepap_traj_sync
    Usage: icepap_traj_sync motor parameter_value
    Put all concerned real motors on the trajectory at the positions corresponding to the given parameter value.

    _icepap_traj_sync
    Usage: _icepap_traj_sync motor parameter_value
    Put all concerned real motors on the trajectory at the positions corresponding to the given parameter value. Returns non null if an error occured.

    icepap_traj_debug
    Usage: icepap_traj_debug verbose_level
    Set the verbose level of trajectory macros, 0==none

Internal Macros:
    _icepap_traj_build
    Usage: _icepap_traj_build (traj_name, type, array, addr, silent)
    Update an IcePAP trajectory, given by its name. Returns non null if an error occured.

    _icepap_traj_delete
    Usage: _icepap_traj_delete (traj_name)
    Delete a trajectory.

    _icepap_traj_load
    Usage: _icepap_traj_load (traj_name, hostname, addr, silent)
    Download a trajectroy, given by its name, into the specified IcePAP system. If the address is not 0, then the trajectory will be sent directly to a DRIVER. Returns non null if an error occured. TODO: -check that the trajectory contains only good addresses Example: _icepap_traj_load("mytraj1", "iceid321", 6) _icepap_traj_load("mytraj1", "iceid321") _icepap_traj_load("mytraj1", "m0")

    _icepap_change_timeout
    Usage: _icepap_change_timeout (hostname, timeout_ms)
    Change communication timeout

    _icepap_traj_check_ready
    Usage: _icepap_traj_check_ready (motor, silent)
    Check if the given parameter motor is ready to be moved. If silent is non null, no message will printed out. Returns 0 if not ready.

    _icepap_traj_read
    Usage: _icepap_traj_read (array_name, hostname, address, npoints, silent)
    Fill in the given array with the trajectory read positions read from the given IcePAP DRIVER. Note: if the requested number of points is higher that the loaded one, then the DRIVER will interpolated.

    _icepap_traj_bench
    Usage: _icepap_traj_bench traj_motor npoints
    FOR TESTS: Bench the trajectory load time. The motor given has to be an "icepap_traj" one with its list of real IcePAP motors concerned by the trajectory. WARNING: the macro will generate a trajectory and load it into the given IcePAP DRIVERs overwriting any previous trajectory. Example: _icepap_traj_bench m1 100

    _icepap_traj_test
    Usage: _icepap_traj_test hostname address [traj_points_wr [traj_points_rd]]
    FOR TESTS: Check interpolation done by the IcePAP DRIVER on a loaded trajectory. Displays the absolute error between the interpolated trajectory and the theoritical one. WARNING: the macro will generate a trajectory and load it into the given IcePAP DRIVER overwriting any previous trajectory. The default number of points of the loaded trajectory is 100 while the default number of points of the read one is 1000. Example: _icepap_traj_test iceid321 6 _icepap_traj_test iceid321 6 100 _icepap_traj_test iceid321 6 100 1000

    icepap_traj_config
    Usage: icepap_traj_config (num, type, p1, p2, p3)
    MACRO MOTOR: Called by spec after reading the config file

    _icepap_addr2mne
    Usage: _icepap_addr2mne (dev, addr)
    Returns the motor mne corresponding to the hardware address given. If not motor is found, the ".error." is returned.

    icepap_traj_par
    Usage: icepap_traj_par (num, key, todo, p1)
    MACRO MOTOR: Called by spec on motor parameters access.

    icepap_traj_print
    Usage: icepap_traj_print
    MACRO MOTOR: Print debug messages

    icepap_traj_cmd
    Usage: icepap_traj_cmd (num, key, p1, p2)
    MACRO MOTOR: Called by spec on motor operation.

Filename: ice_traj.mac
Author: MP BLISS (Original 02/2015).
$Revision: 1.6 $ / $Date: 2020/11/20 17:19:32 $
Last mod.: 20/11/2020 18:19 by witsch