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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Question about compress records |
From: | "Mooney, Tim M. via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, "Guyotte, Greg" <guyottegs at ornl.gov> |
Date: | Mon, 8 Feb 2021 16:13:39 +0000 |
Hi Greg,
The calc module has a database called userAve, which does a running average of a scalar PV. It's described here:
Tim Mooney (mooney at anl.gov) (630)252-5417
Beamline Controls Group (www.aps.anl.gov) Advanced Photon Source, Argonne National Lab From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Guyotte, Greg via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, February 8, 2021 9:58 AM To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Question about compress records Hello,
I’m attempting to use a pair of compress records to calculate the average of a scalar PV over a window of time.
The first compress record is the “Circular Buffer”, which has a size of 360 samples, with a SCAN period of “10 second”, thereby sampling the scalar PV (which is INP) over one hour of time.
record(compress, “Buffer”) { field(INP, “Current”) field(ALG, “Circular Buffer”) field(NSAM, “360”) field(SCAN, “10 second”) field(FLNK, “AvgCurrent”) }
The second compress record is set to “N to 1 Average”, taking as INP the array obtained from the circular buffer compress record. This record should process each time the circular buffer receives new data,
therefore the circular buffer record has a forward link to this record: record(compress, “AvgCurrent”) { field(INP, “Buffer”) field(ALG, “N to 1 Average”) field(N, “360”) }
What I find is that the “N to 1 average” record is invalid until the Circular buffer has filled up (e.g. after one hour in my case). After the circular buffer is full of samples, it works as expected.
I have also tried to compute the average with an acalcout record, but I got the same result.
Is this the expected outcome, or can anyone suggest how to implement so that average works before the circular buffer is full? Is there perhaps a way I can initialize the circular buffer?
Thanks, Greg Guyotte |