EPICS Home

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  <20172018  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  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Reset integral pv and store it
From: "Kasemir, Kay" <[email protected]>
To: Miguel <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Fri, 31 Mar 2017 15:05:59 +0000
Hi:

> On Mar 31, 2017, at 10:47 AM, Miguel <[email protected]> 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  <20172018  2019  2020  2021  2022  2023  2024 
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  <20172018  2019  2020  2021  2022  2023  2024