Table of Contents Previous Chapter Chapter 5: ao - Analog Output

Chapter 5: ao - Analog Output

1. Introduction

The normal use for this record type is to store values to be sent to Digital to Analog Converters. It can also be used to write values to other records via database or channel access links. The OUT field determines how the record is used. The record supports alarm limits, conversion from/to engineering units, and graphics and control limits.

2. Field Summary

--------------------------------------------------------------
Field  Type       DCT  Initial  Access  Modify  Rec Proc   PP   
                                                Monitor         
--------------------------------------------------------------
VAL    DOUBLE     No   0        Yes     Yes     Yes        Yes  
OVAL   DOUBLE     No   0        Yes     Yes     Yes        No   
OUT    OUTLINK    Yes  0        No      No      N/A        No   
OROC   FLOAT      Yes  0        Yes     Yes     No         No   
DOL    INLINK     Yes  0        No      No      N/A        No   
OMSL   GBLCHOICE  Yes  0        Yes     Yes     No         No   
OIF    RECCHOICE  Yes  0        Yes     Yes     No         No   
PREC   SHORT      Yes  0        Yes     Yes     No         No   
LINR   CVTCHOICE  Yes  0        Yes     Yes     No         Yes  
EGUF   FLOAT      Yes  0        Yes     Yes     No         Yes  
EGUL   FLOAT      Yes  0        Yes     Yes     No         Yes  
EGU    STRING     Yes  null     Yes     Yes     No         No   
ESLO   DOUBLE     No   1        Yes     No      No         No   
ROFF   LONG       No   0        Yes     Yes     No         Yes  
DRVH   FLOAT      Yes  0        Yes     Yes     No         Yes  
DRVL   FLOAT      Yes  0        Yes     Yes     No         Yes  
HOPR   FLOAT      Yes  0        Yes     Yes     No         No   
LOPR   FLOAT      Yes  0        Yes     Yes     No         No   
AOFF   FLOAT      Yes  0        Yes     Yes     No         Yes  
ASLO   FLOAT      Yes  0        Yes     Yes     No         Yes  
HIHI   FLOAT      Yes  0        Yes     Yes     No         Yes  
LOLO   FLOAT      Yes  0        Yes     Yes     No         Yes  
HIGH   FLOAT      Yes  0        Yes     Yes     No         Yes  
LOW    FLOAT      Yes  0        Yes     Yes     No         Yes  
HHSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
LLSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
HSV    GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
LSV    GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
HYST   DOUBLE     Yes  0        Yes     Yes     No         No   
ADEL   DOUBLE     Yes  0        Yes     Yes     No         No   
MDEL   DOUBLE     Yes  0        Yes     Yes     No         No   
RVAL   LONG       No   0        Yes     Yes     Yes        Yes  
ORAW   LONG       No   0        Yes     No      No         No   
RBV    LONG       No   0        Yes     No      Yes        No   
ORBV   LONG       No   0        Yes     No      No         No   
PVAL   DOUBLE     No   0        Yes     No      No         No   
LALM   DOUBLE     No   0        Yes     No      No         No   
ALST   DOUBLE     No   0        Yes     No      No         No   
MLST   DOUBLE     No   0        Yes     No      No         No   
PBRK   NOACCESS   No   4        No      No                 No   
INIT   SHORT      No   0        Yes     No      No         No   
LBRK   SHORT      No   0        Yes     No      No         No   
SIOL   OUTLINK    Yes  0        No      No      N/A        No   
SIML   INLINK     Yes  0        No      No      N/A        No   
SIMM   GBLCHOICE  No   0        Yes     Yes     No         No   
SIMS   GBLCHOICE  Yes  0        Yes     Yes     No         No   
IVOA   GBLCHOICE  Yes  0        Yes     Yes     No         No   
IVOV   DOUBLE     Yes  0        Yes     Yes     No         No   
--------------------------------------------------------------

3. Field Descriptions

------------------------------------------------------------------------------------------
Name  Summary               Description                                                     
------------------------------------------------------------------------------------------
VAL   Value                 This is the desired output value, in engineering units. If      
                            DRVH and DRVL are defined, VAL is forced to be within           
                            the drive limits. VAL is either obtained from DOL or set        
                            via dbPuts.                                                     
OVAL  Output Value          This is the desired output value, after adjustments, in         
                            engineering units. It is just VAL possibly adjusted by          
                            OROC. This is the value used to compute RVAL.  OVAL is          
                            used to enforce a maximum rate of change limit before           
                            converting the desired value to a raw value. If soft device     
                            support is selected and OUT is a database or channel            
                            access link, this is the value written to the link.             
OUT   Output Link           This field is used by the device support routines to decide     
                            where to send output. For soft records, it can be a             
                            constant, a database link, or a channel access link. If the     
                            link is a constant, the result is no output.                    
OROC  Maximum Output        If this is not zero, it specifies the maximum change in         
      Rate of Change        value (engineering units) to be sent to OUT each time the       
                            record is processed. It is this field that can cause VAL and    
                            OVAL to differ.                                                 
DOL   Desired Output        If DOL is a database or channel access link and OMSL is         
      Location (an Input    CLOSED_LOOP, then VAL is read from DOL. After the               
      Link)                 check for drive limits, VAL will be set to the value            
                            determined by DOL.                                              
OMSL  Output Mode Select    This field has either the value SUPERVISORY or                  
                            CLOSED_LOOP.  DOL is used to determine VAL only if              
                            OMSL has the value CLOSED_LOOP.   By setting this field         
                            the record can be switched between supervisory and              
                            closed loop mode of operation. While in closed loop             
                            mode, the VAL field cannot be set via dbPuts.                   
OIF   Out Full or           This field is used when input is obtained from DOL, and         
      Incremental           determines if the value obtained from DOL is an increment       
                            to add to the current VAL or is the actual VAL desired.         
PREC  Display Precision     Precision with which to display VAL.  This field is used by     
                            record support to supply a value when get_precision             
                            is called.                                                      
LINR  Conversion Type       No conversion, linear and breakpoint table conversion are       
                            supported.                                                      
EGUF  Engineering Units     These fields are used to perform linear conversions. It is      
      Full                  the responsibility of the device support routines to use        
                            EGUF and EGUL to compute ESLO and ROFF. EGUF and                
                            EGUL must be set by the user to the engineering units           
                            corresponding to the high and low ADC limits. For               
                            example if the DAC has a range of -10 to +10 Volts, then        
                            EGUF must be the engineering units value corresponding          
                            to 10 volts and EGUL to -10 volts. If a linear conversion is    
                            specified ESLO, ROFF,  and EGUL are used to convert the         
                            value from/to engineering units using the following             
                            formula:                                                        
                              RVAL = (OVAL - EGUL)/ESLO - ROFF                              
EGUL  Engineering Units                                                                     
      Low                                                                                   
ESLO  Slope For Linear                                                                      
      Conversions                                                                           
ROFF  Raw Value Offset                                                                      
EGU   Engineering Units     ASCII string describing Engineering units.  This field is       
                            used by record support to supply a units description string     
                            when get_units is called.                                       
DRVH  Drive High            If these values are defined then VAL will forced to be in       
                            the range:                                                      
                              DRVL<=VAL<=DRVH                                         
DRVL  Drive Low                                                                             
HOPR  High Operating        These fields determine the upper and lower display limits       
      Range                 for graphics displays and the upper and lower control           
                            limits for control displays. The fields are used by record      
                            support to honor calls to get_graphic_double or                 
                            get_control_double.  If these values are defined,               
                            they must be in the range:                                      
                              DRVL<=LOPR<=HOPR<=DRVH.                              
LOPR  Low Operating                                                                         
      Range                                                                                 
AOFF  Adjustment Offset     These fields are adjustment parameters for the raw output       
                            values. They are applied to the raw output value after          
                            conversion from engineering units.                              
ASLO  Adjustment Slope                                                                      
HIHI  Hihi Alarm Limit      These fields specify the alarm limits and severities.           
HIGH  High Alarm Limit                                                                      
LOW   Low Alarm Limit                                                                       
LOLO  Lolo Alarm Limit                                                                      
HHSV  Hihi Alarm Severity                                                                   
HSV   High Alarm Severity                                                                   
LSV   Low Alarm Severity                                                                    
LLSV  Lolo Alarm Severity                                                                   
HYST  Alarm Deadband        These parameters specify hysteresis factors for triggering      
                            monitor callbacks, i.e. callbacks specified by calls to         
                            caAddEvent or dbAddEvent. A monitor will not be                 
                            triggered until VAL changes by more than the specified          
                            amount.                                                         
ADEL  Archive Deadband                                                                      
MDEL  Monitor, i.e. value                                                                   
      change, Deadband                                                                      
RVAL  Raw Data Value        RVAL is the value actually sent to the device.                  
ORAW  Old raw data value    ORAW is used to decide if monitors should be triggered for      
                            RVAL.                                                           
RBV   Read Back Value       This is the actual read back value obtained from the            
                            hardware itself or from the associated device driver.  It is    
                            the responsibility of the device support routine to give this   
                            field a value.                                                  
ORBV  Old read back value   ORBV is used to decide if monitors should be triggered for      
                            RBV at the same time monitors are triggered for changes         
                            in VAL.                                                         
PVAL  Previous Data                                                                         
      Value                                                                                 
LALM  Last Alarm Monitor    These fields are used to implement the hysteresis factors       
      Trigger Value         for monitors.                                                   
ALST  Last  Archiver                                                                        
      Monitor Trigger                                                                       
      Value                                                                                 
MLST  Last Value Change                                                                     
      Monitor Trigger                                                                       
      Value                                                                                 
INIT  Initialize            This field is used by record support to perform                 
                            initialization for LBRK and for smoothing.                      
LBRK  Last Breakpoint       Index of last breakpoint interval                               
PBRK  Breakpoint Pointer    Address of breakpoint table                                     
SIMM  Simulation Mode       Simulation mode process variables.  Refer to Chapter 3,         
                            Section "Simulation Mode" on page 13 for more                   
                            information.                                                    
SIML  Simulation Mode                                                                       
      Location                                                                              
SIOL  Simulation Value                                                                      
      Location                                                                              
SIMS  Simulation Mode                                                                       
      Alarm Severity                                                                        
IVOA  Invalid Alarm         Whenever the record is put into INVALID alarm severity          
      Output Action         IVOA specifies an action.  See Chapter 3, Section "Invalid      
                            Alarm Output Action" on page 14 for more information.           
IVOV  Invalid Alarm                                                                         
      Output Value                                                                          
------------------------------------------------------------------------------------------

4. Record Support Routines

init_record

This routine initializes SIMM if SIML is a constant or creates a channel access link if SIML is PV_LINK. If SIOL is PV_LINK a channel access link is created.

This routine next checks to see that device support is available. If DOL is a constant, then VAL is initialized with its value and UDF is set to FALSE.

The routine next checks to see if the device support write routine is defined. If either device support or the device support write routine does not exist, an error message is issued and processing is terminated.

If device support includes init_record, it is called.

INIT is set TRUE. This causes PBRK, LBRK, and smoothing to be reinitialized

If linear conversion is requested, then VAL is computed from RVAL using the algorithm:

  VAL=(RVAL+ROFF)/ESLO+EGUL
and UDF is set to FALSE.

For breakpoint conversion, a call is made to cvtEngToRawBpt and UDF is then set to FALSE. PVAL is set to VAL.

process

See next section.

special

The only special processing for analog output records is SPC_LINCONV which is invoked whenever either of the fields LINR, EGUF, EGUL or ROFF is changed

If the device support routine special_linconv exists it is called.

INIT is set TRUE. This causes PBRK, LBRK, and smoothing to be reinitialized.

get_value

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

get_units

Retrieves EGU.

get_precision

Retrieves PREC.

get_graphic_double

Sets the upper display and lower display limits for the field. If the field is VAL, HIHI, HIGH, LOW, or LOLO, 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.

get_control_double

Sets the upper display and lower control limits for the field. If the field is VAL, HIHI, HIGH, LOW, or LOLO, 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.

get_alarm_double

Sets the following values:

  upper_alarm_limit = HIHI
  upper_warning_limit = HIGH
  lower_warning_limit = LOW
  lower_alarm_limit = LOLO

5. 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. Check PACT: If PACT is FALSE call fetch_values and convert which perform the following steps:
  3. Check alarms: This routine checks to see if the new VAL causes the alarm status and severity to change. If so, NSEV, NSTA and y are set. It also honors the alarm hysteresis factor (HYST). Thus the value must change by at least HYST before the alarm status and severity is reduced.
  4. Check severity and write the new value. See Chapter 3, Section "Invalid Alarm Output Action" on page 14 for details.
  5. If PACT has been changed to TRUE, the device support write output routine has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE.
  6. Check to see if monitors should be invoked:
  7. Scan forward link if necessary, set PACT and INIT FALSE, and return.

6. Device Support

Fields Of Interest To Device Support

Each analog output record must have an associated set of device support routines. The primary responsibility of the device support routines is to output a new value whenever write_ao is called. The device support routines are primarily interested in the following fields:

------------------------------------------------------------------------------------------
Name  Summary                 Description                                                   
------------------------------------------------------------------------------------------
PACT  Processing Active       See Chapter 2, Section "Database Common: Field                
                              Descriptions" on page 4 for descriptions.                     
DPVT  Device Private                                                                        
NSEV  New Alarm Severity                                                                    
NSTA  New Alarm Status                                                                      
OUT   Output Link             This field is used by the device support routines to locate   
                              its output.                                                   
EGUF  Engineering Units Full  These fields are used to calculate ESLO. Note that these      
                              fields correspond to the high and low hardware limits.        
EGUL  Engineering Unit Low                                                                  
ESLO  Slope                   These fields are used  for linear conversions from raw to     
                              engineering units. The device support routines must           
                              calculate these fields unless they obtain values already in   
                              engineering units.                                            
ROFF  Raw Offset                                                                            
RVAL  Raw Value               This is the value to write OUT.                               
------------------------------------------------------------------------------------------

Device Support routines

Device support consists of the following routines:

init

  init()
This routine is called once during IOC initialization.

init_record

  init_record(precord)
This routine is optional. If provided, it is called by the record support init_record routine. It returns a zero for success or a 2 for success, don't convert.

get_ioint_info

  get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt)
This routine is called by the ioEventScan system each time the record is added or deleted from an I/O event scan list. cmd has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner.

write_ao

  write_ao(precord)
This routine must output a new value. Asynchronous device support routines will return with PACT set to TRUE. If PACT is TRUE, the process routine will just return and not continue processing. When the asynchronous routine completes, it can call process which will again call write_ao. When finished, write_ao should set PACT to FALSE and return one the following values:

special_linconv

  special_linconv(precord,after) 
This routine is called whenever either of the fields LINR, EGUF, EGUL or ROFF is modified.

7. Device Support For Soft Records

Two soft device support modules Soft Channel and Raw Soft Channel are provided for output records not related to actual hardware devices. The OUT link type must be either a CONSTANT, DB_LINK, or CA_LINK.

Soft Channel

This module writes the current value of OVAL.

If the OUT link type is PV_LINK, then dbCaAddInlink is called by init_record. init_record always returns a value of 2, which means that no conversion will ever be attempted.

write_ao calls recGblPutLinkValue to write the current value of VAL. See Chapter 3, Section "Soft Output" on page 13 for details.

Raw Soft Channel

This module is like the previous except that it writes the current value of RVAL.

 
Table of Contents Next Chapter