esrf

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

ICE.MAC
See other macros in category: Positioning Isg
Description:
    Macros to control ISG ICEPAP motor controller as a macro motor and to configure macro counters to read DRIVERs temperatures. Replacing the old "icepap.mac" set of macros.
Documentation:
    DESCRIPTION
    Configuring macro motors
    1) You must have an entry in "MOTORS" table for each icepap MASTER
    - The "DEVICE" field must be set to string "icepap"
    - The "ADDR" must be set to the MASTER network name. The communication port can optionaly be specified also (ex: "isgtmp5:5000")
    - The "NUM" should be set to 159
    - The "TYPE" field must be set to "Macro Motors"
    2) For each axis you must define a motor with:
    - The "Controller" field set to "MAC_MOT"
    - The "Unit" field, numbered from 0, must be set to the MOTORS entry.
    - The "Module" field, numbered from 0, must be set to the ICEPAP rack number (seen on the red 7 segments display of the left hand of each rack)
    - The "Chan" field, numbered from 1, must be set to the DRIVER address
    - Example: "0/1/2" refers to the first icepap controller declared, the rack having the number "1" on its display, the 2nd DRIVER of this rack
    Configuring macro counters to read a DRIVER ENCODER POSITION
    1) You must have a "SCALER" define with "icepapenc" as "DEVICE" and "Macro Counter" as "TYPE".
    2) You must define a counter with "MAC_CNT" as "Device".
    - The "Unit" field must be set to the SCALER entry.
    - The "Chan" field must be set to the DRIVER address (ex: 5 for the 5th DRIVER of crate 0 or ex: 23 for the 3rd DRIVER of crate 2)
    - The "encoder" parameter can be set to one of the following values. Typically this parameter is set in config "custom parameters" screen for a counter. Hint: type "p" to get in.
    - "abs" Read the SSI absolute encoder
    - "absuXX" Read the unsigned SSI XX bits absolute encoder
    - "inc" Read the incremental encoder (DEFAULT)
    - "inpos" Read the DRIVER front panel input
    - "motor" Read the motor phase position
    Configuring macro counters to read a single DRIVER TEMPERATURE
    1) You must have a "SCALER" define with "icepapcnt" as "DEVICE" and "Macro Counter" as "TYPE".
    2) You must define a counter with "MAC_CNT" as "Device".
    - The "Unit" field must be set to the SCALER entry.
    - The "Chan" field must be set to the DRIVER address (ex: 5 for the 5th DRIVER of crate 0 or ex: 23 for the 3rd DRIVER of crate 2)
    Configuring macro counters to read several DRIVERs TEMPERATUREs
    1) You must have a "SCALER" define with "icepapcalc" as "DEVICE" and "Macro Counter" as "TYPE"
    2) For each counter declared:
    - The "Device" field set to "MAC_CNT"
    - The "Unit" field must be set to the SCALER entry.
    - The "Chan" field is not used.
    - The "Misc 1" parameter (type "s" to access it) is the crate number (ex: 0)
    - The "Misc 2" parameter is the type of calculation done on the DRIVERs temperatures of the crate. Possible values are "max", "min", "avg"
    Configuring macro counters to read a single DRIVER internal parameter
    1) You must have an entry in "SCALER" table for each icepap MASTER
    - The "DEVICE" field must be set to string "icepapmeas"
    - The "ADDR" must be set to the MASTER network name. The communication port can optionaly be specified also (ex: "isgtmp5:5000")
    - The "NUM" should be set to 159
    - The "TYPE" field must be set to "Macro Counter"
    2) You must define a counter with "MAC_CNT" as "Device".
    - The "Unit" field must be set to the SCALER entry.
    - The "Chan" field must be set to the DRIVER address (ex: 5 for the 5th DRIVER of crate 0 or ex: 23 for the 3rd DRIVER of crate 2)
    - An extra parameter called "cmd" must be set to the command to be used to get the DRIVER internal parameter (ex: "meas vm" "meas i" etc)
    Extra motor_par() parameters
    motor_par(motor,"power")
    Return "1" if the power is enabled on the speficied motor
    motor_par(motor,"power",1)
    Try to enable the the power the speficied motor and return the result
    motor_par(motor,"jog_speed")
    Returns the current speed if the motor is in never ending motion or returns "0" if it's stop or in normal operation mode.
    motor_par(motor,"jog_speed",speed)
    Sets the speed for the never ending motion. If the motor is already moving in this mode, its speed will be changed on the fly. If the new speed has not the same sign that the current one, the motor will first deccelerate until stopping and then starts rotating in the other direction with the new speed.
    motor_par(motor,"jog_speed",0)
    Cancel a never ending motion.
    motor_par(motor,"closed_loop")
    Returns nonzero if the closed loop is active
    motor_par(motor,"closed_loop",1)
    Activate or desactivate the closed loop for the specified motor
    motor_par(motor,"home_active")
    Returns nonzero if logical home signal is active
    motor_par(motor,"high_lim_set")
    Returns nonzero if positive limitswitch is active
    motor_par(motor,"low_lim_set")
    Returns nonzero if negative limitswitch is active
    motor_par(motor,"keepusable",1)
    Keep the motor usable even if power could not be switched on during reconfig. Typically this parameter is set in config "additional optional parameters" screen for a motor. Hint: type "p" to get in


Macros:
    icepap_info
    Usage: icepap_info [hostname|motor]
    Print out information on the specified ICEPAP system or on an ICEPAP motor configured in the current SPEC session.

    icepap_firmware_check
    Usage: icepap_firmware_check [hostname|motor]
    Check the firmware version(s) of the specificied ICEPAP system or ICEPAP motor configured in the current SPEC session.

    icepap_reset
    Usage: icepap_reset [hostname[:port]]
    Reset all the racks of the specified ICEPAP MASTER

    icepapenc_read
    Usage: icepapenc_read (<counter_mnemonic>)
    Returns value of encoder associated to macro-counter <encoder_mnemonic>. This function is similar to the previous one but provided to be user-callable by beeing more user-friendly.

    icepap_setenc
    Usage: icepap_setenc counter position
    MACRO COUNTER: ENCODER Force the value of an ICEPAP encoder configured as a SPEC counter

    icepap_all
    Usage: icepap_all hostname cmd [args]
    Execute the specified command with its args on all ICEPAP modules (MASTER, SLAVES and DRIVERS) known by the hostname. Note that quotes must be used when cmd includes a hash for the acknowledge.

    upgrade_firmware_1_22
    Usage: upgrade_firmware_1_22 hostname
    Upgrade the specified icepap system from firmware 1.22 to 2.0 If called from SPEC wizard mode, the security of the mandatory same subnetwork is bypassed.

    icepap_alldis
    Usage: icepap_alldis hostname
    Will try to guess if the DISDIS parameter is really needed on each DRIVER of the specified ICEPAP systerm. If not needed, the macro will remove it. WARNING: this macro is for temporary usage only.

    icepap
    Usage: icepap [hostname[:port]]
    Console implementation to communicate to icepap MASTER

    icepap_rprog
    Usage: icepap_rprog [hostname[:port] [file] [rack ... ]]
    Program a the ICEPAP specified list of racks using the rack back plane serial line.

    icepap_prog
    Usage: icepap_prog [hostname[:port] [file] [addr] [options]]
    Program a the ICEPAP module with the specified binary file

    icepap_history
    Usage: icepap_history ()
    Print out the history of commands sent to ICEPAP systems

Internal Macros:
    icepapdebug
    Usage: icepapdebug [personal msg]
    Switch on or off the print of debug messages

    icepap_fiforst
    Usage: icepap_fiforst(dev)
    Reset socket communication and MASTER FIFOs

    icepap_cleanup
    Usage: icepap_cleanup(dev)
    Called on <Ctrl-C>

    icepapdebug_init
    Usage: icepapdebug_init
    Needed to initialize debug print out macro the first time the file is loaded.

    icepap__tocase
    Usage: icepap__tocase (string, case)
    Convert to lower (case==1) or to upper (case==0) case the string passed

    icepap__tolower
    Usage: icepap__tolower (string)
    Return the lower string of the string passed

    icepap__toupper
    Usage: icepap__toupper (string)
    Return the upper string of the string passed

    icepap_trim
    Usage: icepap_trim (string)


    icepap_round
    Usage: icepap_round (x)
    Return a well rounded integer as opposed to int() which always round down

    icepap_chkerr
    Usage: icepap_chkerr (ans)
    Check if the answer given contains an ERROR and if yes request the error message

    _icepaplib_check
    Usage: _icepaplib_check ()
    Check if the IcePAP library can be used through the dedicated TANGO DS. Returns non null if usable.

    _icepaplib_access
    Usage: _icepaplib_access
    Macro to get access to the TANGO DS using the IcePAP library

    _icepaplib_create_group
    Usage: _icepaplib_create_group (group_name)
    Creates a group with the specified name. If the group already exists, it will be emptied WARNING: this implies that groups can not be shared accross different SPEC sessions.

    _icepaplib_create_axis
    Usage: _icepaplib_create_axis (mne, flags)
    Add a new axis to defaut group or to a given group if motor mne has a parameter "group" defined. Returns 0 if success otherwise -1

    _icepaplib_prestart_all
    Usage: _icepaplib_prestart_all ()


    _icepaplib_start_one
    Usage: _icepaplib_start_one (mne, pos_in_steps)


    _icepaplib_start_all
    Usage: _icepaplib_start_all ()


    _icepaplib_get_status
    Usage: _icepaplib_get_status (mne)
    Returns the move and limit status of a single motor (bit mask) or the string ".error.". If the library can not be used, returns -1

    _icepaplib_get_position
    Usage: _icepaplib_get_position (mne)
    Returns the position single motor or the string ".error.". If the library can not be used, returns ".error."

    _icepaplib_stop
    Usage: _icepaplib_stop (mne)
    Stops a single motor or the string ".error.". If the library can not be used, returns -1

    _icepaplib_power_axis
    Usage: _icepaplib_power_axis (mne, power)
    Change the power of the specified axis. The argument can be "ON" or "OFF". Returns 0 if success otherwise -1

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

    icepap_par
    Usage: icepap_par(num,key,todo,p1)
    MACRO MOTOR: Called by spec after reading the config file, after calling _config() and only if parameters are set in the config file for a motor.

    _icepap_prestart_all
    Usage: _icepap_prestart_all(dev)
    MACRO MOTOR:

    _icepap_start_all
    Usage: _icepap_start_all(dev)
    MACRO MOTOR:

    _icepap_start_one
    Usage: _icepap_start_one(dev, addr, pos)
    MACRO MOTOR:

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

    _icepap_print_info
    Usage: _icepap_print_info (dev,addr,mne)


    _icepap_print_info_driver
    Usage: _icepap_print_info_driver (dev,addr)
    TODO: unify with icepap_info macro

    _icepap_print_tabbed
    Usage: _icepap_print_tabbed(tab,str)


    _icepap_print_info_mot
    Usage: _icepap_print_info_mot (motor)


    _icepap_print_info_system
    Usage: _icepap_print_info_system (hostname)


    _icepap_fw_check_mot
    Usage: _icepap_fw_check_mot (motor)


    _icepap_fw_check_system
    Usage: _icepap_fw_check_system (hostname)


    _icepap_fw_compare
    Usage: _icepap_fw_compare (rev1, rev2)
    Compare deux revisions, given as strings, and returns: 0 if rev1 equal rev2 1 if rev1 > rev2 2 if rev1 < rev2 -1 if invalid revision numbers

    _icepap_fw_controller
    Usage: _icepap_fw_controller (hostname)
    Returns, for the specified system, the firmware version of the CONTROLLER

    _icepap_fw_driver
    Usage: _icepap_fw_driver (hostname, addr)
    Returns, for the specified system, the firmware version of the DRIVER specified by its address.

    _icepap_fw_saved
    Usage: _icepap_fw_saved (hostname)
    Returns, for the specified system, the firmware version saved in flash

    icepap_lock
    Usage: icepap_lock axis
    CONFIG LOCK: Add a lock on the specified axis (ex: 0/2)

    icepap_unlock
    Usage: icepap_unlock axis
    CONFIG LOCK: Remove a lock on the specified axis (ex: 0/2)

    _icepap_islockfile
    Usage: _icepap_islockfile()
    CONFIG LOCK: Check that lock file exist and create empty if not

    _icepap_lock
    Usage: _icepap_lock (axis,lock)
    CONFIG LOCK: Add or remove (lock=1 or 0) a lock on the specified axis (ex: 0/2)

    _icepap_islock
    Usage: _icepap_islock (axis)
    CONFIG LOCK: Return 1 if a lock exist for the specified axis (ex: 0/2) Return 0 if there is no lock. Return -1 in case of error.

    _icepapcnt_gettemp
    Usage: _icepapcnt_gettemp (hostname:port, address)
    MACRO COUNTER: Read the temperature on the specified address Returns 0 in case of error

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

    icepapcnt_cmd
    Usage: icepapcnt_cmd(num,key,p1,p2)
    MACRO COUNTER: Called by spec on counter operation.

    _icepapenc_getpos
    Usage: _icepapenc_getpos (<counter_number>, <hostname:port>, <address>)
    MACRO COUNTER: ENCODER Read the encoder position on the specified address Returns 0 in case of error

    _icepapenc_setpos
    Usage: _icepapenc_setpos (counter, hostname:port, address, pos)
    MACRO COUNTER: ENCODER Set the encoder position on the specified address Returns 0 in case of error

    _icepap_setenc
    Usage: _icepap_setenc (counter_mne, position)
    MACRO COUNTER: ENCODER Force the value of an ICEPAP encoder configured as a SPEC counter

    icepapenc_config
    Usage: icepapenc_config(num,type,p1,p2,p3)
    MACRO COUNTER: ENCODER Called by spec after reading the config file

    icepapenc_cmd
    Usage: icepapenc_cmd(num,key,p1,p2)
    MACRO COUNTER: ENCODER Called by spec on counter operation.

    icepapcalc_config
    Usage: icepapcalc_config(num,typ,p1,p2,p3)
    MACRO COUNTER: Called by spec after reading the config file

    icepapcalc_cmd
    Usage: icepapcalc_cmd(num,key,p1,p2)
    MACRO COUNTER: Called by spec on counter operation.

    icepapmeas_config
    Usage: icepapmeas_config(num,type,p1,p2,p3)
    MACRO COUNTER: MEASURE Called by spec after reading the config file

    icepapmeas_cmd
    Usage: icepapmeas_cmd(num,key,p1,p2)
    MACRO COUNTER: MEASURE Called by spec on counter operation.

    _icepap_all
    Usage: _icepap_all (hostname,cmd)


    _icepap_get_addrs
    Usage: _icepap_get_addrs (hostname)
    Returns the addresses of all ICEPAP modules alive on the specficed hostname. The addresses are returned in a single string, blank separated.

    _is_package_installed
    Usage: _is_package_installed (bliss_package_name)


    _is_same_subnetwork
    Usage: _is_same_subnetwork (icepap_hostname)


    _is_valid_version
    Usage: _is_valid_version (firmwares_list)


    _is_alive
    Usage: _is_alive (icepap_hostname)


    _emulate_alldis
    Usage: _emulate_alldis (dev, addr_list)
    Bypass external disable signal on the list of drivers given. (this was done with DISDIS command on old firmwares <2.0) Works only on firmware >=2.0

    _emulate_onedis
    Usage: _emulate_onedis (dev, addr)
    Bypass external disable signal on the driver given. (this was done with DISDIS command on old firmwares <2.0) Works only on firmware >=2.0

    _icepap_alldis
    Usage: _icepap_alldis(dev, silent)


    _icepap_getdev
    Usage: _icepap_getdev (string, n)
    Parse the string to get the ICEPAP device to talk to. Try to get as nth argument (starting from 1) in the string, if not prompt the user.

    _icepap_getfname
    Usage: _icepap_getfname (string, n)
    Parse the string to get the ICEPAP tocho file. Try to get as nth argument (starting from 1) in the string, if not prompt the user.

    _icepap_getaddr
    Usage: _icepap_getaddr (string, n)
    Parse the string to get the addr for programming. Try to get as nth argument (starting from 1) in the string, if not prompt the user.

    _icepap_getopts
    Usage: _icepap_getopts (string, n)
    Parse the string to get the options for programming. Try to get as nth argument (starting from 1) in the string, if not prompt the user. Any remaining argument is also return as option.

    _icepap_getracks
    Usage: _icepap_getracks (string, n)
    Parse the string to get the rack addresses for programming. Try to get as nth argument (starting from 1) in the string, if not prompt the user. Any remaining argument is also return as option.

    _icepap_prog
    Usage: _icepap_prog (dev,fname,addr,opt)
    Program a the ICEPAP module with the specified arguments. If no firmware file name is given, the programmatino will used the firmware saved in the controller flash.

    _icepap_wrbin
    Usage: _icepap_wrbin (dev,fname)
    Send the contain of the file to the ICEPAP using the ISG binary transfer protocol.

    icepap_mdspreset
    Usage: icepap_mdspreset [hostname:port]
    Reset the MASTER DSP

    icepap_ddsppgm_sl
    Usage: icepap_ddsppgm_sl [hostname:port [driver]]
    Program one or all DRIVER DSP numbered from 1 to 8 using the backplane serial line and the DDSP programm taken from MDSP flash (no binary transferred)

    _icepap_check
    Usage: _icepap_check (hostname:port)
    Do not touch, needed by the "raleur"

    _icepap_close
    Usage: _icepap_close (hostname:port)


    _icepap_err
    Usage: _icepap_err


    _icepap_warn
    Usage: _icepap_warn


    _icepap_stopcode
    Usage: _icepap_stopcode (num, status)
    Decode stop reason for the driver status given. No action, print only for diagnostic

    _icepap_wr
    Usage: _icepap_wr (dev,addr,cmd)


    _icepap_wrrd
    Usage: _icepap_wrrd (dev,addr,cmd)


    _icepap_query
    Usage: _icepap_query (dev,addr,cmd,silent)


    _icepap_patch
    Usage: _icepap_patch ()
    Temporary patch

    _icepap_patch_email
    Usage: _icepap_patch_email ()
    Temporary email after patch

    _icepap_email
    Usage: _icepap_email (message)
    Send an email with the specificied patch

    _icepap_hist_init
    Usage: _icepap_hist_init ()
    Init the ICEPAP history if needed

    _icepap_hist_add
    Usage: _icepap_hist_add (dev,cmd)
    Add to the ICEPAP history an entry

    _icepap_hist_append
    Usage: _icepap_hist_append (str)
    Append a string to the last line in the ICEPAP history

    _icepap_hist_dump
    Usage: _icepap_hist_dump ()
    Return a string with the history of commands sent to ICEPAP systems

    icepap_duplicate_conf
    Usage: icepap_duplicate_conf (dev,src_addr,dst_addr)
    Will copy the source driver configuration to the destination one (bypass of icepapcms) ex: ("iceid207",11,25)

Filename: ice2_uselib.mac
Author: MP BLISS (Original 9/07).
$Revision: 2.0 $ / $Date: 2013/10/01 13:18:09 $
Last mod.: 10/02/2014 16:11 by perez