esrf

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

See other macros in category: All
Description:
    Macrocontroller to read the xbpm positions, intensity and FWHM
Documentation:
    DESCRIPTION
    Macrocontroller to read the xbpms position X, Y, intensity and FWHM on X, Y.
    Spec configuration:

    --- The controller xbpm must be declared in the SCALERS part
     
    SCALERS      DEVICE  ADDR  <>MODE  NUM    <>TYPE
        YES       xbpm  ID24/xbpm/1    4      Macro Counter
    - ADDR: tango device name: this is the 'BeamViewer' device of the xbpmds or LimaCCDs server.

    The controller parameters (CONPAR):
    - limadev : 'LimaCCDs' device of a LimaCCDs server - used for roi and image saving features. The device server has to be started as opidxx if the saving of the image feature is to be used.
    Note: the use of a xbpmds (not limads) server does not allow to use the roi or image save features.
    - alias : an alias name for the xbpm (used only for display).
     
    --- The counters can be defined in the Scaler (Counter) Configuration
     
    Number      Name   Mnemonic  <>Device  Unit  Chan  <>Use As  Scale Factor
        10  x_intens  x_intens   MAC_CNT    0    1     counter          1
        11       x_x       x_x   MAC_CNT    0    2     counter          1
        12       x_y       x_y   MAC_CNT    0    3     counter          1
     
    - Unit refers to the macrocounter index in the SCALERS part (used also as 'unit' argument in the macros)
    - channel: 1 (for intensity), 2 (for X position), 3 (for Y position), 4 (FWHM X), 5 (FWHM Y)

Macros:
    xbpm_debug
    Usage: xbpm_debug
    toggle the debug mode if (!(whatis("__xbpm_debug") & 2)) rdef __xbpm_debug \'#$*\'

    xbpmoff
    Usage: xbpmoff [controller name|unit]
    Disable the unit number counters, all if unit not specified.

    xbpmon
    Usage: xbpmon [unit]
    Enable the unit number counters, all if unit not specified.

    xbpm_takebg
    Usage: xbpm_takebg (unit, tt)
    Take backgroung for unit (as in the spec config) xbpm - close safety shutter, take the background, open the safety shutter. If time tt [s] specified, change the exposure time.

    xbpmimgautosave
    Usage: xbpmimgautosave [unit, directory, prefix]
    Save automatically the last gathered image. Set the directory where the image with the preffix filename will be saved.

    xbpmroi
    Usage: xbpmroi [unit X Y Width Height]
    Set a ROI for the BPM unit.

    xbpmroiget
    Usage: xbpmroiget [unit]
    Displays the ROI for all the defined BPMs or the BPM unit.

    xbpmimgset
    Usage: xbpmimgset [unit, directory, prefix, [suffix], [format]]
    Prepare the images for unit (as in the spec config) xbpm to be save in a file. Accepted formats are raw ot edf.

    xbpmimgparsget
    Usage: xbpmimgparsget
    Show the image saving parameters, if set.

    xbpm_imgsave
    Usage: xbpm_imgsave (unit, flag)
    Set the image saving flag (1=yes, 0=no) for BPM unit.

    bvrange
    Usage: bvrange <bv1name> <range> [<bv2name> ...]
    Set the range [nA]

    bvin
    Usage: bvin <bv1name> [<bv2name> ...]
    Insert yag screen(s) in the beam.

    bvout
    Usage: bvout <bv1name> [<bv2name> ...]
    Extract yag screen(s) from the beam.

    bvledon
    Usage: bvledon <bv1name> [<bv2name> ...]
    Switch led(s) on.

    bvledoff
    Usage: bvledoff <bv1name> [<bv2name> ...]
    Switch led(s) off.

    bvfoilin
    Usage: bvfoilin <bv1name> [<bv2name> ...]
    Insert foil(s) in the beam.

    bvfoilout
    Usage: bvfoilout <bv1name> [<bv2name> ...]
    Extract the foil(s) from the beam.

    bvstatus
    Usage: bvstatus [bvmne]
    Print the status of bvmne viewer. With no argument will print the status of all the configured in the session beam viewers.

Internal Macros:
    xbpm_config
    Usage: xbpm_config (mne, type, unit, module, chan)
    Called after reading the config file. If return the string ".error.", spec will consider the channel unusable.

    xbpm_cmd
    Usage: xbpm_cmd (mne, key, p1, p2, unit)
    Execute the command key for the counter mne, with parameters p1 and p2 if needed. The keys used are as follows:
    "start_one" and "prestart_all" - start the counting Parameters: p1 - counting time.
    Parameters: p2 - 2 (count to a time preset - tcount()).
    Parameters: unit - the unit number (if me is ..).
    "counts" - return the current counts. Parameters: unit - the unit number (if mne is ..).
    "get_status" - only used for polling counter Parameters:none.
    "halt_all" - stop the counting and read the controller (all the counters in one go) Parameters: p1 - controller unit number.
    Return the string ".error.", spec will consider the channel unusable.

    _xbpmena
    Usage: _xbpmena (unit,flag)
    Enable the unit number counters.If flag, set only the simulation.

    _xbpmdisa
    Usage: _xbpmdisa (unit,flag)
    Disable the unit number counters. If flag, set only the simulation.

    _xbpmcntstate
    Usage: _xbpmcntstate (unit)
    Check if the unit number counters are enabled/disabled.

    _xbpm_dev2unit
    Usage: _xbpm_dev2unit(name)


    xbpm
    Usage: xbpm


    _xbpm_takebg
    Usage: _xbpm_takebg (unit)
    Take backgroung for the BPM unit.

    _xbpm_imgautosave
    Usage: _xbpm_imgautosave (unit, flag, dir, pref)
    Eanble (flag = 1)/disable (flag = 0) automatic saving of the last image gathered. If dir and pref not specified, the image will be saved in a file with set in advanced. Return -1 if error from the device server, 0 if OK.

    _xbpmroiget
    Usage: _xbpmroiget (unit)
    Displays the ROI for the BPM unit.

    _xbpmroiset
    Usage: _xbpmroiset (unit)
    Set a ROI for the BPM unit if needed.

    _xbpm_imgsave
    Usage: _xbpm_imgsave (unit)
    Save the last gathered image. Return 0 if image saved, -1 if error.

    _xbpm_imgset
    Usage: _xbpm_imgset (unit, dir, pref, suf, fmt)
    Prepare the images for unit (as in the spec config) xbpm to be save in a file. Accepted formats are raw ot edf.

    _xbpm_imgpars_get
    Usage: _xbpm_imgpars_get (unit)
    Get the images parameters for unit (as in the spec config) xbpm.

    xbpmbv_config
    Usage: xbpmbv_config (mne, type, unit, module, chan)
    Called after reading the config file. If return the string ".error.", spec will consider the channel unusable.

    xbpmbv_cmd
    Usage: xbpmbv_cmd (mne, key, p1, p2, unit)
    Execute the command key for the counter mne, with parameters p1 and p2 if needed. The keys used are as follows:
    "start_one" and "prestart_all" - start the counting Parameters: p1 - counting time.
    Parameters: p2 - 2 (count to a time preset - tcount()).
    Parameters: unit - the unit number (if me is ..).
    "counts" - return the current counts. Parameters: unit - the unit number (if mne is ..).
    "halt_all" - read the diode only once. Parameters: p1 - controller unit number.
    Return the string ".error.", spec will consider the channel unusable.

    _bvrange
    Usage: _bvrange (mne, range)
    Change the beam viewer counter mne range.

    bcin
    Usage: bcin


    bcout
    Usage: bcout


    _bvcmd
    Usage: _bvcmd (dev, val)
    Execute a command on dev beam viewer. Accepted values are: "In"/"Out" for the yag screen, "LedOn"/"LedOff" for the led, "FoilIn"/ "FoilOut" for the foil. Return 0 if OK, -1 if error.

    _yagstatus
    Usage: _yagstatus (dev)
    Return the status of the yag screen for dev.

    _foilstatus
    Usage: _foilstatus (dev)
    Return the status of the scattering foil for dev.

    _ledstatus
    Usage: _ledstatus (dev)
    Return the status of the illuminator for dev.

    _geterr
    Usage: _geterr (unit)
    Disable the controller unit if Tango RuntimeError.

Filename: xbpm.mac
Author: mcd/ab BLISS
Last mod.: 22/06/2020 22:28 by witsch