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  <20122013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: AO ALST & MLST stuck at nan.
From: "Zelazny, Michael Stanley" <zelazny@slac.stanford.edu>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 4 Oct 2012 15:53:24 -0700
I have an AO record whose ALST & MLST are stuck at nan:

$ caget KLYS:LI23:81:PJTN KLYS:LI23:81:PJTN.PVAL KLYS:LI23:81:PJTN.LALM KLYS:LI23:81:PJTN.ALST KLYS:LI23:81:PJTN.MLST KLYS:LI23:81:PJTN.ADEL KLYS:LI23:81:PJTN.MDEL KLYS:LI25:81:PJTN KLYS:LI25:81:PJTN.PVAL KLYS:LI25:81:PJTN.LALM KLYS:LI25:81:PJTN.ALST KLYS:LI25:81:PJTN.MLST  KLYS:LI25:81:PJTN.ADEL  KLYS:LI25:81:PJTN.MDEL
 KLYS:LI23:81:PJTN              0.164428
 KLYS:LI23:81:PJTN.PVAL         0.164428
 KLYS:LI23:81:PJTN.LALM         0.164428
 KLYS:LI23:81:PJTN.ALST         nan
 KLYS:LI23:81:PJTN.MLST         nan
 KLYS:LI23:81:PJTN.ADEL         0
 KLYS:LI23:81:PJTN.MDEL         0
 KLYS:LI25:81:PJTN              0.0761155
 KLYS:LI25:81:PJTN.PVAL         0.0761155
 KLYS:LI25:81:PJTN.LALM         0.0761155
 KLYS:LI25:81:PJTN.ALST         0.0761155
 KLYS:LI25:81:PJTN.MLST         0.0761155
 KLYS:LI25:81:PJTN.ADEL         0
 KLYS:LI25:81:PJTN.MDEL         0

Once ADEL is stuck at nan, the AO record support has no way to clear this.  From aoRecord.c:

        /* check for archive change */
        delta = prec->alst - prec->val;
        if(delta<0.0) delta = -delta;
        if (delta > prec->adel) {
                /* post events on value field for archive change */
                monitor_mask |= DBE_LOG;
                /* update last archive value monitored */
                prec->alst = prec->val;
        }

According to Matjaz Kobal, COSYLAB, "Every arithmetic expression that includes a NAN value will have a NAN value as a result. So "delta" will have a value of NAN. Also every comparison with a NAN value will return false. So none of the two if statements will execute their bodies and the monitor_mask will not change. Since the ALST field value is not changed anywhere else, there is no way to get inside the if statement."

I have not verified the above statement, but I believe it to be true.

Q1: Have you ever seen this?  If you have, how did you overcome it?  

My testing tells me ALST doesn't get set to nan when VAL goes to nan.  Example:

lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201 SIOC:SYS0:ML02:AO201.ALST SIOC:SYS0:ML02:AO201.MLST
SIOC:SYS0:ML02:AO201           0 
SIOC:SYS0:ML02:AO201.ALST      0 
SIOC:SYS0:ML02:AO201.MLST      0 
lcls-zelazny bash:~>caput SIOC:SYS0:ML02:AO201 1
Old : SIOC:SYS0:ML02:AO201           0 
New : SIOC:SYS0:ML02:AO201           1 
lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201 SIOC:SYS0:ML02:AO201.ALST SIOC:SYS0:ML02:AO201.MLST
SIOC:SYS0:ML02:AO201           1 
SIOC:SYS0:ML02:AO201.ALST      1 
SIOC:SYS0:ML02:AO201.MLST      1 
lcls-zelazny bash:~>caput SIOC:SYS0:ML02:AO201 nan
Old : SIOC:SYS0:ML02:AO201           1 
New : SIOC:SYS0:ML02:AO201           nan 
lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201 SIOC:SYS0:ML02:AO201.ALST SIOC:SYS0:ML02:AO201.MLST
SIOC:SYS0:ML02:AO201           nan 
SIOC:SYS0:ML02:AO201.ALST      1 
SIOC:SYS0:ML02:AO201.MLST      1 
lcls-zelazny bash:~>caput SIOC:SYS0:ML02:AO201 nan
Old : SIOC:SYS0:ML02:AO201           nan 
New : SIOC:SYS0:ML02:AO201           nan 
lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201 SIOC:SYS0:ML02:AO201.ALST SIOC:SYS0:ML02:AO201.MLST
SIOC:SYS0:ML02:AO201           nan 
SIOC:SYS0:ML02:AO201.ALST      1 
SIOC:SYS0:ML02:AO201.MLST      1 
lcls-zelazny bash:~>caput SIOC:SYS0:ML02:AO201 2  
Old : SIOC:SYS0:ML02:AO201           nan 
New : SIOC:SYS0:ML02:AO201           2 
lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201 SIOC:SYS0:ML02:AO201.ALST SIOC:SYS0:ML02:AO201.MLST
SIOC:SYS0:ML02:AO201           2 
SIOC:SYS0:ML02:AO201.ALST      2 
SIOC:SYS0:ML02:AO201.MLST      2 
lcls-zelazny bash:~>caget SIOC:SYS0:ML02:AO201.ADEL SIOC:SYS0:ML02:AO201.MDEL                 
SIOC:SYS0:ML02:AO201.ADEL      0 
SIOC:SYS0:ML02:AO201.MDEL      0 
lcls-zelazny bash:~>

Q2: Any idea HOW my ALST & MLST got nan?

I'm running a soft IOC on RHEL5 with EPICS 3.14.12.

I'm tempted to change the code to:

        if ((epicsNAN == delta) || (delta > prec->adel)) {
                /* post events on value field for archive change */
                monitor_mask |= DBE_LOG;
                /* update last archive value monitored */
                prec->alst = prec->val;
        }

Q3: Is there any reason I shouldn't?

Thanks in advance for your help!

Mike



Replies:
Re: AO ALST & MLST stuck at nan. Andrew Johnson

Navigate by Date:
Prev: Lambda-TDK Genesys support Jiro Fujita
Next: Re: Announcing pymsi - EPICS macro substitution and expansion tool Angus Gratton
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
Navigate by Thread:
Prev: RE: Lambda-TDK Genesys support Szalata, Zenon M.
Next: Re: AO ALST & MLST stuck at nan. Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·