EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Problem with epics alarm
From: Sue Witherspoon <[email protected]>
To: [email protected], [email protected]
Cc: [email protected]
Date: Fri, 08 Oct 1999 12:23:17 -0400
Epics core guru's,

The problem is in the epics alarm subroutine: 
  (snipit from an ai record)

static void alarm(aiRecord *pai)
{
    double      val;
    float       hyst, lalm, hihi, high, low, lolo;
    unsigned short  hhsv, llsv, hsv, lsv;

    if(pai->udf == TRUE ){
        recGblSetSevr(pai,UDF_ALARM,INVALID_ALARM);
        return;
    }
    hihi = pai->hihi; lolo = pai->lolo; high = pai->high; low = pai->low;
    hhsv = pai->hhsv; llsv = pai->llsv; hsv = pai->hsv; lsv = pai->lsv;
    val = pai->val; hyst = pai->hyst; lalm = pai->lalm;

    /* alarm condition hihi */
    if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
            if (recGblSetSevr(pai,HIHI_ALARM,pai->hhsv)) pai->lalm = hihi;
        return;
    }

The comparison between a double and a float is okay as long as the precision of
the comparison is not very large. For instance

 if val = 125303.000 and hihi = 125303.001 the above comparision
 would give you an alarm.

On the surface the solution would be to change the type of hihi to
be double but on further inspection the ascii file for this record
says that the field is DBF_FLOAT? Does this imply that the
size of the record must also change?

Your insight would be greatly appreciated.

Oh by the way I'm using:
   Epics version 3.13.0Beta 12
   mv167
   Hp-ux 10.2 unix host
______________________________________________________________
Sue D. Witherspoon                      TJNAF - CEBA 
[email protected]                        (757) 269-7579 
If my people would Humble, Pray, Seek and Turn....2 Chron. 7:14


Replies:
Re: Problem with epics alarm Benjamin Franksen
Re: Problem with epics alarm Andrew Johnson

Navigate by Date:
Prev: Re: problem w/ 3.13.1 -> 3.13.1.1 Dale L. Brewe
Next: Re: Problem with epics alarm Benjamin Franksen
Index: 1994  1995  1996  1997  1998  <19992000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: problem w/ 3.13.1 -> 3.13.1.1 Dale L. Brewe
Next: Re: Problem with epics alarm Benjamin Franksen
Index: 1994  1995  1996  1997  1998  <19992000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·