to pop up its description (if any).
ALGORITHM INIT IN Java : N.value = 0; MEAN.value = 0; SD.value = 0; MINX.value = 0; MAXX.value = 0; SUMX.value = 0; SUMX2.value = 0; END_ALGORITHM
ALGORITHM REQ IN Java :
N.value++;
SUMX.value += X.value;
MEAN.value = SUMX.value/N.value;
SUMX2.value += X.value*X.value;
if( N.value > 1 ){
SD.value = (float)Math.sqrt((SUMX2.value-MEAN.value*SUMX.value)/(N.value-1));
MINX.value = Math.min(MINX.value,X.value);
MAXX.value = Math.max(MAXX.value,X.value);}
else{
MINX.value = X.value;
MAXX.value = X.value;}
END_ALGORITHM
An instance of this Function Block type accumulates statistics on a
sequence of REAL values. The accumulation of statistics
is reset by an event at the INIT input, and a new value
is added to the sequence from the X input at each
occurrence of an event at the REQ input.
See the E_RDELAY_STATS
System configuration for an example of the use of an instance of this
FB Type.