EPICS Controls 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  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: Problem with compress record in version 7.0.8
From: "Waddel, Matt via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 11 Mar 2024 13:19:14 +0000
Hello,

I believe a bug was introduced to the compress record between versions 7.0.7 and 7.0.8. The details are outlined below, but it seems like the "N" entry of the compress record is not being used in the latest compress calculations.

Attached is a patch for review that fixes the problem.

Thanks,
Matt Waddel
ORNL

Details: We have a record which reads 12500 entries from a ADC input. The 12500 gets reduced to 125 entries by averaging 100 elements at a time:

record( waveform, "$(S)_Mag:PS_IKick_$(PsId):CurPsWf" ) {
  field( DESC, "PS IKick Gen $(PsId) Waveform")
  field( SCAN, "2 second" )
  field( NELM, "12500" )
  field( FTVL, "LONG" )
  field( DTYP, "InjWfGen" )
  field( INP,  "@$(InpDvc) f=bar1Wf c=$(Chan)" )
}
record( compress, "$(S)_Mag:PS_IKick_$(PsId):SmallCurPsWf" ) {
  field( DESC, "Decimated $(PsId) Waveform")
  field( INP, "$(S)_Mag:PS_IKick_$(PsId):CurPsWf CP" )
  field( ALG, "N to 1 Average" )
  field( N, "100" )
  field( NSAM, "125" )
}

Here is a small sample of the expanded entries:
$ caget Test_Dev_Mag:PS_IKick_H01:CurPsWf
Test_Dev_Mag:PS_IKick_H01:CurPsWf 12500 1228 1229 1230 1230 1231 1231 1232 1233 1233 1234 1234 1235 1236 1236 1237 1237 1238 1239 1239 1240 1240 1241 1242 1242 1243 1243 1244 1245 1245 1246 1246 1247 1248 1248 1249 1249 1250 1251 1251 1252 1252 1253 1254 1254 1255 1255 1256 1257 1257 1258 1258 1259 1260 1260 1261 1261 1262 1263 1263 1264 1264 1265 1266 1266 1267 1267 1268 1269 1269 1270 1270 1271 1272 1272 1273 1273 1274 1275 1275 1276 1276 1277 1278 1278 1279 1279 1280 1281 1281 1282 1282 1283 1284 1284 1285 1285 1286 1287 1287 1288 1288 1289 1290 1290 1291 1291 1292 1293 1293 1294 1294 1295 1296 1296 1297 1297 1298 1299 1299 1300 1300 1301 1302 1302 1303 1303 1304 1305 1305 1306 1306 1307 1308 1308 1309 1309 1310 1311
...

In version 7.0.7 the SmallCurPsWf results PV looked like this:
$ caget Test_Dev_Mag:PS_IKick_H01:SmallCurPsWf
Test_Dev_Mag:PS_IKick_H01:SmallCurPsWf 125 1258.1 1318.1 1378.1 1438.1 1498.1 1558.1 1618.1 1678.1 1738.1 1798.1 1858.1 1918.1 1978.1 2038.1 2098.1 2158.1 2218.1 2278.1 2338.1 2398.1 2458.1 2518.1 2578.1 2638.1 2698.1 2758.1 2818.1 2878.1 2938.1 2998.1 3058.1 3118.1 3178.1 3238.1 3298.1 3358.1 3418.1 3478.1 3538.1 3598.1 3658.1 3718.1 3778.1 3838.1 3898.1 3958.1 4018.1 4078.1 4138.1 4198.1 4258.1 4318.1 4378.1 4438.1 4498.1 4558.1 4618.1 4678.1 4738.1 4798.1 4858.1 4918.1 4978.1 5038.1 5098.1 5158.1 5218.1 5278.1 5338.1 5398.1 5458.1 5518.1 5578.1 5638.1 5698.1 5758.1 5818.1 5878.1 5938.1 5998.1 6058.1 6118.1 6178.1 6238.1 6298.1 6358.1 6418.1 6478.1 6538.1 6598.1 6658.1 6718.1 6778.1 6838.1 6898.1 6958.1 7018.1 7078.1 7138.1 7198.1 7258.1 7318.1 7378.1 7438.1 7498.1 7558.1 7618.1 7678.1 7738.1 7798.1 7858.1 7918.1 7978.1 8038.1 8098.1 8158.1 8218.1 8278.1 8338.1 8398.1 8458.1 8518.1 8578.1 8638.1 8698.1

However, in version 7.0.8 the output is the same value and each one of these entries was made every 2 seconds over about a 2 minute time period.
$ caget Test_Dev_Mag:PS_IKick_H01:SmallCurPsWf
Test_Dev_Mag:PS_IKick_H01:SmallCurPsWf 125 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1 4978.1

In the algorithm "n" became the total number of elements no matter what the N in "field( N, "100" )" was set to.
-    n = no_elements;
+    n = prec->n;

Let me know if you have any questions.

diff --git a/modules/database/src/std/rec/compressRecord.c b/modules/database/src/std/rec/compressRecord.c
index b6fafb4ab..5d6b19638 100644
--- a/modules/database/src/std/rec/compressRecord.c
+++ b/modules/database/src/std/rec/compressRecord.c
@@ -169,7 +169,7 @@ static int compress_array(compressRecord *prec,
         prec->n = 1;
     if (no_elements < prec->n && prec->pbuf != menuYesNoYES)
         return 1; /*dont do anything*/
-    n = no_elements;
+    n = prec->n;
 
     /* determine number of samples to take */
     if (no_elements < nsam * n)

Replies:
Re: Problem with compress record in version 7.0.8 Ralph Lange via Tech-talk

Navigate by Date:
Prev: Re: pvget syntax Charter via Tech-talk
Next: Possibility of adding/appending data to existing PVs Windsor Tanner via Tech-talk
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: pvget syntax Charter via Tech-talk
Next: Re: Problem with compress record in version 7.0.8 Ralph Lange via Tech-talk
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, 13 Mar 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·