Package hec.rss.model

Class FirmYieldRuleRef

java.lang.Object
hec.rss.model.FirmYieldRuleRef
All Implemented Interfaces:
RssModelVariableConstants, RssReturnStatusConstants, Cloneable

public class FirmYieldRuleRef extends Object implements RssReturnStatusConstants, RssModelVariableConstants, Cloneable
Simple container class to manage a reference to one operating rule that can be used as the basis of a Firm Yield analysis.
  • Field Details

    • RULETYPE_DIVERSION

      public static final String RULETYPE_DIVERSION
      The Constant RULETYPE_DIVERSION.
      See Also:
    • RULETYPE_HYDROPOWER

      public static final String RULETYPE_HYDROPOWER
      The Constant RULETYPE_HYDROPOWER.
      See Also:
    • RULETYPE_SYSHYDROPOWER

      public static final String RULETYPE_SYSHYDROPOWER
      The Constant RULETYPE_SYSHYDROPOWER.
      See Also:
    • RULETYPE_RESMIN

      public static final String RULETYPE_RESMIN
      The Constant RULETYPE_RESMIN.
      See Also:
    • RULETYPE_DNSTRMMIN

      public static final String RULETYPE_DNSTRMMIN
      The Constant RULETYPE_DNSTRMMIN.
      See Also:
    • FYTEST_CONVERGE

      public static final int FYTEST_CONVERGE
      The Constant FYTEST_CONVERGE.
      See Also:
    • FYTEST_INCR_DEMAND

      public static final int FYTEST_INCR_DEMAND
      The Constant FYTEST_INCR_DEMAND.
      See Also:
    • FYTEST_DECR_DEMAND

      public static final int FYTEST_DECR_DEMAND
      The Constant FYTEST_DECR_DEMAND.
      See Also:
    • FYTEST_RULEFAIL

      public static final int FYTEST_RULEFAIL
      The Constant FYTEST_RULEFAIL.
      See Also:
    • FYTEST_STOPSCRIPT

      public static final int FYTEST_STOPSCRIPT
      See Also:
    • FYTEST_DSSREAD_ERROR

      public static final int FYTEST_DSSREAD_ERROR
      See Also:
    • FYTEST_RULENOTFOUND_ERROR

      public static final int FYTEST_RULENOTFOUND_ERROR
      See Also:
    • FYTEST_RULEINZONE_ERROR

      public static final int FYTEST_RULEINZONE_ERROR
      See Also:
  • Constructor Details

    • FirmYieldRuleRef

      public FirmYieldRuleRef()
      Default Constructor.
    • FirmYieldRuleRef

      public FirmYieldRuleRef(RssTSLocationObject rule, Object owner)
      Constructor used by RssAlt.
      Parameters:
      rule - the rule
      owner - the owner
  • Method Details

    • getRule

      public RssTSLocationObject getRule()
      Get the demand rule for the firm yield analysis.
      Returns:
      either a Rule object (Diversion) or OpRule (all other demands), may return null
    • getRuleOwner

      public Object getRuleOwner()
      Gets the rule owner.
      Returns:
      the rule owner
    • getLocationName

      public String getLocationName()
      Gets the Rule Location Name to be displayed in the tables of rules.
      Returns:
      String name or null
    • getRuleName

      public String getRuleName()
      Gets the Rule Name to be displayed in the tables of rules.
      Returns:
      String name or null
    • getRuleTypeString

      public String getRuleTypeString()
      Gets the Rule Type String to be displayed in the tables of rules.
      Returns:
      String name or null
    • getReservoirList

      public List<ReservoirElement> getReservoirList(RssAlt alt)
      Gets the list of reservoirs that may operate for this rule.
      Parameters:
      alt - the alt
      Returns:
      List of ReservoirElement Objects
    • getReservoirsForDnstrmRule

      public static List<ReservoirElement> getReservoirsForDnstrmRule(RssAlt alt, RssSystem system, DownstreamOpRule dor, List<ReservoirElement> resList)
      Gets the reservoirs for dnstrm rule.
      Parameters:
      alt - the alt
      system - the system
      dor - the dor
      resList - the res list
      Returns:
      the reservoirs for dnstrm rule
    • writeDataToFile

      public void writeDataToFile(BufferedWriter writer)
      writes the persistent data for this object to an ASCII file.
      Parameters:
      writer - the writer
    • readDataFromFile

      public void readDataFromFile(RssAlt alt, BufferedReader reader)
      reads the persistent data for this object from an ASCII file and saves it to a string until the rule is needed.
      Parameters:
      alt - the alt
      reader - the reader
    • isInitialized

      public boolean isInitialized()
      Checks if is initialized.
      Returns:
      true, if is initialized
    • initializeData

      public void initializeData(RssSystem sys)
      Initialize data.
      Parameters:
      alt - the alt
    • getFirmYieldRules

      public static List<FirmYieldRuleRef> getFirmYieldRules(RssAlt alt, RssSystem system)
      Get the list of all rules that can be used as a basis for Firm Yield Analysis. These include Downstream minimum flow rules, at site minimum flow rules, at site hydropower, system hydropower, and diversion rules. For first implementation, only Downstream minimum flow rules and at site minimum flow rules are considered!
      Parameters:
      alt - the alt
      system - the system
      Returns:
      ArrayList of rules that can be used as a basis for firm yield analysis
    • getZoneForReservoir

      public StorageZone getZoneForReservoir(ReservoirElement res)
      Gets the zone for reservoir.
      Parameters:
      res - the res
      Returns:
      the zone for reservoir
    • testFirmYield2

      public double[] testFirmYield2(RssRun run, RunTimeWindow rtw, double stortol, double ruletol)
      Tests the result of the ResSim compute to see if the firm yield criteria are met.
      Parameters:
      run - the run
      rtw - the rtw
      stortol - the stortol
      ruletol - the ruletol
      Returns:
      convergence value (number of time steps reservoir bottomed out -1)
    • checkSpecRelFirmYield

      public int checkSpecRelFirmYield(RssRun run, RunTimeWindow rtw, double ruletol)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setZones

      public void setZones(List<StorageZoneRef> zones)
      Sets the zones.
      Parameters:
      zones - the new zones
    • getZones

      public List<StorageZoneRef> getZones()
      Gets the zones.
      Returns:
      the zones
    • initCompute

      public void initCompute(RssAlt rssAlt)
      Inits the compute.
      Parameters:
      rssAlt - the rss alt
    • clone

      public Object clone()
      Overrides:
      clone in class Object