Class Measure
java.lang.Object
dataAnalysis.Measure
- Direct Known Subclasses:
InverseMeasure
This class implements a measure object.
- Author:
- Federico Granata (modified by Stefano Omini) (modified by Bertoli Marco), Bertoli Marco (new Data Analyzer, bugfixed scaling)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicDataAnalyzerThis is the object which receives the collected samples, computes the mean value and determines when the simulation must be stopped (confidence interval reached or too many analyzed samplesprotected doubleprotected doubleprotected doubleprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturns number of analyzed samples.intReturns number of discarded samples.doubleGets measure value: if the confidence requirements have not been reached, it is returned the value estimated up to that moment.Gets the name of the job class this measure refers todoubleGets last interval average value.doubleGets lower limit.doubleReturns max precision percentage reached.intReturns the maximum number of samples that can be analyzed.doubleGets measure value.intGets the measure type (see constants defined in class Simulation)getName()Gets the name of the measure.Gets the QueueNetwork this measure belongs toGets the name of the node this measure refers toGets output object.double[]gets all requested quantilesdoubleReturns analyzed samples percentage.doublebooleanReturns true if the analysis measure is successfuldoubleGets upper limit.booleanReturns true if the analysis measure is verbosebooleanbooleanHas the simulation already finished?voidmeasureTarget(String node, String jClass, int mType) Sets the station, the class, the type of this MeasurebooleanvoidsetNetwork(QueueNetwork network) Sets the QueueNetwork this measure belongs tovoidsetSimParameters(SimParameters param) Set simulation parameters for this measurevoidprotected voidprotected voidstopMeasure(boolean success) booleanThis method will check if a measure is dead i.e.booleanupdate(double sample, double weight) Updates data.booleanbooleanvoidupdateSampleJob(Job sampleJob) Updates the sample job.voidupdateSampleJob(Job sampleJob, String nodeName)
-
Field Details
-
analyzer
This is the object which receives the collected samples, computes the mean value and determines when the simulation must be stopped (confidence interval reached or too many analyzed samples -
lastIntervalAvgValue
protected double lastIntervalAvgValue -
simulationTime
protected double simulationTime -
lastSampleWeight
protected double lastSampleWeight -
lastWeight
protected double lastWeight
-
-
Constructor Details
-
Measure
public Measure(String name, double alfa, double precision, int maxSamples, boolean verbose, double[] quantiles) Creates a new instance of measure class.- Parameters:
name- name of the measure.alfa- the quantile required for the confidence intervalprecision- indicator of maximum amplitude of confidence interval (precision = maxamplitude / mean)maxSamples- maximum number of data to be analyzedverbose- True, if each measure should be sent on outputquantiles- the quantiles to be computed (null, if no quantiles should be computed)
-
-
Method Details
-
measureTarget
-
getNodeName
Gets the name of the node this measure refers to -
getJobClassName
Gets the name of the job class this measure refers to -
getMeasureType
public int getMeasureType()Gets the measure type (see constants defined in class Simulation) -
getNetwork
Gets the QueueNetwork this measure belongs to- Returns:
- the QueueNetwork this measure belongs to
-
setNetwork
Sets the QueueNetwork this measure belongs to- Parameters:
network- the QueueNetwork this measure belongs to
-
getVerbose
public boolean getVerbose()Returns true if the analysis measure is verbose- Returns:
- true if the analysis measure outputs all the samples
-
getOutput
-
getSuccess
public boolean getSuccess()Returns true if the analysis measure is successful- Returns:
- true if the analysis measure respects all users requests
-
getMeanValue
public double getMeanValue()Gets measure value.- Returns:
- measure value.
-
getEstimatedMeanValue
public double getEstimatedMeanValue()Gets measure value: if the confidence requirements have not been reached, it is returned the value estimated up to that moment.- Returns:
- measure value.
-
getLowerLimit
public double getLowerLimit()Gets lower limit.- Returns:
- Lower limit.
-
getUpperLimit
public double getUpperLimit()Gets upper limit.- Returns:
- Upper limit.
-
getLastIntervalAvgValue
public double getLastIntervalAvgValue()Gets last interval average value.- Returns:
- Last interval average value.
-
getAnalyzedSamples
public int getAnalyzedSamples()Returns number of analyzed samples.- Returns:
- Samples analyzed.
-
getDiscardedSamples
public int getDiscardedSamples()Returns number of discarded samples.- Returns:
- Samples analyzed.
-
getMaxSamples
public int getMaxSamples()Returns the maximum number of samples that can be analyzed.- Returns:
- Samples analyzed.
-
update
public boolean update(double sample, double weight) Updates data. This method should be called to add a new sample to the collected data.- Parameters:
sample- sample to be added.weight- sample weight.- Returns:
- True if the computation of this measure has been finished, false otherwise.
-
update
-
update
-
getNetSystem
-
getName
-
getAnalyzer
-
getSamplesAnalyzedPercentage
public double getSamplesAnalyzedPercentage()Returns analyzed samples percentage.- Returns:
- analyzed samples percentage.
-
getMaxPrecisionPercentage
public double getMaxPrecisionPercentage()Returns max precision percentage reached.- Returns:
- Max precision percentage reached.
-
hasFinished
public boolean hasFinished()Has the simulation already finished?- Returns:
- true, if the simulation has already finished; false otherwise
-
getQuantileResults
public double[] getQuantileResults()gets all requested quantiles- Returns:
- vector of quatiles, null if quantiles computation was not requested while creating the Measure object. See constructor's parameters.
-
updateSampleJob
Updates the sample job.- Parameters:
sampleJob- sample job.
-
updateSampleJob
-
abortMeasure
public boolean abortMeasure() -
testDeadMeasure
public boolean testDeadMeasure()This method will check if a measure is dead i.e. no samples are received for a long period (so the measure will probably be zero). This is needed to abort measures in stations that are not reachable after initial transient- Returns:
- true iff measure has been marked as dead and was stopped
-
receivedNoSamples
public boolean receivedNoSamples() -
stop_NoSamples
public void stop_NoSamples() -
stopMeasure
protected void stopMeasure(boolean success) -
stopMeasure
protected void stopMeasure() -
hasBeenAborted
public boolean hasBeenAborted() -
setSimParameters
Set simulation parameters for this measure- Parameters:
param- the simulation parameters to consider
-
getSimTime
public double getSimTime()
-