Compression Record (compress)
The data compression record is used to collect and compress data from arrays. When the INP field references a data array field, it immediately compresses the entire array into an element of an array using one of several algorithms, overwriting the previous element. If the INP field obtains its value from a scalar-value field, the compression record will collect a new sample each time the record is processed and add it to the compressed data array as a circular buffer.
The INP link can also specify a constant; however, if this is the case, the compression algorithms are ignored, and the record support routines merely return after checking the FLNK field.
Parameter Fields
The record-specific fields are described below, grouped by functionality.
Scanning Parameters
The compression record has the standard fields for specifying under what
circumstances the record will be processed. Since the compression record
supports no direct interfaces to hardware, its SCAN field cannot be set to I/O Intr
.
These fields are described in Scan Fields.
Field |
Summary |
Type |
DCT |
Default |
Read |
Write |
CA PP |
---|---|---|---|---|---|---|---|
SCAN |
Scan Mechanism |
MENU menuScan |
Yes |
Yes |
Yes |
No |
|
PHAS |
Scan Phase |
SHORT |
Yes |
Yes |
Yes |
No |
|
EVNT |
Event Name |
STRING [40] |
Yes |
Yes |
Yes |
No |
|
PRIO |
Scheduling Priority |
MENU menuPriority |
Yes |
Yes |
Yes |
No |
|
PINI |
Process at iocInit |
MENU menuPini |
Yes |
Yes |
Yes |
No |
Operator Display Parameters
These parameters are used to present meaningful data to the operator. They display the value and other parameters of the record either textually or graphically.
Field |
Summary |
Type |
DCT |
Default |
Read |
Write |
CA PP |
---|---|---|---|---|---|---|---|
EGU |
Engineering Units |
STRING [16] |
Yes |
Yes |
Yes |
No |
|
HOPR |
High Operating Range |
DOUBLE |
Yes |
Yes |
Yes |
No |
|
LOPR |
Low Operating Range |
DOUBLE |
Yes |
Yes |
Yes |
No |
|
PREC |
Display Precision |
SHORT |
Yes |
Yes |
Yes |
No |
|
NAME |
Record Name |
STRING [61] |
No |
Yes |
No |
No |
|
DESC |
Descriptor |
STRING [41] |
Yes |
Yes |
Yes |
No |
The EGU field should be given a string that describes the value of VAL, but is
used whenever the get_units
record support routine is called.
The HOPR and LOPR fields only specify the upper and lower display limits for VAL, HIHI, HIGH, LOLO and LOW fields.
PREC controls the floating-point precision whenever get_precision
is
called, and the field being referenced is the VAL field (i.e., one of the values
contained in the circular buffer).
See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.
Alarm Parameters
The compression record has the alarm parameters common to all record types described in Alarm Fields.
Run-time Parameters
These parameters are used by the run-time code for processing the data compression algorithm. They are not configurable by the user, though some are accessible at run-time. They can represent the current state of the algorithm or of the record whose field is referenced by the INP field.
Field |
Summary |
Type |
DCT |
Default |
Read |
Write |
CA PP |
---|---|---|---|---|---|---|---|
NUSE |
Number Used |
ULONG |
No |
Yes |
No |
No |
|
OUSE |
Old Number Used |
ULONG |
No |
Yes |
No |
No |
|
BPTR |
Buffer Pointer |
NOACCESS |
No |
No |
No |
No |
|
SPTR |
Summing Buffer Ptr |
NOACCESS |
No |
No |
No |
No |
|
WPTR |
Working Buffer Ptr |
NOACCESS |
No |
No |
No |
No |
|
CVB |
Compress Value Buffer |
DOUBLE |
No |
Yes |
No |
No |
|
INPN |
Number of elements in Working Buffer |
LONG |
No |
Yes |
No |
No |
|
INX |
Current number of readings |
ULONG |
No |
Yes |
No |
No |
NUSE and OUSE hold the current and previous number of elements stored in VAL.
BPTR points to the buffer referenced by VAL.
SPTR points to an array that is used for array averages.
WPTR points to the buffer containing data referenced by INP.
CVB stores the current compressed value for N to 1
algorithms when INP
references a scalar.
INPN is updated when the record processes; if INP references an array and the size changes, the WPTR buffer is reallocated.
INX counts the number of readings collected.
Record Support
Record Support Routines
long init_record(struct dbCommon *precord, int pass)
Space for all necessary arrays is allocated. The addresses are stored in the appropriate fields in the record.
long process(struct dbCommon *precord)
See “Record Processing” below.
long special(struct dbAddr *paddr, int after)
This routine is called when RSET, ALG, or N are set. It performs a reset.
long cvt_dbaddr(struct dbAddr *paddr)
This is called by dbNameToAddr. It makes the dbAddr structure refer to the actual buffer holding the result.
long get_array_info(struct dbAddr *paddr, long *no_elements, long *offset)
Obtains values from the circular buffer referenced by VAL.
long put_array_info(struct dbAddr *paddr, long nNew);
Writes values into the circular buffer referenced by VAL.
long get_units(struct dbAddr *paddr, char *units);
Retrieves EGU.
long get_precision(const struct dbAddr *paddr, long *precision);
Retrieves PREC.
long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *p);
Sets the upper display and lower display limits for a field. If the field is VAL, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.
long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *p);
Sets the upper control and the lower control limits for a field. If the field is VAL, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.
Record Processing
Routine process implements the following algorithm:
If INP is not a database link, check monitors and the forward link and return.
Get the current data referenced by INP.
Perform the appropriate algorithm:
Average: Read N successive instances of INP and perform an element by element average. Until N instances have been obtained it just return without checking monitors or the forward link. When N instances have been obtained complete the algorithm, store the result in the VAL array, check monitors and the forward link, and return.
Circular Buffer: Write the values obtained from INP into the VAL array as a circular buffer, check monitors and the forward link, and return.
N to 1 xxx when INP refers to a scalar: Obtain N successive values from INP and apply the N to 1 xxx algorithm to these values. Until N values are obtained monitors and forward links are not triggered. When N successive values have been obtained, complete the algorithm, check monitors and trigger the forward link, and return.
N to 1 xxx when INP refers to an array: The ILIL and IHIL are honored if ILIL < IHIL. The input array is divided into subarrays of length N. The specified N to 1 xxx compression algorithm is applied to each sub-array and the result stored in the array referenced by VAL. The monitors and forward link are checked.
If success, set UDF to FALSE.
Check to see if monitors should be invoked:
Alarm monitors are invoked if the alarm status or severity has changed.
NSEV and NSTA are reset to 0.
Scan forward link if necessary, set PACT FALSE, and return.