Merge branch '7.0' (after codeathon 2023) into PSI-7.0
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "dbEvent.h"
|
||||
#include "dbFldTypes.h"
|
||||
#include "errMdef.h"
|
||||
#include "menuYesNo.h"
|
||||
#include "special.h"
|
||||
#include "recSup.h"
|
||||
#include "recGbl.h"
|
||||
@@ -166,9 +167,9 @@ static int compress_array(compressRecord *prec,
|
||||
}
|
||||
if (prec->n <= 0)
|
||||
prec->n = 1;
|
||||
n = prec->n;
|
||||
if (no_elements < n)
|
||||
if (no_elements < prec->n && prec->pbuf != menuYesNoYES)
|
||||
return 1; /*dont do anything*/
|
||||
n = no_elements;
|
||||
|
||||
/* determine number of samples to take */
|
||||
if (no_elements < nsam * n)
|
||||
@@ -272,7 +273,7 @@ static int array_average(compressRecord *prec,
|
||||
prec->inx = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int compress_scalar(struct compressRecord *prec,double *psource)
|
||||
{
|
||||
double value = *psource;
|
||||
@@ -292,19 +293,13 @@ static int compress_scalar(struct compressRecord *prec,double *psource)
|
||||
/* for scalars, Median not implemented => use average */
|
||||
case (compressALG_N_to_1_Average):
|
||||
case (compressALG_N_to_1_Median):
|
||||
if (inx == 0)
|
||||
*pdest = value;
|
||||
else {
|
||||
*pdest += value;
|
||||
if (inx + 1 >= prec->n)
|
||||
*pdest = *pdest / (inx + 1);
|
||||
}
|
||||
*pdest = (inx * (*pdest) + value) / (inx + 1);
|
||||
break;
|
||||
}
|
||||
inx++;
|
||||
if (inx >= prec->n) {
|
||||
if ((inx >= prec->n) || (prec->pbuf == menuYesNoYES)) {
|
||||
put_value(prec,pdest,1);
|
||||
prec->inx = 0;
|
||||
prec->inx = (inx >= prec->n) ? 0 : inx;
|
||||
return 0;
|
||||
} else {
|
||||
prec->inx = inx;
|
||||
|
||||
@@ -40,7 +40,7 @@ the beginning or the end of the VAL array.
|
||||
|
||||
=head2 Parameter Fields
|
||||
|
||||
The record-specific fields are described below.
|
||||
The record-specific fields are described below, grouped by functionality.
|
||||
|
||||
=recordtype compress
|
||||
|
||||
@@ -60,10 +60,6 @@ menu(bufferingALG) {
|
||||
}
|
||||
recordtype(compress) {
|
||||
|
||||
=head2 Parameter Fields
|
||||
|
||||
The record-specific fields are described below, grouped by functionality.
|
||||
|
||||
=head3 Scanning Parameters
|
||||
|
||||
The compression record has the standard fields for specifying under what
|
||||
@@ -85,7 +81,7 @@ algorithms which can be specified as follows:
|
||||
|
||||
The following fields determine what channel to read and how to compress the data:
|
||||
|
||||
=fields ALG, INP, NSAM, N, ILIL, IHIL, OFF, RES
|
||||
=fields ALG, INP, NSAM, N, ILIL, IHIL, OFF, RES, PBUF
|
||||
|
||||
As stated above, the ALG field specifies which algorithm to be performed on the data.
|
||||
|
||||
@@ -167,6 +163,23 @@ Compress N to 1 samples, taking the median value.
|
||||
|
||||
=back
|
||||
|
||||
The behaviour of the record for partially filled buffers depends on the field PBUF.
|
||||
If PBUF is set to NO, then the record will wait until the buffer is completely full
|
||||
before processing. If PBUF is set to YES, then it will start processing immediately.
|
||||
|
||||
For example, if ALG is set to C<<< N to 1 Average >>> with NSAM equal to 4, N equal
|
||||
to 1, and PBUF set to NO, then the first three times that the compress record is
|
||||
processed it will remain in an undefined state. On the fourth process, the average
|
||||
of all four records will be calculated and placed into the VAL field.
|
||||
|
||||
If PBUF is set to YES, then after each process the average of the first several
|
||||
elements will be calculated.
|
||||
|
||||
Note that PBUF has no impact on the C<<< Average >>> method. If one wishes to have a
|
||||
rolling average computed, then the best way to achieve that is with two compress
|
||||
records: a C<<< Circular buffer >>> which is linked to an C<<< N to 1 Average >>>
|
||||
record with PBUF set to YES.
|
||||
|
||||
The compression record keeps NSAM data samples.
|
||||
|
||||
The field N determines the number of elements to compress into each result.
|
||||
@@ -393,7 +406,15 @@ Scan forward link if necessary, set PACT FALSE, and return.
|
||||
interest(1)
|
||||
menu(compressALG)
|
||||
}
|
||||
field(BALG,DBF_MENU) {
|
||||
field(PBUF,DBF_MENU) {
|
||||
prompt("Use Partial buffers")
|
||||
promptgroup("30 - Action")
|
||||
special(SPC_RESET)
|
||||
interest(1)
|
||||
menu(menuYesNo)
|
||||
initial("NO")
|
||||
}
|
||||
field(BALG,DBF_MENU) {
|
||||
prompt("Buffering Algorithm")
|
||||
promptgroup("30 - Action")
|
||||
special(SPC_RESET)
|
||||
|
||||
@@ -271,7 +271,7 @@ static long special(DBADDR *paddr, int after)
|
||||
} else if(after==1 && fieldIndex >= mbboDirectRecordB0 && fieldIndex <= mbboDirectRecordB1F) {
|
||||
/* Adjust VAL corresponding to the bit changed */
|
||||
epicsUInt8 *pBn = (epicsUInt8 *) paddr->pfield;
|
||||
epicsUInt32 bit = 1 << (pBn - &prec->b0);
|
||||
epicsUInt32 bit = 1u << (pBn - &prec->b0);
|
||||
|
||||
/* Because this is !(VAL and PP), dbPut() will always post a monitor on this B* field
|
||||
* after we return. We must keep track of this change separately from MLST to handle
|
||||
|
||||
@@ -162,7 +162,7 @@ static long process(struct dbCommon *pcommon)
|
||||
recGblFwdLink(prec);
|
||||
prec->pact = FALSE;
|
||||
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
static long special(DBADDR *paddr, int after)
|
||||
|
||||
Reference in New Issue
Block a user