On 03/31/2017 10:05 AM, Kasemir, Kay wrote:
>
> 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.
It may be easier to do the time manipulation in C code, but it should be
possible to do it purely in the database. An ai record with its DTYP
field set to "Soft Timestamp" returns the number of seconds +
nanoseconds since the EPICS epoch whenever it gets processed. A calcout
record would also be a good idea following this, since it can
conditionally process its output link based on a separate expression.
Alternatively you could create a scan thread with a 24-hour scan period,
although you won't them get to to control when in the day it will
actually process (it will be every 24 hours from the time when the IOC
was started). To do this just copy the file menuScan.dbd from base/dbd
into your IOC's *App/src directory and add a new entry at the top of the
list of periodic scans with the appropriate period in the choice scrint.
If you're using Base-3.15 that's slightly easier than with 3.14 since
your string can be just "24 hours"; in 3.14 the number must be expressed
in seconds.
- Andrew
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
- Replies:
- Re: Reset integral pv and store it Kasemir, Kay
- References:
- Reset integral pv and store it Miguel
- Re: Reset integral pv and store it Kasemir, Kay
- Navigate by Date:
- Prev:
Re: Reset integral pv and store it Kasemir, Kay
- Next:
Re: Reset integral pv and store it Kasemir, Kay
- 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>
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Reset integral pv and store it Kasemir, Kay
- Next:
Re: Reset integral pv and store it Kasemir, Kay
- 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>
2018
2019
2020
2021
2022
2023
2024
|