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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Question about compress records |
From: | "Guyotte, Greg via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Mon, 8 Feb 2021 15:58:15 +0000 |
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 |