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

Subject: 5 counts in 1 hour
From: "Southern, Tim" <t1o@ornl.gov>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 7 Jan 2016 11:41:26 -0500

Keeping with TIMTOWTDI, I was wondering what solutions others would use to solve a database request.

  

Problem:

We have a spark detector that will increment a counter every time a spark is detected.  The user requests an alarm when the counter increments +5 times within an hour. How can this be implemented on an IOC?


A Solution:

I used came up with a solution using compress records. First, I created a 3600 element compress record using a circular buffer that records the value of the PV counter every second for an hour.  Next, I created two more compress records, one that saved the lowest value, and one that saved the highest value of the first record (N to 1 Low Value, N to 1 High Value). I then created a CALC record that calculated the difference of the low and high values. When CALC is greater than 5 ... then alarm.


Is there a better implementation to do this? Is there anything wrong with this solution?


Thanks,

Tim  


#########################################################################
# Alarm for greater than 5 counts in 1 hour
#########################################################################

# ALG = Circular Buffer
record(compress,"$(S):1HrCmp"){
field(SCAN, "1 second")
field(NSAM, "3600")
field(N, "3600")
field(ALG, "4")
field(INP, "$(S):FltCtr")   # ←- Record that increments
}

# ALG = N to 1 Low Value
record(compress, "$(S):1HrCmpL"){
field(NSAM, "1")
field(N, "3600")
field(ALG, "0")
field(INP, "$(S):1HrCmp CP")
}

# ALG = N to 1 High Value
record(compress, "$(S):1HrCmpH"){
field(NSAM, "1")
field(N, "3600")
field(ALG, "1")
field(INP, "$(S):1HrCmp CP")
}

# Difference of High and Low over time of circular buffer
# Alarms when count is greater than 5
record(calc, "$(S):1HrCmp_diff"){
 field(INPA, "$(S):1HrCmpL CP")
 field(INPB, "$(S):1HrCmpH CP")
 field(CALC, "B-A")
 field(HIGH, "5")
 field(HSV, "MAJOR")
}

Replies:
Re: 5 counts in 1 hour Andrew Johnson

Navigate by Date:
Prev: RE: Please, help me. st.cmd Mark Rivers
Next: areaDetector driver pixel types Phil Atkin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017 
Navigate by Thread:
Prev: RE: Please, help me. st.cmd Mark Rivers
Next: Re: 5 counts in 1 hour 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  <20162017 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·