RRM 3-13 Histogram

From EPICSWIKI
Revision as of 20:03, 1 September 2005 by AndrewJohnson (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

EPICS Record Reference Manual


Histogram

The histogram record is used to store frequency counts of a signal into an array of arbitrary length. The user can configure the range of the signal value that the array will store. Anything outside this range will be ignored.

Parameter Fields

The fields in this record fall into the following categories:

  • scan parameters
  • read parameters
  • operator display parameters
  • monitor parameters
  • run-time and simulation mode parameters


Scanning Parameters

The histogram record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used.


Read Parameters

The SVL is the input link where the record reads its value. It can be a constant, a database link, or a channel access link. If SVL is a database or channel access link, then SGNL is read from SVL. If SVL is a constant, then SGNL is initialized with the constant value but can be changed via dbPuts. The Soft Channel device support module can be specified in the DTYP field. For a list of other device support modules currently supported at the user's local site, use the dbst utility in R3.13.

The ULIM and LLIM fields determine the usable range of signal values. Any value of SGNL below LLIM or above ULIM is outside the range and will not be stored in the array. In the NELM field the user must specify the array size, e.g., the number of array elements. Each element in the NELM field holds the counts for an interval of the range of signal counts, the range specified by ULIM and LLIM. These intervals are determined by dividing the range by NELM:

(ULIM - LLIM) / NELM.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
SVLSignal Value Location (an input link)INLINKYes0NoNoN/ANo
SGNLSignal ValueDOUBLENo0YesYesYesNo
DTYPDevice TypeDEVCHOICEYes0YesNoNo 
NELMNumber of elements in arrayUSHORTYes1YesNoNoNo
ULIMUpper Signal LimitDOUBLEYes0YesYesNoNo
LLIMLower Signal LimitDOUBLEYes0YesYesNoNo


Operator Display Parameters

These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the histogram either textually or graphically. See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
NAMERecord NameSTRING [29]Yes0YesNoNo 
DESCDescriptionSTRING [29]YesNullYesYesNoNo


Alarm Parameters

The Histogram record has the alarm parameters common to all record types. Alarm Fields lists other fields related to a alarms that are common to all record types.


Monitor Parameters

The MDEL field implements the monitor count deadband. Only when MCNT is greater than the value given to MDEL are monitors triggered, MCNT being the number of counts since the last time the record was processed. If MDEL is -1, everytime the record is processed, a monitor is triggered regardless.

If SDEL is greater than 0, it causes a callback routine to be called. The number specified in SDEL is the callback routines interval. The callback routine is called every SDEL seconds. The callback routine posts an event if MCNT is greater than 0.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
MDELMonitor DeltaSHORTYes0YesYesNoNo
SDELMonitor Seconds DeadbandFLOATYes0YesNoNoNo


Run-time and Simulation Mode Parameters

These parameters are used by the run-time code for processing the histogram. They are not configurable by the user prior to run-time. They represent the current state of the record. Many of them are used to process the histogram more efficiently.

The BPTR field contains a pointer to the unsigned long array of frequency values. The VAL field references this array as well. However, the BPTR field is not accessible at run-time.

The MCNT field keeps counts the number of signal counts since the last monitor was invoked.

The WDOG field contains a pointer to the callback control structure and is of no interest to the user.

The collections controls field (CMD) is a menu field with five choices: Read, Clear, Start, Stop, and Setup. When Read, the record retrieves its values and adds them to the signal array. This command will first clear the signal counts which have already been read when it is first invoked. The Clear command erases the signal counts, setting the elements in the array back to zero. Afterwards, the field is set back to Read. The Start command simply causes the record to read signal values into the array. Unlike Read, it doesn't clear the array first. The Stop command disables the reading of signal values into the array. The Setup command waits until the start or read command has been issued to start counting.

The CSTA or collections status field implements the CMD field choices by enabling or disabling the reading of values into the histogram array. While FALSE, no signals are added to the array. While TRUE, signals are read and added to the array. The field is initialized to TRUE. The Stop command is the only command that sets CSTA to FALSE. On the other hand, the Start command is the only command that sets it to TRUE. Thus, Start must be invoked after each Stop command in order to enable counting; invoking Read will not enable signal counting after Stop has been invoked.

A typical use of these fields would be to initialize the CMD field to Read (it is initialized to this command by default), to use the Stop command to disable counting when necessary, after which the Start command can be invoked to re-start the signal count.

The WDTH field is a private field that holds the signal width of the array elements. For instance, if the LLIM was configured to be 4.0 and ULIM was configured to be 12.0 and the NELM was set to 4, then the WDTH for each array would be 2. Thus, it is (ULIM - LLIM) / NELM.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
BPTRBuffer PointerNOACCESSNo0NoNoNoNo
VALValue FieldSee BPTRNo0YesNoNoNo
MCNTMonitor CountsSHORTNo0YesNoNoNo
WDOGWatchdog CallbackNOACCESSNo0NoNoNoNo
CMDCollections ControlRECCHOICENo0YesYesNoNo
CSTACollections StatusSHORTNo1YesNoNoNo
WDTHElement WidthDOUBLENo0YesNoNoNo

The following fields are used to operate the histogram record in simulation mode. See Fields Common to Many Record Types for more information on the simulation mode fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
SIOLSimulation Value LocationINLINKYes0NoNoN/ANo
SVALSimulation ValueDOUBLENo0YesYesNoNo
SIMLSimulation Mode LocationINLINKYes0NoNoN/ANo
SIMMSimulation ModeGBLCHOICENo0YesYesNoNo
SIMSSimulation Mode Alarm SeverityGBLCHOICEYes0YesYesNoNo


Record Support

Record Support Routines

init_record

Using NELM, space for the unsigned long array is allocated and the width WDTH of the array is calculated.

This routine initializes SIMM with the value of SIML if SIML type is CONSTANT link or creates a channel access link if SIML type is PV_LINK. SVAL is likewise initialized if SIOL is CONSTANT or PV_LINK.

This routine next checks to see that device support and a device support read routine are available. If device support includes init_record, it is called.

process

See next section.

special

Special is invoked whenever the fields CMD, SGNL, ULIM, or LLIM are changed.

If SGNL is changed, add_count is called.

If ULIM or LLIM are changed, WDTH is recalculated and clear_histogram is called.

If CMD is less or equal to 1, clear_histogram is called and CMD is reset to 0. If CMD is 2, CSTA is set to TRUE and CMD is reset to 0. If CMD is 3, CSTA is set to FALSE and CMD is reset to 0.

clear_histogram zeros out the histogram array. add_count increments the frequency in the histogram array.

get_value

Fills in the values of struct valueDes so that they refer to the array.

cvt_dbaddr

This is called by dbNameToAddr. It makes the dbAddr structure refer to the actual buffer holding the array.

get_array_info

Obtains values from the array referenced by VAL.

put_array_info

Writes values into the array referenced by VAL.


Record Processing

Routine process implements the following algorithm:

  1. Check to see that the appropriate device support module exists. If it doesn't, an error message is issued and processing is terminated with the PACT field set to TRUE. This ensures that processes will no longer be called for this record. Thus error storms will not occur.
  2. readValue is called. See Input Records for more information
  3. If PACT has been changed to TRUE, the device support read routine has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE.
  4. Add count to histogram array.
  5. Check to see if monitors should be invoked. Alarm monitors are invoked if the alarm status or severity has changed. Archive and value change monitors are invoked if MDEL conditions are met. NSEV and NSTA are reset to 0.
  6. Scan forward link if necessary, set PACT and INIT to FALSE, and return.


Device Support

Fields Of Interest To Device Support

The device support routines are primarily interested in the following fields:


Name Summary Description
PACT Processing ActiveSee Fields Common to All Record Types for an explanation of these fields.
DPVTDevice Private
UDFVAL Undefined
NSEVNew Alarm Severity
NSTANew Alarm Status
SVLSignal ValueThe device support module retrieves a value from SGNL for SVL
SGNLSignal Value Location


Device Support Routines

Device support consists of the following routines:

init_record

init_record(precord)

This routine is called by the record support init_record routine. It makes sure that SGNL is a CONSTANT, PV_LINK, DB_LINK, or CA_LINK. It also retrieves a value for SVL from SGNL. If SGNL is none of the above, an error is generated.

read_histogram

read_histogram(*precord)

This routine is called by the record support routines. It retrieves a value for SVL from SGNL.

Device Support For Soft Records

Only the device support module Soft Channel is currently provided, though other device support modules may be provided at the user's site.

Soft Channel

The Soft Channel device support routine retrieves a value from SGNL. SGNL must be CONSTANT, PV_LINK, DB_LINK, or CA_LINK.




EPICS Record Reference Manual - 19 MAY 1998