HypTargetSim

This function finds a value which, when set on a given slot, will lead to a desired value on another slot.

Description

Given a control slot and a target slot, target date/time, and target value, this function uses hypothetical simulation (see description of the predefined function HypSim) to find a value x such that if the control slot were set to x at all timesteps in the range [current date, target date], then the target slot’s value would equal the target value. If the value x exceeds the physical constraint for that slot at a particular timestep (max outflow on a reservoir for example), then the constrained value is used instead of the x value for that timestep.

Type

NUMERIC

Arguments

Type

Meaning

1

STRING

The name of the Subbasin over which to perform the hypothetical simulations. This should include the objects on which the control and target slot exist as well as all other objects necessary to compute the target slot’s value.
If there is no Subbasin with the given name, the string is taken to be the name of an object and a temporary Subbasin is created containing only that object.

An error will be issued if this subbasin contains a Data Object.

2

SLOT

The control slot, the slot with which you desire to control the target slot’s value.

3

NUMERIC

The minimum control slot value. A value less than this is not considered a legal return value.

4

NUMERIC

The maximum control slot value. A value greater than this is not considered a legal return value.

5

LIST { LIST { SLOT, NUMERIC, DATETIME } }

Fixed value(s) the user would like to set in each hypothetical simulation. Each item in the list is a list itself containing a slot, the value to set, and the timestep at which to set it.

6

SLOT

The target slot, the slot whose value you would like to attain a certain value.

7

DATETIME

The target date/time, the timestep at which you would like the target slot to attain the desired value.

8

NUMERIC

The target value, the value which you would like the target slot to achieve at the target date/time.

9

NUMERIC

The tolerance or desired accuracy of the returned value. If the function is successful, it indicates that setting the control slot to the returned value will lead to a value which differs by no more than the tolerance from the desired target value.

10

NUMERIC

The maximum number of iterations of hypothetical simulations allowed. If this number is reached without finding an return value within the tolerance, then the function fails.

11

NUMERIC

The minimum number of timesteps before and after the current timestep which might be involved in the simulation. As part of hypothetical simulation RiverWare makes copies of the objects in the subbasin and this input is used to determine how much data should be copied from each object. One can usually set this value to 0 and RiverWare will use a heuristic to determine the range over which to copy data. If this function fails because there was not enough data on some object, then input a higher value.

Evaluation

In a sense, HypTargetSim is the inverse of HypSim. In particular,

HypTargetSim(basin, control, min, max, targetSlot, targetDate, targetValue, tolerance, maxIterations) = x

implies that

HypSim(basin,{{targetSlot, t, x}, ..., {targetSlot, targetDate, x}}, {{controlSlot, targetDate}} = targetValue

The implementation of this function uses an iterative algorithm (the bisection algorithm) which performs an hypothetical simulation of the subbasin at each iteration.

Comments

RiverWare assumes that the target value range (computed using the minimum and maximum control slot values) includes the target value itself. For example, if the control slot minimum of 100 cfs leads to a simulated target value of 100 cfs. the control slot maximum of 1000 cfs leads to a simulated target slot value of 200 cfs, and the target value is 300 cfs, then the function would fail because the target value is not in the range implied by the input control slot minimum and maximum values (100-200 cfs). Mathematically, this is the assumption that target slot’s value is a monotonic function of the control slot’s value.

See also documentation See Hypothetical Simulation Overview; all comments mentioned there apply here as well.

HypTargetSim was originally named HypotheticalTargetSimulation.

 
HypTargetSim("upper basin", Navajo.Outflow, 10 "cfs", 1000 "cfs", {{Navajo.Outflow, 1000 "cfs", @"t"}}, Powell.Inflow, @"t", 100 "cfs", 0.1 "cfs", 10)
 
23.4 "cms"