I have tested this solution and it works beautifully. Thanks Matt!
From: Pearson, Matthew R. <pearsonmr at ornl.gov>
Sent: Monday, February 8, 2021 1:45 PM
To: Guyotte, Greg <guyottegs at ornl.gov>; Ralph Lange <ralph.lange at gmx.de>
Cc: tech-talk at aps.anl.gov
Subject: RE: [EXTERNAL] Re: Question about compress records
Hi Greg,
This might be a work around, until the feature is added to the compress record. You can copy the NUSE field and write it to the N field as the circular buffer fills up:
record(ai, "$(P)$(R)Test") {
field(VAL, "0.0")
field(FLNK, "$(P)$(R)Buffer")
}
record(compress, "$(P)$(R)Buffer") {
field(INP, "$(P)$(R)Test")
field(ALG, "Circular Buffer")
field(NSAM, "10")
field(FLNK, "$(P)$(R)AverageCalc")
}
record(longout, "$(P)$(R)AverageCalc") {
field(OMSL, "closed_loop")
field(DOL, "$(P)$(R)Buffer.NUSE")
field(OUT, "$(P)$(R)Average.N")
field(FLNK, "$(P)$(R)Average")
}
record(compress, "$(P)$(R)Average") {
field(INP, "$(P)$(R)Buffer")
field(ALG, "N to 1 Average")
}
Cheers,
Matt
That sounds correct to me Ralph. I’m at least satisfied to know that the current operation is as expected. I will try the solution suggested by Tim Mooney as well – thanks Tim.
Is it correct to write what you're missing as:
The compress record in its "N to 1 Xxx" modes, when reading an INP array that has less than NSAM * N elements (or while still filling its internal circular buffer), should use all existing elements of the INP array
(or the internal buffer) and calculate as much of the resulting VAL array as possible, before firing VAL monitors and forward links.
Such a change should probably have a configuration switch, defaulting to the current behavior.
Sounds like a nice codeathon
project!