Package hec.rss.model
Class ReservoirOp
java.lang.Object
java.util.Observable
hec.lang.NamedType
hec.model.AbstractDataObject
hec.rss.model.AbstractReservoirOp
hec.rss.model.ReservoirOp
- All Implemented Interfaces:
hec.event.AbstractDataListener,hec.event.DataChangeListener,hec.event.LockListener,AsciiSerializable,FieldAccessor,DataObject,DataStruct,ElementOp,RssReturnStatusConstants,Serializable,Cloneable,Comparable,EventListener,Observer,rma.lang.Modifiable
public class ReservoirOp
extends AbstractReservoirOp
implements RssReturnStatusConstants, Cloneable, ElementOp
Contains operating rules for RSS reservoirs
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class hec.model.AbstractDataObject
_dataList, _id, _isLocked, _loaded, _objRefs, _observerList, _outOfDateData, _parent, _propertyChangeSupportFields inherited from class hec.lang.NamedType
_description, _ignoreModifiedEvents, _index, _isValid, _modified, _name, defaultDescription, defaultName, DESCRIPTION_CHANGED, NAME_CHANGED, RENAME_EVENTFields inherited from interface hec.rss.model.RssReturnStatusConstants
RTN_CANCELED, RTN_NOPROBLEM, RTN_OPCHANGE, RTN_PROBLEM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDuplicateOpSet(int oid, String name) Duplicates an operation set identified by the id and gives it the name identified by name.addNewOpSet(String name) instatiates a new OpSet with the given name and adds it to the table.voidvoidapplyGCOperation(RunTimeStep rts, List ruleList) voidvoidvoidapplyRuleLimits2(RunTimeStep rts, OpRule rule, int iteration) voiddumps all ts proxiesclone()Creates a new object of the same class as this object.voidintintafter regular computations are complete for a time step, pumpback operation moves a volume of water from the source reservoir to this reservoirvoidcopyInto(ReservoirOp rop) Performs a deep copy that clones data of the given reservoirOp.voiddeletDownstreamRulesForParent(int dindex, int pindex) deleteConditionalBlock(int cbIndex) voiddeleteControllerReferences(int ctrlId) loops over OpSets, removing all references to a deleted controllervoiddeleteOpRule(OpRule rule) voiddeleteSystemHydropowerRulesForParent(int pindex) voiddeleteTandemSysOpRulesForParent(int pindex) delete all TandemSysOpRules related to the given parent TandemOpParent indexvoiddeterminePhysicalLimits(OpController controller, RunTimeStep rts) booleandoesOpSetExist(String opSetName) Tests to see if a given operation set exists.voidevaluateRuleLimits(RunTimeStep timestep, int k) returns the active operations set for the current computegetActiveRules(RunTimeStep rts, double elev, StorageZone szForZBOp, List list) Gets active rules for the reservoir given a time step and elevation If szForZBOp != null, the reservoir will operate to a zone boundary by inserting a rule at the top of the stackgetActiveRules(RunTimeStep rts, double elev, List list) returns the list of rules active for the given time step and elevationgetActiveRules(RunTimeStep rts, List list) voidgetActiveTSRecordProxies(Vector vec, int iotype) add the time series record proxies associated with the active operation set to the given vectorgetConditionalBlock(int index) getConditionalBlock(String name) Returns a Conditional Block with the specified name.Returns the primary controller for the reservoirgetController(int id) Returns a controller by indexgetController(Element relElem) Returns a controller by release elementgetControllerConstraintNameByID(int cnstrntid) given the combined controller-constraint id that is saved to the OpController constraint array, return the appropriate constraint name.returns the OpController associated with the given element, or nullString[]Returns a list of controller namesgetControllerRuleNameByID(int ruleid) given the combined controller-rule id that is saved to the OpController decision array, return the appropriate rule name.Returns a vector of controllersvoidgetDownstreamRuleNodes(int opid, Hashtable nodetable) adds all downstream nodes used as downstream control points to the given hashtablevoidgetDownstreamRules(int opid, List ruleVec) adds all downstream rules to the given vectorgetFieldObject(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.intdoubledoubleintreturns the number of decision steps in the current decision calculation should be called only during a computegetOperationSet(int id) Returns an operation set by IDgetOperationSet(String name) Returns an operation set by nameString[]Returns a list of reservoir operation set namesReturns a Vector of reservoir operation setsreturns the flow TSRecordProxies from upstream nodes on this element and any TSRecordProxies required by active operating rulesreturns the parent reservoir elementgetRules()Returns a vector all rules in this ReservoirOp controllersvoidadds all rules to the given vectorvoidgetStorageZones(int opid, List<StorageZone> zoneList) adds all storage zones from the given opid to the given listvoidgetSystemHydropowerOpRules(int opid, ArrayList ruleList) adds all SystemHydropowerOpRules rules to the given ArrayListintdoublegetWQControlDeviceFlow(RunTimeStep rts, OpRule rule, boolean usePrevStepAsEstimate) Returns the current controller min op value for the outlet element that the rule is applied to.booleanhasDownstreamGoals(int opid) returns true if any rules referenced in the given opset have downstream operating goalsbooleanPrepares this run for post processing in the ResSim Simulation Module.booleanprepare for computations - to be called after setting the active operations setvoidinitOperationStep(RunTimeStep rts, int iteration) intbooleanisRuleActive(OpRule rule, RunTimeStep rts) returns true if the given rule is active (included in the zone rules of the current OpSet for this ReservoirOp).voidbooleanloadData()this method should be called from the concrete class's loadData method to ensure that the object references get loaded correctly.voidCopies the current data for all DownstreamCntrlOpRules from the master rules held by the RssSystemvoidCopies the current data for all SystemHydropowerRules from the master rules held by the RssSystemmake all new controllers for from here to manage indexingvoidprintErrorMessage(String str) forward printErrorMessage to parent RssSystem if availablevoidprintMessage(String str) forward printMessage to parent RssSystem if availablevoidremoveOpSet(int id) voidremoveOpSet(OpSet opset) voidresetId()reset this Objects id to undefined so that when a ReservoirOp is cloned and saved to the DataList, it won't overwrite the original objectvoidrestoreFunctionState(int stateid) restore the state of the rule matching the given identifier - default behavior is to do nothingbooleanrestoreHotstartState(HotstartState parent) voidsaveFunctionState(int stateid) save the current state of the rule with the given identifier - default behavior is to do nothingvoidsaveHotstartState(HotstartState parent, int stateId) voidsetActiveOpSet(int id) sets the active operations set for the current computebooleansetFieldObject(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.voidsets the parent reservoir elementbooleansetWQControlDeviceFlowRatios(double[] wqcdFlows, OpRule rule, double wqcdTotalFlow) Sets the flow ratios through the outlets of the water quality control device.voidSaves the current data for all DownstreamCntrlOpRules to the master rules held by the RssSystem, adding new rules and deleting rules no longer used.voidvoidinttestOperationStep(RunTimeStep rts, int iteration, int flags, OpRule excludeRule) logic only need for 3.x computeinttestOperationStep(RunTimeStep rts, int iteration, int flags, OpRule excludeRule, double elev) logic only need for 3.x computeinttestOperationStepOld(RunTimeStep rts, int iteration, int flags, OpRule excludeRule) perform operation decision making without committing to the result.inttestOperationStepOld(RunTimeStep rts, int iteration, int flags, OpRule excludeRule, double elev) perform operation decision making without committing to the result.voidupdateDecisions(RunTimeStep rts, int iteration) process decision making for the given time stepvoidHave top level controller update the TSRecordProxy set for itself and all child controllers and rulesbooleanIndicates whether object uses recursive modified testing.Methods inherited from class hec.rss.model.AbstractReservoirOp
copyInto, copyInto, DataChanged, loadId, lockedMethods inherited from class hec.model.AbstractDataObject
addObjectReference, addObserver, addPropertyChangeListener, addPropertyChangeListener, decrementRefCnt, delete, fireDataChangeEvent, getCommonDataListContainer, getData, getDataList, getId, getLocked, getObjectReferences, getParent, getRefCnt, incrementRefCnt, isLoaded, locked, reload, removeObjectReference, removeObjectReference, removeObserver, removePropertyChangeSupport, removePropertyChangeSupport, save, setDataList, setDescription, setId, setLocked, setModified, setName, setParentMethods inherited from class hec.lang.NamedType
addModifiableListener, compareTo, fireModifiedStateChanged, getDescription, getDisplayName, getIgnoreModifiedEvents, getIndex, getName, isModified, isValid, readResolve, removeModifiableListener, rename, set, setIgnoreModifiedEvents, setIndex, setValid, toString, updateMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hec.model.DataObject
getDescription, getName, isModified
-
Field Details
-
NOEVAL_LOCAL
public static final int NOEVAL_LOCAL- See Also:
-
NOEVAL_DNSTRM
public static final int NOEVAL_DNSTRM- See Also:
-
NOEVAL_PERAVG
public static final int NOEVAL_PERAVG- See Also:
-
NOEVAL_GC
public static final int NOEVAL_GC- See Also:
-
NOEVAL_ROC
public static final int NOEVAL_ROC- See Also:
-
NOEVAL_RULES
public static final int NOEVAL_RULES- See Also:
-
-
Constructor Details
-
ReservoirOp
public ReservoirOp()
-
-
Method Details
-
loadControllerLimits
-
testOperationStep
logic only need for 3.x compute -
testOperationStep
public int testOperationStep(RunTimeStep rts, int iteration, int flags, OpRule excludeRule, double elev) logic only need for 3.x compute -
commitOperation
-
initOperationStep
-
applyPhysicalLimits32
-
applyReleaseOverrides
-
applyElevationOverrides
-
applyRuleLimits2
-
applyGCOperation
-
getControllerRuleNameByID
given the combined controller-rule id that is saved to the OpController decision array, return the appropriate rule name.- Specified by:
getControllerRuleNameByIDin interfaceElementOp- Parameters:
ruleid-- Returns:
-
getControllerConstraintNameByID
given the combined controller-constraint id that is saved to the OpController constraint array, return the appropriate constraint name.- Specified by:
getControllerConstraintNameByIDin interfaceElementOp- Parameters:
cnstrntid-- Returns:
-
evaluateRuleLimits
-
updateDecisions
process decision making for the given time step- Parameters:
rts-iteration-
-
initPumpbackStep
-
computePumpbackStep
after regular computations are complete for a time step, pumpback operation moves a volume of water from the source reservoir to this reservoir- Parameters:
rts-- Returns:
-
deleteConditionalBlock
-
deleteConditionalBlock
- Parameters:
cbIndex-- Returns:
-
createNewConditionalBlock
-
getConditionalBlock
- Specified by:
getConditionalBlockin interfaceElementOp- Parameters:
index-- Returns:
-
getConditionalBlock
Returns a Conditional Block with the specified name. If now conditional block exists then a null value is returned. Names are not case sensitive. A null value is acceptable as input, but a null value is returned.- Parameters:
name- the name of the conditional block to retrieve- Returns:
- the conditional block or null if none exists.
-
getConditionalBlocks
-
getRequiredTSRecordProxies
returns the flow TSRecordProxies from upstream nodes on this element and any TSRecordProxies required by active operating rules -
getGuideCurveStorage
-
getInactiveStorage
-
saveHotstartState
-
restoreHotstartState
-
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
-
deletDownstreamRulesForParent
public void deletDownstreamRulesForParent(int dindex, int pindex) -
deleteSystemHydropowerRulesForParent
public void deleteSystemHydropowerRulesForParent(int pindex) -
deleteTandemSysOpRulesForParent
public void deleteTandemSysOpRulesForParent(int pindex) delete all TandemSysOpRules related to the given parent TandemOpParent index- Parameters:
pindex-
-
loadSystemDownstreamRules
public void loadSystemDownstreamRules()Copies the current data for all DownstreamCntrlOpRules from the master rules held by the RssSystem -
loadSystemSystemHydropowerRules
public void loadSystemSystemHydropowerRules()Copies the current data for all SystemHydropowerRules from the master rules held by the RssSystem -
storeSystemHydropowerRules
public void storeSystemHydropowerRules() -
storeTandemSysOpRules
public void storeTandemSysOpRules() -
storeSystemDownstreamRules
public void storeSystemDownstreamRules()Saves the current data for all DownstreamCntrlOpRules to the master rules held by the RssSystem, adding new rules and deleting rules no longer used. -
getNumDecisionSteps
public int getNumDecisionSteps()returns the number of decision steps in the current decision calculation should be called only during a compute- Returns:
- number of decision steps for the current decision
-
isRuleActive
returns true if the given rule is active (included in the zone rules of the current OpSet for this ReservoirOp).- Specified by:
isRuleActivein interfaceElementOp- Parameters:
rule-rts-- Returns:
-
getWQControlDeviceFlow
Returns the current controller min op value for the outlet element that the rule is applied to. If usePrevStepAsEstimate is true, then the op value is estimated from the previous time step. This is called from scripted rules for operating a water quality control device. The rule must be applied to a release element that has a water quality control device.- Parameters:
rts- the run time steprule- the op rule (scripted rule for WQ operation)usePrevStepAsEstimate- whether to use the previous time step as an estimate- Returns:
- the rule's controller min op value
-
setWQControlDeviceFlowRatios
Sets the flow ratios through the outlets of the water quality control device. The length of the array wqcdFlows must be equal to the number of outlets of the water quality control device. The flow ratios are used because the actual flow through the outlet may not be known at the time this method is called in the scripted rule. This is called from scripted rules for operating a water quality control device. The rule must be applied to a release element that has a water quality control device.- Parameters:
wqcdFlows- array of flows through individual outlets of the water quality control devicerule- the op rule (scripted rule for WQ operation)wqcdTotalFlow- total sum of flow through the water quality control device- Returns:
- true if flows successfully set
-
clone
Creates a new object of the same class as this object.
It then initializes each of the new object's fields by assigning it the same value as the corresponding field in this object. No
constructor is called.- Overrides:
clonein classAbstractReservoirOp
-
clearTSProxyList
public void clearTSProxyList()dumps all ts proxies -
updateTSProxyList
public void updateTSProxyList()Have top level controller update the TSRecordProxy set for itself and all child controllers and rules -
getActiveTSRecordProxies
add the time series record proxies associated with the active operation set to the given vector -
addDuplicateOpSet
Duplicates an operation set identified by the id and gives it the name identified by name. -
printErrorMessage
forward printErrorMessage to parent RssSystem if available- Specified by:
printErrorMessagein interfaceElementOp
-
printMessage
forward printMessage to parent RssSystem if available- Specified by:
printMessagein interfaceElementOp
-
computeHindcastStep
-
testOperationStepOld
perform operation decision making without committing to the result. Used get operation limits without selected rules -
testOperationStepOld
public int testOperationStepOld(RunTimeStep rts, int iteration, int flags, OpRule excludeRule, double elev) perform operation decision making without committing to the result. Used get operation limits without selected rules -
determinePhysicalLimits
- Specified by:
determinePhysicalLimitsin interfaceElementOp- Parameters:
controller-rts-
-
initializeCompute
prepare for computations - to be called after setting the active operations set -
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
-
setActiveOpSet
public void setActiveOpSet(int id) sets the active operations set for the current compute -
getActiveOpSet
returns the active operations set for the current compute- Specified by:
getActiveOpSetin interfaceElementOp- Returns:
-
getActiveRules
-
getActiveRules
returns the list of rules active for the given time step and elevation- Parameters:
rts-elev-list- List to store rules in, may be null- Returns:
- the list of active rules
-
getActiveRules
Gets active rules for the reservoir given a time step and elevation If szForZBOp != null, the reservoir will operate to a zone boundary by inserting a rule at the top of the stack- Parameters:
rts-elev-szForZBOp-list-- Returns:
-
setReservoirElement
sets the parent reservoir element -
deleteControllerReferences
public void deleteControllerReferences(int ctrlId) loops over OpSets, removing all references to a deleted controller- Specified by:
deleteControllerReferencesin interfaceElementOp- Parameters:
ctrlId-
-
deleteOpRule
- Specified by:
deleteOpRulein interfaceElementOp- Parameters:
rule-
-
getReservoirElement
returns the parent reservoir element -
getDownstreamRuleNodes
adds all downstream nodes used as downstream control points to the given hashtable -
getStorageZones
adds all storage zones from the given opid to the given list -
getRules
Returns a vector all rules in this ReservoirOp controllers -
getRules
adds all rules to the given vector -
getDownstreamRules
adds all downstream rules to the given vector -
getSystemHydropowerOpRules
adds all SystemHydropowerOpRules rules to the given ArrayList -
hasDownstreamGoals
public boolean hasDownstreamGoals(int opid) returns true if any rules referenced in the given opset have downstream operating goals -
doesOpSetExist
Tests to see if a given operation set exists. Returns true if it does, otherwise false.- Parameters:
opSetName- - name of the operation set to search for
-
addNewOpSet
instatiates a new OpSet with the given name and adds it to the table. -
removeOpSet
public void removeOpSet(int id) -
removeOpSet
-
loadData
public boolean loadData()Description copied from class:AbstractDataObjectthis method should be called from the concrete class's loadData method to ensure that the object references get loaded correctly.- Specified by:
loadDatain interfaceDataObject- Overrides:
loadDatain classAbstractDataObject
-
copyInto
Performs a deep copy that clones data of the given reservoirOp. This method is used by the reservoir editor. -
getController
Returns the primary controller for the reservoir- Specified by:
getControllerin interfaceElementOp- Returns:
-
getControllers
Returns a vector of controllers- Specified by:
getControllersin interfaceElementOp
-
getController
Returns a controller by index- Specified by:
getControllerin interfaceElementOp- Parameters:
id-- Returns:
-
getController
Returns a controller by release element- Specified by:
getControllerin interfaceElementOp- Parameters:
relElem-- Returns:
-
getControllerForElement
returns the OpController associated with the given element, or null- Parameters:
elem-- Returns:
- OpController associated with the given element, or null
-
getControllerNames
Returns a list of controller names -
getOperationSets
Returns a Vector of reservoir operation sets- Specified by:
getOperationSetsin interfaceElementOp- Returns:
-
getOpSetTable
- Specified by:
getOpSetTablein interfaceElementOp- Returns:
-
getOperationSetNames
Returns a list of reservoir operation set names -
getOperationSet
Returns an operation set by name- Specified by:
getOperationSetin interfaceElementOp- Parameters:
name-- Returns:
-
getOperationSet
Returns an operation set by ID- Specified by:
getOperationSetin interfaceElementOp- Parameters:
id-- Returns:
-
newController
make all new controllers for from here to manage indexing- Specified by:
newControllerin interfaceElementOp- Returns:
-
resetId
public void resetId()reset this Objects id to undefined so that when a ReservoirOp is cloned and saved to the DataList, it won't overwrite the original object -
useRecursiveModifiedTest
public boolean useRecursiveModifiedTest()Indicates whether object uses recursive modified testing. Should be overrided by subclasses that use recursive testing to return true- Overrides:
useRecursiveModifiedTestin classNamedType
-
getGmtOffset
public int getGmtOffset()- Specified by:
getGmtOffsetin interfaceElementOp- Overrides:
getGmtOffsetin classAbstractDataObject
-
getUnitSystem
public int getUnitSystem()- Specified by:
getUnitSystemin interfaceElementOp- Overrides:
getUnitSystemin classAbstractDataObject- Returns:
-
getFieldObject
Description copied from interface:FieldAccessorThis method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObjectin interfaceFieldAccessor- Overrides:
getFieldObjectin classAbstractDataObject- Parameters:
fld- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessorThis allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObjectin interfaceFieldAccessor- Overrides:
setFieldObjectin classAbstractDataObject- Parameters:
fld- The java field object representing the member field to be setfobj- The data to set in that field- Returns:
- returns true if successful
-
getOperationsElement
- Specified by:
getOperationsElementin interfaceElementOp- Returns:
-