Package jsl.observers.variable
Class SimulationResponseDataCollector
- java.lang.Object
-
- jsl.observers.ModelElementObserver
-
- jsl.observers.variable.SimulationResponseDataCollector
-
- All Implemented Interfaces:
ObserverIfc
,GetNameIfc
,IdentityIfc
public class SimulationResponseDataCollector extends ModelElementObserver
The purpose of this class is to store within replication and across replication summary statistics for post processing. This class should be attached to the simulation Model prior to running the simulation in order to observe the data. For each replication, for each response variable the within replication summary statistics are captured. In addition, the summary statistics across all the replications is captured. If the user needs to collect the statistics across multiple experiments of the same model, then use setClearAfterExpFlag(true). In this situation, make sure that the experiments have unique names before running the simulation. The data for each run will be stored based on the name of the experiment.
-
-
Field Summary
-
Fields inherited from class jsl.observers.ModelElementObserver
myName
-
-
Constructor Summary
Constructors Constructor Description SimulationResponseDataCollector(Model m)
SimulationResponseDataCollector(Model m, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterExperiment(ModelElement m, java.lang.Object arg)
protected void
afterReplication(ModelElement m, java.lang.Object arg)
protected void
beforeExperiment(ModelElement m, java.lang.Object arg)
void
clearAllResponseData()
Clears all saved datajava.util.Map<java.lang.String,Statistic>
getAcrossReplicationStatistics(java.lang.String expName)
The map represents the across replication statistics for each response variable in the model.java.util.List<java.util.Map<java.lang.String,WeightedStatistic>>
getAllWithinReplicationStatistics(java.lang.String expName)
Returns a list of maps.boolean
getClearBeforeExpFlag()
void
setClearBeforeExpFlag(boolean flag)
-
Methods inherited from class jsl.observers.ModelElementObserver
beforeReplication, getId, getModelElement, getName, initialize, montecarlo, removedFromModel, replicationEnded, setModelElement, setName, timedUpdate, toString, update, update, warmUp
-
-
-
-
Method Detail
-
getClearBeforeExpFlag
public final boolean getClearBeforeExpFlag()
-
setClearBeforeExpFlag
public final void setClearBeforeExpFlag(boolean flag)
-
beforeExperiment
protected void beforeExperiment(ModelElement m, java.lang.Object arg)
- Overrides:
beforeExperiment
in classModelElementObserver
-
afterReplication
protected void afterReplication(ModelElement m, java.lang.Object arg)
- Overrides:
afterReplication
in classModelElementObserver
-
afterExperiment
protected void afterExperiment(ModelElement m, java.lang.Object arg)
- Overrides:
afterExperiment
in classModelElementObserver
-
getAllWithinReplicationStatistics
public java.util.List<java.util.Map<java.lang.String,WeightedStatistic>> getAllWithinReplicationStatistics(java.lang.String expName)
Returns a list of maps. Each map represents the within replication statistics for each response variable in the model for a replication. The keys to the map are the names of the response variables. Each element of the list is a different replication. The 0th element is the first replication- Parameters:
expName
- the name of the experiment- Returns:
- Returns a list of maps.
-
getAcrossReplicationStatistics
public java.util.Map<java.lang.String,Statistic> getAcrossReplicationStatistics(java.lang.String expName)
The map represents the across replication statistics for each response variable in the model. The keys to the map are the names of the response variables.- Parameters:
expName
- the name of the experiment- Returns:
- the map of across replication statistics for each response
-
clearAllResponseData
public void clearAllResponseData()
Clears all saved data
-
-