Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
dc.mac | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Tools | ||||||
Description:
| ||||||
Documentation:
This macro set is intended to transfer information between SPEC and the data collector (DC). Data can be a single scalar or a vector. It is sent to and read from DC devices, identified by names. For reading or creating a DC device a command name must be specified. A first interface is provided through the macro dcsetup, which hooks into prompt_mac a command that puts on the specified DC device a fixed number of parameters. The other group of macros link motors and counters to DC devices. Macro sets cnt2dc and mot2dc store counter counts and motor positions on the DC, respectively. On the other hand, macro set dc2mot move motors to positions read from the DC, while reading from the DC to pseudo counters is made through the multim macros. The xx2yy macro sets share the same user interface: a setup macro and an add macro. All the macros allow the data on the DC be stored as scalars or vectors. In the case of vectors, different counters or motors can be linked to the same device by specifying different array positions. In the setup macros the DC device name is specified, as well as its size (1 for scalars) and command. In the case of cnt2dcsetup and mot2dcsetup, which are supposed to create the DC device, the variable type can also be specified; D_FLOAT_TYPE and D_VAR_FLOTARARR are used by default for scalar and vector devices, respectively. If counters or motors are specified at the end of the setup macros, they will be passed to the corresponding add macros, where they are associated to a position in the DC vector (0 for scalars). Reading from DC to counters is implemented thorugh multimsetup type=dc. Supported parameters are: EXAMPLE INTERNALS All macros (except dcsetup) share the same DC read/write mechanism. They are based in an associative array that store for each DC device the read command, the array size and all the numbers to write to or read from it. Thus only two functions are needed to access the DC: dc_put and dc_read. In the same way, the setup and add macros share the same interfaces, which are implemented in dc_low_setup and dc_low_add. The first macro initializes the particular internal array, and will call an add macro if motors/counters are specified. The second macro will call an inst macro for each channel specified and a post macro for the device. Those "user" macros are supposed to hook in the correct macros the reading or writing operations. The multim_read_dc uses the new internal variable loop_n supported by the multim macros for reading the DC only once per multim loop. DEPENDENCIES Reading from the DC to counters is made using multim macros. | ||||||
Macros:
Usage: dcsetup dev-name key VAL1 .... VAL8 Creates a pseudo device dev-name in data collector and hooks into prompt_mac to write the specified VALx as an array. cnt2dcsetup Usage: cnt2dcsetup dev-name dev-cmd arr-size [var-type] [cnt-name arr-pos] ... Defines a new DC device dev-name with size arr-size, command dev-cmd and type var-type, and links the specified counters to it by calling cnt2dcadd. cnt2dcadd Usage: cnt2dcadd dev-name cnt-name arr-pos [cnt-name arr-pos] ... Links the specified counters cnt-name to the DC device dev-name at position arr-pos. mot2dcsetup Usage: mot2dcsetup dev-name dev-cmd arr-size [var-type] [mot-name arr-pos] ... Defines a new DC device dev-name with size arr-size, command dev-cmd and type var-type, and links the specified motors to it by calling mot2dcadd. mot2dcadd Usage: mot2dcadd dev-name mot-name arr-pos [mot-name arr-pos] ... Links the specified motors mot-name to the DC device dev-name at position arr-pos. dc2motsetup Usage: dc2motsetup dev-name dev-cmd arr-size [mot-name arr-pos] ... Defines a new DC device dev-name with size arr-size and command dev-cmd, and links the specified motors to it by calling dc2motadd. dc2motadd Usage: dc2motadd dev-name mot-name arr-pos [mot-name arr-pos] ... Links the specified motors mot-name to the DC device dev-name at position arr-pos. | ||||||
Internal Macros: | ||||||
Usage: dc_update dev-name key VAL1 .... VAL8 update data collector with values dc_low_setup Usage: dc_low_setup (arr-name, add-mac-name, create-dev, setup-str) Analizes the setup-str (with format "dev-name cmd arr-size [var-type] [mot-cnt-name arrpos] ...") passed to the calling setup macro. Initializes the DC device dev-name (only if create-dev is non-zero) and the variables in the array arr-name, and calls the macro add-mac-name for linking motors/counters if they are specified. var-type is not analyzed if not create-dev. Asks the user if the values are not specified in the command line of the calling macro. dc_create Usage: dc_create (dev-name, cmd-name, var-type, arr-size) Creates a DC device dc_low_add Usage: dc_low_add (arr-name, setup-mac, is-cnt, chan-mac, post-mac, add-str) Analizes the add-str (with format "dev-name mot-cnt-name arrpos [cnt-name arr-pos] ...") passed to the calling "add" macro. Links the specified motors/counters mot-cnt-name to the the DC device dev-name (defined in arr-name by the macro setup-mac) at position arr-pos. is-cnt is 1 for counters and 0 for motors. The real hook is made by calling "chan-mac(dev-name, mot-cnt-name, arr-pos)" for every channel and "post-mac(dev-name)" for the device. Asks the user if the values are not specified in the command line of the calling macro. dc_put Usage: dc_put (arr-name, dev-name) Fills the DC device dev-name with the values previously stored in the array arr-name. dc_read Usage: dc_read (arr-name, dev-name) Reads the DC device dev-name into the array arr-name. cnt2dc_inst Usage: cnt2dc_inst (dev-name, cnt-name, arr-pos) Called by dc_low_add for each counter. Hooks into cnt2dc_getcounts the command for filling the C2DC array position arr-pos with the cnt-name counts. cnt2dc_post Usage: cnt2dc_post (dev-name) Called by dc_low_add for each DC device. Hooks into user_getcounts the command for filling all the DC devices, cnt2dc_getcounts, and hooks into it for filling the specified device dev-name. mot2dc_inst Usage: mot2dc_inst (dev-name, mot-name, arr-pos) Called by dc_low_add for each motor. Hooks into mot2dc_getangles the command for filling the M2DC array position arr-pos with the mot-name position. mot2dc_post Usage: mot2dc_post (dev-name) Called by dc_low_add for each DC device. Hooks into user_getpangles and user_finished1 the command for filling all the DC devices, mot2dc_getcounts, and hooks into it for filling the specified device dev-name. dc2mot_inst Usage: dc2mot_inst (dev-name, mot-name, arr-pos) Called by dc_low_add for each motor. Hooks into dc2mot_checkall the command for setting the mot-name position from the DC2M array index arr-pos. dc2mot_post Usage: dc2mot_post (dev-name) Called by dc_low_add for each DC device. Hooks into user_checkall the command for filling the motor angles array A[] from the DC devices, dc2mot_checkall, and hooks into it for reading the specified device dev-name. multim_init_dc Usage: multim_init_dc Called when multimsetup <cnt-mne> type=dc is invoked. Checks for the parameters dev, cmd, channel and arrsize. If channel is not specified it is taken from the config file; if arrsize is not specified it is set to 0. Parameters cmd and arrsize can be omitted if another DC multim counter was defined before with the same dev. multim_read_dc Usage: multim_read_dc Called from multim_readinstrument for counters with type=dc. Local variables cntr, ok and value are defined; the last two must be properly set. . | ||||||
|