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

Subject: Re: Reset integral pv and store it
From: "Kasemir, Kay" <kasemirk@ornl.gov>
To: Miguel <miguel.b.fernandes@gmail.com>
Cc: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Fri, 31 Mar 2017 15:05:59 +0000
Hi:

> On Mar 31, 2017, at 10:47 AM, Miguel <miguel.b.fernandes@gmail.com> wrote:
> I have a PV that is an integral over the day. I would like at the end of the day(certain timestamp) to store it to the DB (maybe in another PV) and after that reset the integral.
Not sure about a more elegant solution, but what I’ve done to trigger processing of records at a certain time, for example “10 seconds after midnight” on each day was using a sequence. In C code you can get the current time of day in the local time zone, and determine how long you’d have to sleep until some specific time. A sequence can ‘delay()’ that long and then write to some PV which triggers what you want to happen, or post an EPICS event and then have records process on the event.
You can also call similar C code from a subroutine record, but there you can’t sleep/delay. Instead, periodically process the subroutine record which for example returns how many more seconds are left to the next threshold timestamp and use that in a calcout record to trigger processing when the time comes. 

On the archive side, just archive the PVs that you want to save on “monitor” since they only send a monitor at that certain time stamp.

> I would also like that if epics restarts the intergal will initiate with the most recent value in the DB.
Having the IOC read from the DB on startup would be tricky.
I’d use autosave/restore to keep the most recent value of your integrating record.
So the IOC doesn’t read from the DB, it just counts back up with the last value it placed in the autosave file.

-Kay


Replies:
Re: Reset integral pv and store it Andrew Johnson
References:
Reset integral pv and store it Miguel

Navigate by Date:
Prev: Reset integral pv and store it Miguel
Next: Re: Reset integral pv and store it Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Reset integral pv and store it Miguel
Next: Re: Reset integral pv and store it Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 31 Mar 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·