Experimental Physics and Industrial Control System
|
The way a db record interprets the value of a waveform/compress VAL
field is not the same as when one performs a caget in a terminal?
In a terminal, ( $>> caget somePVwaveform ) returns the entire array of
values for the record. When called inside the CALC record, only the
first item of the array is returned?
-Tim
On 1/7/16 12:20 PM, Andrew Johnson wrote:
Hi Tim,
On 01/07/2016 10:41 AM, Southern, Tim wrote:
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?
Nice little problem.
A Solution:
I 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?
Assuming that your input is a counter that only ever increments, you
really only need the first compress record and a calc. The output from
your High Value compress will always be the same as the current spark
count $(S):FltCtr, and the first element read from the circular buffer
is the oldest value in the buffer (the one from an hour ago), which is
always the same as the output from your Low Value compress. Thus the
following is equivalent to your solution with fewer records:
#########################################################################
# Alarm for greater than 5 counts in 1 hour
#########################################################################
# Circular buffer of spark counts
record(compress,"$(S):1HrCmp"){
field(SCAN, "1 second")
field(NSAM, "3600")
field(N, "3600")
field(ALG, "Circular Buffer")
field(INP, "$(S):FltCtr") # ←- Record that increments
}
# 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):1HrCmp CP")
field(INPB, "$(S):FltCtr")
field(CALC, "B-A")
field(HIGH, "5")
field(HSV, "MAJOR")
}
HTH,
- Andrew
- Replies:
- RE: 5 counts in 1 hour Mark Rivers
- Re: 5 counts in 1 hour Andrew Johnson
- References:
- 5 counts in 1 hour Southern, Tim
- Re: 5 counts in 1 hour Andrew Johnson
- Navigate by Date:
- Prev:
RE: areaDetector driver pixel types Mark Rivers
- Next:
RE: 5 counts in 1 hour Mark Rivers
- 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: 5 counts in 1 hour Andrew Johnson
- Next:
RE: 5 counts in 1 hour Mark Rivers
- 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
|
ANJ, 15 Jul 2016 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|