Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
INTLCK.MAC | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Generic I/O Other hardware | ||||||
Description:
| ||||||
Documentation:
The Wago controllers can implement interlock functionality by means of the isgmain utility (or one of its derivatives) that must be running in the controller. This utility can be configured to associate alarm relays (digital outputs) to a variable number of control signals (input/output channels). In this context each alarm relay with its associated control signals is what is called an \"interlock instance\". Each control signal of an interlock instance has a defined "alarm condition". This condition is a defined logic value (ON or OFF) for digital signals and a value range (defined by MIN/MAX thresholds) for analog signals. Whenever one of the control signal reaches an alarm condition, the interlock instance goes into "tripped" state and the alarm relay switches to the alarm position. By default the alarm position is OFF (relay open) but this can be inverted in the configuration of the interlock instance. One can configure more than one interlock instance in a Wago controller. The controller stores the configuration in its internal non-volatile memory and is completely autonomous: as long it is switched on, the configured interlock functions are active. The configuration is also stored in a ASCII file in the host computer. This makes easy create or modify the configuration by means of an text editor, before uploading it into the controller. The macro intlck allows displaying and changing the configuration file as well as managing the configuration of the interlock instances in the controller itself. In the configuration file each instance is declared by a "relay line" (begining by the literal "relay" keyword) and must be followed by as many "control channel lines" as needed. The syntax is as follows: The instance flags <iflags> is optional and can be any combination of the literal keywords INVERTED, STICKY and NOFORCE separated by whitespaces. By default the alarm relay is normally ON (closed) and switches OFF (opens) when the instance trips. This behaviour can be inverted with the INVERTED flag. If the alarm condition disappears after the instance has tripped, by default the trip state is automatically cleared and the alarm relay switches back to the normal position. If the STICKY flag is set, the trip state is not cleared until the interlock instance is reset from the host computer (see intlckreset). By default when there is no alarm condition, the alarm relay is forced to the normal position and cannot be switched externally. The NOFORCE flag relaxes this constraint. In any case when the instance trips, the relay is always forced into the alarm state. <string> is an arbitrary description string that is stored in the controller for identification purposes. It is optional and must always be at the end of the line (before any optional comment). <chan> is the control channel descriptor. It should be the logical name declared in the device server. Conventional subarray syntax is accepted (e.g. temp[0]). The channel type <chtype> is a mandatory two-letter code that indicates the type of I/O channel. At least the following codes should be valid: IB (input bit), OB (output bit), IW (input word), OW (output word), TC (thermocouple), IV (input voltage), OV (output voltage). The thresholds <min> and <max> are mandatory for analog channels (IW, OW, IV, OV, TC) and define the alarm condition. By default the normal condition occurs when the analog signal is between the <min> and <max> values. When the signal is out of that range an alarm condition is met and the interlock instance trips. The channel flags <chflags> is an optional field and can be any combination of the literal keywords INVERTED and STICKY separated by whitespaces. The logic of alarm condition can be inverted with the INVERTED flag. By default digital control channels are normally ON and switch into alarm condition when they become OFF, and analog channels trip when their value is out of the min/max thresholds as explained above. The STICKY flag has the same function than when it is used as an instance flag, but in this case it is associated to a particular channel and only takes effect when this channel is the one that trips. EXAMPLE DEPENDENCIES This macroset uses the device server class Wagods and the utilities in the macro file wagocore.mac. Older methods used to communicate with the Wago controllers are not supported. jtdo("wagocore") SETUP The Wago controllers must be declared in the setup file by means of the wagosetup macro (see help in wagocore.mac). This requires that the the device server Wagods must be properly configured to access to the Wago controllers. The interlock configuration file uses the same logical names attributed in the device server configuration to the different input/output channels of the controllers. | ||||||
Macros:
Usage: intlck [<action> [<wcname> [<instance>]]] Without arguments, this macro scans all the Wago controllers declared in the setup file and diplays an information summary concerning the interlock instances. If arguments are specified, the macro performs the corresponding actions. If there is more than one possible controller and its name is not passed as an argument, the macro prompts the user for the controller name. Some of the actions require SpecWizard privilegies. If spec is not in wizard mode, the user will be prompted for the Wizard's password. The possible actions/syntax are the following: | ||||||
Internal Macros: | ||||||
Usage: intlck__loadtype(table) intlck__loadflag Usage: intlck__loadflag(table) intlck__select Usage: intlck__select(wcname) intlck__show Usage: intlck__show(wcname) intlck__newfile Usage: intlck__newfile(wcname) intlck__edit Usage: intlck__edit(wcname) Edit and upload the configuration file into the controller intlck__update Usage: intlck__update(wcname) Upload the configuration file into the controller intlck__instlbl Usage: intlck__instlbl(n) intlck__scan Usage: intlck__scan() intlck__cfgfile Usage: intlck__cfgfile(wcname) intlck__filename Usage: intlck__filename(filepath) intlck__reset Usage: intlck__reset (<wcname>, <inst>) Resets the instance controller (in case of sticky channels) intlck__loadcfg Usage: intlck__loadcfg (<wcname>, <cfgfile>, <cfgarr> [, <verbose>]) Reads the interlock configuration contained in the file <cfgfile> and stores it in the array <cfgarr>. If the file cannot be read returns -2 and if there is any error returns -1. Otherwise returns the number of interlock instances read. intlck__upload Usage: intlck__upload (<wcname>, <cfgarr> [, <verbose>]) Loads the interlock configuration stored in the array <cfgarr> into the Wago controller <wcname>. Any previous configuration in <wcname> is deleted. If there is any error returns -1. Otherwise returns the number of interlock instances configured. intlck__download Usage: intlck__download (<wcname>, <cfgarr> [, <verbose>]) Reads the current configuration from the Wago controller <wcname> and stores it in the array <cfgarr>. If there is any error returns -1. Otherwise returns the number of interlock instances configured. intlck_trim Usage: intlck_trim (string) Return the given string without useless whitespaces. intlck__compcfg Usage: intlck__compcfg (<cfg1>, <cfg2>) Compares the interlock configurations stored in the associative arrays conf1[] and conf2[]. If there is any difference returns 1. If both configurations are identical this macro returns 0. intlck__showcfg Usage: intlck__showcfg (<wcname>, <cfgarr>) Displays the interlock configurations stored in the associative array cfgarr[]. | ||||||
|