public class TimeSeries extends StatisticObjectSupportingTimeSpans
TimeSeries
class is recording data from a
ValueSupplier
object and saving it to a file, making data available
to a TimeSeriesPlotter or doing both. Either every
time the ValueSupplier
object has changed or at every tick of
the SimClock. See the automatic parameter in the constructor.
If writing to a file is claimed, the first line of the file contains the name of the file.
Then each line of the file contains a SimTime value and the value of the ValueSupplier
object at that point of time in the simulation, separated by a ";". TimeSeries
object will delete the contents of the
file. TimeSeries
object will be the observer of the
ValueSupplier
object given in the constructor. When
constructing a new TimeSeries
object it will be added to the
list of observers of the ValueSupplier
. That means this
TimeSeries
object will be updated automatically every time the
observed ValueSupplier
has changed and has called its
notifyStatistics()
method.
As separator between different values (e.g. SimTime and value of the
Valuesupplier) ";" is used. See also FileOutput.FileOutput
UNDEFINED
Constructor and Description |
---|
TimeSeries(Model ownerModel,
java.lang.String name,
java.lang.String fileName,
TimeInstant start,
TimeInstant end,
boolean showInReport,
boolean showInTrace)
Constructor for a TimeSeries object that has NO connection to a
ValueSupplier but will write data to the given file. |
TimeSeries(Model ownerModel,
java.lang.String name,
java.lang.String fileName,
ValueSupplier valSup,
TimeInstant start,
TimeInstant end,
boolean automatic,
boolean showInReport,
boolean showInTrace)
Constructor for a TimeSeries object that will observe a
ValueSupplier and write data to the given file. |
TimeSeries(Model ownerModel,
java.lang.String name,
TimeInstant start,
TimeInstant end,
boolean showInReport,
boolean showInTrace)
Constructor for a TimeSeries object that has NO connection to a
ValueSupplier and will NOT write data into a file. |
TimeSeries(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
TimeInstant start,
TimeInstant end,
boolean automatic,
boolean showInReport,
boolean showInTrace)
Constructor for a TimeSeries object that will observe a
ValueSupplier but will NOT write data into a file. |
Modifier and Type | Method and Description |
---|---|
void |
connectToPlotter(java.util.Observer plotter)
Connects this statistic object with its GraphicalObserver.
|
Reporter |
createDefaultReporter()
Returns a default Reporter!
|
TimeInstant |
get_end()
Gets the end instant of this TimeSeries.
|
TimeInstant |
get_start()
Gets the start instant of this TimeSeries.
|
java.util.List<java.lang.Double> |
getDataValues()
Gets the list of data values.
|
java.lang.String |
getGroup()
Gets the group ID used for HTML report clustering.
|
java.util.List<java.lang.Double> |
getTimeValues()
Gets the list of time values.
|
double |
getValue()
Returns the actual value of the
ValueSupplier which values
are recorded from this TimeSeries object. |
void |
reset()
Resets this TimeSeries object by deleting the contents of the file to
which all the data is saved to.
|
void |
setGroup(java.lang.String groupID)
Sets the group ID used for HTML report clustering.
|
void |
update()
Updates this
TimeSeries object by fetching the actual
value of the ValueSupplier and processing it. |
void |
update(double val)
Updates this
TimeSeries 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. |
void |
update(TimeSpan t)
Updates this data collector object with a specific
TimeSpan . |
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 TimeSeries(Model ownerModel, java.lang.String name, java.lang.String fileName, TimeInstant start, TimeInstant end, boolean showInReport, boolean showInTrace)
ValueSupplier
but will write data to the given file.ownerModel
- Model : The model this TimeSeries object is associated toname
- java.lang.String : The name of this TimeSeries objectfileName
- java.lang.String : The name of the file the values will be
saved to. Must comply to the naming rules of the underlying
Operating System. This name will be saved in the first line of
the file.start
- TimeInstant : The instant at which this TimeSeries will start to
save the values to the file.end
- TimeInstant : The instant at which this TimeSeries will stop to
save the values to the file. Choose an end time that lies
before the start time to record the values for all the time.showInReport
- boolean : Flag for showing this TimeSeries in report files. Set
it to true
if TimeSeries should show up in
report. Set it to false
if TimeSeries should not
be shown in report.showInTrace
- boolean : Flag for showing this TimeSeries in trace files. Set
it to true
if TimeSeries should show up in
trace. Set it to false
if TimeSeries should not
be shown in trace.public TimeSeries(Model ownerModel, java.lang.String name, java.lang.String fileName, ValueSupplier valSup, TimeInstant start, TimeInstant end, boolean automatic, boolean showInReport, boolean showInTrace)
ValueSupplier
and write data to the given file.ownerModel
- Model : The model this TimeSeries object is associated toname
- java.lang.String : The name of this TimeSeries objectfileName
- java.lang.String : The name of the file the values will be
saved to. Must comply to the naming rules of the underlying
Operating System. This name will be saved in the first line of
the file.valSup
- ValueSupplier : The values from this ValueSupplier will be
recorded and saved in the file. The given ValueSupplier will
be observed by this TimeSeries object.start
- TimeInstant : The instant at which this TimeSeries will start to
save the values to the file.end
- TimeInstant : The instant at which this TimeSeries will stop to
save the values to the file. Choose an end time that lies
before the start time to record the values for all the time.automatic
- boolean : Shall the values be recorded automatically at every
tick of the SimClock?showInReport
- boolean : Flag for showing this TimeSeries in report files. Set
it to true
if TimeSeries should show up in
report. Set it to false
if TimeSeries should not
be shown in report.showInTrace
- boolean : Flag for showing this TimeSeries in trace files. Set
it to true
if TimeSeries should show up in
trace. Set it to false
if TimeSeries should not
be shown in trace.public TimeSeries(Model ownerModel, java.lang.String name, TimeInstant start, TimeInstant end, boolean showInReport, boolean showInTrace)
ValueSupplier
and will NOT write data into a file.
If you will not connect this object to a TimeSeriesPlotter after
using this constructor, it will be useless.
Choose another constructor for writing data to file.ownerModel
- Model : The model this TimeSeries object is associated toname
- java.lang.String : The name of this TimeSeries objectstart
- TimeInstant : The instant at which this TimeSeries will start to
save the values to the file.end
- TimeInstant : The instant at which this TimeSeries will stop to
save the values to the file. Choose an end time that lies
before the start time to record the values for all the time.showInReport
- boolean : Flag for showing this TimeSeries in report files. Set
it to true
if TimeSeries should show up in
report. Set it to false
if TimeSeries should not
be shown in report.showInTrace
- boolean : Flag for showing this TimeSeries in trace files. Set
it to true
if TimeSeries should show up in
trace. Set it to false
if TimeSeries should not
be shown in trace.public TimeSeries(Model ownerModel, java.lang.String name, ValueSupplier valSup, TimeInstant start, TimeInstant end, boolean automatic, boolean showInReport, boolean showInTrace)
ValueSupplier
but will NOT write data into a file.
If you will not connect this object to a TimeSeriesPlotter after
using this constructor, it will be useless!
Choose another constructor for writing data to file.ownerModel
- Model : The model this TimeSeries object is associated toname
- java.lang.String : The name of this TimeSeries objectvalSup
- ValueSupplier : The values from this ValueSupplier will be
recorded and saved in the file. The given ValueSupplier will
be observed by this TimeSeries object.start
- TimeInstant : The point of SimTime this TimeSeries will start to
save the values to the file.end
- TimeInstant : The point of SimTime this TimeSeries will stop to
save the values to the file. Choose an end time that lies
before the start time to record the values for all the time.automatic
- boolean : Shall the values be recorded automatically at every
tick of the SimClock?showInReport
- boolean : Flag for showing this TimeSeries in report files. Set
it to true
if TimeSeries should show up in
report. Set it to false
if TimeSeries should not
be shown in report.showInTrace
- boolean : Flag for showing this TimeSeries in trace files. Set
it to true
if TimeSeries should show up in
trace. Set it to false
if TimeSeries should not
be shown in trace.public Reporter createDefaultReporter()
null
will be returnedpublic double getValue()
ValueSupplier
which values
are recorded from this TimeSeries object.ValueSupplier
object.public void reset()
reset
in class Reportable
public void update(TimeSpan t)
StatisticObjectSupportingTimeSpans
TimeSpan
.update
in class StatisticObjectSupportingTimeSpans
t
- TimeSpan : The time span to update this data collector.public void update()
TimeSeries
object by fetching the actual
value of the ValueSupplier
and processing it. The
ValueSupplier
is passed in the constructor of this
TimeSeries
object. This update()
method
complies with the one described in DESMO, see [Page91].public void update(double val)
TimeSeries
object with the double value given
as parameter. In some cases it might be more convenient to pass the value
this ValueStatistics
will be updated with directly within
the update(double val)
method instead of going via the
ValueSupplier
.val
- double : The value with which this TimeSeries
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. o
- java.util.Observable : The Observable calling this method
within its own notifyObservers()
method.arg
- Object : The Object with which this TimeSeries
is updated.public void connectToPlotter(java.util.Observer plotter)
plotter
- The TimeSeriesPlotter which will display this TimeSeries object.public java.util.List<java.lang.Double> getDataValues()
public java.util.List<java.lang.Double> getTimeValues()
public TimeInstant get_start()
public TimeInstant get_end()
public java.lang.String getGroup()
public void setGroup(java.lang.String groupID)
groupID
- The group ID used for HTML report clustering.