esrf

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

BV.MAC
See other macros in category: All
Description:
    BV.MAC - Macros for accessing the Standard Pneumatic BeamViewer (BV) control electronics through WAGO I/O station.
Documentation:
    DESCRIPTION
     PAY PARTICULAR ATTENTION TO THE WAGO MODULES ORDERING: OUT IN LEDON LEDOFF GAIN ...
     more details forward. 
    
     These macros, on one hand, interfaces White Beam Viewers control boxes based on Wago,
     and on the other hand allow to set up macro motor for controlling screen pneumatic insertion/extraction,
     and macros counters to read in diode current or range settings.
    
     These macros relies on some particular naming convention in the wago taco resources.
     Each wago channel name is composed of 2 concatened strings <BV name><function key>. 
     
     e.g. below are resources for 2 BV so called wb1 and wb2.
     ID20/wcid20c/wc/module0:   750-436,wb1status,wb1status,wb1status,wb1status, wb2status,wb2status,wb2status,wb2status
     ID20/wcid20c/wc/module1:   750-530,wb1out,wb1in,wb1ledon,wb1ledoff,wb1gain,wb1gain,wb1gain,wb1gain
     ID20/wcid20c/wc/module2:   750-530,wb2out,wb2in,wb2ledon,wb2ledoff,wb2gain,wb2gain,wb2gain,wb2gain
     ID20/wcid20c/wc/module3:   750-479,wb1curr,wb2curr
    
     A standard BV wago control box holds
     4 channels of a module 750-436, "8 Channel Digital Input", to report on BV status. 
       respectively: Screen OUT, Screen IN, Led ON, Remote Gain Setting Enabled (not used).
       default function key is "status"
     8 channels of a module 750-530, "8 Channel Digital Output", to control 
    	pneumatic screen insertion (function keys "out" and "in")
    	illuminator on/off (function keys "ledon" and "ledoff")
    	gain setting (4 channels) (function key "gain")
     1 channel of a module  750-479,  "2 Channel +-10V Input", for diode current. (function key "curr")
    
     the default function keys listed above can eventually be changed by the way of these globals:
    
      BVKEYS ["status"]="status"	
      BVKEYS ["in"]="in"	
      BVKEYS ["out"]="out"	
      BVKEYS ["on"]="ledon"	
      BVKEYS ["off"]="ledoff"	
      BVKEYS ["range"]="gain"	
      BVKEYS ["current"]="curr"	
    
    



    EXAMPLE
    bvsetup wb1 wb2
    initialises software for 2 beamviewers so named wb1 wb2 in wago taco resources.
    it is COMPULSORY to run it also to have the macro motors and counters operationnal.
    bvstatus or bvshow
    displays the status of setup beam viewers.
    
    == wb1 =================
       Screen is      OUT
       Illuminator is OFF
       Range is       1uA
       Current is     0.000976562 uA
    == wb2 =================
       Screen is      OUT
       Illuminator is OFF
       Range is       10nA
       Current is     0.00152588 nA
    
    bvledon wb1
    Switches on illuminator on wb1.
    bvledoff wb1
    Switches off illuminator on wb1.
    bvrange wb1 100nA
    Sets up gain (actualy range 100nA) on wb1.
    available ranges are 1mA 100uA 10uA 1uA 100nA 10nA
    bvautorange wb1
    Automatically Set up more accurate gain on wb1.
    bvin wb1
    inserts screen.
    bvout wb1
    removes screen.
       this macro file also allows to define MACRO MOTORS to control SCREEN INSERTION.
       you must define in SPEC config:
    
       - a bvscr MOTOR controller with as many channels as screens (eg 2):
    
       MOTORS       DEVICE    ADDR   <>MODE      NUM               <>TYPE
          YES       bvscr                          2          Macro Motors
    
       - Motors referring to that controller, with a MOTPAR:wbv parameter that
         is the Wago BV name. 
    
       MOT025 = MAC_MOT:9/0/0   2000  1  2000  200   50  125    0 0x003     wbv1  wbv1
       MOTPAR:wbv = wbv1
       MOT034 = MAC_MOT:9/0/1   2000  1  2000  200   50  125    0 0x003     wbv2  wbv2 
       MOTPAR:wbv = wbv2
    
       - Optional MOTPAR:cntlst parameter that keeps related counter mnemonics list. Those 
         counters are automatically disabled when screen is moved to 0. 
    
       MOT034 = MAC_MOT:9/0/1   2000  1  2000  200   50  125    0 0x003     wbv2  wbv2 
       MOTPAR:cntlst = bv2in bv2x bv2y bv2fwy bv2fwx
    
       this macro file also allows to define MACRO COUNTERS to read in diode CURRENT or
       RANGE.
    
       you must define in SPEC config:
    
       - as many bvcurrent SCALER controller as many diode you read:
         ADDR holds the corresponding Wago BV name. 	
    
       SCALERS        DEVICE   ADDR  <>MODE  NUM                                 <>TYPE
            YES     bvcurrent   wbv1            3                          Macro Counter
            YES     bvcurrent   wbv2            3                          Macro Counter
    
       - Counters in config, the channel defines what to read from the controller.
         chan == 0 will read in direct ADC value
         chan == 1 will read value converted in nA
         chan == 2 will read the setup range in nA
    
       14   <unter 14       dio1   MAC_CNT     0     0    counter             1
       15   <unter 15       rge1   MAC_CNT     0     2    counter             1
       16   <unter 16       cur2   MAC_CNT     1     1    counter             1
    
    
    


Macros:
    bvsetup
    Usage: bvsetup <bv1name> [<bv2name> ...]
    COMPULSORY command to use this set of macros to initialise software, even for using macros motors or counters.

    bvunsetup
    Usage: bvunsetup [<bv1name> <bv2name> ...]


    bvstatus
    Usage: bvstatus


    bvshow
    Usage: bvshow
    same as bvstatus.

    bvin
    Usage: bvin <bv1name> [<bv2name> ...]
    insert screen in beam.

    bvout
    Usage: bvout <bv1name> [<bv2name> ...]
    get screen out of beam.

    bvledon
    Usage: bvledon <bv1name> [<bv2name> ...]
    set internal light on.

    bvledoff
    Usage: bvledoff <bv1name> [<bv2name> ...]
    set internal light off.

    bvrange
    Usage: bvrange <bv1name> <range> [<bv2name> <range>...]
    set up diode current ADC range. available ranges: 1mA 100uA 10uA 1uA 100nA 10nA

    bvautorange
    Usage: bvautorange <bv1name> [<bv2name> ...]
    automatic set up of diode current ADC.

    bvadjustrange
    Usage: bvadjustrange <bv1name> [<bv2name> ...]
    adjust the range for the bv1name> [<bv2name> ...] beam viewer(s) diode. the procedure starts with the most sensitive range possible.

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


    bvscr_cmd
    Usage: bvscr_cmd(mne, cmd, p1, p2)


    _bvscr_disable
    Usage: _bvscr_disable(cntlst,flag)


    bvcurrent_config
    Usage: bvcurrent_config(mne,type,unit,mod,chan)


    bvcurrent_cmd
    Usage: bvcurrent_cmd(mne, cmd, p1, p2)


    _bvstatus
    Usage: _bvstatus(dev)


    _bvrange
    Usage: _bvrange(dev)


    _bvcurrent
    Usage: _bvcurrent (dev)
    read the current of the dev beam viewer diode.

    _bvautorange
    Usage: _bvautorange (dev)
    adjust automatically the range for the dev beam viewer diode. Procedure starting with the current range.

    _bvadjustrange
    Usage: _bvadjustrange (dev)
    adjust automatically the range for the dev beam viewer diode. Procedure starting with the most sensitive range.

    __bv_read
    Usage: __bv_read (dev, bvkey)
    read the bvkey channel for dev.

    __bv_pulse
    Usage: __bv_pulse (dev, inout)
    set the inout channel for dev.

    __bv_setrange
    Usage: __bv_setrange (dev, range)
    set the range for dev.

Filename: bv.mac
Author: BCU - MCL - 2012/10/12 - based on E.Paiser-Ph.Chappelet macros.
Last mod.: 29/10/2020 09:44 by claustre