EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Ai device supports: smoothing issue when receiving FP values
From: Ralph Lange <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Wed, 06 Aug 2014 11:42:32 +0200
All,

There's an issue that has been identified and fixed recently, which affects device supports for the analog input record that handle incoming float and double values. [1]
Possibly affected: device support for field buses, intelligent devices, PLCs, serial connections, ...

If you are maintaining such a device support, please read the details and take action, if necessary.
If not, stay calm and carry on.

Cheers,
~Ralph


Details:
Any device support for the analog input record that handles floating point values (e.g., IEEE 754) being sent by the device has to apply the smoothing algorithm in the device support, as the record support does this as part of converting from integer to double, which is not used in case the device sends floating point values.

Typically, such a code snipped would look like:


        /* Apply smoothing algorithm */
        if (prec->smoo != 0.0)
            prec->val = val * (1.00 - prec->smoo) + (prec->val * prec->smoo);
        else
            prec->val = val;

This breaks if the record's value is not finite (i.e., NaN, +inf, or -inf) as the formula will never return a finite value, and the record is stuck at NaN/+inf/-inf and will never get back to a finite value, no matter what the device sends.

A possible simple fix is extending the condition:


        #include <epicsMath.h>
       
        /* Apply smoothing algorithm */
        if (prec->smoo != 0.0 && finite(prec->val))
            prec->val = val * (1.00 - prec->smoo) + (prec->val * prec->smoo);
        else
            prec->val = val;

Please check and fix your code if you expect devices to be capable of sending non-finite numbers.

[1] https://bugs.launchpad.net/epics-base/+bug/1351332


Navigate by Date:
Prev: Re: error of beacon Ralph Lange
Next: RE: st.cmd -- Line 30 -- Command seq not found. Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: st.cmd -- Line 30 -- Command seq not found. Benjamin Franksen
Next: VDCT priya tiwari
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·