Package hec.rss.model

Class RssRun

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, LockableObject, MessagePrinter, TsRecordContainer, AltInputReportInfc, RssModelVariableConstants, RssReturnStatusConstants, Serializable, Cloneable, Comparable, Runnable, Callable, Observer, mil.army.usace.hec.rmi.csinterface.CallBackInterface, rma.lang.Modifiable

Manages the information required for a single execution of the RSS model and controlls the computation process. This class replaces the hec.rss.model.Run object
See Also:
  • Field Details

    • VERSION

      public static final int VERSION
      See Also:
    • FILE_EXTENSION

      public static final String FILE_EXTENSION
      See Also:
    • COMPUTE_REG

      public static final int COMPUTE_REG
      See Also:
    • COMPUTE_UNREG

      public static final int COMPUTE_UNREG
      See Also:
    • COMPUTE_HOLDOUT

      public static final int COMPUTE_HOLDOUT
      See Also:
    • COMPUTE_PULSE_ROUTING

      public static final int COMPUTE_PULSE_ROUTING
      See Also:
    • COMPUTE_CUMLOC

      public static final int COMPUTE_CUMLOC
      See Also:
    • COMPUTE_TYPE_NAME

      public static final String[] COMPUTE_TYPE_NAME
    • MSG_RSSRUNERROR

      public static String MSG_RSSRUNERROR
    • MSG_COMPUTEFAIL

      public static String MSG_COMPUTEFAIL
    • MSG_INITCOMPUTE

      public static String MSG_INITCOMPUTE
    • MSG_EVALROUTING

      public static String MSG_EVALROUTING
    • MSG_COMPUTEREG

      public static String MSG_COMPUTEREG
    • MSG_COMPUTECUMLOC

      public static String MSG_COMPUTECUMLOC
    • MSG_COMPUTEUNREG

      public static String MSG_COMPUTEUNREG
    • MSG_COMPUTEHOLDOUT

      public static String MSG_COMPUTEHOLDOUT
    • MSG_FAILEDTOLOADALT

      public static String MSG_FAILEDTOLOADALT
    • PROGRESS_START

      public static final int PROGRESS_START
      See Also:
    • PROGRESS_INIT

      public static final int PROGRESS_INIT
      See Also:
    • PROGRESS_EVALROUTE

      public static final int PROGRESS_EVALROUTE
      See Also:
    • PROGRESS_CUMLOC

      public static final int PROGRESS_CUMLOC
      See Also:
    • PROGRESS_UNREG

      public static final int PROGRESS_UNREG
      See Also:
    • PROGRESS_REG

      public static final int PROGRESS_REG
      See Also:
    • PROGRESS_HOLDOUT

      public static final int PROGRESS_HOLDOUT
      See Also:
    • PROGRESS_END

      public static final int PROGRESS_END
      See Also:
    • _additionalComputeOptions

      protected transient Object _additionalComputeOptions
      additional compute options
  • Constructor Details

    • RssRun

      public RssRun()
    • RssRun

      public RssRun(String name)
  • Method Details

    • usesTimeBlocking

      public boolean usesTimeBlocking()
    • setTimeBlocking

      public void setTimeBlocking(boolean timeBlocking)
    • isIterative

      public boolean isIterative()
    • setIterative

      public void setIterative(boolean iterative)
    • setStopFYIter

      public void setStopFYIter(boolean stopFYIter)
      Set the value of the stopFYIter flag. If the stopFYIter is true, the Firm Yield run will stop the loop that iteratively evaluates regulated flows.
    • getStopFYIter

      public boolean getStopFYIter()
      Get the value of the stopFYIter flag. If the stopFYIter is true, the Firm Yield run will stop the loop that iteratively evaluates regulated flows.
      Returns:
      the stopFYIter flag
    • init

      public void init()
      Specified by:
      init in class Manager
    • setRunProgress

      public void setRunProgress(double dp)
    • initProgress

      public void initProgress()
    • getTSRecordByPathParts

      public TSRecord getTSRecordByPathParts(String tsName, String paramName)
    • getDataRecord

      public RunDataRecord getDataRecord()
      Stores Run member data into a RunDataRecord which can be passed to other objects. Typically this function is used to provide data to a dialog for display and/or editing.
      Returns:
      A RunDataRecord containing copies of current member data
      See Also:
    • setDataRecord

      public boolean setDataRecord(RunDataRecord rec)
      Set member data from the values in a RunDataRecord. Typically called by a dialog to set the values of data members.
      Parameters:
      rec - RunDataRecord containing new data for this Run
      See Also:
    • setAltPath

      public void setAltPath(String path)
      set the alternative path and clear current managers
    • getAltPath

      public String getAltPath()
      return the current alternative path
    • getRunTimeWindow

      public RunTimeWindow getRunTimeWindow()
      return the current run time window
    • getTimeWindowString

      public String getTimeWindowString()
      return a string representation of the time window limits - lookback to end of forecast
    • setComputeObserver

      public void setComputeObserver(hec.client.RunObserver obs)
      sets the object that watches for completion of the RSS compute.
    • getAlternative

      public RssAlt getAlternative()
      return the input TSDataSet - load it if it is not already available
    • getNetwork

      public RssSystem getNetwork()
    • getInputGVData

      public GVDataSet getInputGVData()
      return the input Global Variable DataSet - load it if it is not already available
    • getInputWQTSDataSet

      public TSDataSet getInputWQTSDataSet(boolean printUseMessage)
      retrieves the input data set for water quality time series data
      Returns:
      TSDataSet
    • getInputWQPDCDataSet

      public PDCDataSet getInputWQPDCDataSet()
    • getObsWQTSDataSet

      public TSDataSet getObsWQTSDataSet()
      retrieves the observed data set fdor water quality time series data
      Returns:
      TSDataSet
    • getInputTSData

      public TSDataSet getInputTSData()
      return the input TSDataSet - load it if it is not already available
    • getObservedTSData

      public TSDataSet getObservedTSData()
      return the observed TSDataSet - load it if it is not already available
    • getOutputTSData

      public TSDataSet getOutputTSData()
      returns the output tsdataset for regulated flow runs
    • getWQOutputTSData

      public TSDataSet getWQOutputTSData()
    • getReleaseDecisionReportOptions

      public hec.rss.client.reports.ReleaseDecisionReportOptions getReleaseDecisionReportOptions()
    • setReleaseDecisionReportOptions

      public void setReleaseDecisionReportOptions(hec.rss.client.reports.ReleaseDecisionReportOptions options)
    • setSelectedSummaryReportCollectionRun

      public void setSelectedSummaryReportCollectionRun(String collectionRun)
    • getSelectedSummaryReportCollectionRun

      public String getSelectedSummaryReportCollectionRun()
    • getReportKey

      public String getReportKey()
    • clearInputTSData

      public void clearInputTSData()
      Clears reference to input TSDataSet objects to force a refresh of the TSDataSet
    • clearOutputTSData

      public void clearOutputTSData()
      Clears references to output TSDataSet objects to force a refresh of the TSDataSets
    • getRegOutputGVData

      public GVDataSet getRegOutputGVData()
      returns the output global variable dataset
    • getRegOutputTSData

      public TSDataSet getRegOutputTSData()
      returns the output tsdataset for regulated flow
    • getRegOutputTSData

      public TSDataSet getRegOutputTSData(boolean isReleaseDecesion)
      returns the output tsdataset for regulated flow
    • getUnregOutputTSData

      public TSDataSet getUnregOutputTSData()
      returns the output tsdataset for regulated flow
    • getCumLocOutputTSData

      public TSDataSet getCumLocOutputTSData()
      returns the output tsdataset for cumulative local flow
    • call

      public Integer call() throws Exception
      Specified by:
      call in interface Callable
      Throws:
      Exception
    • run

      public void run()
      Provides the entry point when the compute function is performed within a thread.
      Specified by:
      run in interface Runnable
    • compute

      public int compute()
      Runs the RSS simulation
    • getEmbeddedAltList

      public List<hec.rss.plugins.model.EmbeddedAlternative> getEmbeddedAltList()
    • computeStandard

      public int computeStandard()
    • isCoupledWQCompute

      public boolean isCoupledWQCompute()
      Return true if the alternative is configured for coupled water quality and flow operation simulation.
      Returns:
      true if the WQ option is set for coupled water quality and operations simulation
    • shouldComputeWaterQuality

      public boolean shouldComputeWaterQuality()
      Returns:
    • computeFirmYield

      public int computeFirmYield()
      Water Account Firm Yield compute method
      Returns:
      RTN_NOPROBLEM if successful
    • initCompute

      public int initCompute(long[] time)
    • initForPostProcessing

      public int initForPostProcessing()
      Prepares this run for post processing in the ResSim Simulation Module. This routing sets up all data model connectivity, but does not load time series arrays.
      Returns:
      RTN_NOPROBLEM if successful
    • pulseRoutingCompute

      public int pulseRoutingCompute(long[] time)
    • cumLocCompute

      public int cumLocCompute(long[] time)
    • unRegCompute

      public int unRegCompute(long[] time)
    • regCompute

      public int regCompute(long[] time)
    • regFYCompute

      public int regFYCompute(long[] time)
    • holdOutCompute

      public int holdOutCompute(long[] time)
    • finalizeCompute

      public int finalizeCompute(long[] time, boolean saveTS)
    • finalizeCompute

      public int finalizeCompute(long[] time, boolean saveTS, boolean saveRssOutput)
    • getCurrentComputeBlockRunTimeWindow

      public RunTimeWindow getCurrentComputeBlockRunTimeWindow()
      get the RunTimeWIndow for the current Compute Time Block, if no timeblocking is occurring this will return the same lookback/start/end times as the Simulation's RunTimeWindow
      Returns:
      the RunTimeWindow
    • backupConfigFiles

      protected void backupConfigFiles(String backupDir)
    • getOutputFile

      public String getOutputFile(boolean convertSpaces)
    • getOutput

      public RssOutput getOutput()
      returns a reference to the output object, or null if output does not exist
    • printDatumConversionMessages

      protected void printDatumConversionMessages(List tspVec)
    • printConversionTable

      protected void printConversionTable()
    • convertInputTimeSeriesToVerticalDatum

      protected void convertInputTimeSeriesToVerticalDatum(List tspVec)
      Takes as input a list of TSRecordProxy that contain TSRecordImpl and converts the data to the Vertical data for the location they are for
      Parameters:
      tspVec -
    • checkTSRecords

      public boolean checkTSRecords(Vector tsrecVec, RunTimeWindow rtw)
      read in the data for the record and check completeness of the data
    • findReservoirForHindcastData

      public ReservoirElement findReservoirForHindcastData(HindcastData selectedHd)
    • unloading

      public void unloading()
      called when the manager proxy is unloading the manager
      Overrides:
      unloading in class Manager
    • getTimeBlocks

      public List<RunTimeWindow> getTimeBlocks()
    • getRoutingTimeSteps

      public int getRoutingTimeSteps()
    • createOutputTSData

      public TSDataSet createOutputTSData(String altname, String computeType, int computeId)
    • createOutputWQTSData

      public TSDataSet createOutputWQTSData(String altname)
    • createOutputGVData

      public GVDataSet createOutputGVData(String altname, String computeType, int computeId)
      Build a Global Variable data set containing all Global Variable 1records output from an RSS System. This method is called before each compute.
    • updateOutputFPart

      public void updateOutputFPart()
    • constructTSRecordProxyDssPath

      public String constructTSRecordProxyDssPath(TSRecordProxy rp, String paramMod)
      Construct and output pathname from a TSRecord Proxy This is used for DSS output
    • constructWQTSRecordProxyDssPath

      public String constructWQTSRecordProxyDssPath(TSRecordProxy rp)
      Construct and output pathname from a TSRecord Proxy This is used for WQ Input TS Records
    • constructGvDssPath

      public String constructGvDssPath(GlobalVariable gv, String paramMod)
      Construct and output pathname from a TSRecord Proxy
    • getOutputFPart

      public String getOutputFPart()
      returns the output time series record f pathname part
    • setOutputFPart

      public void setOutputFPart(String fpart)
    • getDSSOutputFile

      public String getDSSOutputFile()
      gets the DSS output file name
    • setForecastDir

      public void setForecastDir(String forecastDir)
      set the forecast directory during a cavi compute
    • setDSSOutputFile

      public void setDSSOutputFile(String path)
      sets the DSS output file name
    • setRunId

      public void setRunId(String path)
      sets the runId that is used as the DSS output fpart for WCDS CAVI computes
    • getRunId

      public String getRunId()
      gets the runId that is used as the DSS output fpart for WCDS CAVI computes
    • setTimeWindow

      public void setTimeWindow(RunTimeWindow rtw)
      sets the time window for computation this method is called before every compute force time window to be on even time step boundaries
    • getDiversionOverrides

      public ReleaseOverrides getDiversionOverrides()
      get a reference to the run's diversion release overrides
      Returns:
    • getReleaseOverrides

      public ReleaseOverrides getReleaseOverrides()
      get a reference to the run's release overrides, first updating adjustable flow list
    • getElevationOverrides

      public ReleaseOverrides getElevationOverrides()
      get a reference to the run's reservoir elevation target overrides
    • getGateOverrides

      public ReleaseOverrides getGateOverrides()
      get a reference to the run's adjustable flow gate opening overrides
    • getCapacityOverrides

      public ReleaseOverrides getCapacityOverrides()
      get a reference to the Run's capacity overrides
    • getStorageOverrides

      public ReleaseOverrides getStorageOverrides()
    • getElevationStorageOverrides

      public ReleaseOverrides getElevationStorageOverrides()
    • readReleaseOverrides

      public void readReleaseOverrides()
      get the DSS data into the release Overrides table. need to call updateReleaseOverrides first.
    • updateReleaseOverrides

      public boolean updateReleaseOverrides()
      update the list of adjustable flows in the release override object
    • createForecastInputGVData

      protected GVDataSet createForecastInputGVData(GVDataSet inputGVdata, String filename, String fpart)
      Build an input GVData set for a forecast.
      Parameters:
      inputGVdata -
      filename -
      fpart -
      Returns:
    • createForecastInputPDCData

      protected PDCDataSet createForecastInputPDCData(PDCDataSet inputPDCData, String filename, String fpart)
    • matchUpInputGvData

      protected void matchUpInputGvData(List<GlobalVariable> globalVarList, GVDataSet gvdata)
      match the network global variable to the alternative's GVDataSet GlobalVariableData
      Parameters:
      globalVarList -
      gvdata -
    • createForecastInputTSData

      protected TSDataSet createForecastInputTSData(TSDataSet inputTSdata, String filename, String fpart)
      Build an input TSData set for a forecast.
    • writeOutput

      public boolean writeOutput(Identifier id)
      write the computed output to a file
    • writeFile

      public boolean writeFile(Identifier id)
      Overrides:
      writeFile in class Manager
    • reLoadFile

      public boolean reLoadFile(Identifier id)
      Overrides:
      reLoadFile in class Manager
    • readFile

      public boolean readFile(Identifier id)
      Overrides:
      readFile in class Manager
    • getRunModifiedTime

      public long getRunModifiedTime()
      return the Run's modified time.
    • setFpartPos

      public void setFpartPos(int inputPosition, int modelPosition)
      used for input FPart and output FPart during a CAVI compute.
    • setFpartMultiplier

      public void setFpartMultiplier(int multiplier)
    • getLastModifiedTime

      public long getLastModifiedTime()
      return the greater of the Run's modified time or the Alternative's
      Overrides:
      getLastModifiedTime in class Manager
    • getComputeUnReg

      public boolean getComputeUnReg()
      return whether unregulated flow computations will be done
    • setComputeUnReg

      public void setComputeUnReg(boolean computeUnReg)
    • getComputeHoldout

      public boolean getComputeHoldout()
      return whether reservoir holdout flow computations will be done
    • setComputeHoldout

      public void setComputeHoldout(boolean computeHoldout)
    • getComputeCumLoc

      public boolean getComputeCumLoc()
      Returns:
    • setComputeCumLoc

      public void setComputeCumLoc(boolean computeCumLoc)
    • getLogLevel

      public int getLogLevel()
    • setLogLevel

      public void setLogLevel(int logLevel)
    • isModified

      public boolean isModified()
      Description copied from class: NamedType
      Check if the object has been modified.
      Specified by:
      isModified in interface rma.lang.Modifiable
      Overrides:
      isModified in class NamedType
      Returns:
      true if the object has been modified
    • saveManagerAs

      public Manager saveManagerAs(String directory, String filePrefix, ManagerProxyListContainer container)
      Description copied from class: Manager
      duplicate our data file to a new file and add a new Manager that uses it to the ManagerProxyListContainer specified
      Overrides:
      saveManagerAs in class Manager
      Returns:
      the new Manager
    • getSaveAsId

      protected Identifier getSaveAsId(String directory, String filePrefix, int index, Identifier srcId)
      Overrides:
      getSaveAsId in class Manager
    • refreshData

      public boolean refreshData(Manager mgr)
      Description copied from class: Manager
      refresh this managers data from the origMgr's data
      Overrides:
      refreshData in class Manager
    • setStorageOverrideType

      public void setStorageOverrideType(int type)
      set the Storage override type.
      Parameters:
      type - one of ReleaseOverrides.ELEV_STORAGE or ReleaseOverrides.STORAGE
    • getStorageOverrideType

      public int getStorageOverrideType()
    • getFieldObject

      public Object getFieldObject(Field fld)
      Description copied from interface: FieldAccessor
      This method allows access to java.lang.reflect.Field objects within the implementing class.
      Specified by:
      getFieldObject in interface FieldAccessor
      Overrides:
      getFieldObject in class Manager
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Description copied from interface: FieldAccessor
      This allows access to fields withing the implementing object to set there data.
      Specified by:
      setFieldObject in interface FieldAccessor
      Overrides:
      setFieldObject in class Manager
      Parameters:
      fld - The java field object representing the member field to be set
      fobj - The data to set in that field
      Returns:
      returns true if successful
    • getTimeInit

      public long[] getTimeInit()
    • setTimeInit

      public void setTimeInit(long init)
    • getTimePulse

      public long[] getTimePulse()
    • setTimePulse

      public void setTimePulse(long reg)
    • getTimeCLoc

      public long[] getTimeCLoc()
    • setTimeCLoc

      public void setTimeCLoc(long loc)
    • getTimeUReg

      public long[] getTimeUReg()
    • setTimeUReg

      public void setTimeUReg(long uReg)
    • getTimeReg2

      public long[] getTimeReg2()
    • setTimeReg2

      public void setTimeReg2(long reg2)
    • getTimeHOut

      public long[] getTimeHOut()
    • setTimeHOut

      public void setTimeHOut(long hOut)
    • getTimeCplt

      public long[] getTimeCplt()
    • setTimeCplt

      public void setTimeCplt(long cplt)
    • getReportPath

      public String getReportPath()
    • saveReport

      public boolean saveReport()
    • getOutputReportId

      public Identifier getOutputReportId()
      save the report and then return the report Identifier.
      Returns:
      the Report Identifier if the report was created successfully, null if it was not.
    • getTotalComputeTime

      protected long getTotalComputeTime()
      Returns:
      the _TOTAL_TIME
    • outputReport

      public void outputReport(AlternativeInputReport report, org.jdom.Element elem)
      Description copied from interface: AltInputReportInfc
      Alternative Input Report Interface for data.
      Specified by:
      outputReport in interface AltInputReportInfc
    • setAlternative

      public void setAlternative(RssAlt alt)
      don't call this method to set the alternative. use setAltPath()
      Parameters:
      alt -
    • setTaskNumber

      public void setTaskNumber(int taskNum)
    • setNumberTasks

      public void setNumberTasks(int numTasks)
    • isSeededCompute

      public boolean isSeededCompute()
    • simulationEventRandomSeed

      public double simulationEventRandomSeed()
    • simulationRealizationRandomSeed

      public double simulationRealizationRandomSeed()
    • seededIterationNumber

      public int seededIterationNumber()
    • setAdditionalComputeOptions

      public void setAdditionalComputeOptions(Object additionalOptions)
      set additional compute options. Wat needs to do some special processing on the pathnames so this is here as a generic way to pass those options in. Its dealt with in a subclass. CAVI ensemble running a native ResSim ensemble contains the ensemble id String to run
      Parameters:
      additionalOptions -
    • getAdditionalComputeOptions

      public Object getAdditionalComputeOptions()
      get additional compute options. Wat needs to do some special processing on the pathnames so this is here as a generic way to pass those options in. Its dealt with in a subclass. CAVI ensemble running a native ResSim ensemble contains the ensemble id String to run
    • setVariantName

      public void setVariantName(String variant)
      Parameters:
      variant -
    • getVariantName

      public String getVariantName()
    • deleting

      public void deleting()
      Description copied from class: Manager
      called when the manager proxy is deleting the manager allows the manager to do any additional clean required.
      Overrides:
      deleting in class Manager
    • setComputeType

      public void setComputeType(int computeType)
      Parameters:
      computeType -
    • getComputeType

      public int getComputeType()
    • getLastComputeStatus

      public ComputeStatus getLastComputeStatus()
    • setLastComputeStatus

      public void setLastComputeStatus(ComputeStatus lastStatus)
    • getWQRun

      public hec.rss.wq.model.WQRun getWQRun()
      Get the active water quality run. Returns null if this not WQ should not compute or if the WQRun is null.
      Returns:
      the active water quality run, or null
    • setUserInterface

      public UserInterface setUserInterface(UserInterface ui)
      Overrides:
      setUserInterface in class Manager
      Parameters:
      ui -
      Returns:
    • setUserInterface

      public mil.army.usace.hec.rmi.server.RemoteWrapper setUserInterface(mil.army.usace.hec.rmi.server.RemoteWrapper uiWrap)
      Overrides:
      setUserInterface in class Manager