public class Accumulate extends ValueStatistics
Accumulate
class is providing a statistic analysis about
one value. The mean value and the standard deviation is weighted over time.UNDEFINED
Constructor and Description |
---|
Accumulate(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructor for a Accumulate object that will not be connected to a
ValueSupplier automatically. |
Accumulate(Model ownerModel,
java.lang.String name,
double initialValue,
boolean showInReport,
boolean showInTrace)
Constructor for a Accumulate object that will not be connected to a
ValueSupplier automatically. |
Accumulate(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
boolean automatic,
boolean showInReport,
boolean showInTrace)
Constructor for a Accumulate object that will be connected to a
ValueSupplier , from which the values will be fetched. |
Modifier and Type | Method and Description |
---|---|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Accumulate.
|
boolean |
doesRetainLastValueOnReset()
This method determines whether if the accumulate's last value is
retained on reset (true) or nullified (false).
|
double |
getMean()
Returns the mean value of all the values observed so far, weighted over
time.
|
TimeSpan |
getPeriodMeasured()
Returns the period measured (excluding pauses).
|
double |
getStdDev()
Returns the standard deviation of all the values observed so far,
weighted over time.
|
void |
pause()
Temporarily suspend data collection to exclude a period, e.g. to disregard
the night period in which a plant is closed from machine utilization statistics.
|
void |
reset()
Resets this Accumulate object by resetting all variables to 0.0.
|
void |
setRetainLastValueOnReset(boolean retainValue)
Sets the value of the retainLastValueOnResetFlag.
|
void |
update()
Updates this
Accumulate object by fetching the actual
value of the ValueSupplier and processing it. |
void |
update(double val)
Updates this
Accumulate object with the double value given
as parameter. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Implementation of the virtual
update(Observable, Object)
method of the Observer interface. |
getLastValue, getMaximum, getMinimum, update
getShowTimeSpansInReport, getUnit, setShowTimeSpansInReport
getUnitText, round, setUnit
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public Accumulate(Model ownerModel, java.lang.String name, ValueSupplier valSup, boolean automatic, boolean showInReport, boolean showInTrace)
ValueSupplier
, from which the values will be fetched.ownerModel
- Model : The model this Accumulate is associated toname
- java.lang.String : The name of this Accumulate objectvalSup
- ValueSupplier : The ValueSupplier providing the value for this
Accumulate. The given ValueSupplier will be observed by this
Accumulate
object, if it is not observed
automatically at every tick of the SimClock.automatic
- boolean : Flag for observing the ValueSupplier at every tick
of the SimClock. Set it to true
to have it
observed at every SimClock tick.showInReport
- boolean : Flag for showing the report about this Accumulate.showInTrace
- boolean : Flag for showing the trace output of this
Accumulate.public Accumulate(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace)
ValueSupplier
automatically. No specific initial value
is assumed, so that the period covered effectively begins after the
first update.ownerModel
- Model : The model this Accumulate is associated toname
- java.lang.String : The name of this Accumulate object.showInReport
- boolean : Flag for showing the report about this Accumulate.showInTrace
- boolean : Flag for showing the trace output of this
Accumulate.public Accumulate(Model ownerModel, java.lang.String name, double initialValue, boolean showInReport, boolean showInTrace)
ValueSupplier
automatically. An initial value stated
explicitly will be assumed after creation/reset.ownerModel
- Model : The model this Accumulate is associated toname
- java.lang.String : The name of this Accumulate object.initialValue
- double : Value to assume initially and after resets.showInReport
- boolean : Flag for showing the report about this Accumulate.showInTrace
- boolean : Flag for showing the trace output of this
Accumulate.public Reporter createDefaultReporter()
public TimeSpan getPeriodMeasured()
public double getMean()
getMean
in class ValueStatistics
public double getStdDev()
getStdDev
in class ValueStatistics
public void reset()
reset
in class ValueStatistics
public boolean doesRetainLastValueOnReset()
public void setRetainLastValueOnReset(boolean retainValue)
retainValue
- new value of the flag.public void update()
Accumulate
object by fetching the actual
value of the ValueSupplier
and processing it. The
ValueSupplier
can be passed in the constructor of this
Accumulate
object. This update()
method
complies with the one described in DESMO, see [Page91].update
in class ValueStatistics
public void update(double val)
Accumulate
object with the double value given
as parameter. In some cases it might be more convenient to pass the value
this Accumulate
will be updated with directly within the
update(double val)
method instead of going via the
ValueSupplier
.update
in class ValueStatistics
val
- double : The value with which this Accumulate
will be updated.public void update(java.util.Observable o, java.lang.Object arg)
update(Observable, Object)
method of the Observer
interface. This method will be
called automatically from an Observable
object within its
notifyObservers()
method. null
value) is passed as arg, the actual
value of the ValueSupplier will be fetched with the value()
method of the ValueSupplier. Otherwise it is expected that the actual
value is passed in the Object arg.update
in interface java.util.Observer
update
in class ValueStatistics
o
- java.util.Observable : The Observable calling this method
within its own notifyObservers()
method.arg
- Object : The Object with which this Accumulate
is updated. Normally a Double value which is added to the
statistics or null
.public void pause()