EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Ideas for Codeathon
From: "Kalantari Babak" <[email protected]>
To: "Andrew Johnson" <[email protected]>
Cc: [email protected]
Date: Tue, 17 Feb 2009 10:06:05 +0100
This might be of interest:

Sometime ago I tried to use CA monitor on a waveform channel. I realized
that a monitor occurs "every time" when the waveform channel gets
processed irrespective of channel content change (maybe this has a
reason?). 
I thought (and I needed) that a monitor should only occur when the
content of channel (e.g. one or more element) changes. Therefore I
modified the waveform record to do so and called it "psiwaveform" which
I load separately (like a dev/drv) to avoid conflict with "waveform" in
base.   

The modification is as the following:
- added a filed called "CHKS" that keeps the checksum (or hash) of the
current (or previous if you like) content of the waveform. 
- Next time when the record is processed, it calculates the checksum of
new content and checks if it is different than what is kept in "CHKS"
filed; if this is the case a monitor happens otherwise not.

This is how the implementation looks like:

static void monitor(pwf)
    struct psiwaveformRecord    *pwf;
{
        unsigned short  monitor_mask;
        unsigned long   checksum;

        monitor_mask = recGblResetAlarms(pwf);
        checksum = adler_32((char *)pwf->bptr,pwf->nelm*sizeofTypes[pwf
>ftvl]);
        if(checksum != pwf->chks){
            monitor_mask |= DBE_LOG | DBE_VALUE;
            pwf->chks = checksum;
        }
        if(monitor_mask) db_post_events(pwf,pwf->bptr,monitor_mask);
        return;
}

In that "adler_32" is "Adler-32" checksum algorithm. It is not the best
algorithm but fast. One could use other algorithms or select an
algorithm depending on the waveform size to avoid monitor misses due to
imperfection of the checksum algorithm. 

The modification was rather simple however it might need a closer look
to check for all data types, the load it puts on processing, etc. For us
it has been working well.
Maybe this could also be done for the waveform record in base.

Babak  
  


Replies:
Re: Ideas for Codeathon Andrew Johnson
References:
Ideas for Codeathon Bernd Schoeneburg
Re: Ideas for Codeathon Andrew Johnson

Navigate by Date:
Prev: Re: Ideas for Codeathon Andrew Johnson
Next: Re: Ideas for Codeathon Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Ideas for Codeathon Andrew Johnson
Next: Re: Ideas for Codeathon Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·