EPICS Controls 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  2018  <20192020  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  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Count record that resets by date
From: Eric Norum via Tech-talk <[email protected]>
To: Daniel Cuneo <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Wed, 13 Mar 2019 15:12:47 -0700
Here’s an all-database solution that does what you want, I think.  I’m no expert on databases, so there may very well be ways of doing this with fewer records.
The ‘count’ record increments each time it’s processed unless the ‘clear’ record has pushed a 1 into the ‘C’ field.

record(bi, "$(user):now") {
    field(PINI, "YES")
    field(SCAN, "10 second")
    field(FLNK, "$(user):day")
}
record(stringin, "$(user):day") {
    field(DTYP, "Soft Timestamp")
    field(INP,  "@%j")
    field(TSEL, "$(user):now.TIME")
    field(FLNK, "$(user):clear")
}
record(calcout, "$(user):clear") {
    field(INPA, "$(user):day NPP MS")
    field(INPB, "1000")
    field(CALC, "A<B;B:=A")
    field(OOPT, "When Non-zero")
    field(OCAL, "1")
    field(OUT,  "$(user):count.C PP")
}
record(calc, "$(user):count") {
    field(VAL,  "0")
    field(TPRO, 1)
    field(CALC, "C?0:VAL+1;C:=0")
}


On Mar 13, 2019, at 2:07 PM, Daniel Cuneo via Tech-talk <[email protected]> wrote:

Hi all,
I'd like to create a database record that counts based on a forward link. This record would need to reset back to zero 
at 12AM every day. 

Use case, is where a beam line user hits a reset button repeatably (tied to a bo record) as a work around for something that is broken.
I'd like to track these resets.

Is there a way to do this with base?
I'm considering writing a C subroutine for this is it doesn't already exist.

Cheers!
dpc


Replies:
Re: Count record that resets by date Daniel Cuneo via Tech-talk
References:
Count record that resets by date Daniel Cuneo via Tech-talk

Navigate by Date:
Prev: Fw: Count record that resets by date Mooney, Tim M. via Tech-talk
Next: Re: Count record that resets by date Daniel Cuneo via Tech-talk
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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Fw: Count record that resets by date Mooney, Tim M. via Tech-talk
Next: Re: Count record that resets by date Daniel Cuneo via Tech-talk
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  <20192020  2021  2022  2023  2024 
ANJ, 13 Mar 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·