Class Measure

java.lang.Object
dataAnalysis.Measure
Direct Known Subclasses:
InverseMeasure

public class Measure extends Object
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 Details

    • analyzer

      protected DynamicDataAnalyzer 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 interval
      precision - indicator of maximum amplitude of confidence interval (precision = maxamplitude / mean)
      maxSamples - maximum number of data to be analyzed
      verbose - True, if each measure should be sent on output
      quantiles - the quantiles to be computed (null, if no quantiles should be computed)
  • Method Details

    • measureTarget

      public void measureTarget(String node, String jClass, int mType)
      Sets the station, the class, the type of this Measure
      Parameters:
      node - the node on which the measure is computed
      jClass - the job class this measure refers to
      mType - the type of measure (see constants defined in class Simulation)
    • getNodeName

      public String getNodeName()
      Gets the name of the node this measure refers to
    • getJobClassName

      public String 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

      public QueueNetwork getNetwork()
      Gets the QueueNetwork this measure belongs to
      Returns:
      the QueueNetwork this measure belongs to
    • setNetwork

      public void setNetwork(QueueNetwork network)
      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

      public MeasureOutput getOutput()
      Gets output object.
      Returns:
      output object.
    • 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

      public boolean update(double sample, double weight, String nodeName)
    • update

      public boolean update(double sample, double weight, String nodeName, int numOfVisits)
    • getNetSystem

      public NetSystem getNetSystem()
    • getName

      public String getName()
      Gets the name of the measure.
      Returns:
      name property value.
    • getAnalyzer

      public DynamicDataAnalyzer 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

      public void updateSampleJob(Job sampleJob)
      Updates the sample job.
      Parameters:
      sampleJob - sample job.
    • updateSampleJob

      public void updateSampleJob(Job sampleJob, String nodeName)
    • 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

      public void setSimParameters(SimParameters param)
      Set simulation parameters for this measure
      Parameters:
      param - the simulation parameters to consider
    • getSimTime

      public double getSimTime()