From a8b20f07a8fd506ffcc6ecacb0d43421e274fd5a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 9 Apr 2009 15:03:09 +0000 Subject: [PATCH] Applied Bernd's devAiSoft SMOO patch. --- documentation/RELEASE_NOTES.html | 57 ++++++++++++++++++-------------- src/dev/softDev/devAiSoft.c | 21 ++++++++++-- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 56ec64251..8592c07f0 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -12,29 +12,39 @@

Changes between 3.14.10 and 3.14.11

+

Soft Channel ai device support and SMOO

+ +

The (probably unwritten) rules for ai device support have always required +that any device support which sets the VAL field and returns "2" should also +perform any other operations normally performed by the ai's convert() routine. +In practice very few devices did this, but there are some which makes it +impossible to move that smoothing function into the body of the record. This +change adds the support for SMOO filtering to the soft channel device support +for the ai record. The filter is short-circuited when a link recovers from a +failure.

+

New link flags for alarm severity/status inheritance

-

Two new link flags have been introduced: MSI (maximize severity INVALID) -and MSS (maximize severity and status).

+

Two new link flags have been introduced: MSI (Maximize Severity INVALID) +and MSS (Maximize Severity and Status).

-

Through a link flagged as MSI the receiver side inherits the severity -(similar to the MS flag), but only if it is INVALID.

+

When a link is flagged MSI the receiving record inherits the target's +severity as with the MS flag, but only if it is INVALID.

-

Through a link flagged as MSS the receiver side inherits as well the -severity (similar to the MS flag) as the alarm status, thereby preserving -the alarm status through MS chains instead of setting the status to LINK -unconditionally.

+

When a link is flagged MSS the receiving record inherits the target's alarm +status as well as its severity, thereby preserving the alarm status through MSS +chains instead of setting that status to LINK.

-

New behaviour of get_alarm_double() in analog records

+

Analog records get_alarm_double() semantics changed

-

The behavior of get_alarm_double() in several record types, which -have a value of type double and use alarm limits, has been changed.

+

The get_alarm_double() routine in several record types has been changed to +make it easier for CA client applications to display the correct warning and +alarm limits for a record.

-

The old behaviour (always returning the current settings of the alarm -limits fields) has been changed to returning epicsNAN (not-a-number) -if the severity of the corresponding limit is NO_ALARM. -This allows CA clients to suppress displaying of unused limits -(e.g. at bargraphs).

+

Originally these routines would always return the current values from the +associated alarm limit fields, but now they will return epicsNAN (not-a-number) +instead if the severity field of the corresponding limit is NO_ALARM. This +allows CA clients to suppress the display of unused limits.

New math constants epicsNAN and epicsINF

@@ -48,15 +58,14 @@ to support subscriptions that get events whenever a property of the PV changes. This will allow clients to get notified on changes of control limits, graphical limits, state strings etc.

-

The CA commandline tool camonitor and the CA Perl interface support -the new event type. -As a first working example, the mbbi and mbbo records have been extended -to send a DBE_PROPERTY event when their status strings are updated. -A more general mechanism to specify sending DBE_PROPERTY events through -the DBD file will appear in 3.15.

+

The CA commandline tool camonitor and the CA Perl interface support the new +event type. As a first working example, the mbbi and mbbo records have been +extended to send a DBE_PROPERTY event when their status strings are modified. +A more general mechanism to specify sending DBE_PROPERTY events through the DBD +file will appear in 3.15.

-

Application developers are encouraged to start using DBE_PROPERTY -subscriptions.

+

Client application developers are encouraged to start using DBE_PROPERTY +subscriptions to fetch channel attribute data.

PINI Processing Phases

diff --git a/src/dev/softDev/devAiSoft.c b/src/dev/softDev/devAiSoft.c index 2bdddac4b..d6a311237 100644 --- a/src/dev/softDev/devAiSoft.c +++ b/src/dev/softDev/devAiSoft.c @@ -70,12 +70,27 @@ static long init_record(aiRecord *prec) static long read_ai(aiRecord *prec) { - if (!dbGetLink(&prec->inp, DBR_DOUBLE, &prec->val, 0, 0)) { - if (prec->inp.type != CONSTANT) - prec->udf = FALSE; + double val; + + if (prec->inp.type == CONSTANT) + return 2; + + if (!dbGetLink(&prec->inp, DBR_DOUBLE, &val, 0, 0)) { + + /* Apply smoothing algorithm */ + if (prec->smoo != 0.0 && prec->dpvt) + prec->val = val * (1.00 - prec->smoo) + (prec->val * prec->smoo); + else + prec->val = val; + + prec->udf = FALSE; + prec->dpvt = &devAiSoft; /* Any non-zero value */ + if (prec->tsel.type == CONSTANT && prec->tse == epicsTimeEventDeviceTime) dbGetTimeStamp(&prec->inp, &prec->time); + } else { + prec->dpvt = NULL; } return 2; }