Package hec.rss.model

Class OpRule

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, TSLocation, AltInputReportInfc, RssModelVariableConstants, RssReturnStatusConstants, RssTSLocation, Serializable, Cloneable, Comparable, Observer, rma.lang.Modifiable
Direct Known Subclasses:
DiversionDemandOpRule, ElevReleaseOpRule, FlowLimitOpRule, GCOpRule, InducedSurchargeOpRule, InputTSBasedOpRule, PhysMaxOpRule, PhysMinOpRule, PrescribedOpRule, PumpOpRule, RateChangeElevLimitOpRule, RateChangeLimitOpRule, ReleaseFuncOpRule, ReleaseFunctionInflowOpRule, ScheduledHydropowerOpRule, ScriptOpRule, SpecFlowOpRule, SystemHydropowerOpRule, SystemHydropowerRule, TandemOpParent, TandemOpRule, TandemSysOpRule, VariableTSBasedOpRule, ZBOpRule

public class OpRule extends RssTSLocationObject implements AltInputReportInfc
Operating rule utilized by OpController objects.
See Also:
  • Field Details

    • _multiplier

      protected DayOfWeekMultiplier _multiplier
    • _timeOfDayMultiplier

      protected TimeOfDayMultiplier _timeOfDayMultiplier
    • _useDayOfWeekMultiplier

      protected boolean _useDayOfWeekMultiplier
    • _useTimeOfDayMultiplier

      protected boolean _useTimeOfDayMultiplier
    • _usePeriodAverageLimit

      protected boolean _usePeriodAverageLimit
    • _enableRiseFallCond

      protected boolean _enableRiseFallCond
    • _riseFallCondition

      protected int _riseFallCondition
    • _avgPeriod

      protected int _avgPeriod
    • _riseFallTolerance

      protected double _riseFallTolerance
    • _parameterType

      protected int _parameterType
    • _system

      protected transient RssSystem _system
    • NONE

      public static final int NONE
      See Also:
    • RISING

      public static final int RISING
      See Also:
    • RISING_OR_CONST

      public static final int RISING_OR_CONST
      See Also:
    • FALLING_OR_CONST

      public static final int FALLING_OR_CONST
      See Also:
    • FALLING

      public static final int FALLING
      See Also:
    • POOL_ELEVATION

      public static final int POOL_ELEVATION
      See Also:
    • INFLOW

      public static final int INFLOW
      See Also:
    • RULETYPE_DEMAND

      public static final int RULETYPE_DEMAND
      Demand rule type flag
      See Also:
    • RULETYPE_MAX

      public static final int RULETYPE_MAX
      Maximum rule type flag
      See Also:
    • RULETYPE_SPEC

      public static final int RULETYPE_SPEC
      Specified rule type flag
      See Also:
    • RULETYPE_MIN

      public static final int RULETYPE_MIN
      Minimum rule type flag
      See Also:
    • RULETYPE_FREE

      public static final int RULETYPE_FREE
      free rule type flag - indicates value unconstrained by a rule
      See Also:
  • Constructor Details

    • OpRule

      public OpRule()
    • OpRule

      public OpRule(String name)
    • OpRule

      public OpRule(OpController controller, String name)
  • Method Details

    • computeStepLimit

      public double computeStepLimit(RunTimeStep rts)
    • setPriority

      public void setPriority(RunTimeStep rts, double p)
    • getPriority

      public double getPriority(RunTimeStep rts)
      Get the rule priority value for the given time step. Highest priority is 0 (hard constraint), increasing value indicates lower priority. Priority invalid input: '<' 0 indicates the rule is not active for this time step.
      Parameters:
      rts -
      Returns:
      rule priority value
    • getTargetTSRecordProxy

      public TSRecordProxy getTargetTSRecordProxy()
      returns the TSRecordProxy for the time series that is the target for this rule operation. Comparison of the target to the rule limit allows determination as to whether the rule was satisfied.
    • updateByDemandScale

      public void updateByDemandScale(double scl)
    • setUseDemandScale

      public void setUseDemandScale(boolean b)
      set the flag to use demand scale for firm yield analysis
    • useDemandScale

      public boolean useDemandScale()
      return flag to use demand scale for firm yield analysis
      Returns:
      flag to use demand scale for firm yield analysis
    • setDemandScale

      public void setDemandScale(double scl)
      sets the demand scale used for firm yield analysis
    • getDemandScale

      public double getDemandScale()
      gets the demand scale used for firm yield analysis
    • getElementDependencies

      public void getElementDependencies(List elemList)
      adds elements upon which the current rule depends to the given list. Does not add the element that owns this rule. Default behavior is to add nothing to the list. Subclasses must override this method.
    • getOpValue

      public OpValue getOpValue(RunTimeStep rts)
    • getPowerOpValue

      public OpValue getPowerOpValue(RunTimeStep rts)
    • evaluateLimits

      public void evaluateLimits(RunTimeStep rts, int iteration)
      default implementation calls the old method without the iteration argument 2007-12-27
      Parameters:
      rts -
      iteration -
    • evaulatePerformance

      public void evaulatePerformance(RunTimeWindow rtw)
      post processing immediately following compute to evalute performance
      Parameters:
      rtw -
    • getRuleLimitType

      public int getRuleLimitType()
      get the limit type of this rule should be implemented by all subclasses of OpRule
    • getActiveTSRecordProxies

      public Vector getActiveTSRecordProxies(Vector vec, int iotype)
      add the time series record proxies associated current compute. subclassses that over-ride this method should also call this method
      Overrides:
      getActiveTSRecordProxies in class RssTSLocationObject
    • updateTSProxyList

      public void updateTSProxyList()
      Regenerates the list of all TSProxies required for this location. This list includes all records that are generated by this function even if the records are held in another objects (e.g. RssNode) proxy list sub-classes of OpRule may over-ride this method if they use TSRecordProxies but should also call this method
      Specified by:
      updateTSProxyList in class RssTSLocationObject
    • getTSProxyName

      public String getTSProxyName()
    • getReferencedStateVariables

      public void getReferencedStateVariables(List svlist)
      adds StateVariables refereced by this rule to the given list
      Parameters:
      svlist - unique list of state variables
    • getRequiredTSRecordProxies

      public Vector getRequiredTSRecordProxies(Vector v)
      returns the TSRecordProxies required by operating rules default implementation is to not add any proxies to the list
    • saveFunctionState

      public void saveFunctionState(int stateid)
      save the current state of the rule with the given identifier - default behavior is to do nothing
      Parameters:
      stateid - identifier for the state
    • restoreFunctionState

      public void restoreFunctionState(int stateid)
      restore the state of the rule matching the given identifier - default behavior is to do nothing
      Parameters:
      stateid - identifier for the state
    • getOperationsElement

      public OperationsElement getOperationsElement()
      returns the element associated with this rule.
      Returns:
      the element associated with this rule
    • getReservoirElement

      public OperationsElement getReservoirElement()
      Deprecated.
      use getOperationsElement()
      returns the element, Reservoir or Diversion, that this rule is operating for. Here for backward compatibility with previous versions of ResSim (pre 4.0)
      Returns:
      the Element this rule operations for
    • isActive

      public boolean isActive(RunTimeStep rts)
      returns true if this rule is active (included in the zone rules of the current OpSet for the parent ReservoirOp).
      Parameters:
      rts - The RunTimeStep at which the test is made
    • setSystem

      public void setSystem(RssSystem sys)
    • getSystem

      public RssSystem getSystem()
      get the ResSim Network
      Specified by:
      getSystem in class RssTSLocationObject
      Returns:
      the ResSim Network
    • getNetwork

      public RssSystem getNetwork()
      get the ResSim Network
      Returns:
      the ResSim Network
    • applyHindcastData

      public void applyHindcastData(HindcastData hd)
      applies specific hindcast data for compute
    • toString

      public String toString()
      return the String representation of the OpRule.
      Overrides:
      toString in class NamedType
      Returns:
      the OpRule's name
    • resetChildOwnership

      public void resetChildOwnership()
    • getGmtOffset

      public int getGmtOffset()
      get the GMT offset
      Returns:
      the GMT Offset
    • getUnitSystem

      public int getUnitSystem()
      get the unit system in use
      Returns:
      the unit system
    • clone

      public Object clone()
      Description copied from class: RssTSLocationObject
      clone method
      Overrides:
      clone in class RssTSLocationObject
    • initializeCompute

      public boolean initializeCompute()
      prep for compute
    • initForPostProcessing

      public boolean 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
    • initOperationStep

      public int initOperationStep(RunTimeStep rts, int iteration)
      initialization call before each operation step, or before recomputing operations with different options
    • evaluateRule

      public OpValue evaluateRule(RunTimeStep rts, double initialValue, int iteration, boolean evalDownstream)
      compares the intial value to rule constraints and returns the adjusted value
    • evaluateRule

      public OpValue evaluateRule(RunTimeStep rts, double initialValue, int iteration)
      compares the intial value to rule constraints and returns the adjusted value
    • evaluateRule

      public OpValue evaluateRule(RunTimeStep rts, double initialValue)
      compares the intial value to rule constraints and returns the adjusted value
    • setController

      public void setController(OpController controller)
    • getController

      public OpController getController()
      get the OpRules Controller
      Returns:
      the OpController that owns the OpRule
    • isLocalRule

      public boolean isLocalRule()
      returns true if this rule is local to a reservoir
      Returns:
      default is true
    • isDnstrmRule

      public boolean isDnstrmRule()
      returns true if this rule is a downstream rule
      Returns:
      default is false
    • isPerAvgRule

      public boolean isPerAvgRule()
      returns true if this rule uses period average evaluation
      Returns:
      default is false
    • 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 pass request to RssSystem This should be a TSLocation method
    • getObjectForKeyString

      public Object getObjectForKeyString(String keystr)
      Takes a key string and returns the object of class Element, Function, Node, OpController, or OpRule Pass request to RssSystem This should be a TSLocation method
    • getRssSystem

      public RssSystem getRssSystem()
      gets the RssSystem from the reservoir element that this rule belongs to
      Returns:
      the ResSim network
    • checkRisingFallingCondition

      public boolean checkRisingFallingCondition(RunTimeStep rts)
      If Rising-Falling condition is enabled for rule, check whether the OpRule should apply
    • riseFallConditionIsValid

      public boolean riseFallConditionIsValid()
      check completeness of rise-fall condition data
    • setEnableRiseFallCondition

      public void setEnableRiseFallCondition(boolean tf)
    • getEnableRiseFallCondition

      public boolean getEnableRiseFallCondition()
    • setRiseFallCondition

      public void setRiseFallCondition(int type)
    • getRiseFallCondition

      public int getRiseFallCondition()
    • setAveragingPeriod

      public void setAveragingPeriod(int seconds)
    • getAveragingPeriod

      public int getAveragingPeriod()
    • setRiseFallTolerance

      public void setRiseFallTolerance(double tol)
    • getRiseFallTolerance

      public double getRiseFallTolerance()
    • setParameterType

      public void setParameterType(int type)
    • getParameterType

      public int getParameterType()
    • useDayOfWeekMultiplier

      public boolean useDayOfWeekMultiplier()
      Returns true if Day Of Week Multiplier to be used
    • setUseDayOfWeekMultiplier

      public void setUseDayOfWeekMultiplier(boolean tf)
      Set flag for Day Of Week Multiplier
    • setPeriodAverageLimit

      public void setPeriodAverageLimit(boolean tf)
    • getMultiplier

      public DayOfWeekMultiplier getMultiplier()
      Returns a new Day of Week Multiplier object
    • setMultiplier

      public void setMultiplier(DayOfWeekMultiplier mult)
      Sets the Day of Week Mulitplier
    • getDayOfWeekFactor

      public double getDayOfWeekFactor(RunTimeStep rts)
      Get multiplier factor for the day, accounting for day of the week
    • getLargestDayOfWeekFactor

      public double getLargestDayOfWeekFactor()
      Get largest multiplier factor for any day, accounting for day of the week
    • useTimeOfDayMultiplier

      public boolean useTimeOfDayMultiplier()
      Returns true if Time Of Day Multiplier to be used
    • usePeriodAverageLimit

      public boolean usePeriodAverageLimit()
    • setUseTimeOfDayMultiplier

      public void setUseTimeOfDayMultiplier(boolean tf)
      Set flag for Time Of Day Multiplier
    • setUsePeriodAverageLimit

      public void setUsePeriodAverageLimit(boolean tf)
      Set flag for period average limit use
      Parameters:
      tf -
    • getTimeOfDayMultiplier

      public TimeOfDayMultiplier getTimeOfDayMultiplier()
      Returns a Time Of Day Multiplier object
    • setTimeOfDayMultiplier

      public void setTimeOfDayMultiplier(TimeOfDayMultiplier mult)
      Sets the Time of Day Mulitplier
    • getTimeOfDayFactor

      public double getTimeOfDayFactor(RunTimeStep rts)
    • getLargestTimeOfDayFactor

      public double getLargestTimeOfDayFactor()
    • saveHotstartState

      public void saveHotstartState(HotstartState parentState, int stateId)
    • restoreHotstartState

      public void restoreHotstartState(OpControllerHotstartState opControllerHotstartState)
    • 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 RssTSLocationObject
      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 RssTSLocationObject
      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
    • 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