esrf

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

WAGOCORE.MAC
See other macros in category: All
Description:
    WAGOCORE.MAC - Basic macros and utilities for Wago I/O stations
Documentation:
    OVERVIEW
    This macro set provides basic functionality and utilities to access Wago I/O stations through the device server class Wagods.
    It also provides a simple way to declare I/O channels as spec pseudomotors or pseudocounters.



    EXAMPLE
    wagosetup wcid33a wcid33d
    Declares the Wago I/O stations named wcid33a and wcid33d as being accessible through this macro set.
    wagoshow
    Displays the currently declared Wago stations
    wread .
    Reads and prints the values of all the channels currently declared.
    wread temp[2:4] mirrordac
    Reads and prints the values of temp[2:4] (3 channels) and mirrordac.
    wwrite phscreen 1
    Writes 1 into the output channel phscreen
    wwrite dac[3,0] 4.6 2.1
    Writes the value 4.6 in the output channel dac[3] and 2.1 in dac[0].
    print wago_readch("phscreen")
    prints the value of the channel phscreen
    wago_writech("phscreen", 0)
    Writes 0 into the output channel phscreen
    wagopseudosetup cnt1 temp[3] cnt2 mirroradc mot3 mirrordac
    Configures the spec counters cnt1 and cnt2 to be loaded with the Wago channels temp[3] and mirroradc, and mot3 is configured as a pseudocounter that drives the Wago output mirrordac.


    DEPENDENCIES
    ============================================================= ============================================================= 2018/05/03 - rh __wagopseudocheck: included double check of mnemonic to solve the issue associated to the new spec version (eval inside cnt_num() and motor_num() ============================================================= ============================================================= jtdo("stlist")

    SETUP


Macros:
    wagosetup
    Usage: wagosetup <wagoname1> [<wagoname2> [...]]
    Declares new Wago I/O stations. The corresponding device server(s) must be running and the device names be in conformity with the BLISS convention (<blname>/<wagoname>/wc).
    All the logical names declared to the device server become accesible through this macro set.
    This line must be included in the spec setup file.


    wagopseudosetup
    Usage: wagopseudosetup {<mne> <wagoch>} ...
    Declares channels in Wago I/O stations as spec pseudomotors or pseudocounters. If <mne> is a spec mnemonic and <wagoch> a valid single-channel wago name, the channel gets configured as a pseudomotor or pseudocounter depending on the type of mnemonic.
    Pseudomotors only can be assigned to output channels. Pseudocounters can be assigned to either input or output channels.
    In the case of pseudocounters, the scale factor in the config file is applied.


    wagoshow
    Usage: wagoshow
    Lists the currently declared Wago I/O stations and the associated logical names.


    wagoinfo
    Usage: wagoinfo
    Prints the status of currently declared Wago I/O stations. Usefull to get hardware info about wago box and modules


    wread
    Usage: wread <logname1> [<logname2> [...]]
    Reads the current values of the Wago channels corresponding to the logical names in the parameter list. The logical names accept subarray syntax. A single dot character ('.') represents all the available channels.


    wwrite
    Usage: wwrite <logname> <value1> <value2> [...]
    Writes the channels corresponding to the logical name <logname>. The logical name accepts subarray syntax and must only include output channels. One must specify values for all the channels.


    wago_readch
    Usage: wago_readch (<chid> [, <out_array>])
    This macro function reads the current values of the Wago channels identified by <chid>. <chid> can be either a string or an associative array.
    In the case of a string, <chid> must be a Wago logic name with optional subarray syntax (i.e. "temp[1,4]").
    If <chid> is an array, the elements chid[0], ..., chid[n] must contain strings with the corresponding logical names of the n channels to read. If a logical name is associated to several the physical channels, the channel index within the logical name must be specified in chid[i]["ch"].
    If <chid> is a string and refers to only one channel, the function returns the corresponding value. If <chid> is an associative array or a string that refers to more than one channel, the function returns the number of channels actually read into the output array <out_arr> that is mandatory in that case. If there is an error, the function returns an emty string ("").


    wago_writech
    Usage: wago_writech (<chid>, <data>])
    This macro function writes into the output Wago channels identified by <chid>. <chid> can be either a string or an associative array.
    In the case of a string, <chid> must be a Wago logic name with optional subarray syntax (i.e. "dac[1,4]").
    If <chid> is an array, the elements chid[0], ..., chid[n] must contain strings with the corresponding logical names of the n output channels to write. If a logical name is associated to several physical channels, the channel index within the logical name must be specified in chid[i]["ch"].
    If <chid> is a string and refers to a single output channel, the parameter <data> can be a simple numerical value. Otherwise <data> must be an array containing all the values to be written. The function returns the number of channels written if it completes succesfully. It returns 0 if there is an error in the channel specification or in the data format, and -1 if the error happens in the access to the device server.


    wc_comm
    Usage: wc_comm


    wc_sendcomm
    Usage: wc_sendcomm (<wcname>, <command>, <npar>, <par>, <res> [, <silent>])


    wc_getversion
    Usage: wc_getversion (<wcname>)
    Loads and returns the current version of the isgmain program running in the controller <wcname>. Returns 0 if there is no response.

    wago__chanrange
    Usage: wago__chanrange (<logname>, <chlist>)
    This macro function parses the logical name in the string <logname> and stores the information so obtained in the associative array <chlist>. Individual channels or channel ranges within the logical name can be specified by using the spec subarray syntax (i.e. "vin[0,4:7]").
    If there is an error, the function returns -1, otherwise it returns the total number of physical channels n that is also stored in chlist["n"].%BR chlist["key"] contains the device server key, and the array elements chlist[0] to chlist[n] contain the indexes of the channels. Other information available is the device server name in chlist["ds"] and the logical name in chlist["name"].

Internal Macros:
    _dowagosetup
    Usage: _dowagosetup(args)


    wagounsetup
    Usage: wagounsetup


    __wagopseudocheck
    Usage: __wagopseudocheck(mne, wchan, warr)


    wago_move
    Usage: wago_move(motors, wtp, wds, wkey, wname)


    wago_getangles
    Usage: wago_getangles(motors, wtp, wds, wkey, wname)


    wago_getcounts
    Usage: wago_getcounts(counters, wtp, wds, wkey, wname)


    wagomotorunsetup
    Usage: wagomotorunsetup


    wagocounterunsetup
    Usage: wagocounterunsetup


    _wagoremove
    Usage: _wagoremove(wcname)


    _wagoadd
    Usage: _wagoadd(wcname)


    wago_io
    Usage: wago_io(tp, ds, cmd, argin, argout)


    wago__getkeys
    Usage: wago__getkeys(ds, tp)


    __wread
    Usage: __wread(chlbl)


    wago__plcinit
    Usage: wago__plcinit()


    wc_getstring
    Usage: wc_getstring(device, comm, npar, par, silent)


    wago__parseindex
    Usage: wago__parseindex(str, arr, maxidx)


    wago__parseindex0
    Usage: wago__parseindex0(str, arr, n, maxidx)


    wago__type2code
    Usage: wago__type2code(type)


    wago__code2type
    Usage: wago__code2type(code)


    wago__hard2log
    Usage: wago__hard2log(wcname, channel, type)


    wago__log2hard
    Usage: wago__log2hard(chname)


    wago__log2scale
    Usage: wago__log2scale(chname)


Filename: wagocore.mac
Author: M. Perez, P.Fajardo, (Original 3/2005). $Revision: 3.6 $ / $Date: 2018/09/24 13:23:31 $
Last mod.: 24/09/2018 15:24 by meyer