esrf

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

Macromotors_utils.mac
See other macros in category: Tools
Description:
    Some macros to handle XML manipulations for macromotors writing
Documentation:
    DESCRIPTION
    In the following:
    - <controller> refers to the generic controller name
    <controller>.xml contains the list of equipments (instances) of that type, for the spec session
    - <equipment> (or module) refers to a particular instance of controller (ex: equipments pslit, sslit are of type slit), and is a group of motors (macromotors and real motors having some links between them)
    <equipment>.xml describe a particular equipment in xml format. It contains properties and references to motors. We assume that :
    - xml files for controllers and equipments are situated from the hardware repository location at the <spec> subdirectory.
    - xml files for motors are situated from the hardware repository location, at the <spec>/<motors> subdirectory

    DEPENDENCIES
    XML_utils.mac XML_obj.mac

Macros:
    CreateMotor
    Usage: CreateMotor (mne)
    Creates a spechw object for this motor mnemonic, and load the properties of the associated xml file. This macro reads <mne>.xml file.
    WE SUPPOSE THAT THE XML FILE ASSOCIATED IS SITUATED FROM THE HWR LOCATION INT THE <spec>/<motors> SUBDIRECTORY
    - returns always 0

    motor_prop
    Usage: motor_prop (mne,prop,[val])
    sets or reads a property for a spechw motor object created with CreateMotor
    - returns the property value if reading
    - returns 0 if setting
    - returns __error__ if error

    ShowMotor
    Usage: ShowMotor (mne)
    shows properties of spechw object <mne> created by CreateMotor

    CreateEquipmentList
    Usage: CreateEquipmentList (controller)
    Creates the list of equipment for a particular type of macromotor controller <controller>. This macro does:
    - Create controller object (equipment list) from <controller>.xml file
    - Create object for each equipment appearing in that file (read the list of <equipment>.xml)
    Then, on each equipment object:
    - get 'macromotor' property (which is a list of 'role' associated to macromotors), check that everyone is in the spec config and is of correct macromotor type
    - get 'realmotor' property (which is a list of 'role' associated to real motors), and check that everyone is in the spec config.
    - associate each motor of these list to its equipment, inside the controller object.
    WE SUPPOSE THAT THE <controller>.xml and each <equipment>.xml XML FILE ASSOCIATED IS SITUATED FROM THE HWR LOCATION INT THE <spec> SUBDIRECTORY.
    - returns 0 if OK
    - returns -1 if error

    GetEquipmentList
    Usage: GetEquipmentList (controller)
    Gets the list of equipment for a particular type of macromotor controller <controller>. We assume that a CreateEquipmentList has been performed previously on it.
    - returns a string list, or __error__ in case of error

    ShowController
    Usage: ShowController (controller)
    Shows properties of corresponding <controller> object

    ShowEquipment
    Usage: ShowEquipment (equipment)
    Shows properties of corresponding <equipment> object

    equipment_prop
    Usage: equipment_prop (modulename,prop,[val])
    sets or reads a property for a spechw equipment object created with CreateEquipment.
    This macro can also be used on controller objects
    - returns the property value if reading
    - returns 0 if setting
    - returns __error__ if error

    EquipmentGetReal
    Usage: EquipmentGetReal (motormne,controller)
    Checks that this motor is really expected in one of the modules defined for the 'controller' macrocontroller (just to see it is not an extra one)
    - returns the list of real motors of that equipment (list done by EquipmentRegisterReal) if OK.
    - returns -1 if no such list.

    GetEquipment
    Usage: GetEquipment (motormne,controller)
    Looks controller object for equipment associated to motor mnemonic <motormne>
    - returns equipment name if OK
    - returns -1 if not OK

Internal Macros:
    CreateEquipment
    Usage: CreateEquipment (modulename,controller)
    Creates a spechw object for the equipment <modulename>, and load the properties of the xml file. The <controller> is the macromotor controller type of the equipment, this name is given in the spec config. This macro reads <modulename>.xml file
    From the xml file containing <role> and associated <hwrid> keys, this macro creates a spechw object whose properties are the xml <role> values and the associated properties values are the motors mnemonics extracted from the <hwrid> values representing motor names with their path from the hardware repository.
    WE SUPPOSE THAT THE XML FILE ASSOCIATED IS SITUATED AT THE HWR LOCATION.
    - returns always 0

    EquipmentRegisterMacro
    Usage: EquipmentRegisterMacro (modulename, string_list)
    For an equipment <modulename> already created with CreateEquipment macro, this macro gets every name of the <string_list> (each is supposed to be a <role> associated to a motor name). It does the following things:
    - the name is supposed to be a <role> of the equipment (see CreateEquipment above) or equivallent: key associated to a motor mnemonic
    - the associated motor appears in the spec config, as a macromotor of correct macromotor type: in case of problem, a significant message is printed.
    - associate to this motor its <modulename> equipment, in order to identify later, with GetEquipment macro, to which equipment it belongs.
    - returns always 0

    EquipmentRegisterReal
    Usage: EquipmentRegisterReal (modulename, string_list)
    For an equipment <modulename> already created with CreateEquipment macro, this macro gets every name of the <string_list> (each is supposed to be a <role> associated to a motor name). It does the following things:
    - the name is supposed to be a <role> of the equipment (see CreateEquipment above) or equivallent: key associated to a motor mnemonic
    - the associated motor appears in the spec config. in case of problem, a significant message is printed.
    - associate to this motor its <modulename> equipment, in order to identify later, with GetEquipment macro, to which equipment it belongs.
    - returns always 0

Filename: Macromotors_utils.mac
Author:
Last mod.: 31/07/2008 08:48 by rey