esrf

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

Analog instruments
See other macros in category: Detection
Description:
    Macros to manage analog instruments as pseudocounters.
Documentation:
    DESCRIPTION
    This macro set is intended to operate instruments that provide analog readings as pseudocounters. They will be called "multimeters" even if they might be other type of instruments or signal sources. These macros may replace those in pico.mac adding new features. The more relevant are:
    • Different type of multimeters and signal sources can be used as mentioned above.
    • One can operate multimetres in integrating or averaging mode. The integration and the average are implemented by software. In both cases the signal is integrated in time with respect to the computer clock. In averaging mode the time integral is divided by the counting time (time averaging).
    • Counters mnemonics can be freely choosen.
    • Parameters like scale factors and GPIB address, can be set in the config file.
    • A new macro (multimshow) displays the configuration in a concise way.
    The implemented signal sources are:
    • Keithley multimeters (and similar) interfaced by GPIB with the old protocol and the new series, using the SCPI protocol.
    • Electron current of the Storage Ring.
    • ADC's in ICV150 VME boards.
    • ADC - wago modules.
    • Dummy (simulated) signals for test purposes.
    This file includes versions of the macros picosetup and picopol for backward compatibility.

    EXAMPLE
    multimsetup mon2 mon3 integrate=yes scale=1e9
    This macro configures the pseudocounters mon2 and mon3 to be loaded with multimeter readouts. The multimeters must be Keithley-like with GPIB interface (the default) and the interface number and address of each multimeter is taken respectively from the unit and channel fields of the pseudocounter in the config file.
    The instrument readings will be time-integrated and multiplied by a scale factor of 1E9.
    multimsetup i0 address=16
    The pseudocounter i0 is set to be loaded with the reading of a multimeter with the GPIB address 16. In this case the pseudocounter will work in averaging mode and the scale factor will be taken from the config file.
    multimsetup i0 i1 type=madc device="id23/wct231_thc/1"
    The pseudocounters i0 and i1 are set each to read a channel from an ADC (same server, possibly different board). The unit and channel for each counter will be read from the config file.
    multimshow
    Displays the current configuration.


    EXAMPLE
    multimsetup pd0 type=bliss_keithley_gpib device=id09/gpib/pd0
    A pseudo counter named pd0 will be set up for a Keithley Picoamperemeter.


    EXAMPLE
    multimsetup pico2 type=kscpi
    A pseudo counter named pico2 will be set up for a Keithley Picoamperemeter using the SCPI protocol. Unit and channel of the named counter are used as gpib interface and address respectively.


    INTERNALS
    To add a new type of signal source one must do the following:

    1.- Choose a string <type> to identify the type of the instrument.

    2.- If the instrument needs any kind of initialisation include it in a macro called multim_init_<type>. This is executed at the end of multimsetup and reconfig. One can include here any check or parameter initialisation that might speed up the counting.

    3.- Write a macro called multim_read_<type> that gets the instrument reading and saves it in the local variable `value'. If the value is succesfully set, the macro must set the variable `ok' to 1.

    Have a look to multim_read_kgpib and multim_init_kgpib as examples of how to check and read the parameters.

Macros:
    multimsetup
    Usage: multimsetup <counter1> [<counter2> ...] [<parameter>=<value> ...]
    This macro configures the list of pseudocounters to be loaded with the analog readings. It is possible to add parameters to change the defaults. All the parameters will affect to all the counters regardless of their position in the line. If one wants to set particular parameters to specific counters, he should use several multimsetup lines. As it is explained below whenever a essential parameter, like the scale factor or the instrument address, is not especified it will be taken from the config file.
    Parameters that are meaningless for a particular type of signal source are accepted but ignored.
    The currently implemented parameters are the following:


    type: the type of signal source. Accepted values are:
  • "kgpib" (Keithley-like behaviour with GPIB interface) (Default)
  • "kscpi" (Keithley with GPIB interface using the SCPI protocol) (6485) this accepts an extra "readmode" parameter (ex: readmode=pt100) that will configure the readmode an initialization. Accepted values are:
  • "pt100" (read temperature/pt100 thermocouple) (k2010)
  • "resistance" (read resistance) (tested on k2001 and k6514)
  • "resistance4w" (read 4-wire resistance) (tested on dmm7510)
  • "current" (read current) (tested on k6485 and k6514)
  • "vmeadc" (ADC channel in a ICV150 VME board with OS9 taco server)
  • "lvmeadc" (ADC channel in a ICV150 VME board with Linux taco server)
  • "madc" (ADC channel read with MAdc150 (ICV150 VME board) or WagoCt (wago ADC board) Linux device servers)
  • "tangoelect" (Electrometers TANGO device server, for Keithley electrometers)
  • "dummy" (dummy counter, may simulate a constant rate, a peak or an exponential decay)

address: the GPIB address of the multimeter in the standard spec format. If it is not especified, the address for a GPIB instrument is constructed from the "unit" and "channel" fields associated to the counter in the config file: "unit" corresponds to the interface number and "channel" to the instrument address in the bus.

integrate: if set to "yes" makes the pseudocounter work in integrating mode. The default is "no" that correspond to averaging mode. In one case the multimeter readings during the counting interval are time integrated by spec, while in the other they are time averaged.

average: if set to "yes" makes the pseudocounter work in a simple averaging mode. Values are accumulated and then divided by the number of measurements.

scale: The scale factor that multiplies the instrument readout. If it is not especified, the value is taken from the "scale" field in the config file.

trigger: By default is set to yes. The effect of this parameter is device dependent. For "kgpib" multimeters the intruments are triggered at the beginning of the counting interval discarding any old values stored in the intrument buffers.

device: the device name for ICV150 VME boards.

channel: the channel number for ADC's in ICV150 VME boards. If it is not especified, the value is taken from the "channel" field in the config file, only mandatory for OS9 device server, the Linux version of the server exports one device per channel.

sample: If set to yes, the device will be read only once each count; otherwise it will be read as much as possible during the counting time (taking into account the polltime parameter). Default is no.

polltime: specifies the minimum time between accesses to the device in seconds. By default the devices will be polled during counting at a rate determined by the COUNTERSPOLLTIME and the total access time of all the multim devices. Sometimes this can represent an overload of some resource, which can be controlled by this parameter.

motor, center and fwhm: description of the simulated peak for "dummy" signals.

timeconstant: time constant in minutes of an exponentially decaying "dummy" signal. If it is not especified, the value is taken from the "channel" field in the config file.


multimunsetup
Usage: multimunsetup <key>
Removes the configuration for a particular pseudocounter. It is called internally by the automatic unsetup procedure but it can be also called by the user.

multimshow
Usage: multimshow
This macro displays the current configuration.

picosetup
Usage: picosetup
This macro is a version of the old picosetup compatible with the new macros. It is included only for backward compatibility.

picopol
Usage: picopol
This macro changes the sign of the scale factor for those electrometers configured by picosetup

pico_azero
Usage: pico_azero counter_name [on/off]
Toggle Keithley pico amperemeter Automatic ZERO checking . Used to achieve optimum accuracy for low current measurements, readings become slower by a factor of 3.

pico_av
Usage: pico_av counter_name [on/off]
switch Keithley pico amperemeter averging on or off, second argument is optional.

av_K648x
Usage: av_K648x counter_name [on/off]
Please do not use anymore, for backwards compatibility only.

pico_autorange
Usage: pico_autorange counter_name [on|off]
Toggle Keithley pico amperemeter Automatic RANGE.

pico_setrange
Usage: pico_setrange counter_name [range]
Set Keithley SCPI instrument RANGE. Or read the RANGE and asks a range if no range value is asked.

multim_range
Usage: multim_range <mnemonic> <list|range>
change gain setting. Allowed values for range are "2nA", "20nA", "200nA", "2uA", "20uA", "200uA", "2mA", "auto" and "fix". "fix" disables autoranging, keeping the currently chosen gain.

multim_query_range
Usage: multim_query_range mnemonic
This macro uses a macro fuction which returns the used range of the instrument. Example: multim_query_range pd2

Internal Macros:
    _multimsetup
    Usage: _multimsetup (<argument_string>)
    This macro does the actual setup.

    multim_precount
    Usage: multim_precount (<counter>)
    This macro function initialises variables for the pseudocounting.

    multim_getcounts
    Usage: multim_getcounts (<counter>, <polling>)
    This macro function reads the signal and averages or performs the integration as necessary.

    multim_init_kgpib
    Usage: multim_init_kgpib
    Particular initialisation for type=kgpib

    multim_read_kgpib
    Usage: multim_read_kgpib
    Reads the instrument for type=kgpib

    multim_init_vmeadc
    Usage: multim_init_vmeadc
    Particular initialisation for type=vmeadc


    multim_read_vmeadc
    Usage: multim_read_vmeadc
    Reads the ADC value for type=vmeadc

    multim_init_lvmeadc
    Usage: multim_init_lvmeadc
    Particular initialisation for type=lvmeadc


    multim_read_lvmeadc
    Usage: multim_read_lvmeadc
    Reads the ADC value for type=lvmeadc

    multim_init_madc
    Usage: multim_init_madc
    Setup a single channel variables when type=madc.

    multim_read_madc
    Usage: multim_read_madc
    Read a single value when type=madc.

    multim_init_dummy
    Usage: multim_init_dummy
    Iniatises values for a multimeter for type=dummy.
    Uses undocumented parameters "motor", "fwhm" and "center" (peak simulation) and "timeconstant" (exponential decay).

    multim_read_dummy
    Usage: multim_read_dummy
    Simulates the reading of a multimeter for type=dummy

    multim_config
    Usage: multim_config (<counter_name>)
    This macro checks and configures the internal parameters.

    multim_init
    Usage: multim_init (<counter>)
    This macro initialises the instruments if there is something to initialise. It returns 0 after a correct initialization and -1 if an error happens.

    _picosetup
    Usage: _picosetup


    multim_init_bliss_keithley_gpib
    Usage: multim_init_bliss_keithley_gpib


    multim_read_bliss_keithley_gpib
    Usage: multim_read_bliss_keithley_gpib


    multim_init_kscpi
    Usage: multim_init_kscpi
    Particular initialisation for type=kscpi

    multim_read_kscpi
    Usage: multim_read_kscpi
    Reads encoder value for type=kscpi

    kscpi_put
    Usage: kscpi_put(cntrl,str)


    kscpi_get
    Usage: kscpi_get(cntrl)


    kscpi_flush
    Usage: kscpi_flush(cntrl)


    multim_init_tangoelect
    Usage: multim_init_tangoelect
    Particular initialisation for type=tangoelect


    multim_read_tangoelect
    Usage: multim_read_tangoelect
    Reads the ADC value for type=tangoelect

    _multim_query_range
    Usage: _multim_query_range mnemonic
    This macro function returns the used range of the instrument. Example: _multim_query_range(4)

Filename: multim.mac
Author: P. Fajardo, (Original 2/96)
Holger a little bit (kscpi, June 2003)
$Revision: 3.44 $ / $Date: 2021/10/05 12:21:41 $
Last mod.: 05/10/2021 14:21 by witsch