Replace fixed limits with global variables

Replaced Dirk's fixed precision=2 and limit=10 seconds with
global variables which can be set for each IOC.  Also changed
the upper control limit for delay fields from 10 to 100,000.
This commit is contained in:
Andrew Johnson
2012-01-21 16:35:40 -06:00
parent ed18b6903e
commit 0abfcc9445
9 changed files with 46 additions and 12 deletions
+5 -2
View File
@@ -20,8 +20,11 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.</p>
<p>Non-VAL fields now report meaningful information for precision, units,
graphic limits, control limits, and alarm limits instead of simply using
PREC, EGU, HOPR, LOPR, DRVL, DRVH, HIHI, HIGH, LOW, and LOLO. All delay
fields have precision 2 and units "s". Input fields like A-L of the calc record
read these information from the corresponding INPn link if possible.
fields have a default precision of 2 digits, units "s" and control limits
of 0 to 100,000 seconds (these precision and limit values can be changed
for each record type as a whole at runtime by updating a registered global
variable). Input fields like A-L of the calc record read their metadata
from the corresponding INPn link if possible.</p>
<h3>
Changes to epicsVersion.h</h3>
+7 -2
View File
@@ -82,6 +82,11 @@ rset boRSET={
};
epicsExportAddress(rset,boRSET);
int boHIGHprecision = 2;
epicsExportAddress(int, boHIGHprecision);
double boHIGHlimit = 100000;
epicsExportAddress(double, boHIGHlimit);
struct bodset { /* binary output dset */
long number;
DEVSUPFUN dev_report;
@@ -280,7 +285,7 @@ static long get_units(DBADDR *paddr, char *units)
static long get_precision(DBADDR *paddr, long *precision)
{
if(dbGetFieldIndex(paddr) == indexof(HIGH))
*precision = 2;
*precision = boHIGHprecision;
else
recGblGetPrec(paddr,precision);
return(0);
@@ -290,7 +295,7 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
{
if(dbGetFieldIndex(paddr) == indexof(HIGH)) {
pcd->lower_ctrl_limit = 0.0;
pcd->upper_ctrl_limit = 10.0;
pcd->upper_ctrl_limit = boHIGHlimit;
} else
recGblGetControlDouble(paddr,pcd);
return(0);
+3
View File
@@ -149,3 +149,6 @@ recordtype(bo) {
interest(2)
}
}
variable(boHIGHprecision, int)
variable(boHIGHlimit, double)
+9 -4
View File
@@ -83,7 +83,12 @@ rset calcoutRSET = {
get_alarm_double
};
epicsExportAddress(rset, calcoutRSET);
int calcoutODLYprecision = 2;
epicsExportAddress(int, calcoutODLYprecision);
double calcoutODLYlimit = 100000;
epicsExportAddress(double, calcoutODLYlimit);
typedef struct calcoutDSET {
long number;
DEVSUPFUN dev_report;
@@ -401,7 +406,7 @@ static long get_precision(DBADDR *paddr, long *pprecision)
int linkNumber;
if(fieldIndex == indexof(ODLY)) {
*pprecision = 2;
*pprecision = calcoutODLYprecision;
return 0;
}
*pprecision = prec->prec;
@@ -472,8 +477,8 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
break;
case indexof(ODLY):
pcd->lower_ctrl_limit = 0.0;
pcd->upper_ctrl_limit = 10.0;
break;
pcd->upper_ctrl_limit = calcoutODLYlimit;
break;
default:
recGblGetControlDouble(paddr,pcd);
}
+3
View File
@@ -504,3 +504,6 @@ recordtype(calcout) {
extra("char orpc[INFIX_TO_POSTFIX_SIZE(80)]")
}
}
variable(calcoutODLYprecision, int)
variable(calcoutODLYlimit, double)
+4 -1
View File
@@ -83,6 +83,9 @@ rset histogramRSET={
};
epicsExportAddress(rset,histogramRSET);
int histogramSDELprecision = 2;
epicsExportAddress(int, histogramSDELprecision);
struct histogramdset { /* histogram input dset */
long number;
DEVSUPFUN dev_report;
@@ -410,7 +413,7 @@ static long get_precision(DBADDR *paddr,long *precision)
*precision = prec->prec;
break;
case indexof(SDEL):
*precision = 2;
*precision = histogramSDELprecision;
break;
default:
recGblGetPrec(paddr,precision);
+2
View File
@@ -135,3 +135,5 @@ recordtype(histogram) {
interest(1)
}
}
variable(histogramSDELprecision, int)
+10 -3
View File
@@ -84,6 +84,11 @@ rset seqRSET={
};
epicsExportAddress(rset,seqRSET);
int seqDLYprecision = 2;
epicsExportAddress(int, seqDLYprecision);
double seqDLYlimit = 100000;
epicsExportAddress(double, seqDLYlimit);
/* Total number of link-groups in a sequence record */
#define NUM_LINKS 10
#define SELN_BIT_MASK ~(0xffff << NUM_LINKS)
@@ -448,7 +453,7 @@ static long get_precision(dbAddr *paddr, long *pprecision)
if (fieldOffset >= 0) switch (fieldOffset & 2) {
case 0: /* DLYn */
*pprecision = 2;
*pprecision = seqDLYprecision;
return 0;
case 2: /* DOn */
if (dbGetPrecision(get_dol(prec, fieldOffset),
@@ -486,9 +491,11 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
{
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
recGblGetControlDouble(paddr,pcd);
if (fieldOffset >= 0 && (fieldOffset & 2) == 0) /* DLYn */
if (fieldOffset >= 0 && (fieldOffset & 2) == 0) { /* DLYn */
pcd->lower_ctrl_limit = 0.0;
pcd->upper_ctrl_limit = seqDLYlimit;
} else
recGblGetControlDouble(paddr,pcd);
return(0);
}
+3
View File
@@ -231,3 +231,6 @@ recordtype(seq) {
interest(1)
}
}
variable(seqDLYprecision, int)
variable(seqDLYlimit, double)