Package hec.rss.model

Class RssSystem

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, LockableObject, hec.map.MapObjectInterface, ComputeCanceledCallback, MessagePrinter, TSManager, TsRecordContainer, RssReturnStatusConstants, Serializable, Cloneable, Comparable, Observer, mil.army.usace.hec.rmi.csinterface.CallBackInterface, rma.lang.Modifiable

public class RssSystem extends Manager implements hec.map.MapObjectInterface, TSManager, RssReturnStatusConstants, ComputeCanceledCallback
Represents the physical elements of a river-reservoir system. It maintains a list of nodes and elements that make up the discretization of the prototype system. The RssSystem object also organizes the hindcast and forecast compute procedure within each time step of the simulation.
See Also:
  • Field Details

    • REACH_STR

      public static final String REACH_STR
      The Constant REACH_STR.
      See Also:
    • RESERVOIR_STR

      public static final String RESERVOIR_STR
      The Constant RESERVOIR_STR.
      See Also:
    • JUNCTION_STR

      public static final String JUNCTION_STR
      The Constant JUNCTION_STR.
      See Also:
    • DIVERSION_STR

      public static final String DIVERSION_STR
      The Constant DIVERSION_STR.
      See Also:
    • REACH

      public static final int REACH
      The Constant REACH.
      See Also:
    • RESERVOIR

      public static final int RESERVOIR
      The Constant RESERVOIR.
      See Also:
    • JUNCTION

      public static final int JUNCTION
      The Constant JUNCTION.
      See Also:
    • DIVERSION

      public static final int DIVERSION
      The Constant DIVERSION.
      See Also:
    • SPILLWAY

      public static final int SPILLWAY
      The Constant SPILLWAY.
      See Also:
    • KEYMARK

      public static final String KEYMARK
      The Constant KEYMARK.
      See Also:
    • KEYDELIM

      public static final String KEYDELIM
      The Constant KEYDELIM.
      See Also:
    • VERSION

      public static final int VERSION
      version 1029 updated diversions with no rules in ResSim version 3.5 files
      See Also:
    • HINDCAST_ELEM_STATE

      public static final int HINDCAST_ELEM_STATE
      The Constant HINDCAST_ELEM_STATE.
      See Also:
    • OUTER_TIME_ELEM_STATE

      public static final int OUTER_TIME_ELEM_STATE
      The Constant OUTER_TIME_ELEM_STATE.
      See Also:
    • TRIAL_ELEM_STATE

      public static final int TRIAL_ELEM_STATE
      The Constant TRIAL_ELEM_STATE.
      See Also:
    • INNER_TIME_ELEM_STATE

      public static final int INNER_TIME_ELEM_STATE
      The Constant INNER_TIME_ELEM_STATE.
      See Also:
    • TIME_BLOCK_ELEM_STATE

      public static final int TIME_BLOCK_ELEM_STATE
      The Constant TIME_BLOCK_ELEM_STATE.
      See Also:
    • TIME_BLOCK_ELEM_STATE2

      public static final int TIME_BLOCK_ELEM_STATE2
      The Constant TIME_BLOCK_ELEM_STATE2.
      See Also:
    • PRE_COMPUTE_ELEM_STATE

      public static final int PRE_COMPUTE_ELEM_STATE
      The Constant PRE_COMPUTE_ELEM_STATE.
      See Also:
    • NUM_ELEM_STATES

      public static final int NUM_ELEM_STATES
      The Constant NUM_ELEM_STATES.
      See Also:
    • COMPUTE_ENGINE_3X

      public static final int COMPUTE_ENGINE_3X
      flag indicating use of version 3X compute engine
      See Also:
    • COMPUTE_ENGINE_4A

      public static final int COMPUTE_ENGINE_4A
      flag indicating use of version 4A compute engine based on message passing
      See Also:
    • COMPUTE_ENGINE_4B

      public static final int COMPUTE_ENGINE_4B
      flag indicating use of version 4B compute engine based on modified simplex method
      See Also:
    • GLOBAL_VARIABLE_TABLES_DSS

      public static final String GLOBAL_VARIABLE_TABLES_DSS
      See Also:
    • DEFAULT_PULSE_FLOW_ENGLISH

      public static final double DEFAULT_PULSE_FLOW_ENGLISH
      The Constant DEFAULT_PULSE_FLOW_ENGLISH.
      See Also:
    • DEFAULT_PULSE_FLOW_SI

      public static final double DEFAULT_PULSE_FLOW_SI
      The Constant DEFAULT_PULSE_FLOW_SI.
      See Also:
    • DEBUG_CONV

      public static boolean DEBUG_CONV
      Static flag that triggers detailed output to analyze convergence of the decision algorithm
  • Constructor Details

    • RssSystem

      public RssSystem()
      Instantiates a new rss system.
  • Method Details

    • finalize

      public void finalize() throws Throwable
      Overrides:
      finalize in class Manager
      Throws:
      Throwable
    • getStateRts

      public RunTimeStep getStateRts()
    • buildElementGraph

      public ElementGraph buildElementGraph(int computeType, boolean considerRules)
    • buildElementGraph

      public ElementGraph buildElementGraph(int computeType, boolean considerRules, boolean returnOnlyIfSuccess)
    • orderElementsForCompute

      public boolean orderElementsForCompute(int computeType)
      Develop correct element ordering for given compute type including creation of iteration blocks. collect all tsrecord and set up array that holds them
      Parameters:
      computeType - the compute type
      Returns:
      true, if successful
    • getComputeElemBlockCounter

      public int getComputeElemBlockCounter()
      returns the counter index of the element block loop in the RssSystem.compute method or -1 if outside the loop.
      Returns:
      the counter index of the element
    • getComputePassCounter

      public int getComputePassCounter()
      returns the counter index of the solution pass loop in the RssSystem.compute method or -1 if outside the loop.
      Returns:
      the counter index of the solution pass
    • getComputeTimeStepCounter

      public int getComputeTimeStepCounter()
      returns the counter index of the time step loop in the RssSystem.compute method or -1 if outside the loop.
      Returns:
      the counter index of the time step
    • getComputeDecisionElemCounter

      public int getComputeDecisionElemCounter()
      returns the counter index of the decision element loop within an element block in the RssSystem.compute method or -1 if outside the loop.
      Returns:
      the counter index of the time decision element
    • getComputeRoutingStepCounter

      public int getComputeRoutingStepCounter()
      returns the counter index of the routing step loop in the RssSystem.compute method or -1 if outside the loop.
      Returns:
      the counter index of the routing step
    • getComputeType

      public int getComputeType()
      Gets the compute type.
      Returns:
      the compute type
    • getTandemOp

      public TandemOp getTandemOp()
      return the tandemOp, creating it if necessary.
      Returns:
      the tandemOp
    • initTandemOpForecastStep

      public void initTandemOpForecastStep(RunTimeStep rts)
      initialize the tandemOp, creating it if necessary.
      Parameters:
      rts - the rts
    • getTandemOpParent

      public TandemOpParent getTandemOpParent(int id)
      retreive a TandemOp object by integer index. If the TandemOp does not exist the method returns null
      Parameters:
      id - TandemOp index
      Returns:
      TandemOp or null
    • getTandemOps

      public List getTandemOps()
      get a List of all TandemOp objects.
      Returns:
      a new ArrayList containing TandemOp objects
    • newTandemOpParent

      public TandemOpParent newTandemOpParent(String name)
      Creates a new TandemOp with the given name, no checking is done to ensure unique names.
      Parameters:
      name - Name of new TandemOp
      Returns:
      new TandemOp
    • createTandemOpParent

      public TandemOpParent createTandemOpParent(TandemSysOpRule tandemSysRule)
      create a new TandemOp for the given rule and initialize data to that of the given rule.
      Parameters:
      tandemSysRule - the tandem sys rule
      Returns:
      a new TandemOp
    • deleteTandemOpParent

      public void deleteTandemOpParent(int id)
      delete the TandemOp matching the id and have the all TandemSysOpRule objects that reference that TandemOp be deleted.
      Parameters:
      id - the id
    • initDownstreamPulse

      public int initDownstreamPulse()
      Calls the initialization routine for all DownstreamOp objects in preparation for compute.
      Returns:
      RTN_NOPROBLEM if initialization is successful
    • getDownstreamOpRule

      public DownstreamOpRule getDownstreamOpRule(String name)
      Gets the downstream op rule.
      Parameters:
      name - the name
      Returns:
      the downstream op rule
    • deleteDownstreamOpRule

      public void deleteDownstreamOpRule(int dindex, int rindex)
      Delete downstream op rule.
      Parameters:
      dindex - the dindex
      rindex - the rindex
    • deleteDownstreamOp

      public void deleteDownstreamOp(int nodeIndex)
      deletes the downstreamOp referenced by the node index.
      Parameters:
      nodeIndex - the node index
    • createSystemHydropowerRule

      public SystemHydropowerRule createSystemHydropowerRule()
      Creates the system hydropower rule.
      Returns:
      the system hydropower rule
    • getSystemHydropowerRule

      public SystemHydropowerRule getSystemHydropowerRule(int ruleIndex)
      Retrives the SystemHydropowerRule for a given ruleIndex. If there is not HydropowerRule for that index then a null value is returned.
      Parameters:
      ruleIndex - the rule index
      Returns:
      the system hydropower rule
    • getSystemHydropowerRule

      public SystemHydropowerRule getSystemHydropowerRule(String ruleName)
      Retrives the SystemHydropowerRule by name. If there is not HydropowerRule for that name then a null value is returned. Note: this is a slower retrieval than using the SystemHydropowerRule's Index.
      Parameters:
      ruleName - the rule name
      Returns:
      the system hydropower rule
    • deleteSystemHydropowerRule

      public void deleteSystemHydropowerRule(int rindex)
      Delete system hydropower rule.
      Parameters:
      rindex - the rindex
    • getDownstreamOp

      public DownstreamOp getDownstreamOp(int nodeIndex)
      Gets a the DownstreamOp for the given node index, will return null if the DownstreamOp does not already exist.
      Parameters:
      nodeIndex - RssNode index
      Returns:
      DownstreamOp object or null
    • getDefaultDownstreamOptions

      public DownstreamOptions getDefaultDownstreamOptions()
      Default Downstream Rule Options.
      Returns:
      the default downstream options
    • setDefaultDownstreamOptions

      public void setDefaultDownstreamOptions(DownstreamOptions dOps)
      Sets the default downstream options.
      Parameters:
      dOps - the new default downstream options
    • getDownstreamOp

      public DownstreamOp getDownstreamOp(int nodeIndex, boolean createIfNull)
      Gets a the DownstreamOp for the given node index. If the DownstreamOp does not already exist. one will be created when the createIfNull parameter if true.
      Parameters:
      nodeIndex - RssNode index
      createIfNull - if true a DownstreamOp will be created if necessary
      Returns:
      DownstreamOp object
    • getSystemHydropowerRules

      public List getSystemHydropowerRules()
      Returns a list of SystemHydropowerRule(s). This list is guaranteed to be non null. If the RssSystem does not have any hydropower rules than a list of size 0 will be returned.
      Returns:
      the list of SystemHydropowerRules.
    • getDownstreamOpRulesBlwElement

      public Vector getDownstreamOpRulesBlwElement(ReservoirElement res, Vector vec)
      Gets the downstream op rules blw element.
      Parameters:
      res - the res
      vec - the vec
      Returns:
      the downstream op rules blw element
    • getTSRecordProxy

      public TSRecordProxy getTSRecordProxy(String name, int varid)
      Gets the tS record proxy.
      Parameters:
      name - the name
      varid - the varid
      Returns:
      the tS record proxy
    • isKeyString

      public boolean isKeyString(String str)
      checks to see if string is a key string.
      Parameters:
      str - the str
      Returns:
      true, if is key string
    • getOriginalNetworkName

      public String getOriginalNetworkName()
      Returns to original network's name that was used when creating an alternative. Background - when a user uses a network to create an alternative, the network name is changed to the alternative key + ":" + original network name. The original network is actually getting copied and renamed when used in a different alternative.
      Returns:
      the original network selected for the alternative at the time the alternative was created.
    • getNameForKeyString

      public String getNameForKeyString(String key)
      returns the display name for key string.
      Parameters:
      key - the key
      Returns:
      the name for key string
    • getKeyStringForObject

      public String getKeyStringForObject(Object obj)
      Takes a object of class Element, Function, RssNode, OpController, or OpRule and returns a unique string identifying that object.
      Parameters:
      obj - the obj
      Returns:
      the key string for object
    • getObjectForKeyString

      public NamedType getObjectForKeyString(String keystr)
      Takes a key string and returns the object of class Element, Function, Node, OpController, or OpRule This should be a TSManager method.
      Parameters:
      keystr - the keystr
      Returns:
      the object for key string
    • generateUniquePathPart

      public String generateUniquePathPart(List nameElements, String delimeter)
      Generate unique path part.
      Parameters:
      nameElements - the name elements
      delimeter - the delimeter
      Returns:
      the string
    • setupForSerialization

      public void setupForSerialization()
      Called just before ascii serialization. Prepares all subcomponets for serialization.
    • cleanupFromDeSerialization

      public void cleanupFromDeSerialization()
      Cleanup from de serialization.
    • getBaseDirectory

      public String getBaseDirectory()
      Gets the base directory.
      Returns:
      the base directory
    • getDssPairedDataFilePath

      public String getDssPairedDataFilePath()
      Gets the dss paired data file path.
      Returns:
      the dss paired data file path
    • getHindcastDataList

      public Vector getHindcastDataList()
      gets a vector of HindcastData objects from all elements in the system that require hindcast information.
      Returns:
      the hindcast data list
    • setConfiguration

      public void setConfiguration(hec.watershed.model.Study study, hec.watershed.model.Condition config)
      Sets the configuration (Condition) causing elements to be created based on projects and control points in the configuration. This method is called right after creating a new RssSystem, and is only called on the client side.

      Elements created are as follows:

      Common Computation Point -> Junction with one downstream node, uses name and station

      Reservoir -> Reservoir, uses name, associated junctions and region

      Diversion -> Diversion, uses name, associated junctions and line

      Parameters:
      study - the study
      config - the config
    • getConfiguration

      public hec.watershed.model.Condition getConfiguration()
      Gets the configuration.
      Returns:
      the configuration
    • getConfigurationId

      public long getConfigurationId()
      Gets the configuration id.
      Returns:
      the configuration id
    • setConfigurationForImport

      public void setConfigurationForImport(hec.watershed.model.Condition config)
      set a new configuration when importing this network into another watershed.
      Parameters:
      config - the new configuration for import
    • updateConfiguration

      public void updateConfiguration()
      Updates all nodes and elements associated with configuration objects. Update operations include the following: Rename junctions, reservoirs, diversions. Move junctions, reservoir polygons, diversion lines. Add new junctions, reservoirs, diversions. If an object has a configuration id, but that id is not found, it looks for a link by name.
    • modifiyForSaveAs

      public boolean modifiyForSaveAs()
      called during saveAs to allow managers to modify themselves as necessary, returns true if there are changes made.
      Overrides:
      modifiyForSaveAs in class Manager
      Returns:
      true, if successful
    • addInputTSData

      @Deprecated public void addInputTSData(String name)
      Deprecated.
      adds and Input TSDataSet to this system.
      Parameters:
      name - the name
    • getInputTSDataList

      @Deprecated public Vector getInputTSDataList()
      Deprecated.
      returns a Vector of input TSDataSet names.
      Returns:
      the input ts data list
    • deleteInputTSData

      @Deprecated public void deleteInputTSData(String name)
      Deprecated.
      deletes the input TSDataSet.
      Parameters:
      name - the name
    • renameInputTSData

      @Deprecated public void renameInputTSData(String old, String newr)
      Deprecated.
      renames an input TSDataSet.
      Parameters:
      old - the old
      newr - the newr
    • setRssRun

      public void setRssRun(RssRun run)
      sets the run for the active compute.
      Parameters:
      run - the new rss run
    • getRssRun

      public RssRun getRssRun()
      get the active run.
      Returns:
      the rss run
    • getWQRun

      public hec.rss.wq.model.WQRun getWQRun()
      Gets the Water Quality Run. This is called from scripted rules for operating a Water Quality Control Device.
      Returns:
      the WQ Run
    • setAlternative

      public void setAlternative(RssAlt alt)
      set the alternative for the current compute.
      Parameters:
      alt - the new alternative
    • getAlternative

      public RssAlt getAlternative()
      Returns the current RssAlt alternative used for this Network- returns null if not available.
      Returns:
      RssAlt the Alternative used
    • getWaterAccountSet

      public WaterAccountSet getWaterAccountSet(String name)
    • renameWaterAccountSet

      public void renameWaterAccountSet(String currentName, String newName)
    • deleteWaterAccountSet

      public void deleteWaterAccountSet(WaterAccountSet set)
    • getReservoirSysOps

      public ReservoirSysOp[] getReservoirSysOps()
      Gets the reservoir sys ops.
      Returns:
      the reservoir sys ops
    • getUpstreamElements

      public Vector getUpstreamElements(Element startingElem)
      Gets the downstream elements.
      Parameters:
      startingElem - the starting elem
      Returns:
      the downstream elements
    • getDownstreamElements

      public Vector getDownstreamElements(Element startingElem)
      returns a vector of elements that are downstream of the given element following the flow path - not following any diversions. Returns null if there is a connectivity error.
      Parameters:
      startingElem - the starting elem
      Returns:
      the downstream elements
    • getDownstreamElements

      public Vector getDownstreamElements(Element startingElem, boolean sort)
      Gets the downstream elements.
      Parameters:
      startingElem - the starting elem
      sort - the sort
      Returns:
      the downstream elements
    • getDownstreamNodeList

      public boolean getDownstreamNodeList(Element startingElem, List<RssNode> nodeList)
      fills the given list of downstream nodes associated with elements that are downstream of the given element following the flow path - not following any diversions. This method does follow all downstream branches for elements with more than one downstream node. The filled list will not contain duplicate nodes Includes the downstream node of the given element. Returns returns false if there is a connectivity error, otherwise returns true.
      Parameters:
      startingElem - the starting elem
      nodeList - the node list
      Returns:
      the downstream node list
    • getDownstreamNodeList

      public boolean getDownstreamNodeList(Element startingElem, List<RssNode> nodeList, Predicate<RssNode> query)
    • getReservoirOpDataList

      @Deprecated public CommonDataList getReservoirOpDataList()
      Deprecated.
      - now stores data in it's own DBF file get a reference to the reservoir data list
      Gets the reservoir op data list.
      Returns:
      the reservoir op data list
    • getReservoirSysOpDataList

      @Deprecated public CommonDataList getReservoirSysOpDataList()
      Deprecated.
      - now stores data in it's own DBF file get a reference to the reservoir system data list
      Gets the reservoir sys op data list.
      Returns:
      the reservoir sys op data list
    • renameReservoirSysOp

      public void renameReservoirSysOp(String oldName, String newName)
      Rename reservoir sys op.
      Parameters:
      oldName - the old name
      newName - the new name
    • getReservoirSysOp

      public ReservoirSysOp getReservoirSysOp(String name)
      Retreives a Reservoir System Operation by name. If there is a reservoir system operation with the given name it is returned. Otherwise a null value is returned.
      Parameters:
      name - the name
      Returns:
      the reservoir sys op
    • createReservoirSysOpName

      public String createReservoirSysOpName(String name)
      Creates the reservoir sys op name.
      Parameters:
      name - the name
      Returns:
      the string
    • loadReservoirSysOps

      public void loadReservoirSysOps(boolean force)
      This method is used to ensure that the Reservoir System Ops have been loaded
    • createNewReservoirSysOp

      public ReservoirSysOp createNewReservoirSysOp(String name, String description)
      Creates a new reservoir system operations set.
      Parameters:
      name - the name
      description - the description
      Returns:
      the reservoir sys op
    • addReservoirSysOp

      public void addReservoirSysOp(ReservoirSysOp resSysOp)
    • deleteReservoirSysOp

      public void deleteReservoirSysOp(ReservoirSysOp sysOp)
      delete a reservoir system operations object.
      Parameters:
      sysOp - the sys op
    • deleteReservoirOps

      protected void deleteReservoirOps(rma.util.IntVector resOpIds)
      delete the ReservoirOp with the record numbers in resOpIds.
      Parameters:
      resOpIds - the List of ReservoirOp dbf record numbers to delete
    • deleteReservoirSysOps

      protected void deleteReservoirSysOps(rma.util.IntVector resSysOpIds)
      delete the ReservoirSysOps with the record numbers in resSysOpIds.
      Parameters:
      resSysOpIds - the List of ReservoirSysOp dbf record numbers to delete
    • prepRegulatedFlowCompute

      public boolean prepRegulatedFlowCompute()
      sets all elements and nodes active in preparation for a regulated flow simulation.
      Returns:
      true, if successful
    • prepCumLocFlowCompute

      public boolean prepCumLocFlowCompute()
      sets active state of elements and nodes in preparation for a cumulative local flow simulation.
      Returns:
      true, if successful
    • prepUnregulatedFlowCompute

      public boolean prepUnregulatedFlowCompute()
      sets active state of elements and nodes in preparation for a unregulated flow simulation.
      Returns:
      true, if successful
    • prepHoldoutCompute

      public boolean prepHoldoutCompute(String resname)
      sets active elements for computing holdouts for a specific reservoir.
      Parameters:
      resname - the resname
      Returns:
      true, if successful
    • prepPulseRoutingCompute

      public boolean prepPulseRoutingCompute(ReservoirElement res, int opid, int outletId)
      Sets active elements for computing a pulse change in flow for a specific reservoir outlet. Set active only elements between reservoir outlet tailwater and downstream most element(s). All reservoirs downstream of outlet are set to uncontrolled behavior, so pulse will not flow down diverted outlets of downstream reservoirs.
      Parameters:
      res - the res
      opid - the opid
      outletId - the outlet id
      Returns:
      true, if successful
    • init

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

      public void clearStreamAlignment()
      Clear stream alignment.
    • getAlignment

      public StreamAlignment getAlignment()
      Gets the alignment.
      Returns:
      the alignment
    • getElementCount

      public int getElementCount()
      Gets the element count.
      Returns:
      the element count
    • getElementCount

      public int getElementCount(String classname)
      count the elements of the given classname in the element vector.
      Parameters:
      classname - the classname
      Returns:
      the element count
    • getElementCountByFunction

      public int getElementCountByFunction(String classname)
      count the elements of the given classname in the element vector.
      Parameters:
      classname - the classname
      Returns:
      the element count by function
    • getElementNameVector

      public Vector getElementNameVector(String classname)
      returns a vector of string with element names of the given class.
      Parameters:
      classname - the classname
      Returns:
      the element name vector
    • getElementNameVectorByFunction

      public Vector getElementNameVectorByFunction(String classname)
      returns a vector of string with element names of the given class.
      Parameters:
      classname - the classname
      Returns:
      the element name vector by function
    • newElement

      public Element newElement(boolean addtolist)
      create a new element and add it to the element list.
      Parameters:
      addtolist - the addtolist
      Returns:
      the element
    • newReachElement

      public ReachElement newReachElement()
      create a new reach element with a default name and add it to the element list.
      Returns:
      the reach element
    • newReachElement

      public ReachElement newReachElement(String name)
      create a new reach element and add it to the element list.
      Parameters:
      name - the name
      Returns:
      the reach element
    • newTimeStepRoutingElement

      public TimeStepRoutingElement newTimeStepRoutingElement(boolean addToList)
    • newDiversionElement

      public DiversionElement newDiversionElement()
      create a new reach element with a default name and add it to the element list.
      Returns:
      the diversion element
    • newDiversionElement

      public DiversionElement newDiversionElement(String name)
      create a new reach element and add it to the element list.
      Parameters:
      name - the name
      Returns:
      the diversion element
    • newGlobalVariable

      public GlobalVariable newGlobalVariable(String name, GlobalVariableType type)
      New global variable.
      Parameters:
      name - the name
      Returns:
      the global variable
    • newGlobalVariable

      public GlobalVariable newGlobalVariable(String name, GlobalVariable gv)
      New global variable.
      Parameters:
      name - the name
      gv - GlobalVariable that will be added as "new"
      Returns:
      the global variable
    • printGlobalScalarsToComputeLog

      public void printGlobalScalarsToComputeLog(int detailLevel)
      print the Scalar GLobalVariables to the compute log
      Parameters:
      detailLevel - 1 same as ScalarGlobalVariable.printToComputeLog() 2 print more details of the ScalarGlobalVariable
      See Also:
    • printGlobalStringsToComputeLog

      public void printGlobalStringsToComputeLog(int detailLevel)
      print the String GlobalVariables to the compute log
      Parameters:
      detailLevel - 1 same to StringGlobalVariable.printToComputeLog() 2 print greater detail about the String GlobalVariable
      See Also:
    • printGlobalTablesToComputeLog

      public void printGlobalTablesToComputeLog(int detailLevel)
      Parameters:
      detailLevel -
    • printGlobalTimeSeriesToComputeLog

      public void printGlobalTimeSeriesToComputeLog(int detailLevel)
      Parameters:
      detailLevel -
    • updateGlobalVariable

      public void updateGlobalVariable(int id, GlobalVariable updatedGV)
    • newStateVariable

      public StateVariable newStateVariable(String name)
      New state variable.
      Parameters:
      name - the name
      Returns:
      the state variable
    • newStateVariable

      public StateVariable newStateVariable(String name, StateVariable sv)
      New state variable.
      Parameters:
      name - the name
      sv - StateVariable that will be added as "new"
      Returns:
      the state variable
    • getWaterAccount

      public WaterAccount getWaterAccount(int id)
      Gets the Water Account.
      Parameters:
      id - the id
      Returns:
      the Water Account
    • getGlobalVariable

      public GlobalVariable getGlobalVariable(int id)
      Gets the global variable.
      Parameters:
      id - the id
      Returns:
      the global variable
    • getGlobalVariable

      public GlobalVariable getGlobalVariable(String name)
      Gets the user-defined GlobalVariable named by the given string "name", or null if no match is found. The match is not case-sensitive.
      Parameters:
      name - String containing the name of a GlobalVariable
      Returns:
      GlobalVariable
    • getStateVariable

      public StateVariable getStateVariable(int id)
      Gets the state variable.
      Parameters:
      id - the id
      Returns:
      the state variable
    • getStateVariable

      public StateVariable getStateVariable(String name)
      Gets the user-defined StateVariable named by the given string "name", or null if no match is found. The match is not case-sensitive.
      Parameters:
      name - String containing the name of a StateVariable
      Returns:
      StateVariable
    • getDefaultPulseFlow

      public double getDefaultPulseFlow()
      Base flow value for computing pulse routing, RssSystem default. This value may be overriden by the individual ReservoirOutletElement
      Returns:
      default pulse flow
    • getDefaultPulseFlow

      public void getDefaultPulseFlow(hec.data.ParamDouble pd)
      Gets the default pulse flow.
      Parameters:
      pd - the pd
    • setDefaultPulseFlow

      public void setDefaultPulseFlow(double basePulseFlow)
      Sets the default pulse flow.
      Parameters:
      basePulseFlow - the new default pulse flow
    • setDefaultPulseFlow

      public void setDefaultPulseFlow(hec.data.ParamDouble pd)
      Sets the default pulse flow.
      Parameters:
      pd - the new default pulse flow
    • newJunctionElement

      public JunctionElement newJunctionElement()
      create a new junction element with a default name and add it to the element list.
      Returns:
      the junction element
    • newJunctionElement

      public JunctionElement newJunctionElement(String name)
      create a new junction element and add it to the element list.
      Parameters:
      name - the name
      Returns:
      the junction element
    • newJunctionElement

      public JunctionElement newJunctionElement(hec.watershed.model.ComputationPoint cp)
      create a new junction element and add it to the element list.
      Parameters:
      cp - the cp
      Returns:
      the junction element
    • findDivertedOutlet

      public DivertedOutletElement findDivertedOutlet(String name)
      Finds a diverted outlet by name.
      Parameters:
      name - the name
      Returns:
      DivertedOutletElement with the name or null
    • findDivertedOutlet

      public DivertedOutletElement findDivertedOutlet(hec.map.WorldPt wpt, double tol)
      Finds a diverted outlet that Contains the given World Point.
      Parameters:
      wpt - the wpt
      tol - the tol
      Returns:
      the diverted outlet element
    • findDiversion

      public DiversionElement findDiversion(hec.map.WorldPt wpt, double tol)
      Finds a diversion that Contains the given World Point.
      Parameters:
      wpt - the wpt
      tol - the tol
      Returns:
      the diversion element
    • findDiversion

      public DiversionElement findDiversion(String name)
      Finds a diversion by name.
      Parameters:
      name - the name
      Returns:
      DiversionElement with the name or null
    • deleteDiversion

      public boolean deleteDiversion(String name)
      Delete diversion.
      Parameters:
      name - the name
      Returns:
      true, if successful
    • findReach

      public ReachElement findReach(hec.map.WorldPt wpt, double tol)
      Finds a Reach that Contains the given World Point.
      Parameters:
      wpt - the wpt
      tol - the tol
      Returns:
      the reach element
    • findReaches

      public List<ReachElement> findReaches(Predicate<hec.map.WorldLine> predicate)
    • findReach

      public ReachElement findReach(String name)
      Find reach.
      Parameters:
      name - the name
      Returns:
      the reach element
    • breakReach

      public void breakReach(ReachElement oldreach, hec.map.WorldPt wpt, JunctionElement newjunc)
      split the given reach into two reaches at the given world point.
      Parameters:
      oldreach - the oldreach
      wpt - the wpt
      newjunc - the newjunc
    • deleteStateVariable

      public boolean deleteStateVariable(StateVariable sv)
      Delete state variable.
      Parameters:
      sv - the sv
      Returns:
      true, if successful
    • deleteGlobalVariable

      public boolean deleteGlobalVariable(GlobalVariable gv)
      Delete global variable.
      Parameters:
      gv - the gv
      Returns:
      true, if successful
    • deleteReach

      public boolean deleteReach(String name)
      Delete reach.
      Parameters:
      name - the name
      Returns:
      true, if successful
    • findJunction

      public JunctionElement findJunction(hec.map.WorldPt wpt, double tol)
      Finds a Reach that Contains the given World Point.
      Parameters:
      wpt - the wpt
      tol - the tol
      Returns:
      the junction element
    • findReservoirs

      public List<ReservoirElement> findReservoirs(Predicate<Object> predicate)
    • findJunctions

      public List<JunctionElement> findJunctions(Predicate<hec.map.WorldPt> predicate)
    • findJunction

      public JunctionElement findJunction(String name)
      Finds a junction by name.
      Parameters:
      name - the name
      Returns:
      JunctionElement with the name or null
    • findJunction

      public JunctionElement findJunction(hec.watershed.model.ComputationPoint cp)
      find a JunctionElement by computation point id.
      Parameters:
      cp - the cp
      Returns:
      the junction element
    • deleteJunction

      public boolean deleteJunction(String name)
      Delete junction.
      Parameters:
      name - the name
      Returns:
      true, if successful
    • cleanVectors

      public void cleanVectors()
      Clean vectors.
    • findReservoir

      public ReservoirElement findReservoir(hec.map.WorldPt wpt)
      Finds an Reservoir the Contains the given World Point.
      Parameters:
      wpt - the wpt
      Returns:
      the reservoir element
    • findReservoir

      public ReservoirElement findReservoir(int id)
      Finds a reservoir by its ID.
      Parameters:
      id - the id
      Returns:
      the reservoir element
    • findReservoir

      public ReservoirElement findReservoir(String name)
      Finds an Reservoir by name.
      Parameters:
      name - the name of the ReservoirElement
      Returns:
      the ReservoirElement with the name of name or null
    • findReservoir

      public ReservoirElement findReservoir(int streamIndex, double coord)
      Find reservoir by stream index and coordinate.
      Parameters:
      streamIndex - the stream index
      coord - the coord
      Returns:
      the reservoir element
    • addReservoir

      public void addReservoir(ReservoirElement resElem)
      Adds a reservoir element to the system. Does no checking to see if it already exists.
      Parameters:
      resElem - the res elem
    • deleteReservoir

      public boolean deleteReservoir(String name)
      Delete reservoir.
      Parameters:
      name - the name
      Returns:
      true, if successful
    • createReservoir

      @Deprecated public ReservoirElement createReservoir(hec.map.WorldRegion reg)
      Deprecated.
      Adds a new Reservoir Region into the system.
      Parameters:
      reg - the reg
      Returns:
      the reservoir element
    • createReservoir

      public ReservoirElement createReservoir(hec.map.WorldRegion reg, Vector nodeVec, Vector ndirVec, double tol, String name, String descrip)
      Adds a new Reservoir Region into the system.
      Parameters:
      reg - the reg
      nodeVec - the node vec
      ndirVec - the ndir vec
      tol - the tol
      name - the name
      descrip - the descrip
      Returns:
      the reservoir element
    • getNextResOpId

      public int getNextResOpId()
      Gets the next res op id.
      Returns:
      the next res op id
    • getNextResSysOpId

      public int getNextResSysOpId()
      Gets the next res sys op id.
      Returns:
      the next res sys op id
    • createReservoir

      public ReservoirElement createReservoir(hec.watershed.model.Reservoir resProject)
      Adds a new Reservoir Region into the system.
      Parameters:
      resProject - the res project
      Returns:
      the reservoir element
    • getConnectionNode

      public RssNode getConnectionNode(hec.map.WorldPt pt, double tol, int idir)
      Gets the connection node.
      Parameters:
      pt - the pt
      tol - the tol
      idir - the idir
      Returns:
      the connection node
    • createReach

      public ReachElement createReach(JunctionElement upstreamJunc, JunctionElement downstreamJunc, RssNode inflowNode, RssNode outflowNode, String reachName)
      add a Reach into the System
      Parameters:
      upstreamJunc - the inflow junction
      downstreamJunc - the outflow junction
      inflowNode - the inflow node
      outflowNode - the outflow node
      reachName - the name of the new Reach
      Returns:
      the new ReachElement
    • createReach

      @Deprecated public ReachElement createReach(RssNode node0, RssNode node1, double tol)
      Deprecated.
      Adds a new Reach into the System.
      Parameters:
      node0 - the node0
      node1 - the node1
      tol - the tol
      Returns:
      the reach element
    • createDiversion

      public DiversionElement createDiversion(RssNode node0, RssNode node1, Vector ptVec, double tol)
      Adds a new Diversion into the System.
      Parameters:
      node0 - the node0
      node1 - the node1
      ptVec - the pt vec
      tol - the tol
      Returns:
      the diversion element
    • createDiversion

      public Element createDiversion(hec.watershed.model.Diversion divproj, hec.watershed.model.Reservoir resproj)
      Adds either a Diversion of DivertedOutlet based on a Diversion Project.
      Parameters:
      divproj - the divproj
      resproj - the resproj
      Returns:
      the element
    • findReach

      public ReachElement findReach(int streamIndex, double coord)
      Find reach.
      Parameters:
      streamIndex - the stream index
      coord - the coord
      Returns:
      the reach element
    • getElementVector

      public Vector getElementVector()
      get a reference to the element vector.
      Returns:
      the element vector
    • getStateVariableList

      public List<StateVariable> getStateVariableList()
      get a reference to the StateVariable List.
      Returns:
      the state variable list
    • getGlobalVariableList

      public List<GlobalVariable> getGlobalVariableList()
      get a reference to the GlobalVariable List.
      Returns:
      the global variable list
    • getInputGlobalVariables

      public List<GlobalVariable> getInputGlobalVariables()
      get Global Variable List of input usage type.
      Returns:
      the global variable list with usage type of input
    • getInputGlobalVariables

      public List<GlobalVariable> getInputGlobalVariables(GlobalVariableType gvType)
      get Global Variable List of input usage type for the type of global variable.
      Parameters:
      gvType - the type of GlobalVariable to return
      Returns:
      the global variable list with usage type of input
    • getGlobalVariables

      public List<GlobalVariable> getGlobalVariables(GlobalVariableType gvType)
    • getOutputGlobalVariables

      public List<GlobalVariable> getOutputGlobalVariables()
      get Global Variable List of output usage type.
      Returns:
      the global variable list with usage type of output
    • findGlobalScalars

      public List<ScalarGlobalVariable> findGlobalScalars()
      get list of Global Scalars.
      Returns:
      the list of Scalar Global Variables
    • findGlobalScalar

      public ScalarGlobalVariable findGlobalScalar(String name)
      get Global Scalar Variable by name.
      Parameters:
      name -
      Returns:
      the Scalar Global Variable
    • findGloblScalars

      public List<ScalarGlobalVariable> findGloblScalars(ScalarDataType type)
      get the Scala Global Variables of a specified ScalarDataType
      Parameters:
      type -
      Returns:
    • findGlobalStrings

      public List<StringGlobalVariable> findGlobalStrings()
      get a List of Global Variable Strings.
      Returns:
      the list of String Global Variables
    • findGlobalString

      public StringGlobalVariable findGlobalString(String name)
      get Global String Variable by name.
      Parameters:
      name - the name of the String Global Variable
      Returns:
      the String Global Variable
    • findGlobalTables

      public List<TableGlobalVariable> findGlobalTables()
      get list of Global Tables.
      Returns:
      the list of Table Global Variables
    • findGlobalTable

      public TableGlobalVariable findGlobalTable(String name)
      get Global Table Variable by name.
      Parameters:
      name -
      Returns:
      the Table Global Variable
    • findGlobalTimeSeries

      public List<TimeSeriesGlobalVariable> findGlobalTimeSeries()
      get list of Global Time Series Variables.
      Returns:
      the list of Time Series Global Variables
    • findGlobalTimeSeries

      public TimeSeriesGlobalVariable findGlobalTimeSeries(String name)
      get Global Time Series Variable by name.
      Parameters:
      name -
      Returns:
      the Time Series Global Variable
    • findInputGlobals

      public List<GlobalVariable> findInputGlobals()
      get a List of all the Input GlobalVariables
      Returns:
      the List of Input GlobalVariables
    • findOutputGlobals

      public List<GlobalVariable> findOutputGlobals()
      get a List of all the Output GlobalVariables
      Returns:
      the List of Output GlobalVariables
    • getNodeVector

      public Vector getNodeVector()
      get a reference to the node vector.
      Returns:
      the node vector
    • getElementVectorByClass

      public Vector getElementVectorByClass(String classname)
      returns a vector of elements of the given class.
      Parameters:
      classname - the classname
      Returns:
      the element vector by class
    • getElementVectorByClass

      public <T> Vector<T> getElementVectorByClass(Class<T> c)
      returns a vector of elements of the given class.
      Parameters:
      c - the c
      Returns:
      the element vector by class
    • getElementOrder

      public int[] getElementOrder()
      Gets the element order.
      Returns:
      the element order
    • getElementByOrder

      public Element getElementByOrder(int iorder)
      return the element from the Active Element Vector based on the id's listed in array returned from getElementOrder()
      Parameters:
      iorder -
      Returns:
      Element, may be null if iorder is out of range or active element vec is not initialized.
    • getElement

      public Element getElement(int idx)
      Finds an element with the given index from the network's element vector or from the elements children by recursing into child elements.
      Parameters:
      idx - the idx
      Returns:
      the element
    • findElement

      public Element findElement(int idx)
      Finds an element with the given index from the network's element vector, does not recurse into child elements.
      Parameters:
      idx - the idx
      Returns:
      the element
    • findElement

      public Element findElement(String name)
      Find element. Use this method with caution since it will find the first element with the name specified not caring what the Element type is (Reservoir, Reach, Junction, etc). Better to use the find method for the appropriate Element type wanted (findReservoir(), findReach() etc)
      Parameters:
      name - the name
      Returns:
      the element
    • getNodeNames

      @Deprecated public String[] getNodeNames(String type)
      Deprecated.
      Gets the node names.
      Parameters:
      type - the type
      Returns:
      the node names
    • findAdjParam

      public AdjustableParameter findAdjParam(String elemName, String function, String param)
      Find adj param.
      Parameters:
      elemName - the elem name
      function - the function
      param - the param
      Returns:
      the adjustable parameter
    • findTSArray

      public double[] findTSArray(String locType, String locName, String param)
      Find ts array.
      Parameters:
      locType - the loc type
      locName - the loc name
      param - the param
      Returns:
      the double[]
    • initialize

      @Deprecated public boolean initialize(Operations op, TSDataSet inputTS, TSDataSet outputTS, GVDataSet inputGvDataSet, GVDataSet outputGvDataSet)
      Deprecated.
      Initializes the system to use a particual operations, inputTS, and outputTS in preparation for a compute used only by RssLpAlt, no longer supported.
      Parameters:
      op - the op
      inputTS - the input ts
      outputTS - the output ts
      Returns:
      true, if successful
    • initialize

      public boolean initialize(TSDataSet inputTS, TSDataSet outputTS, GVDataSet inputGvDataSet, GVDataSet outputGvDataSet, int computeType, RunTimeWindow rtw)
      initialize prior to a compute, called by RssRun.
      Parameters:
      inputTS - the input ts
      outputTS - the output ts
      computeType - the compute type
      rtw - the rtw
      Returns:
      true, if successful
    • initializeGlobalVariables

      public boolean initializeGlobalVariables()
    • initForPostProcessing

      public boolean initForPostProcessing(TSDataSet inputTS, TSDataSet outputTS, int computeType, RunTimeWindow rtw)
      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
    • initializeStateVariables

      public boolean initializeStateVariables(int computeType)
      Initialize state variables.
      Parameters:
      computeType - the compute type
      Returns:
      true, if successful
    • runStateVariableInitScripts

      public boolean runStateVariableInitScripts(int computeType)
      Runs the Init script for the state variables.
      Parameters:
      computeType - the compute type
      Returns:
      true, if successful
    • finalizeCompute

      public void finalizeCompute()
      called when compute is complete to allow system to dump unneeded resources.
    • evalStateVariables

      public int evalStateVariables(RunTimeStep rts, List svlist)
      walks over list of all state variables and calls their evaluate method for the given time step.
      Parameters:
      rts - time step for the evaluation
      svlist - the svlist
      Returns:
      the int
    • initHotstart

      public void initHotstart(RunTimeWindow rtw)
      initialize the hotstart settings.
      Parameters:
      rtw - the rtw
    • compute3x

      public int compute3x(RunTimeWindow rtw, RssRun run, int computeType, boolean runHindcastCompute)
      New version 3.0 computations supporting single step execution, flexible decision intervals, and downstream operation by multiple reservoirs
      Parameters:
      rtw - time window of the compute
      run - the run
      computeType - Regulated, Unregulated, Cum-Loc, Pulse
      runHindcastCompute - true if hindcast is to be run
      Returns:
      RTN_NOPROBLEM if compute successful
    • simulateHindcast

      public int simulateHindcast(RunTimeWindow rtw, int computeType)
      Perform hindcast simulation.
      Parameters:
      rtw - the rtw
      computeType - the compute type
      Returns:
      the int
    • simulateForecastStep

      public int simulateForecastStep(RunTimeStep rts, int computeType, IterationBlock iterblk, boolean computeall, boolean runHindcastCompute, List pumpResList, int iteration, int elemStart, boolean lastTSEval, List pumpRuleList)
      Perform forecast simulation step, only recomputes elements that have been flagged as dirty.
      Parameters:
      rts - the rts
      computeType - the compute type
      iterblk - the iterblk
      computeall - the computeall
      runHindcastCompute - the run hindcast compute
      pumpResList - the pump res list
      iteration - the iteration
      elemStart - the elem start
      Returns:
      the int
    • simulateForecast

      public int simulateForecast(RunTimeWindow rtw, int computeType, IterationBlock iterblk, boolean runHindcastCompute)
      Perform forecast simulation.
      Parameters:
      rtw - the rtw
      computeType - the compute type
      iterblk - the iterblk
      runHindcastCompute - the run hindcast compute
      Returns:
      the int
    • simulateForecastWithLocalDecisions

      public int simulateForecastWithLocalDecisions(RunTimeWindow rtw, int computeType, IterationBlock iterblk, boolean runHindcastCompute, int maxtrial)
      Perform forecast simulation with local decision making.
      Parameters:
      rtw - the rtw
      computeType - the compute type
      iterblk - the iterblk
      runHindcastCompute - the run hindcast compute
      maxtrial - the maxtrial
      Returns:
      the int
    • setOperations

      public void setOperations(Operations op)
      Sets the operations.
      Parameters:
      op - the new operations
    • setInputTSDataSet

      public void setInputTSDataSet(TSDataSet tsData)
      Sets the input ts data set.
      Parameters:
      tsData - the new input ts data set
    • getInputTSDataSet

      public TSDataSet getInputTSDataSet()
      Overrides:
      getInputTSDataSet in class Manager
    • getInputGvDataSet

      public GVDataSet getInputGvDataSet()
      Returns:
    • getOutputGVDataSet

      public GVDataSet getOutputGVDataSet()
      Returns:
    • setOutputTSDataSet

      public void setOutputTSDataSet(TSDataSet tsData)
      Sets the output ts data set.
      Parameters:
      tsData - the new output ts data set
    • getOutputTSDataSet

      public TSDataSet getOutputTSDataSet()
      Overrides:
      getOutputTSDataSet in class Manager
    • findNode

      public RssNode findNode(String name)
      Find node.
      Parameters:
      name - the name
      Returns:
      the rss node
    • getNode

      public RssNode getNode(int idx)
      Gets the node.
      Parameters:
      idx - the idx
      Returns:
      the node
    • readFile

      public boolean readFile(Identifier id)
      Retrieves the RssSystem data from the specified ASCII file. If no path name is given, the method uses the current pathname of the Run.

      The file must have type=param formatting. The following types and parameters are defined.

      System Name= (String) name of the System
      Description= (String) description of the System
      RssNode= (int) zero-based array location of a new node
      Element= (int) zero-based array location of a new element

      The RssNode and Element line types generate new RssNode and Element objects respectively. The new objects are places in the _nodeVector or _elementVector at the specified index location. The readData method of the new object is called to process RssNode and Element specific data. Control is returned to this method when a RssNode End or Element End line type is found. Note that a RssNode= line type must be matched by a RssNode End line type or the file will not be processed correctly. Similary, Element= must be matched by Element End.

      Overrides:
      readFile in class Manager
      Parameters:
      id - the id
      Returns:
      true, if successful
      See Also:
    • updateDiversionAndDivertedOutletElementsToTimeStep

      public void updateDiversionAndDivertedOutletElementsToTimeStep()
    • writeFile

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

      public int getVersion()
      Return the current version id of the RssSystem. This represents the version id of the RssSystem as read from the file.
      Returns:
      the version
    • getLastSavedInResSimVersion

      public String getLastSavedInResSimVersion()
      get the last version of ResSim the network was saved in
      Returns:
      the last version of ResSim the network was saved in
    • setMapIdentifier

      public void setMapIdentifier(hec.map.MapIdentifier id)
      Description copied from interface: hec.map.MapObjectInterface
      Sets the MapIdentifier attribute of the MapObjectInterface object
      Specified by:
      setMapIdentifier in interface hec.map.MapObjectInterface
      Parameters:
      id - The new MapIdentifier value
    • getMapIdentifier

      public hec.map.MapIdentifier getMapIdentifier()
      Description copied from interface: hec.map.MapObjectInterface
      Gets the MapIdentifier attribute of the MapObjectInterface object
      Specified by:
      getMapIdentifier in interface hec.map.MapObjectInterface
      Returns:
      The MapIdentifier value
    • setExtent

      public void setExtent(hec.map.WorldRect rc)
      Description copied from interface: hec.map.MapObjectInterface
      Sets the Extent attribute of the MapObjectInterface object
      Specified by:
      setExtent in interface hec.map.MapObjectInterface
      Parameters:
      rc - The new Extent value
    • getExtent

      public hec.map.WorldRect getExtent()
      Description copied from interface: hec.map.MapObjectInterface
      Gets the Extent attribute of the MapObjectInterface object
      Specified by:
      getExtent in interface hec.map.MapObjectInterface
      Returns:
      The Extent value
    • load

      public void load() throws IOException
      Loads the system from disk into memory.
      Specified by:
      load in interface hec.map.MapObjectInterface
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • unload

      public void unload()
      called when the MapGlyph unloads this Manager.
      Specified by:
      unload in interface hec.map.MapObjectInterface
    • unloading

      public void unloading()
      called when the ManagerProxy unloads this Manager.
      Overrides:
      unloading in class Manager
    • getFlowContolTSRecordProxies

      public Vector getFlowContolTSRecordProxies()
      returns a vector of ts record proxies used to identify adjustable flow elements and their time series 2008-03-03 corrected to return all controlled objects in reservoirs.
      Returns:
      the flow contol ts record proxies
    • getDivContolTSRecordProxies

      public Vector getDivContolTSRecordProxies()
      returns a vector of ts record proxies used to identify adjustable diversion elements and their time series
      Returns:
      the diversion control ts record proxies
    • clearTSProxyList

      public void clearTSProxyList()
      Loops over all elements and reservoir system operations clearing set of TSRecordProxies for all computation modes.
    • updateTSProxyList

      public void updateTSProxyList()
      Loops over all elements and reservoir system operations updating the set of TSRecordProxies for all computation modes.
    • addWQModelVariables

      public List<ModelVariable> addWQModelVariables(Collection<hec.wqenginecore.Constituent> conlist)
      Add ModelVariables to the global list of model variables for each water quality constituent modeled included in the current alternative
      Parameters:
      conlist - set of constituents
      Returns:
      list of ModelVariable objects created for each constituent
    • applyHindcastData

      public void applyHindcastData(Vector hdvec)
      applies hindcast data to computeable objects.
      Parameters:
      hdvec - the hdvec
    • getObservedDataTSProxies

      public Vector getObservedDataTSProxies(Vector vec)
      Gets the observed data ts proxies.
      Parameters:
      vec - the vec
      Returns:
      the observed data ts proxies
    • getActiveTSProxies

      public Vector getActiveTSProxies(Vector vec, int iotype)
      returns a vector of required input, or generated output TSRecordProxies used in the current alternative.
      Parameters:
      vec - the vec
      iotype - the iotype
      Returns:
      the active ts proxies
    • getActiveTSProxies

      public Vector getActiveTSProxies(Vector vec, int iotype, int computeType)
      returns a vector of required input, or generated output TSRecordProxies used in the current alternative.
      Parameters:
      vec - the vec
      iotype - the iotype
      computeType - the compute type
      Returns:
      the active ts proxies
    • getActiveWaterQualityTSProxies

      public List<TSRecordProxy> getActiveWaterQualityTSProxies(hec.rss.wq.model.WQRun wqRun)
    • getTSRecordProxies

      @Deprecated public Vector getTSRecordProxies()
      Deprecated.
      gets all time-series record proxies from nodes. Implementation for TSManager interface.
      Specified by:
      getTSRecordProxies in interface TSManager
      Returns:
      the tS record proxies
    • getTSRecordProxies

      @Deprecated public Vector getTSRecordProxies(boolean isInput)
      Deprecated.
      Returns a list of all TSRecordProxies for an input or output data set This is only returning the proxies required for the current computation mode.
      Specified by:
      getTSRecordProxies in interface TSManager
      Parameters:
      isInput - the is input
      Returns:
      the tS record proxies
    • getNextDefaultName

      public String getNextDefaultName(int type)
      returns a suggested name that is unique for given element type.
      Parameters:
      type - the type
      Returns:
      the next default name
    • getElementNames

      public String[] getElementNames(String classname)
      get and array of strings containing the names of all elements of the given class.
      Parameters:
      classname - the classname
      Returns:
      the element names
    • getReservoirNames

      public String[] getReservoirNames()
      get an array of Strings containing the names of all reservoir elements.
      Returns:
      the array of ReservoirElement names
    • getReachNames

      public String[] getReachNames()
      get and array of strings containing the names of all reach elements.
      Returns:
      the array of ReachElement names
    • getJunctionNames

      public String[] getJunctionNames()
      get and array of strings containing the names of all junction elements.
      Returns:
      the array of JunctionElement names
    • getDiversionNames

      public String[] getDiversionNames()
      /** get and array of strings containing the names of all diversion elements.
      Returns:
      the array of DiversionElement names
    • newNode

      public RssNode newNode()
      create a new node and add it to the list.
      Returns:
      the rss node
    • createNode

      public RssNode createNode(hec.map.WorldPt pt)
      Adds a RssNode to the system.
      Parameters:
      pt - the pt
      Returns:
      the rss node
    • createNode

      public RssNode createNode(hec.watershed.model.ComputationPoint cp)
      Adds a RssNode to the system based on a Common Computation Point.
      Parameters:
      cp - the cp
      Returns:
      the rss node
    • createNode

      public RssNode createNode(Node n)
      Adds a RssNode to the system based on a Node from a Reservoir Project.
      Parameters:
      n - the n
      Returns:
      the rss node
    • deleteNode

      public void deleteNode(RssNode node)
      Delete node.
      Parameters:
      node - the node
    • findDownstreamNode

      public RssNode findDownstreamNode(int streamIndex, double coord)
      Find downstream node.
      Parameters:
      streamIndex - the stream index
      coord - the coord
      Returns:
      the hec.rss.model. rss node
    • findUpstreamNode

      public RssNode findUpstreamNode(int streamIndex, double coord)
      Find upstream node.
      Parameters:
      streamIndex - the stream index
      coord - the coord
      Returns:
      the hec.rss.model. rss node
    • 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
    • nextElementIndex

      public int nextElementIndex()
      Next element index.
      Returns:
      the int
    • resetParentElement

      public void resetParentElement()
      reset parent element assignment to all child elements.
    • renameDamElementChildren

      public void renameDamElementChildren()
      fix naming of dam and diverted outlet default child elements.
    • renameResChildrenUpNodes

      public void renameResChildrenUpNodes()
      fix naming of dam and diverted outlet default child elements.
    • hasDownstreamGoals

      public boolean hasDownstreamGoals()
      returns true if the system has any downstream goals in the active operation set.
      Returns:
      true, if successful
    • backupFile

      public boolean backupFile(String backupDir)
      Overrides:
      backupFile in class Manager
    • 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
    • saveManagerAs

      public Manager saveManagerAs(String directory, String filePrefix, ManagerProxyListContainer container, Identifier destId, RssSystem copy)
      Save manager as.S
      Parameters:
      directory - the directory
      filePrefix - the file prefix
      container - the container
      destId - the dest id
      copy - the copy
      Returns:
      the manager
    • refreshData

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

      public void copyGlobalVariableTables(RssSystem otherSys)
    • getGlobalVariableTablesFile

      public String getGlobalVariableTablesFile()
    • deleting

      public void deleting()
      called when the manager proxy is deleting the manager.
      Overrides:
      deleting in class Manager
    • renamed

      public void renamed(Identifier id)
      Description copied from class: Manager
      called to rename the manager.
      Overrides:
      renamed in class Manager
    • resetAndSaveOperations

      public void resetAndSaveOperations()
      cause the ReservoirOps and RerservoirSysOps to save correctly when the the dbf filenames have changed. Used for renaming and saveAs
    • getResOpDbfFileName

      protected String getResOpDbfFileName()
      get the path to the ReservoirOp DBF file.
      Returns:
      the Reservoir Opertations file path
    • getResSysOpDbfFileName

      protected String getResSysOpDbfFileName()
      get the path to the ReservoirSysOp DBF file.
      Returns:
      the Reservoir System Operations file path
    • getResOpDbfFile

      public mil.army.usace.hec.rmi.io.dbf.DbfFile getResOpDbfFile()
      open/return the ReservoirOperations DbfFile.
      Returns:
      the DbfFile for the ReservoirOperations
    • getResSysOpDbfFile

      public mil.army.usace.hec.rmi.io.dbf.DbfFile getResSysOpDbfFile()
      open/return the ReservoirSystem Operations DBF file.
      Returns:
      the DbfFile for the ReservoirSystem Operations
    • getDbfFile

      protected mil.army.usace.hec.rmi.io.dbf.DbfFile getDbfFile(String path)
      given a file path open, and create if necessary, the corresponding DbfFile.
      Parameters:
      path - the file path to open
      Returns:
      the DbfFile for path
    • deserializeString

      public boolean deserializeString(AsciiSerializable obj, String data)
      deserialize the AsciiSerialiable object from the String data.
      Parameters:
      obj - the object to deserialize data into
      data - the AsciiSerialized data
      Returns:
      whether the deserialization was successful
    • serializeObjectToString

      public StringBuffer serializeObjectToString(AsciiSerializable obj)
      serialize an AsciiSerializable object to a StringBuffer.
      Parameters:
      obj - the object to AsciiSerialize
      Returns:
      the AsciiSerialized obj in the form of a StringBuffer
    • setComputeCanceled

      public void setComputeCanceled(boolean canceled)
      Specified by:
      setComputeCanceled in interface ComputeCanceledCallback
    • isComputeCanceled

      public boolean isComputeCanceled()
      Checks if is compute canceled.
      Returns:
      true, if is compute canceled
    • getTimeSeriesLocation

      public RssTSLocation getTimeSeriesLocation(String elementType, String elementName)
      return a RssTLocation object of the given type and name.
      Parameters:
      elementType - the element type
      elementName - the element name
      Returns:
      the time series location
    • getTimeSeriesLocation

      public RssTSLocation getTimeSeriesLocation(int elementType, String elementName)
      return a RssTLocation object of the given type and name.
      Parameters:
      elementType - The type of element. One of REACH, RESERVOIR, JUNCTION, DIVERSION
      elementName - The name of the element
      Returns:
      the time series location
    • getTimeSeries

      public TSRecord getTimeSeries(String elementType, String elementName, String childElementName, String tsRecordParam)
      return an output(computed) TSRecord for the specified arguments.
      Parameters:
      elementType - the type of element. One of RESERVOIR_STR, REACH_STR, JUNCTION_STR, DIVERSION_STR
      elementName - the element name
      childElementName - the child element name or null
      tsRecordParam - the name of the TimeSeries Record
      Returns:
      the TSRecord or null if not found
    • getTimeSeries

      public TSRecord getTimeSeries(String elementType, String elementName, String childElementName, String tsRecordParam, String computeType)
      return an output(computed) TSRecord for the specified arguments.
      Parameters:
      elementType - the type of element. One of RESERVOIR_STR, REACH_STR, JUNCTION_STR, DIVERSION_STR
      elementName - the element name
      childElementName - the child element name or null
      tsRecordParam - the name of the TimeSeries Record
      computeType - 'unreg' or 'cumloc' to get the record from either the unreg or cumloc compute
      Returns:
      the TSRecord or null if not found
    • getTimeSeries

      public TSRecord getTimeSeries(int computeType, String elementType, String elementName, int varId)
      return a TSRecord for the specified arguments.
      Parameters:
      computeType - one of RssRun.COMPUTE_CUMLOC, RssRun.COMPUTE_UNREG, RssRun.COMPUTE_REG
      elementType - the type of element. One of RESERVOIR_STR, REACH_STR, JUNCTION_STR, DIVERSION_STR
      elementName - the element name
      varId - the Variable ID
      Returns:
      the TSRecord or null if not found
    • getTimeSeries

      public TSRecord getTimeSeries(int computeType, String elementType, String elementName, String childElementName, String tsRecordParam)
      return a TSRecord for the specified arguments.
      Parameters:
      computeType - one of RssRun.COMPUTE_CUMLOC, RssRun.COMPUTE_UNREG, RssRun.COMPUTE_REG
      elementType - the type of element. One of RESERVOIR_STR, REACH_STR, JUNCTION_STR, DIVERSION_STR
      elementName - the element name
      childElementName - the child element name or null
      tsRecordParam - the name of the TimeSeries Record
      Returns:
      the TSRecord or null if not found
    • getTimeSeries

      public TSRecord getTimeSeries(String elementType, String elementName, String childElementName, String tsRecordParam, boolean wantsInputRecord)
      return a TSRecord for the specified arguments.
      Parameters:
      elementType - the type of element. One of RESERVOIR_STR, REACH_STR, JUNCTION_STR, DIVERSION_STR
      elementName - the element name
      childElementName - the child element name or null
      tsRecordParam - the name of the TimeSeries Record
      wantsInputRecord - true if a input TSRecord is wanted
      Returns:
      the TSRecord or null if not found is an input record
    • getTSRecordProxy

      public TSRecordProxy getTSRecordProxy(String elementType, String elementName, String childElementName, String tsRecordParam, boolean wantsInputRecord)
    • getTimeSeries

      public TSRecord getTimeSeries(int elementType, String elementName, int vid)
      return a TSRecord for the specified arguments.
      Parameters:
      elementType - the type of element. One of RESERVOIR, REACH, JUNCTION, DIVERSION
      elementName - the element name
      vid - the variable ID
      Returns:
      the TSRecord or null if not found
    • getScriptableMethodNames

      public static List getScriptableMethodNames()
      Gets the scriptable method names.
      Returns:
      the scriptable method names
    • writeHotstartStates

      public void writeHotstartStates(RunTimeWindow rtw)
      Write hotstart states.
      Parameters:
      rtw - the rtw
    • shouldSaveHotstartAtTimeStep

      public boolean shouldSaveHotstartAtTimeStep(int step, int computeType)
      Should save hotstart at time step.
      Parameters:
      step - the step
      computeType - the compute type
      Returns:
      true, if successful
    • getHeadwaterJunctions

      public List<JunctionElement> getHeadwaterJunctions()
      get the headwater junctions for this network. Headwater junctions have no inflow nodes.
      Returns:
      a non null List of the headwater junctions.
    • didConversionOccur

      public boolean didConversionOccur()
      Did conversion occur.
      Returns:
      true, if successful
    • setWaterAccountSetList

      public void setWaterAccountSetList(List<WaterAccountSet> waterAccountSetList)
      Sets the water account set list.
      Parameters:
      waterAccountSetList - the new water account set list
    • getWaterAccountSetList

      public List<WaterAccountSet> getWaterAccountSetList()
      Gets the water account set list.
      Returns:
      the water account set list
    • addWaterAccountSet

      public void addWaterAccountSet(WaterAccountSet set)
      Adds the water account set.
      Parameters:
      set - the set
    • getWaterAccountSet

      public WaterAccountSet getWaterAccountSet(int index)
      Gets the water accoutn set.
      Parameters:
      index - the index
      Returns:
      the water accoutn set
    • nextWaterAccountSetIndex

      public int nextWaterAccountSetIndex()
    • getCoordinateReferenceSystem

      public hec.map.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
      Description copied from interface: hec.map.MapObjectInterface
      Returns the coordinate reference system that describes the location of this map. Users can return NULL if they don't have CoordinateReferenceSystem.
      Specified by:
      getCoordinateReferenceSystem in interface hec.map.MapObjectInterface
      Returns:
    • getSystemRules

      public List<OpRule> getSystemRules()
      Returns:
    • compute

      public int compute(RunTimeWindow rtw, RssRun run, int computeType, boolean runHindcastCompute)
    • computeRS4

      public int computeRS4(RunTimeWindow rtw, RssRun run, int computeType, boolean runHindcastCompute)
      ResSim v 4.0 compute process
      Parameters:
      rtw -
      run -
      computeType -
      runHindcastCompute -
      Returns:
    • computeEventQueue

      public int computeEventQueue(RunTimeWindow rtw, RssRun run, int computeType, boolean runHindcastCompute)
      first try at ResSim v 4.0 compute process
      Parameters:
      rtw -
      run -
      computeType -
      runHindcastCompute -
      Returns:
    • compute_DevOld

      public int compute_DevOld(RunTimeWindow rtw, RssRun run, int computeType, boolean runHindcastCompute)
      New version 3.3 computations with system iteration for all reservoir elevations and evaluation of tandem operation considering routing lag
      Parameters:
      rtw - time window of the compute
      computeType - Regulated, Unregulated, Cum-Loc, Pulse
      runHindcastCompute - true if hindcast is to be run
      Returns:
      RTN_NOPROBLEM if compute successful
    • simulatePumpbackStep32

      public int simulatePumpbackStep32(RunTimeStep rts, List pumpResList, int iteration)
    • buildSysRuleStack

      public List<OpRule> buildSysRuleStack(RunTimeStep rts, List<Element> decisionElemVec, double[] delemElev, List<OpRule>[] resRuleList)
      build the system rule stack
      Parameters:
      rts - current time step
      decisionElemVec - list of all decision elements
      delemElev - elevation for all decision elements
      Returns:
      priority ordered rule stack
    • initZBruleArray

      public void initZBruleArray(IterationBlock iterblk, RunTimeWindow rtw)
      Initializes mapping of reservoir elements to zone boundary rule array indices. Initializes ZB rule array.
    • getIterationBlockList

      public List<IterationBlock> getIterationBlockList()
      Returns the working list of iteration blocks for the current compute. This method will only return valid list once the RssSystem has been initialized for a compute.
      Returns:
      iteration block vector
    • globalVariableExists

      public boolean globalVariableExists(int index, GlobalVariableType type)