Package hec.rss.model

Class IndependentVariable

java.lang.Object
hec.rss.model.IndependentVariable
All Implemented Interfaces:
AsciiSerializable, FieldAccessor, AltInputReportInfc, Serializable, Cloneable

public class IndependentVariable extends Object implements AsciiSerializable, Cloneable, AltInputReportInfc

Title: General CWMS Project

Description:

Copyright: Copyright (c) 2002

Company: RMA

See Also:
  • Field Details

    • DATE_TYPE

      public static final int DATE_TYPE
      Type for Date Independent Variable
      See Also:
    • DATE_TIME_TYPE

      public static final int DATE_TIME_TYPE
      type for Date Time Independent Variable
      See Also:
    • MODEL_VARIABLE_TYPE

      public static final int MODEL_VARIABLE_TYPE
      type for Model Variable Independent Variable
      See Also:
    • TIME_SERIES_TYPE

      public static final int TIME_SERIES_TYPE
      type for Time Series Independent Variable
      See Also:
    • STATE_VARIABLE_TYPE

      public static final int STATE_VARIABLE_TYPE
      type for State Variable Independent Variable
      See Also:
    • TWO_VARIABLE_TYPE

      public static final int TWO_VARIABLE_TYPE
      type for State Variable Independent Variable
      See Also:
    • GLOBAL_VARIABLE_TYPE

      public static final int GLOBAL_VARIABLE_TYPE
      type for Global Variable
      See Also:
    • TS_FUNCTION_STRINGS

      public static final String[] TS_FUNCTION_STRINGS
      /** strings corresponding to Time Series Functions
    • TS_CURRENT_TYPE

      public static final int TS_CURRENT_TYPE
      type id for Current Value time series function
      See Also:
    • TS_PREVIOUS_TYPE

      public static final int TS_PREVIOUS_TYPE
      type id for Previous Value time series function
      See Also:
    • TS_LAGGED_TYPE

      public static final int TS_LAGGED_TYPE
      type id for Lagged Value time series function
      See Also:
    • TS_PERAVG_TYPE

      public static final int TS_PERAVG_TYPE
      type id for Period Average time series function
      See Also:
    • TS_PERMAX_TYPE

      public static final int TS_PERMAX_TYPE
      type id for Period Maximum time series function
      See Also:
    • TS_PERMIN_TYPE

      public static final int TS_PERMIN_TYPE
      type id for Period Minimum time series function
      See Also:
  • Constructor Details

    • IndependentVariable

      public IndependentVariable(int type)
      Create a new IndependentVariable object
      Parameters:
      type - the type of IndependentVariable
    • IndependentVariable

      public IndependentVariable()
      Default constructor needed for Ascii Deserialization
  • Method Details

    • getElementDependencies

      public void getElementDependencies(List<Element> elemList, Element parentElem)
      Add elements that this independent variable depends on for its calculation, not including the element that holds this variable.
      Parameters:
      elemList -
      parentElem -
    • evaluateTSFunction

      public double evaluateTSFunction(RunTimeStep rts)
      Computes the value of the independent variable based on the Time Series Function. Uses the _xvalArray established in the method initializeCompute()
      Parameters:
      rts - RunTimeStep at which the independent variable is to be evaluated
      tsarray - Time Series array
      Returns:
      value of independent variable
      See Also:
    • evaluateTSFunction

      public double evaluateTSFunction(RunTimeStep rts, double[] tsarray)
      Computes the value of the independent variable based on the Time Series Function 2/12/2010 added logic to support negative lag (positive offset)
      Parameters:
      rts - RunTimeStep at which the independent variable is to be evaluated
      tsarray - Time Series array
      Returns:
      value of independent variable
    • initializeCompute

      public boolean initializeCompute(RssSystem system, RssTSLocationObject tsLocationObject)
      Retrieves data for the _xvalArray.
      Parameters:
      system - RssSystem
      tsLocationObject - RssTSLocationObject for possibly retrieving a TIME_SERIES_TYPE data
      Returns:
      true if successfully filled _xvalArray
    • initializeCompute

      public static boolean initializeCompute(IndependentVariable iv, RssSystem system, RssTSLocationObject tsLocationObject)
      Retrieves data for the _xvalArray of the IndependentVariable iv.
      Parameters:
      iv -
      system -
      tsLocationObject -
      Returns:
    • getTSProxyName

      public String getTSProxyName()
      Gets the name if the TSRecordProxy
      Returns:
      name of proxy
    • getModelVariableElementIds

      public int[] getModelVariableElementIds()
    • setModalVariableInfo

      public void setModalVariableInfo(TSRecordProxy proxy, Element elem, ModelVariable mv)
      Sets the ModalVariableInfo information for this object.
      Parameters:
      elem - the Element
      mv - the ModelVariable
      Throws:
      IllegalStateException - if the type isn't MODEL_VARIABLE_TYPE
    • setTimeSeriesName

      public void setTimeSeriesName(String name)
      Sets the TimeSeries Name for this object
      Parameters:
      name - The new TimeSeries Name
      Throws:
      IllegalStateException - if the type isn't TIME_SERIES_TYPE
    • setTimeSeriesOptions

      public void setTimeSeriesOptions(int function, double lag, double period)
      Sets the TimeSeriesOptions attribute of the IndependentVariable object
      Parameters:
      function - the TimeSeriesOption Function
      lag - the TimeSeries lag
      period - the TimeSeries period
      Throws:
      IllegalStateException - if the type isn't TIME_SERIES_TYPE or MODEL_VARIABLE_TYPE
    • setTimeSeriesOptions

      public void setTimeSeriesOptions(boolean usesTimeSeries)
      Sets the TimeSeriesOptions attribute of the IndependentVariable object
      Parameters:
      function - the TimeSeriesOption Function
      lag - the TimeSeries lag
      period - the TimeSeries period
      Throws:
      IllegalStateException - if the type isn't TIME_SERIES_TYPE or MODEL_VARIABLE_TYPE
    • getTimeSeriesName

      public String getTimeSeriesName()
      Gets the TimeSeries Name value only valid if the type is TIME_SERIES_TYPE
      Returns:
      The TimeSeries Name value
    • getTimeSeriesFunction

      public String getTimeSeriesFunction()
      Gets the TimeSeries Function only valid if the type is MODEL_VARIABLE_TYPE or TIME_SERIES_TYPE
      Returns:
      The TimeSeries Function value
    • getTimeSeriesLag

      public double getTimeSeriesLag()
      Gets the TimeSeries Lag only valid if the type is MODEL_VARIABLE_TYPE or TIME_SERIES_TYPE
      Returns:
      The TimeSeries Lag value
    • getDisplayOnlyTimeSeriesLag

      public double getDisplayOnlyTimeSeriesLag()
      Gets the TimeSeries Lag with the - showing for display purposes. THis value is for display only. The compute uses the getTimeSeriesLag() value, not this one. only valid if the type is MODEL_VARIABLE_TYPE or TIME_SERIES_TYPE
      Returns:
      The display Only TimeSeries Lag value. Do not use for calculations. Use getTimeSeriesLag() for compute.
    • setTimeSeriesLag

      public void setTimeSeriesLag(double lag)
    • getTimeSeriesPeriod

      public double getTimeSeriesPeriod()
      Gets the TimeSeries Period only valid if the type is MODEL_VARIABLE_TYPE or TIME_SERIES_TYPE
      Returns:
      The TimeSeries Period value
    • setTimeSeriesPeriod

      public void setTimeSeriesPeriod(double period)
    • getType

      public int getType()
      Gets the Type of this object one of:
      DATE_TYPE
      DATE_TIME_TYPE
      MODEL_VARIABLE_TYPE
      TIME_SERIES_TYPE
      Returns:
      The Type value
    • getElementId

      public int getElementId()
      Gets the Element of this object
      Only valid if type is MODEL_VARIABLE_TYPE
      Returns:
      The Element value
    • getModelVariableId

      public int getModelVariableId()
      Gets the ModelVariable value
      Only valid if type is MODEL_VARIABLE_TYPE
      Returns:
      The ModelVariable value
    • getModelVariable

      public ModelVariable getModelVariable()
    • getStateVariableId

      public int getStateVariableId()
    • getStateVariableName

      public String getStateVariableName()
    • getGlobalVariableId

      public int getGlobalVariableId()
      Returns:
    • getGlobalVariableName

      public String getGlobalVariableName()
    • getTwoVariableName

      public String getTwoVariableName()
    • setStateVariable

      public void setStateVariable(StateVariable st)
    • setGlobalVariable

      public void setGlobalVariable(GlobalVariable gv)
    • setTwoVariableRule

      public void setTwoVariableRule(IndependentVariable rowVar, IndependentVariable colVar)
    • getRowVariable

      public IndependentVariable getRowVariable()
    • getColVariable

      public IndependentVariable getColVariable()
    • areTheSame

      public boolean areTheSame(IndependentVariable iv)
      Test if two IndependentVariable are essentially the same
    • timeSeriesOptionsAreTheSame

      public boolean timeSeriesOptionsAreTheSame(IndependentVariable iv)
      Compare the time series options between two independent variables
      Parameters:
      iv -
      Returns:
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • buildFunctionOfString

      public String buildFunctionOfString(ReleaseFuncOpRule rule)
    • buildFunctionOfString

      public String buildFunctionOfString(DiversionRule rule)
      Build a string for display showing type, location and other info describing the rule. This form is for a DiversionRule
      Parameters:
      rule -
      Returns:
    • buildFunctionOfString

      public String buildFunctionOfString(StorageZone zone)
      Build a string for display showing type, location and other info describing the rule. This form is for a DiversionRule
      Parameters:
      rule -
      Returns:
    • buildFunctionOfString

      public String buildFunctionOfString(RssSystem network)
      Build a string for display showing type, location and other info describing the rule.
      Parameters:
      RssSystem - network
      Returns:
    • toString

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

      public void setModelVariableString(String s)
    • 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
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • isTSOptChecked

      public boolean isTSOptChecked()
    • 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
      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
    • setTwoVariableColumnValues

      public void setTwoVariableColumnValues(String[] columnValues)
    • getTwoVariableColumnValues

      public String[] getTwoVariableColumnValues()
    • setRowVariableInterpType

      public void setRowVariableInterpType(String rowVarInterpType)
    • setColVariableInterpType

      public void setColVariableInterpType(String colVarInterpType)
    • getRowVariableInterpType

      public String getRowVariableInterpType()
    • getColVariableInterpType

      public String getColVariableInterpType()
    • 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