Class WelchDataArrayObserver

  • All Implemented Interfaces:
    ObserverIfc, GetNameIfc, IdentityIfc

    public class WelchDataArrayObserver
    extends ModelElementObserver
    Collects Welch data in to an array. The size of the array must be specified when creating the observer. Any data that is observed that results in more data than the array size is ignored (not stored). Permits the creation of CSV files that hold the data and the Welch plotting data This is essentially an in memory version of the WelchDataFileObserver
    • Constructor Detail

      • WelchDataArrayObserver

        public WelchDataArrayObserver​(ResponseVariable responseVariable,
                                      double batchSize)
        Defaults to a maximum number of observations of 50000 and maximum number of replications of 20
        Parameters:
        responseVariable - the ResponseVariable or TimeWeighted variable to observe
        batchSize - the batch size for condensing the data
      • WelchDataArrayObserver

        public WelchDataArrayObserver​(ResponseVariable responseVariable,
                                      int maxNumObs,
                                      int maxNumReps,
                                      double batchSize)
        Parameters:
        responseVariable - the ResponseVariable or TimeWeighted variable to observe
        maxNumObs - the limit on the number of observations in each replication to store
        maxNumReps - the limit on the number of replications
        batchSize - the batch size for condensing the data
    • Method Detail

      • createWelchFileObserver

        public static WelchDataArrayObserver createWelchFileObserver​(ResponseVariable responseVariable)
        Creates a WelchDataArrayObserver with batch size 1 Defaults to a maximum number of observations of 10000 and maximum number of replications of 20
        Parameters:
        responseVariable - the ResponseVariable to observe
        Returns:
        the created WelchDataArrayObserver
      • createWelchFileObserver

        public static WelchDataArrayObserver createWelchFileObserver​(ResponseVariable responseVariable,
                                                                     int maxNumObs,
                                                                     int maxNumReps)
        Creates a WelchDataArrayObserver with batch size 1
        Parameters:
        responseVariable - the ResponseVariable or TimeWeighted variable to observe
        maxNumObs - the limit on the number of observations in each replication to store
        maxNumReps - the limit on the number of replications
      • createWelchFileObserver

        public static WelchDataArrayObserver createWelchFileObserver​(TimeWeighted timeWeighted)
        Creates a WelchDataArrayObserver with batch size 10. The discretizing interval of 10 time units Defaults to a maximum number of observations of 10000 and maximum number of replications of 20
        Parameters:
        timeWeighted - the TimeWeighted to observe
        Returns:
        the created WelchDataArrayObserver
      • createWelchFileObserver

        public static WelchDataArrayObserver createWelchFileObserver​(TimeWeighted timeWeighted,
                                                                     int maxNumObs,
                                                                     int maxNumReps,
                                                                     double deltaTInterval)
        Creates a WelchDataArrayObserver with batch size 10. The discretizing interval of 10 time units Defaults to a maximum number of observations of 10000 and maximum number of replications of 20
        Parameters:
        timeWeighted - the TimeWeighted to observe
        maxNumObs - the limit on the number of observations in each replication to store
        maxNumReps - the limit on the number of replications
        Returns:
        the created WelchDataArrayObserver
      • makeCSVWelchData

        public final void makeCSVWelchData()
        This results in a comma separated value file that has each row containing each observation for each replication and each replication as columns. The last two columns are avg is the average across the replications and cumAvg. The file is flushed and closed. The file is stored in the base directory holding the welch data files and has the name of the data with _WelchData.csv appended. The header row is: Rep1, Rep2, ..., RepN, Avg, CumAvg
      • makeCSVWelchPlotData

        public final void makeCSVWelchPlotData()
        Makes and writes out the welch plot data. Squelches inconvenient IOExceptions The file is stored in the base directory holding the welch data files and has the name of the data with _WelchPlotData.csv appended. The header row is Avg, CumAvg
      • getResponseName

        public java.lang.String getResponseName()
      • getBatchSize

        public double getBatchSize()
      • getLastTime

        public double getLastTime()
      • getLastValue

        public double getLastValue()
      • getNumberOfObservationsForEachReplication

        public long[] getNumberOfObservationsForEachReplication()
      • getAvgTimeBtwObservationsForEachReplication

        public double[] getAvgTimeBtwObservationsForEachReplication()
      • getReplicationAverages

        public double[] getReplicationAverages()
      • getTimeOfLastObservationForReps

        public double[] getTimeOfLastObservationForReps()
      • getNumberOfReplications

        public int getNumberOfReplications()
      • getMinNumberOfObservationsAcrossReplications

        public long getMinNumberOfObservationsAcrossReplications()
        Returns:
        the minimum number of observations across the replications
      • getWelchAverages

        public double[] getWelchAverages()
        Welch average is across each replication for each observation
        Returns:
        an array of the Welch averages
      • getWelchCumulativeAverages

        public double[] getWelchCumulativeAverages()
        Gets an array that contains the cumulative average over the Welch Averages
        Returns:
        returns an array that contains the cumulative average
      • getData

        public double[][] getData()
        Columns are the replications, rows are the data
        Returns:
        a copy of the data
      • getReplicationData

        public double[] getReplicationData​(int repNum)
        Parameters:
        repNum - the replication number 1, 2, etc
        Returns:
        the within replication data for the indicated replication