Class SimulationPeriod

All Implemented Interfaces:
hec.clientapp.client.WkspCallBack, hec.clientapp.event.ManagerChangedListener, ManagerProxyListContainer, Simulation, AsciiSerializable, FieldAccessor, LockableObject, MessagePrinter, TsRecordContainer, Serializable, Cloneable, Comparable, EventListener, Observer, mil.army.usace.hec.rmi.csinterface.CallBackInterface, rma.lang.Modifiable

public class SimulationPeriod extends AbstractSimulation implements Simulation
See Also:
  • Field Details

    • MAX_ALTERNATIVE_NAME_LENGTH

      public static final int MAX_ALTERNATIVE_NAME_LENGTH
      See Also:
    • SIMULATION_DSS_FILE_NAME

      public static final String SIMULATION_DSS_FILE_NAME
      See Also:
    • DEFAULT_KEY_LENGTH

      public static final int DEFAULT_KEY_LENGTH
      See Also:
    • m_simulationPath

      protected String m_simulationPath
    • FILE_EXT

      public static String FILE_EXT
      Description of the Field
    • _keyLength

      protected int _keyLength
      length of the SimulationRun's key
    • _maxAlternativeNameLength

      protected int _maxAlternativeNameLength
    • m_loaded

      protected transient boolean m_loaded
    • _simulationFileName

      protected String _simulationFileName
    • _simRuns

      protected transient Vector<SimulationRun> _simRuns
  • Constructor Details

    • SimulationPeriod

      public SimulationPeriod()
      Constructor for the SimulationPeriod object
  • Method Details

    • getOutputDSSFilePath

      public String getOutputDSSFilePath()
      Returns full path to simulation dss file
      Specified by:
      getOutputDSSFilePath in class AbstractSimulation
      Returns:
      full path to simulation dss file
    • getOutputDSSFileName

      public String getOutputDSSFileName()
      Returns only the name of the simulation dss file
      Specified by:
      getOutputDSSFileName in class AbstractSimulation
      Returns:
      only the name of the simulation dss file
    • setOutputDSSFileName

      public void setOutputDSSFileName(String fileName)
      set the Simulation DSS output filename
      Parameters:
      fileName -
    • getTrialRunNames

      public Vector getTrialRunNames()
      returns a Vector of the names of the SimulationTrialRuns that this SimulationPeriod holds
      Specified by:
      getTrialRunNames in interface Simulation
    • createNewTrialRun

      public TrialRun createNewTrialRun(String newTrialName, String userName, String trialKey, SimulationRun parent, TrialRun baseTrial, int modelPosition)
      Specified by:
      createNewTrialRun in interface Simulation
    • setSimulationRunClass

      public void setSimulationRunClass(String className)
      Sets the name of the class the will perform the simulation run. If the class name is invalid an illegal arguement exception is thrown.
      Parameters:
      className - The new SimulationRunClass value
    • getSimulationRunClass

      public String getSimulationRunClass()
    • getSimulationAppType

      public String getSimulationAppType()
    • setSimulationAppType

      public void setSimulationAppType(String appType)
      Sets the application type that is running the simulation. This is used to lookup the simulation run objects
    • unloadAlternatives

      protected void unloadAlternatives()
    • setAlternatives

      public void setAlternatives(String[] alts)
      Sets the Alternatives attribute of the SimulationPeriod object. This are a list of Simulation Runs that will be used in a particular simulation.
      Parameters:
      alts - A String array of Simulation Run Names.
    • saveStreamAlignment

      public boolean saveStreamAlignment()
    • newBaseModelTrial

      protected SimulationRun newBaseModelTrial(SimulationRun run, int numRuns)
      create a new base Model Trial for a new ForecastRun added to this Forecast
    • getModelTrials

      public Vector getModelTrials(String program, String id)
      Specified by:
      getModelTrials in interface Simulation
    • getUnusedModelTrials

      public Vector getUnusedModelTrials(String program, String id)
      return a list of Model trials that have been created but aren't currently in use.
      Specified by:
      getUnusedModelTrials in interface Simulation
    • addModelTrial

      public boolean addModelTrial(String program, String id, int num)
      add a new Model Trial to the list. Return true if the model was added.
    • copyTrialDataFiles

      protected void copyTrialDataFiles(SimulationRun run, ManagerProxyList proxyList, Vector altList, int numRuns)
      copy the datafiles that the trial is going to use to the Forecast directory
    • createBaseTrialName

      public String createBaseTrialName(String name)
      Creates the base trial name. For a simulation the base trial name is the name of the alternative clipped to 10 characters and appended with the number 0. If it is shorter than 10 then it is appended with '-' characters
    • getReferenceResultsPath

      public String getReferenceResultsPath()
      returns the absolute path to where the simulation reference results are stored
      Returns:
      The reference results value. There is NO trailing '/' character
    • getSimulationPath

      public String getSimulationPath()
      Returns an absolute path to where the simulation data is stored
      Specified by:
      getSimulationPath in class AbstractSimulation
      Returns:
      The SimulationPath value. There is NO trailing '/' character
    • getWorkspacePath

      public String getWorkspacePath()
      return the path to the workspace.
      Overrides:
      getWorkspacePath in class ManagerProxyListManager
    • getStreamAlignment

      public StreamAlignment getStreamAlignment()
      Gets the StreamAlignment attribute of the SimulationPeriod object
      Specified by:
      getStreamAlignment in interface Simulation
      Returns:
      The StreamAlignment value
    • writeTrials

      public void writeTrials()
    • getTrialRunByUserName

      public TrialRun getTrialRunByUserName(String trialUserName)
      get TrialRun by username
      Parameters:
      trialUserName - the username of the Trial
      Returns:
      the TrialRun or null if its not found
    • getTrialRun

      public TrialRun getTrialRun(String trialName)
      get the TrialRun by name
      Parameters:
      trialName - the name of the Trial
      Returns:
      the TrialRun or null if its not found
    • getTrialRuns

      public Vector getTrialRuns()
      return a Vector of TrialRuns that this Simulation holds
    • findManagerID

      public Identifier findManagerID(Vector idlist, String idname)
    • loadWorkspace

      public void loadWorkspace(String remoteRegistry, String baseDir)
      Load the Simulations specific RmiWorkspace
      Specified by:
      loadWorkspace in class AbstractSimulation
      Parameters:
      remoteRegistry - Description of Parameter
      baseDir - Description of Parameter
    • isLoaded

      public boolean isLoaded()
      Overrides:
      isLoaded in class AbstractSimulation
    • unloading

      public void unloading()
      Description copied from class: ManagerProxyListManager
      called when Manager is being unloaded. Closes the workspace.
      Overrides:
      unloading in class ManagerProxyListManager
    • acceptTrial

      public void acceptTrial(SimulationRun run, AltItem altItem, int modelPos, String trialKey)
      Description of the Method
      Specified by:
      acceptTrial in interface Simulation
      Parameters:
      run - Description of Parameter
      altItem - Description of Parameter
      modelPos - Description of Parameter
      trialKey - Description of Parameter
    • removeTrial

      public boolean removeTrial(AltItem altItem, TrialReference trialRef2Remove)
      Specified by:
      removeTrial in interface Simulation
      Overrides:
      removeTrial in class AbstractSimulation
    • setSimulationTypeString

      public void setSimulationTypeString(String simType)
      Set the name type (default is "Simulation") of the string printed to compute log, etc.
      Parameters:
      simType -
    • toString

      public String toString()
      Overrides:
      toString in class Manager
    • getAlternatives

      public String[] getAlternatives()
      return an array of the Alternatives (SimulationRuns) names
      Specified by:
      getAlternatives in class AbstractSimulation
      Returns:
    • getAlternativeInfo

      public SimRunInfo[] getAlternativeInfo()
    • getSimulationRuns

      public Vector<SimulationRun> getSimulationRuns()
      return the list of SimulationRuns
      Overrides:
      getSimulationRuns in class AbstractSimulation
    • getSimulationRun

      public SimulationRun getSimulationRun(String simRunName)
    • compute

      public boolean compute()
      Description of the Method
      Specified by:
      compute in interface Simulation
      Returns:
      Description of the Returned Value
    • computeRun

      public boolean computeRun(SimulationRun run, int lastModel)
      compute the ForecastRun run throught model position lastModel.
      Parameters:
      run - TrialForecastRun to compute
      lastModel - position of last model to run. -1 runs all models
    • computeInit

      public boolean computeInit()
    • getModelPosition

      protected int getModelPosition(int a, String altname)
      Parameters:
      a -
      altname -
      Returns:
    • getCurrentComputingRun

      public SimulationRun getCurrentComputingRun()
      get the SimulationRun currently being computed.
      Returns:
      null if no run is being computed.
    • setLastComputeTime

      public void setLastComputeTime(int index, long computeTime)
    • getLastComputeTime

      public long getLastComputeTime(int index)
    • getLastComputeTimeString

      public String getLastComputeTimeString(int index)
    • runExtract

      public boolean runExtract(SimulationExtract extract)
    • getSimulationExtract

      public SimulationExtract getSimulationExtract(ManagerProxyListContainer wksp)
    • getKeyLength

      public int getKeyLength()
    • setKeyLength

      public void setKeyLength(int length)
    • getMaxAlternativeNameLength

      public int getMaxAlternativeNameLength()
    • setMaxAlternativeNameLength

      public void setMaxAlternativeNameLength(int length)
    • reloadManagers

      public void reloadManagers()
    • deleting

      public void deleting()
      called when the Simulation is being deleted, deletes the Simulation directory.
      Overrides:
      deleting in class Manager
      See Also:
    • closeWorkspace

      protected void closeWorkspace()
      Overrides:
      closeWorkspace in class ManagerProxyListManager
    • getFieldObject

      public Object getFieldObject(Field fld)
      Gets the FieldObject attribute of the SimulationPeriod object
      Specified by:
      getFieldObject in interface FieldAccessor
      Overrides:
      getFieldObject in class AbstractSimulation
      Parameters:
      fld - Description of Parameter
      Returns:
      The FieldObject value
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      This is part of the ascii serializer interaface. It gives the serializer the ability to assigne a value to a private field. If the field does not belong to this class, it is passed to the superclass.
      Specified by:
      setFieldObject in interface FieldAccessor
      Overrides:
      setFieldObject in class AbstractSimulation
      Parameters:
      fld - The field object that describes which field to set
      fobj - The value that is assigned to the field
      Returns:
      true if the assignment was successful