|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Welcome Contact About MCH HAZ1508 Consultancy Services ABACUS4
|
ABACUS4 Manualhttp://www.abacus4.com/old/abacus.htmlABACUS 4 BLOCK LANGUAGEABACUS 4 - LinuxBased on more than 25 years of development and use ABACUS 4 is the latest in a line of process control software systems with the ABACUS name. ABACUS 4 runs on standard Intel PC hardware under the Linux operating system.Intended AudienceThis document is intended for system engineers and others engaged in the development, maintenance and support of ABACUS 4 computer systems. Top of documentTable of Contents
IntroductionABACUS 4 blocks are the programming units with which a control scheme is written. Each block within a system has a unique block number, each block is of a particular type and blocks of the same type are numbered sequentially. The first and last block numbers and therefore the total number of each different type of block is configurable.Block ParametersBlocks have parameters. The number and types of these parameters varies with block type. Furthermore parameters are of different types, namelyanalogue value
logical value a/m, s/n,v/n Logical values represent logical results of measurements or calculations, or status flags. block reference
text string
Common parametersAll blocks in the system have the following parameters.
example:
b6301 _FIR
example: (must be unique)
b14011 nnFIRST-DI
example:
b5301 b14037;p
Block 14037 () type dig input
The Indata (plc) driver uses the information here to identify 'nin'
and 'nout' numbers.
b14011 deThis is a bit of text to explain that this block is a digital
input block
Process I/OIn this section the following block types are described.One analogue input block is connected to each PI-Bus analogue input point. The calibrated output is presented on the block ra parameter. One analogue output block is connected to each PI-Bus analogue output
point.
The Digital input block reflects the status of a discrete signal from
the process.
The Digital output block asserts the status of its am flag in
the form of a discrete digital output.
The Pulse duration Output block is used for plant control via two discrete
digital output, producing a timed raise or lower signal, to effect the
required control action.
One K48 analogue input/output block is connected to each analogue input
point and corresponding analogue output point on a SIOX K48 module. The
calibrated output is presented on the block ra parameter.
This block is used to connect one SIOX N45 I/O module to various other ABACUS I/O blocks. Analogue input block (PI-Bus)![]() One analogue input block is connected to each PI-Bus analogue input point. The calibrated output is presented on the block ra parameter. The block has the following parameters in addition to the common parameters tg sn ra am vn and ss.
integer_value
integer_value This parameter sets the gain of the amplifier as follows
block_number or indirect
floating_point_value This is the result of the analogue to digital conversion represented as 0.0 to 100.0 (unipolar) or -100.0 to 100.0 (bipolar).
floating_point_constant
floating_point_constant The block result is calculated using the following equation Analogue output block (PI-Bus)![]() One analogue output block is connected to each PI-Bus analogue output point. The block has the following parameters in addition to the common parameters tg sn ra am vn and ss. sp set point floating_point_value hl high limit floating_point_value ll low limit floating_point_value sp set point The full output range of the analogue output is represented by a setpoint of 0-100. On the first scan after the am is set the sp set point is made equal to the current output. hl high limit ll low limit The sp is constrained between the values of hl and ll , before being further processed. Digital Input block![]() The Digital input block reflects the status of a discrete signal from the process. The vn flag will be v when the discrete signal is active, and n otherwise. Although the block has all the common parameters including sn and am it is scanned independently of the normal block scanning process. Digital Output block![]() The Digital output block asserts the status of its am flag in the form of a discrete digital output. Depending on the process I/O used the vn flag may indicate the actual status of the digital output. Although the block has all the common parameters including sn, it is scanned independently of the normal block scanning process. Pulse Duration Output block![]() The Pulse duration Output block is used for plant control via two discrete digital output, producing a timed raise or lower signal, to effect the required control action. In addition to the common parameters the following exist sp set point floating_point_value hl high limit positive floating_point_value ll low limit positive floating_point_value sp set point The required number, and duration of pulses required are cascaded into the sp of this block. Cascading +1.00 produces a raise pulse of one unit duration, -1.00 a lower pulse of one duration. On the first scan after being set auto the sp is set to zero. hl high limit The maximum duration of pulse permitted in either direction is determined by the hl high limit value. If the absolute value of sp is greater than hl then hl pulses will be sent ll low limit The minimum duration of pulse permitted in either direction is determined by the ll low limit value. If the sp is less than ll then no pulse will be sent. ra result a The value of ra represents the actual pulse length to be sent. If an sp value greater than a predetermined maximum is sent then only that maximum is sent and the value of sp is reduced by that amount. Thus pulses are carried forward from one scan to the next. The actual execution of the pulse duration depends on hardware. If a SIOX N45 module is to be used, the PDO block must be referenced in the N45 module block, see N45 section. Indata I/O blockThese blocks, normally in the range 18001 to 18511, are used to communicate with the Indata series of PLCs. Indata PLCs may be connected to a multidrop RS485 network. For ABACUS to communicate on such a network a serial port is used via an RS232 to RS485 converter. If a single Indata PLC is connected it may be via RS232.The Indata communications protocol is based on markers. Each of the units on an Indata network has an address in the range 1-31. Markers have a number in the range 1-511 (coresponding to blocks 18001 to 18511). Only one unit on the network should write a marker, but any or all of the units may read that marker. Markers may be either analog or digital. In the Indata programming language a marker is set using a NOUT entity, and is read using a NIN entity. If ABACUS reads a marker (set by another unit) it will detect the type (analog or digital), the source address and the value. The value will be put into the ra of the block for analog markers, or the vn for digital markers.Text is inserted in the nm parameter describing the address and type or marker. For example if a digital marker (1) from unit with addres 1 is received nin d adr 1 mark 1 will be written. If ABACUS is to output a marker then the nm must have text of the following format. nout d or nout a The digital value of the am flag or analog value of the ra will be transmitted onto the network. System blocks used by the Indata driverBlocks 21 to 25 are used to define certain characteristics of the Indata link software.
To avoid scanning the entire address range when only some addresses are present the first and last uPLD addresses are defined in the ra parameters of block 23 and 23 respectively. The cycle time is defined by setting a value in the ra of block 24. This value is the polling frequency of the driver in milliseconds. To reduce trafic, the Indata protocol allows polling of changes of signals in addition to taking all values. The C/I ratio is the ratio of the number of Change messages to Init (i.e. all signals) messages. Multiple Indata NetworksTo accommodate multiple Indata networks the indata program can be called with the optional extra parameters spec_block and ind_block. In the file /home/abacus/abacus the following lines start three networks using the ports cua1,2 & 3, all with baud rate 9600, and different system and indata block ranges. No check is made for overlapping number ranges, so care is required when configuring.sudo $ABACUS_HOME/indata /dev/cua1 9600 21 18001 &
Hardware considerationsThe Indata network hardware is based on RS485, multidrop two wire serial communications. The standard serial I/O ports on a PC are RS232; and a conversion must be done. Most RS232 - RS485 converters use the signal RTS (or similar) to control direction of data flow. The ABACUS/Indata link is purely half duplex. This means that sometimes a special connection must be made.One method is to use a RS232 - RS422 (4-wire) converter with the RS422 TX and RX pairs connected together. TX+ ----+-----------------+--------------+-----------+ | | | | TX- ----|--+--------------|--+-----------|--+--------|--+ | | | | | | | | RX+ ----+ | | | | | | | | RX- -------+ K48 Analogue input/output block![]() One K48 analogue input/output block is connected to each analogue input point and corresponding analogue output point on a SIOX K48 module. The calibrated output is presented on the block ra parameter. The block has the following parameters in addition to the common parameters tg sn ra am vn and ss. ao analogue output block number ds data source integer constant mx max value floating_point_constant ze zero floating_point_constant The block result is scaled to the range ze to mx corresponding to 0 to 100 % input. This may be 0 - 20mA, 4 - 20mA, or 0 - 10 V depending on the hardware configuration of the K48 module. The K48 module should be configured to have 4 addresses, (4A/I and 4A/O). The value of ds defines both the SIOX port used and the point address. ds should be 10000 + 100*port number + SIOX point address. i.e. for port number 2, SIOX point address 5 ds should be 10205. The ao parameter should be connected to an analogue output block, whose result will be sent to the corresponding point address. N45 Module control blockThis block is used to connect one SIOX N45 I/O module to various other ABACUS I/O blocks.The block has the following parameters in addition to the common parameters
tg
sn ra am vn and ss.
The value of ds defines both the SIOX port used and the point address. ds should be 10000 + 100*port number + SIOX point address. i.e. for port number 2, SIOX point address 5 ds should be 10205. The SIOX N45 I/O module is a general purpose digital I/O module with 7 sourcing output and 14 inputs, all 10V - 35V DC. The outputs can supply 0.5A each and have short circuit protection. Through the built-in CPU and a simple PLC programming language, curtain options are available. If the PLC programme has been correctly loaded and configured, a number of the outputs may serve as pulse duration outputs. The corresponding output parameter (oa - og ) should be connected to a pdo block. Enter the pdo block as a positive number to connect the raise side, and as a negative number for the lower side. Thus it is possible to connect raise and lower in any combination. The pdo function, if programmed into to N45 module excludes ordinary digital output operation for those specified output points. It is possible to configure any combination of digital outputs and pdo outputs. Logical Blocks
Checklist block![]() The checklist block derives a single logical result (vn), and
can switch auto or manual one block, depending on the status of five logical
inputs. The block has the following parameters in addition to the common
parameters tg sn ra am vn and ss.
The logical result of the five blocks specified by each of the logical inputs in turn (ia,ib ,ic,id,ie) is processed by its coresponding algorithm ( aa,ab,ac, ad,ae) to generate five intermediate logical results in accordance with table ck1. (Note that only aa can have a value greater than one.) Unconnected inputs are ignored. af = 0 AND operation The logical result of the block will be v (true) only if all of the five intermediate logical results are true (1). af = 1 OR operation The logical result of the block will be v (true) if any of the five intermediate logical results is true (1). Table ck1
The block addressed by the sv parameter will be affected in accordance with table ck2. Table ck2
Switch block![]() The switch block derives a single logical result (vn), and can
switch auto or manual two blocks, depending on the status of a single logical
input. The block has the following parameters in addition to the common
parameters tg sn ra am vn and ss.
The status of the logical input specified by the input a ia parameter is processed by algorithm a aa and the target block's am auto/manual flag is changed in accordance with table sw1 . The logical result of the block is set to the intermediate logical result
derived by aa algorithm a.
The status of the logical input specified by the input a ia parameter is processed by algorithm b ab and the target block's am auto/manual flag is changed in accordance with table sw1 . List processing These algorithms permit the execution of the block's algorithm over a contiguous list of blocks instead of individual blocks. The target list is specified by sa and sb . The first output block is specified by sa, the last by sb . The input list is of exactly the same length as the output list, thus it is only necessary to specify the first input block with ia. Indirection is allowed on ia, sa and sb. The direction of processing is always from the first to the last, and cannot be reversed; thus the block specified as the first output block must have a lower or equal block number as that specified as the last. If ia is zero then an imaginary input list of blocks all having a 0 (nonviolated,reset, false) logical result is used. The only restriction to the size of the lists is that they must both be accommodated within the constraint of the system. aa = ab = 6 List processing (inverting) The switch type of both sa and sb must be the same. For each block an intermediate result is calculated and the corresponding target block is modified as if the algorithm were 0 (inverting). aa = ab = 7 List processing (noninverting) This algorithm functions in the same list processing way as above, except that for each block an intermediate result is calculated and the corresponding target block is modified as if the algorithm were 1 (noninverting). Table sw1
Pattern Block![]() The pattern block is used to switch up to five blocks auto or manual.
The block has the following parameters in addition to the common parameters
tg
sn ra am vn and ss.
Each time the block is executed the blocks specified by switches sa to se are switched auto or manual depending on the specified switch type s or r respectively. Note unless continual and repeated operation is desired it is usual to the set the single shot flag ss to s. Process Control BlocksThis section of the ABACUS block language manual describes those blocks specifically designed for process control use. These areThe p.i.d. block is designed to perform P, PI, or PID control functions, with standard control constants, executing a variety of alternative control algorithms, and calculating control performance data at the same time. The motor block is designed to allow comprehensive control of the starting/stopping
of electric motors, pumps, and opening/closing of valves. The connections
are made through digital inputs and outputs. Facilities are included to
initiate alarm signals if the motor/pump fails to respond to control signals
in allowed time periods. The accumulation of run time is also included.
PID Controller block![]() The p.i.d. block is designed to perform P, PI, or PID control functions,
with standard control constants, executing a variety of alternative control
algorithms, and calculating control performance data at the same time.
In addition to the common parameters the p.i.d. block has the following
The am flag of a pid block may be considered as an îauto-requestî flag. When the am flag is auto the loop may be regarded as requested auto. The vn flag may be regarded as that flag which indicates that the loop is in fact operating in automatic. When conditions are right for the controller to start operating in automatic the vn falg is set, and previous stored values of er are set to zero, and previous values of mv are set to the current mv value. If the se flag is set ( e equalise) then the setpoint value is made equal to the measured variable. This is done to ensure bumpless transfer. ir input run If the vn violation status of any block connected here is v then the normal processing of the block may proceed. The vn of this pid block is made the same as that of the pointed to block if this pid block is auto. If this pid block is inactivated because of this connection it will be initialised when reactivated. This allows interlocking of control loops. ip input process If the vn violation status of any block connected here is v then the normal processing of the block may proceed. No re-initialisation is performed nor is the vn status changed as a consequence of this connection. This parameter is intended for use with the ai=1 dead time controller option. ia input a The measured variable (mv) in the following is derived from the analogue result ra of the block specified here. mh input hl, ml input ll These limits are used to constrain the value of the measured variable (mv). is input setpoint, sp setpoint If the is value is that of a valid block number, then the sp value is obtained from the analogue result ra of that block. The sp value is the same as the ra of this block. sh setpoint hl, sl setpoint ll These limits are used to constrain the value of sp. Upon execution of this block the ra of the block pointed to by is will also be constrained, That is to say the constrained sp is fed back to the block pointed to by is on each scan. op output block, an answer an answer is the result of the control equation below which is then added to the op output block. If the op output block is an analogue output, pulse duration output or a control block the value of an is added to the sp of that block, other wise it is added to its ra. Note that because of the fact that an incremental value is added to the op output block it is possible to alter manually, or with other blocks, that value. Control Equation Normal operation (ai=0)On each execution of the block the following are evaluateder = sp - mv er_1 = er from previous scan er_2 = er from two scans previous mv_1 = mv from previous scan mv_2 = mv from two scans previous. an = kp * ( prop_value + int_value + deriv_value ) where prop_value, int_value and deriv_value are internal temporary variables depending on the algorithms and constants as follows td derivative time, ad derivative algorithm, deriv_value if ad = 0 then deriv_value =(mv - 2*mv_1 + mv_2) * td / scan_time_in_minutes if ad = 1 then deriv_value =(er - 2*er_1 + er_2) * td / scan_time_in_minutes if ad = 3 then er = error squared, (note if error is -ve, er is also made -ve) deriv_value =(er - 2*er_1 + er_2) * td / scan_time_in_minutes Derivative time (in minutes) can be set to zero to disable derivative action. The derivative action may be configured to operate on the measured variable (ad=0) or the error ( ad=1). Even error squared control is available with (ad=3). kp proportional constant, ap proportional algorithm, prop_value if ap = 0 then prop_value = er - er_1 if ap = 1 then prop_value = mv - mv_1 The proportional action may be configured to operate on the error ( ap=0) or the measured variable ( ap=1) ti integral time, ai integral algorithm, int_value if ti is not equal to 0 then int_value = er * scan_time_in_minutes / ti To disable integral action simply set ti to 0, otherwise ti represents integral time in minutes. ( ai integral algorithm is reserved for future use.) Control Equation dead time controller ai=1In this mode of operation the following equation is calculated each time that the block is processed and the block pointed to by ip is violated. The block pointed to by ip is normally a timer of some type which may have a process related time constant.
These parameters are reserved for future use. if ag = 0 gf = gf + abs( er ) absolute error if ag = 1 gf = gf + er * er error squared if ag = 2 gf = gf + abs( er ) * db absolute error * time if ag = 3 gf = gf + er * er * db error squared * time After a step change in demand, one can look at the rising value of gf
and compare with other tuning constants.
Motor Block The motor block is designed to allow comprehensive control of the starting/stopping of electric motors, pumps, and opening/closing of valves. The connections are made through digital inputs and outputs. Facilities are included to initiate alarm signals if the motor/pump fails to respond to control signals in allowed time periods. The accumulation of run time is also included. Each of the logical inputs and outputs has associated with it an algorithm for inverting the significance of that input or output. In each case this algorithm follows the normal ABACUS convention where 1=noninverting, and 0=inverting. In addition to the common parameters the motor block has the following
Motor block flow diagramCheck if sn = current scan & am = a No - exit Yes Read in all logical inputs to internal flags IRVAL = logical result of ir if ar=1 else not logical result of ir IUVAL = logical result of iu if au=1 else not logical result of iu ITVAL = logical result of it if at=1 else not logical result of it IPVAL = logical result of ip if ap=1 else not logical result of ip ICVAL = logical result of ic if ac=1 else not logical result of ic C1VAL = logical result of c1 if a1=1 else not logical result of c1 C2VAL = logical result of c2 if ar=1 else not logical result of c2 SAVAL = logical result of sa if na=1 else not logical result of sa SRVAL = logical result of sr if nr=1 else not logical result of sr SPVAL = logical result of sp if np=1 else not logical result of sp Read in time values from scratchpads if specified t1 = if (d1 is a block) d1's ra t2 = if (d2 is a block) d2's ra t3 = if (d3 is a block) d3's ra t4 = if (d4 is a block) d4's ra if t1 > t2 then set saval (alarm) (time-out) if IPVAL (stop input) then reset SAVAL (alarm) if ITVAL (start i/p) is set then set SRVAL (start o/p) if SRVAL (start o/p) is set then if IRVAL (run i/p) ir reset or t2 > t1 or IPVAL (stop i/p) or ICVAL (auto) is set then reset SRVAL (start switch) if ICVAL (auto) is set then if IRVAL (ready i/p) is reset or t2 > t1 or IPVAL (stop i/p) or ITVAL (start) is set then reset ICVAL (auto flag) if ICVAL is set (auto) then if af = 0 do îANDî control action i.e. if C1VAL AND C2VAL then set SRVAL (start) else reset SRVAL (start) else if af = 1 do îORî control action i.e. if C1VAL OR C2VAL then set SRVAL (start) else reset SRVAL (start) Calculate timer values if SRVAL is set (start requested) and IUVAL (running i/p) is reset then increment t2 if IUVAL is set (runnning) then increment t3 if t3 > 3600 then increment t4, and subtract 3600 from t3 (t4 becomes hours if t3 is seconds) set SPVAL to the complement of SRVAL (i.e. stop o/p opposite of start o/p) reset is and ip blocks (start and stop scratchpads) is = if (as = 1) then 0 else 1 ip = if (ap = 1) then 0 else 1 set / reset logical block in accordance with internal flags ic block = if ( (ICVAL = 1) & (ac = 1) ) or ( (ICVAL = 0) & ( ac = 0) ) then 1 else 0 sr block = if ( (SRVAL = 1) & (nr = 1) ) or ( (SRVAL = 0) & ( nr = 0) ) then 1 else 0 sp block = if ( (SPVAL = 1) & (np = 1) ) or ( (SPVAL = 0) & ( np = 0) ) then 1 else 0 sa block = if ( (SAVAL = 1) & (na = 1) ) or ( (SAVAL = 0) & ( na = 0) ) then 1 else 0 FINISH Calculation Timing and type conversion
Index Block![]() The index block is used for counting, timing and integer arithmetic. The block has the following parameters in addition to the common parameters tg sn ra am vn and ss.
ia input a, aa algorithm a The status of the logical input specified by the ia parameter is processed by aa in accordance with table IX1. If the intermediate logical result is 1 then further processing is carried out as described below, otherwise processing is discontinued, except for the initialisation described for ab of 1. ib input b The analogue result of the block specified by this parameter is used as the measured variable in further processing of this block. hl high limit, ll low limit, k1 constant The value of these parameters are used in the various calculations performed in accordance with ab. Table IX1
ab = 0 Integer additionra = measured variable + k1 ab = 1 cyclic progressionThe cyclic progression is initialised the first time the block is scanned after being set auto, the violation status being reset, and the block result initialised according to the following conditionsIf ib is nonzero ra = measured variableFurther processing of this algorithm only occurs if the logical input ia and its algorithm aa produce an intermediate result of 1. Each time this algorithm is processed, the value of ra and vn are updated according to the following conditions.If k1 = 0 then if ra+k1 hl then
ab = 2 Integer subtractionra = k1 - measured variable ab = 3 Integer multiplicationra = k1 * measured variable ab = 4 Integer divisionra = measured variable / k1 ab = 5 Integer divisionra = k1 / measured variable ab = 6 Delay TimerThis algorithm performs as a normal delay timer where the vn logical result of the block is a delayed version of the intermediate logical result (logical result from block ia and aa). The block counts k1 each scan from ll to hl while the intermediate logical result is 1, then sets the vn flag. (If the k1 < 0 then the block counts down from hl to ll.).
Input Code Conversion Block![]()
The input code conversion block is used to reference a continuous range of logical block results and produce an analogue result depending upon their status. In addition to the common parameters the input conde conversion block has the following aa = 0 binary transferTransfers the binary pattern of the logical inputs to the block result. The logical input specified by ia is regarded as the least significant bit in the word and is represented by 1 in the ra if it is set. The next logical input is represented by 2 if set, the next by 4, 8 etc.aa = 2 displacementCauses the block to search for the first logical input in the range that is set. If the first input is set the ra will be 1, if the second is set but not the first ra will be 2 etc. If none of the inputs are set then ra will be 0.Output Code Conversion Block![]()
The output conde conversion block is used to convert an analogue result into a bit pattern and switch a continuous range of blocks. In addition to the common parameters the output conde conversion block has the following aa = 0 binary transferThis algorithm transfers the binary pattern of the measured variable
to the am flags of the specified range of blocks. The block specified
by sw is regarded as the least significant bit in the word, and
is represented by 1 in the measured variable, the next block by 2 then
by 4 etc. Should a bit be set in the measured variable then the corresponding
output block will be set auto, otherwise it will be set manual.
Control Block![]()
The control block is a multifunction block capable of many different
types of calculation, control functions, accumulation functions, and list
processing. The ab algorithm b parameter specifies the manner in
which the control block is processed. The algorithms are divided into three
main categories.
The block has the following parameters in addition to the common parameters
tg
sn ra am vn and ss.
Calculation and control algorithms ab 0 - 9if is 0 then sp = ra of is blockresult is the intermediate analogue result which is then process by aa.
List Calculation algorithms ab 10 - 13if is 0 then sp = ra of is blockThese algorithms operate on the contiguous list of block defined as those blocks between is and ia. ia should refer to a block with higher block number than that pointed to by is. result is the intermediate analogue result which is then process by aa.
Accumulation algorithms ab 14 - 19These algorithms include integration, averaging and standard deviation functions. They can only operate in a satisfactory manner when the block is the recipient of a double precision ( dp) cascade (from another control block or blocks).Algorithms are either pre-initialised or post-initialised. Pre-initialisation involves resetting the accumulations and setting the result to zero the first time the block is processed after having been set auto. Post-initialisation processes the accumulations to obtain the result prior to resetting the accumulations, on the first scan after the block has been set auto. This having the advantage that the block may be left manual whilst accumulating, it only being necessary to set it auto to obtain the result, and to reset the accumulations for the next period. (It is normal to set the single shot flag ss in this case.) acc is an internal floating point variable which is incremented by the cascading block with its result each time it cascades.
List processing algorithms ab 20 - 25The list processing algorithms permit data input from a range of blocks to be processed, and output to a range of blocks.ia The input a ia parameter specifies the first of a range of blocks to be used as inputs to these algorithms. During processing, the algorithm steps from the first input block to next, then the next etc., and at each step reads the result of the input block which then becomes the measured variable mv. If the input a ia parameter is zero then the measured variable is regarded as zero for all steps.
The ca parameter specifies the first block to receive a cascade from the list processing algorithm. The cb parameter specifies the last block to receive a cascade. The number of target blocks is thus defined by the cascades, and therefore the number of input blocks is the same. cb must point to a higher block number than ca. The cascade type must be the same for both ca and cb, and must be consistent with the type of target block. When the algorithm is processed the measured variable is taken from each input block in turn. The measured variable is processed and the result cascaded to the corresponding target block. For each item of data thus processed, limits are checked to produce an intermediate violation status, and result which are taken into account by the cascades. When the block specified by cb has been processed the algorithm is finished and the last calculated result and violation status are the final values for the block.
aa Logical algorithm The analogue result of the block calculated by the various algorithms ( ab) is further processed by aa. (In the case where ab = 4 it is the value of er, where ab = 6 it is the value of sp) The list processing algorithms have the result processed by aa at each step. These parameters are related to the final ra and vn values as in the following table.
CascadesThese parameters specify two independent cascades, which consist of a block number and a cascade type, and represent the final stage of processing for the control block.
Sequence BlockThis block is not implemented at this timeScratchpad Block![]()
All blocks which have no other block type are classified as scratchpad blocks. Scratchpad blocks are nonexecutable, and only have the common parameters. They are used for analogue and data storage only. Operator CommunicationsThis section of the ABACUS block language manual describes the alarm code block and the programs used in connection with the Tck/tk language to produce displays in the X windows system.The operator communicates with ABACUS4 via an operators station. This is usually a PC running the Linux operating system and the X window system. This may be the same system that is running ABACUS4 or another reachable over a network. Text based operator interfaces may be constructed, but these are not documented here. All normal operator access to the ABACUS4 block database is done via the Alarm Code Block, although all blocks are accesable to the Tck/tk language. The Alarm Code Block permits the monitoring of the analogue or logical results of blocks, and the generation of process alarms when limits are violated, or upon changes. The block permits the operator access to its high and low process limits,
and to the result, setpoint, auto/manual and auto/manual request flags
of the loop being monitored.
Alarm Code Block![]() The Alarm Code Block permits the monitoring of the analogue or logical results of blocks, and the generation of process alarms when limits are violated, or upon changes. The block permits the operator access to its high and low process limits, and to the result, setpoint, auto/manual and auto/manual request of the loop being monitored. In addition to the common parameters the Alarm Code Block has the following
This is the loop name which is used in all ABACUS journaling. (It should be copied over the the descriptor of any Enterprise Server database points - see later.) ia input a The ra of the block referenced here is taken as the measured variable of the loop. Subject to the value of aa it is this block's result which is tested against the various limits. is input setpoint The ra of the block referenced here is taken as the setpoint of the loop. ar auto/man request The vn of the block referenced here is taken as the auto/man request flag of the loop. That is to say the flag which is set when the operator requests that the loop go into auto. st status The vn of the block referenced here is taken as the auto/man status flag of the loop. That is to say the flag which is set when the loop is in auto. hl high limit ll low limit xh high high limit xl low low limit hy hysteresis value Each time the measured variable passes one of the above limit values a message is recorded in the journal file, excepting that if the hy value is nonzero a return excursion is ignored until a movement greater than hy occurs. This can be used to avoid multiple alarms when a noisy signal goes into alarm. For correct functioning of the limit test facilities the following should be true xh > hl > ll > xl, and hy should be positive and less than the difference between any two of the other limits. s1 status 1 (alarm) text The text string written by the block processor here depends on the relationship between the measured value and the alarm limits. If hy = 0 the following is carried out if ( measured value < xl ) then s1 = lx (low low alarm text) else if ( measured value < ll ) then s1 = ml (low alarm text) else if ( measured value > hl ) then s1 = mh (high alarm text) else if ( measured value > xh ) then s1 = hx (high high alarm text) else s1 = mo (ok text) If however the hy value is nonzero the above becomes if ( measured value < xl ) then s1 = lx (low low alarm text) else if ( (xl + hy ) > measured value >= xl ) then s1 is unchanged else if ( measured value < ll ) then s1 = ml (low alarm text) else if ( (ll + hy ) > measured value >= ll ) then s1 is unchanged else if ( measured value > hl ) then s1 = mh (high alarm text) else if ( (hl - hy ) < measured value <= hl ) then s1 is unchanged else if ( measured value > xh ) then s1 = hx (high high alarm text) else if ( (xh - hy ) < measured value <= xh ) then s1 is unchanged else s1 = mo (ok text) aa algorithm This algorithm determines which limits are used to define an alarm state and set the vn of the Alarm Code Block or if the st logical value should be used. The following tables shows the effects of alternative aa values. (aa values greater than 9 inhibit the printing/logging of setpoint changes) Analogue alarms
Digital alarms
s2 status 2 (hand/auto) text The text string written by the block processor here depends on the vn of the block referred to in st. If this block's vn = v then ma is copied, otherwise mm. All changes to limit values, setpoint value, auto/manual request flag, and status changes are logged in the journal file if the Alarm Code Block is auto. One line is written for each event, and has the following format YYMMDD HH:MM:SS signal_name message ( old_value ) new_value where signal_name is the si of the Alarm Code Block YYMMDD HH:MM:SS is the time and date of the event message = "setpoint changed" "hi-hi lim changed" " high lim changed" " low lim changed" or "lo-lo lim changed" as appropriate. When an alarm limit is exceeded the format is as follows YYMMDD HH:MM:SS signal_name alarm_text value units where alarm_text is the appropriate alarm text string ( ml mh lx hx or ok ), value is the measured value, and units is the text un. The ABACUS4 - Tcl/tk interfaceIt is beyond the scope of this manual to describe the opperation of the Tcl/tk language, the reader is refered to the many man pages in the section n, 'Tcl and the Tk Toolkit" (Addison-Wesly, 1994) or "Practical Programming in Tcl and Tk" (Brent B .Welch).The easiest way to get to see a list of the commands is to run the xman program, and look into the n section. Displays are stored in a subdirectory of /home/abacus. This directory has the name of the application, and also contains the datadump.bin file(s). If the project is called smith for example then these files will reside in the directory /home/abacus/smith. It is usual to have one 'display manager' file which includes code for menus and a frame for the displays to be shown in, and a number of 'display files'. In addition the background diagrams and dynamic symbols are stored in gif format. ABACUS4 programs which Tcl/tk programs may useam ra3 si ss vn2eng2This is a non-interactive version of the eng program (se eng ). eng2 is called with all the block access parameters on the command line, i.e.eng2 b1234,p Here block 1234 is printed, something like the following being returned: Block 1234 () type index B1234 () nn de nm tg spare;sn 0(0.0 sec);ra 0.000 am m ;vn n ;ss r en 0;dd 0 aa 0;ia 0( 0.000 m-rn) ab 0;ib 0( 0.000 m-rn) k1 0;hl 0;ll 0The tcl program is responsible for extracting the part of this printout which is of interest. eng2 requires that all the commands come together in its first argument, so that if spaces are part of the syntax, then the argument should be enclosed in quote marks. If you use this program from an xterm window for example beware of the command line conversions that your shell does, in particular the * character is translated into all the filename of files in the current area, before being passed onto, in this case, the eng2 program. This can be avoided either by enclosing you arguments in quotes, or by prefixing the * with the \ character. eng2 is sometimes used with a unix pipe. For example if we ish to list all the si paramters of the blocks in the range 8001 to 8099 we could use eng2 b8001,xb8099,.si This would produce something like Block 8001 () type alarm code Xblock 8099 type alarm code b 8001;si b 8002;si# 02 GAUGE ON/OFF SHEET b 8003;si# 03 GAUGE STATIC b 8004;si# 04 GAUGE STANDARDIZE b 8005;si ...Whereas we might not want the 'b ' parts or the ';si'. We could use the unix program sed in a pipe like this eng2 b8001,xb8099,.si | sed -e "s/^b //" -e "s/;si/ /"which would produce something like Block 8001 () type alarm code Xblock 8099 type alarm code 8001 8002 # 02 GAUGE ON/OFF SHEET 8003 # 03 GAUGE STATIC 8004 # 04 GAUGE STANDARDIZE 8005 8006Removal of the top two lines could be achieved with grep eng2 b8001,xb8099,.si | sed -e "s/^b //" -e "s/;si/ /" | \ grep -v "^B\|^X"The possibilities are endless, however there are some other programs to do the simpler things easier. eng4eng4 is a very simple socket program which accepts the two letter nmuemonic followed by the block number, and returns the appropriate paramter value. Not every parameter is available, however everything on an alarm code block, including the acknowledged flag (not accessable any other way). eng4 in common with the other 'socket' programs always responds with exactly one line for each line it recieves.raThis returns the result of the block whose number is given as the first argument. An optional second argument may specify the format (in C syntax) for the returned value.frank(abacus):~$ ra 14 0.250931frank(abacus):~$ frank(abacus):~$Note that there was no end of line printed. ra2This returns the results of one or more blocks as listed after the ra2.frank(abacus):~$ ra2 14 51 52 53 0.15332 0.1 0.2 0.58 frank(abacus):~$The values are returned in the same order as the block numbers apear in the command line. ra3This program is designed for use at the end of a socket connection. A list of one or more block numbers is sent into the program which then responds with the results of those blocks, and then waits for the next input.vnThis returns the violtation status of the block whose number is given as the first argument. Two further arguments may define the returned text for respectively the nonviolated and violated states of the block.vn2This returns the violtation status of one or more blocks whose numbers are given as the arguments. vn2 return either 0 for nonviolated or 1 for violated.vn3This is the socket version, returning 0 or 1 for each block sent it.amThis returns the auto/manual status of the block whose number is given as the first argument. Two further arguments may define the returned text for respectively the auto and manual states of the block.siThis returns the signal identity of the Alarm Code block whose number is given as the first argument. If the block number specified is not an Alarm Code block blanks are returned.si3This is the socket version of si. For each line of input exactly one line of output is returned.sp3This socket program returns the analog result (ra) of the block whose number is stored as the is parameter of the Alarm Code block whose number is inputted to this program.s13This socket program returns the s1 value of the Alarm Code block whose number is inputted to this program.s23This socket program returns the s2 value of the Alarm Code block whose number is inputted to this program.un3This socket program returns the un value of the Alarm Code block whose number is inputted to this program.ABACUS 4System blocks, Configuration etc.This section deals with System Scratchpad Blocks, Scan control Blocks, and issues concerning the configuration of ABACUS4 systems.Data dumping is discussed, as is logging in and out of the system. ABACUS4 processes are listed with a short description of their function.
Starting and Stopping ABACUS4On most installations it is arranged that ABACUS is started by the /etc/rc.d/rc.local shell script file which is started automatically during system start.To start ABACUS manually, log in as abacus (initial password abacus) and enter the command abacus. You will be asked if you wish to stop and restart ABACUS, pressing enter with the yes field selected will first stop any running ABACUS processes, then after a short pause startup the ABACUS system. To stop ABACUS manually, log in as abacus (initial password abacus) and enter the command kill.abacus. On systems configured with the PI-Bus driver, and possibly others, you
may be asked for your password before ABACUS will start. This is because
the processes which access I/O ports on the PC must be run with root privileges.
Installing ABACUS4README.1STThis is the README.1ST file for abacus-4.9807 this first public version. Hello everyone, this is just a bit of information about ABACUS. ABACUS runs under Linux, the free Un*x operating system found on a large number of Internet servers around the world. The minimal hardware requirements are an IBM compatible 386 machine or better with at least 4 Mb RAM (preferably at least 8 Mb). A hard-disk with 30Mb has been used although >200Mb is required for the display system (X). On a network (Ethernet or even serial) a disk-less system should be possible, although this cannot be considered a secure arrangement. To install ABACUS 4 on your Intel based Linux machine you will need to consider the following. You need a user called abacus with his/her home at /home/abacus. He/She must have sudo rights (I put 'abacus ALL=ALL' at the end of /etc/sudoers, but you might want to work out something more sophisticated, let me know what you find works) As root you can install the package from the / directory with cd / tar -xzvf where_ever_it_is/abacus-4.version.tar.gz install/doinst.sh Or (if you are using Slackware) you can use the installpkg installpkg where_ever_it_is/abacus-4.version.tar.gz The ABACUS 4 manuals are in html format in the abacusmanual/ directory. To start the system log in as abacus, and start the command abacus. The file abacus is a bash shell, and is where the main configuration of which parts of abacus are started (i.e. which process I/O drivers, and which block scan processors) ABACUS 4 expects '.' to be in the PATH environment variable, other wise it won't find everything. Process I/O =========== Drivers exist is this version for pibus, indata and das08. The source for the das08 and a number of h files are stored in the src directory. It is expected that new drivers will appear in the not too distant future for MODBUS and COMLI protocols. These may however require modifications to the database structure (i.e. new block types). DISPLAYS ======== The displays are made using Tcl/tk. I've used version 8.0, some however will work with earlier versions. The tk_openfile type widgets have been used in the trend page, and 8.0 is required for that. LICENSING ========= ABACUS 4 is a commercial product and a license is required to run it. However it will run for an evaluation period of 24 hours before shutting down without a valid /home/abacus/abacus.computer.id.dat file. At the time of writing the pricing has not been fixed, so if you want to buy a license mail to abacusabacus@hotmail.com STARTUP ======= Here is a log of how it went when I started abacus frank(abacus):~$ abacus starting kill of abacus kill 8461: No such process kill_smem:mem_id 0, shmctl returned 0 Starting abacus Warning - id_check failed -1 The identity of your harddisk does not match that expected This ABACUS system will run in demonstration only The file /home/abacus/abacus.computer.id.dat contains a coded version of the identity of the disk for which this software is licensed. Please send the following information to the supplier of your ABACUS system, and arrange for a new /home/abacus/abacus.computer.id.dat file to be sent to you. MODEL="WDC AC31600H" FW_REV="23.16U23WDC AC31600H" SERIAL_NO="WD-WT2893535299" This information has been saved in /home/abacus/hard.disk.id.txt Abacus will start shortly in demonstration mode. It will require restarting after a period of 24 hours key = 0 shmget(key, TOTAL_SPACE , IPC_PRIVATE | IPC_CREAT ) errno = 0 mem_id = 134 Loading from datadump file ...Database load done system start 1, stop 20 pibus ai start 101, stop 420 i/p code start 801, stop 810 index start 1001, stop 1199 checklist start 2001, stop 2199 switch start 2501, stop 2699 pattern start 4001, stop 4199 sequencer start 9001, stop 9050 control start 5001, stop 5999 p.d.o. start 6001, stop 6080 analogue out start 6301, stop 6364 o/p code start 6501, stop 6550 alarm code start 8000, stop 8999 motor start 9501, stop 9699 dig input start 14001, stop 14320 dig output start 14501, stop 14820 disc start 17501, stop 17510 data link start 17901, stop 17910 scan control start 51, stop 65 p.i.d. start 7001, stop 7299 indata I/O start 18001, stop 18511 at: pluralization is wrong Job 68 will be executed using /bin/sh Subroutine start 7901, stop 7999 Date Owner Queue Job# 08:52:00 07/08/98 root c 62 10:10:00 07/08/98 root c 63 11:24:00 07/08/98 root c 64 11:28:00 07/08/98 root c 65 15:02:00 07/08/98 root c 68 Start journal program Start dcctsk ? Start X windows stuff Starting sxserv Starting blktsk ... Starting /home/abacus/dmptsk Starting /home/abacus/rep 1 Starting trendmem program /home/abacus/trendmem /home/abacus/trenddatafiles/trend.000.002.dat update datadump to be done every 300s approx /home/abacus/trendmem /home/abacus/trenddatafiles/trend.001.002.dat update /home/abacus/trendmem /home/abacus/trenddatafiles/trend.002.002.dat update /home/abacus/trendmem /home/abacus/trenddatafiles/trend.003.002.dat update /home/abacus/trendmem /home/abacus/trenddatafiles/trend.063.002.dat update /home/abacus/trendmem /home/abacus/trenddatafiles/trend.080.002.dat update /home/abacus/trendmem /home/abacus/trenddatafiles/trend.080.060.dat update Starting engdrawserver.sh If you get /home/abacus/faucet: Trying again . . . /home/abacus/faucet: Address 9000 in use, sleeping 10. /home/abacus/faucet: Trying again . . . /home/abacus/faucet: Address 9000 in use, sleeping 10. /home/abacus/faucet: Trying again . . . /home/abacus/faucet: Address 9000 in use, sleeping 10. then it means that there is still a faucet running in the system using address 9000. frank(abacus):~$ ps ax | grep fauc will find it, and then use kill -9 on it. Bugs, complaints, suggestions and complements to abacusabacus@hotmail.com please. System Scratchpad BlockThese scratchpad blocks have only the common parameters. The ra values of some of these are written into by the system clock, and have the following significance.These blocks may be used to synchronise events with the system clock.
am is set by the dump command in engineers mode, the datadump
programme sets vn = v during the dump process. This only applies
if the dmptsk line in the startup shell script ABACUS was configured
with the -b 20 switch.
Scan Control BlockThis block controls the frequency of the block processor scans. It also permits the restriction of block processing to a range of blocks in order to reduce system loading.In addition to the common parameters the Scan Control Block has the following
Only blocks with number from f1 to l1 inclusive are processed.
ConfigurationThe number and type of ABACUS blocks may be defined to suit a particular application's needs. The current configuration may be examined by entering the look command in engineers mode. To change configuration the file /home/abacus/abacus.sys needs to be altered, the existing application programme symbolically saved, then ABACUS stopped, and restarted.The format of the text file /home/abacus/abacus.sys is as follows 20000 Max Block Number 1 20 system 0 0 PiBus ai 201 250 K48 401 410 N45 0 0 siox3 0 0 0 0 pulse counter 801 810 input code .. The first line has the highest block number in the system. Each line after that has the first and then last of each successive block type. These are in the order as shown with the look command. Subsequent text is not used and only serves as commentary. All blocks of a particular block type have contiguous block numbers. A block number cannot refer to two different blocks at the same time, and so first and last block ranges must not overlap. Since every block number from 1 up to the maximum block number is allocated the common parameters, and is designated a scratchpad if not of any defined block type, the higher the Max Block Number the more space consumed. Unused block types are marked with first and last block numbers equal to zero. To initiate a new block configuration the command /home/abacus/initsk i is used. This should olny be done on a system where ABACUS is NOT running. After initialising the database initsk spawns engineers mode to load up the applications in file /home/abacus/abacus.eng. This file usually contains engineers mode commands to set up scan rate values etc. The total size of the database may not exceed a predetermined amount. When INITSK initialises the database it prints the total size. Datadump files are stored in binary format, and are a straight copy of the memory into the file. It is therefore impossible to convert directly from one shape of ABACUS system to another without using a 'symbolic' dunp. eng2 may be used to do this before you change the block configuration of a system. Something like eng2 b1,xb999999,short,fp > /tmp/symbolic.dump will create a file called /tmp/symbolic.dump with all the eng commands required to re-establish you database. Check with an editor that the file is complete, before you destroy your old system! When you've got your new system up and running you might want to use something like eng2 xb99,@/tmp/symbolic.dump to resotre your data. (xb99 overides the requirement for connecting to each block's tag) Data dumping In order to preserve the applications programme the entire ABACUS database is saved periodically. This process may be automatic depending on the dmptsk line in /home/abacus/ABACUS. . This section covers communications between ABACUS4 and other systems, and other ABACUS4 systems. MODBUS CommunicationsModbus RTU communications may be set up via one or more serial ports. One process is started (in the /home/abacus/ABACUS script file) for each port.MODBUS Master'coils' and 'registers' may be read and/or written.Each block which is intended for use as a MODBUS signal must have its nm setup with the following format MODBUS <channel> <address> <R=register, or C=coil> <reg/coil reference> <IN/OUT>
Example: To send the ra of block 10002 to the 'Local Set
Point' register (42) of a Commander 100 controller whose address is 1 on
the modbus channel 1 the block should look like this...
This block may then be set to whatever value you want the controller to control to. Another block (10001 in this example) may be used to obtain the 'Process Variable Input' from the controller...Block 10002 () type scratchpad nn.b.name de.descr nm.name MODBUS 1 1 R 42 OUT tg.tag spare sn.scan 0(0.0 sec) ra.rslta 123.000 am.au/mn a vn.vltn v ss.sshot r en.A Entpr 0 dd.D Entpr 0 Not e that all numbers transferred are integer with ranges restricted by the modbus unit. Decimal point location for displays on controllers is possibly also accessible via MODBUS, see the handbook for the unit in question.Block 10001 () type scratchpad nn.b.name de.descr nm.name MODBUS 1 1 R 2 IN tg.tag spare sn.scan 0(0.0 sec) ra.rslta -18.000 am.au/mn a vn.vltn n ss.sshot r en.A Entpr 0 dd.D Entpr 0 The modbus programThe modbus program is executed with the following formatwhere port is the special file name for the port (i.e. /dev/cua1) baudrate (9600 etc.) channel is the within ABACUS unique id. for just this MODBUS channel, and sys-block-number is the system block which will give running information about the link.modbus port baudrate channel sys-block-number Here follows a trial run, using the above two blocks only. Note that the sys-block-number is left undefined, the default being 20+channel, i.e. 21 in this case. The sys-block-number block is also updated with information in the de parameter. The value of ra is the number of cycles that the modbus program has executed.frank(abacus):~$ /home/abacus/modbus /dev/cua1 9600 1 stty sane ispeed 9600 < /dev/cua1 stty -ixon -ixoff -crtscts -parenb cs8 cstopb -echo raw ispeed 9600 < /dev/cua1 Starting cycle... MODBUS Block 10001 (n -18), chan 1, adr 1, creg R, cregnr 2, direction IN MODBUS Block 10002 (v 123), chan 1, adr 1, creg R, cregnr 42, direction OU Starting cycle... MODBUS Block 10001 (n -18), chan 1, adr 1, creg R, cregnr 2, direction IN MODBUS Block 10002 (v 123), chan 1, adr 1, creg R, cregnr 42, direction OU For each channel a separate serial port is required, and a unique channel number. The /home/abacus/ABACUS file should include a line likefrank(abacus):~$ eng2 b21,p Block 21 () type scratchpad B21 () nn demodbus: Port /dev/cua1 at 9600 Baud, Channel 1. Found 2 blocks of interest nmmodbus: /dev/cua1 tg spare;sn 0(0.0 sec);ra 7.000 am m ;vn v ;ss r en 0;dd 0 The first argument to the modbus program is the special file for the serial port, the second argument is the baud rate, and the third is the channel number. The program prints a significant amount of diagnostic information which can be useful in the setting up phase, but is usually discarded by the ' > /dev/null 2>&1 ' in the above.$ABACUS_HOME/modbus /dev/cua1 9600 1 > /dev/null 2>&1 & WarningThe am of the sys-block-number block may be used to stop the modbus program. Use of /etc/inittab and a script file would be required to ensure that the program is restarted.MODBUS SlaveAny ABACUS4 block may be connected to any one signal reachable via a connected BSAP network. Which signal is defined in the nn parameter. The nm parameter is loaded (by the system) with a series of numbers representing the global address of the node, the MSD address of the signal, the MSD version number, and two status values obtained from the signal. Data is transferred from the signal into the ABACUS4 block. In order to reduce the network load of continuously polling all the signals a count down timer is used on each block. This counter is stored in the en parameter, which can be seen to decrement. When either the value 0 has been reached the signal is read and the counter reset to 60. If it is desired to prioritize one or more particular signals then set the am flag to a. This will have the effect of putting these signals at the top of the list of signals to be collected. For this reason it is not a good idea to use blocks other than scratchpads for BSAP signal collection. In order to change a value at a remote signal the en parameter must be set to the magic value 777, and the result to the desired value. As confirmation that the new value has been sent to the BSAP node the value 999 is put into the en parameter. The following shows some blocks with appropriate nn values and their generated nm values. The node name here is BIP1. frank(abacus):~$ eng2 long,b10001,xb10019,.nn.nm.ra.en.am.vn Block 10001 (BIP1:#TIME.001.) type scratchpad Xblock 10019 type scratchpad b10001,nnBIP1:#TIME.001. ,nm0000 0968 B53A 0000 32 ,ra 65484.000,en 59,am m ,vn v b10002,nnBIP1:#TIME.002. ,nm0000 0971 B53A 0000 32 ,ra 1999.000,en 59,am m ,vn v b10003,nnBIP1:#TIME.003. ,nm0000 097A B53A 0000 32 ,ra 6.000,en 59,am m ,vn v b10004,nnBIP1:#TIME.004. ,nm0000 0983 B53A 0000 32 ,ra 28.000,en 59,am m ,vn v b10005,nnBIP1:#TIME.005. ,nm0000 098C B53A 0000 32 ,ra 18.000,en 59,am m ,vn v b10006,nnBIP1:#TIME.006. ,nm0000 0995 B53A 0000 32 ,ra 11.000,en 59,am m ,vn v b10007,nnBIP1:#TIME.007. ,nm0000 099E B53A 0000 32 ,ra 25.000,en 59,am m ,vn v b10008,nn ,nm ,ra 0.000,en 0,am m ,vn n b10009,nn ,nm ,ra 0.000,en 0,am m ,vn n b10010,nn ,nm ,ra 0.000,en 0,am m ,vn n b10011,nnBIP1:FTEST.001. ,nm0000 09A7 B53A 0000 02 ,ra 1105.000,en 59,am m ,vn v b10012,nnBIP1:FTEST.002. ,nm0000 0788 B53A 0000 00 ,ra 0.000,en 59,am m ,vn n b10013,nnBIP1:FTEST.003. ,nm0000 0A7E B53A F5F7 06 ,ra 1105.000,en 59,am m ,vn v b10014,nnBIP1:FTEST.LOLO. ,nm0000 09CA B53A 0000 02 ,ra 2.000,en 59,am m ,vn v b10015,nnBIP1:FTEST.LOW. ,nm0000 09D7 B53A 0000 02 ,ra 4.000,en 59,am m ,vn v b10016,nnBIP1:FTEST.HIGH. ,nm0000 09B0 B53A 0000 02 ,ra 95.000,en 59,am m ,vn v b10017,nnBIP1:FTEST.HIHI. ,nm0000 09BD B53A 0000 02 ,ra 99.000,en 59,am m ,vn v b10018,nn ,nm ,ra 0.000,en 0,am m ,vn n b10019,nn ,nm ,ra 0.000,en 0,am m ,vn n The bsap2 programThis is the program which actually collects and delivers the data to/from the BSAP network. If you try to execute it you will get the following informative text.Notice that this program executes one pass through the ABACUS database, and then exits. It is the responsibility of another script to repeatedly run bsap2. The standard script is called bsap-run.sh and looks something like this. It is here that you must edit so that the correct node name (in this example BIP1) and local address (1) are used.bsap2 [-a local_adr] [-p port] [-b baud-rate] [-L] [-1 startblock] [-2 stopblock] [-n node_gadr] -N node_string scans the blocks in the range startblock to stopblock to find nn's that match the node_string. Then tries to update the results of those blocks whose en == 1, decrementing all with en > 1 If -L is present the node will be interogated for signal names otherwise the msd adresses in the nm parameters will be used -a bsap local node address (default 0) -p port (default /dev/cua1) -b baud rate (default 9600) -1 first block (default 20000) -2 last block (default 39999) -s new_start (default 60) -n node global adr -N node_string Attention should be made to the global address, which is a hex number (in this example 0 i.e. the local node). This can be obtained from the NETFILE.DOC file produced by the Bristol Babcock tools.#!/bin/sh # # This file runs the various bsap calls for tivoli and stations under # sudo chmod a+w /dev/cua0 # sudo chmod a+r /dev/cua0 export LOGFILE=/dev/null export LOGFILE=/home/abacus/tivoli/bsap-run.log stty 5:0:8bd:0:0:0:0:0:0:1:1:0:0:0:0:0:0:0:0:0:0:0:0 < /dev/cua1 echo " Detta program startar /home/abacus/bsap2 -1 10000 -2 10999 data hämntingprogrammet. This program starts /home/abacus/bsap2 data collection program." /home/abacus/bsap2 -1 10000 -2 10999 -a 1 -p /dev/cua1 -n 0 -N BIP1: -L >> $LOGFILE while sleep 0 do echo "Starting /home/abacus/bsap2 -1 10000 -2 10999 loop `date`" echo >> $LOGFILE echo /home/abacus/tivoli/bsap-run.sh `date` >> $LOGFILE echo /home/abacus/tivoli/bsap-run.sh Starting normal pass >> $LOGFILE echo >> $LOGFILE echo Ordinary pass on BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -w -a 1 -p /dev/cua1 -n 0 -N BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -w -a 1 -p /dev/cua1 -n 0 -N BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -w -a 1 -p /dev/cua1 -n 0 -N BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -w -a 1 -p /dev/cua1 -n 0 -N BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -w -a 1 -p /dev/cua1 -n 0 -N BIP1: >> $LOGFILE /home/abacus/bsap2 -1 10000 -2 10999 -a 1 -p /dev/cua1 -n 0 -N BIP1: -L >> $LOGFILE echo /home/abacus/tivoli/bsap-run.sh `date` >> $LOGFILE mv $LOGFILE $LOGFILE.tmp tail -1000 $LOGFILE.tmp > $LOGFILE rm $LOGFILE.tmp done The -N argument specifies the search string used by the
program when it goes through all the ABACUS blocks to find suitable candidates
for communication. The normal syntax for BSAP signal names is of the form
XXXX:BASENAME.EXTNTN.ATTR where XXXX is the node name, the maximum length
of the remaining parts is 8.6.4.
Enterprise Server CommunicationsWhen an ABACUS4 system needs to communicate with an Enterprise Server (VAX/VMS version) the en and dd parameters are used to specify which signal in the Enterprise Server system will correspond to the block in question. It is however during start-up of the entlnk4_clientIn the Enterprise Server data base there are analog and logical signals. Each analog signal has a unique number know as its PTID (point ID), each logical also has a unique DIID (digital input ID). Each signal has a system unique name which usually is of the form XXXX:SIGNALNAME. For an ABACUS block to have its values sent to the Entprise system it must have a valid signal name in the nn parameter. The following is an example of an analog input block... In the case of all blocks excluding Alarm Code blocks, the system sets the en parameter to the corresponding PTID, and the dd parameter to the corresponding DIID number.frank(abacus):~$ eng2 b101,p Block 101 (UC71:F701..AI) type pibus ai B101 (UC71:F701..AI) nnUC71:F701..AI deFLODE INKOMMANDE GRUVVATTEN nmfms AI N:01 C:02 P:0 tg F701;sn 3(1.0 sec);ra -0.232 am a ;vn n ;ss r en 2101;dd 0 aa 91;rn 0;ds 2515513 rw 12864.000;sp 50.000;ze 0.000 Alarm Code Blocks (acb) may be associated with more than one Enterprise signal. If the acb is called, as in our example, UC71:A720.. then the following signals may also be present... frank(abacus):~$ grep UC71:A720 analog.dat 2880 UC71:A720.. C 1 0 0 0 0 0.000 0.000 JARNHALTSMATARE - GRUVV. 2881 UC71:A720..HL C 0 0 0 0 0 0.000 0.000 JARNHALTSMATARE - GRUVV. HOG 2882 UC71:A720..LL C 0 0 0 0 0 0.000 0.000 JARNHALTSMATARE - GRUVV. LAG 2883 UC71:A720..XL C 0 0 0 0 0 0.000 0.000 JARNHALTSMATARE - GRUVV. INGET STROMNote that even XH is permitted, but not used in this case. Alarms are generated by Entprise, which needs to be setup so that the base signal (console point) has the HL,LL XL etc as its alarm limits. The status of the link program (entlnk4_client in ABACUS, usl:entlnk4_server running as ENTLNK4 in the Enterprise Server) can be seen in block 30. With heavily loaded Enterprise systems the server can have problems with the database, where is can no longer extract or insert data. This usually happens during start-up, and the observed number of PTIDs and DIIDs (shown in the en and dd parameters respectively) is less than the correct number. Blocks 28 and 29 are used to define minimum nos. of DIIDs and PTIDs respectively. If fewer than these are found, then the program exits and is restarted by the system.frank(abacus):~$ eng2 long,b8002,p Block 8002 (UC71:A720..) type alarm code Block 8002 (UC71:A720..) type alarm code nn.b.name UC71:A720.. de.descr JARNHALTSMATARE - GRUVV. nm.name NOT IN ALARM tg.tag A720 sn.scan 3(1.0 sec) ra.rslta -5.000 am.au/mn a vn.vltn n ss.sshot r en.A Entpr 0 dd.D Entpr 0 si.name aa.algra 1 hy.hyst 0.000 s1.status s2.status xl.limit -30.000 xh.limit 19.800 ll.limit -25.000 hl.limit 15.000 is.inputsp 0( 0.000 m-rn) ia.inputa 102(UC71:A720..AI -5.000 a+rv) st.status 0( 0.000 m-rn) ar.amreqst 0( 0.000 m-rn) un.unittx mo.ok tx ml.low tx mh.hi tx lx.xl tx hx.xh tx ma.autotx mm.handtx ur.areqtx hr.hreqtx dy.delay 0:00:30 Signal Value Monitor remote signal -+ alarm signal -+ | +- message suppr constant value -+| | |+- group suppr manual inhibit -+|| | ||+- unacknowledge control inhibit -+||| | |||+- in alarm alarm inhibit -+|||| | ||||++- alarm prio Signal Value questionable -+||||| | ||||||++- alm type ------------------------ --------- ---------------- |||||| | |||||||| -------- UC71:A720.. -5.000000 AV X L. A . U C 68010428 UC71:A720..HL 15.000000 AV X L. A . 68014000 UC71:A720..LL -25.00000 AV X L. A . 68014000 UC71:A720..XL -30.00000 AV X L. A . 68014000 ------------------------ --------- |||||||| | -------- -------- -------- updating -+||||||+- rbe +- logical value alarm change -+||||+- manual data value change -+||+- operator lock user change -++- aux change In the above example the system has not yet found all the PTIDs and DIIDs corresponding to the names in the ABACUS data base.frank(abacus):~$ eng2 b28,xb30,fp Block 28 () type scratchpad Xblock 30 type scratchpad B28 () nn deentlnk4: minimum no of DIIDs nm tg entlnk4;sn 0(0.0 sec);ra 196.000 am m ;vn n ;ss r en 0;dd 0 B29 () nn deentlnk4: minimum no of PTIDs nm tg entlnk4;sn 0(0.0 sec);ra 355.000 am m ;vn n ;ss r en 0;dd 0 B30 () nn deentlnk4: Try and find all the ptid and diid numbers nm tg entlnk4;sn 0(0.0 sec);ra 0.000 am m ;vn n ;ss r en 326;dd 2 Profibus-fmsThe Profibus-fms protocol is used at this time only in connection with PEP-Computer's SMART-I/O subsystem, which requires specific programming. This software allows connection directly to analog & digital inputs & outputs.Analog inputsWhen used with the SMART-I/O subsystem, analog inputs may use the aa of 90 or 91. aa = 90 is for 0-20mA, and 91 is for 4-20mA. With these algorithms the sp corresponds to the desired ra for 20mA in and the ze corresponds to the desired ra for 0/4 mA input. The rw is the raw signal value from the SMART-I/O subsystem, in the range 0 - 65536. The ds parameter is used by the driver software to store the previous value of rw. If the difference between rw and ds is greater than 1024 the block is not updated, this prevent false readings causing undesirable effects.frank(abacus):~$ eng2 b101,p Block 101 (UC71:F701..AI) type pibus ai B101 (UC71:F701..AI) nnUC71:F701..AI deFLODE INKOMMANDE GRUVVATTEN nmfms AI N:01 C:02 P:0 tg F701;sn 3(1.0 sec);ra -0.232 am a ;vn n ;ss r en 2101;dd 0 aa 91;rn 0;ds 2515513 rw 12864.000;sp 50.000;ze 0.000 The nm parameter shows which point the block relates
to. In the above example N:01 refers to the first node, C:02 refers to
the card number 2, and P:0 is point 0. Points are numbered from 0 upwards,
as are slots. The nodes have a Profibus address which is shown after the
N:..
Analog outputsThe nm parameter shows which point the block relates to. In the above example N:01 refers to the first node, C:05 refers to the card number 5, and P:0 is point 0. The nodes have a Profibus address which is shown after the N:..frank(abacus):~$ eng2 b6301,p Block 6301 (UC71:FV750.STYR.AO) type analogue out B6301 (UC71:FV750.STYR.AO) nnUC71:FV750.STYR.AO deREGLERVENTIL GRUVVATTEN nmfms AO N:01 C:05 P:0 tg FV750;sn 3(1.0 sec);ra 20.000 am a ;vn v ;ss r en 2134;dd 0 hl 40.000;ll 20.000;sp 20.000 Data Link Block
WARNING: This block is not implemented yet in ABACUS4. This section of the ABACUS block language manual describes the data link block. This block allows data to be transmitted from one ABACUS system to another via a variety of hardware including Ethernet and asynchronous ASCII. Data Link Block
The Data Link Block controls the transfer of both analogue
and digital data between ABACUS systems, over Ethernet or asynchronous
ASCII links.
|
|