Description | Absolute value operator | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | value to evaluate |
Evaluation | Determines the absolute value of the numeric argument | |
Comments |
Description | Given a string representing an account’s full name (object^account), returns a list containing the account’s attributes, i.e., the account’s water type, water owner, and account type. | |
Type | LIST {STRING, STRING, STRING} | |
Arguments | Type | Meaning |
1 | STRING | The name of the account. |
Evaluation | ||
Comments |
Description | This function returns the name of a single account having the specified priority date. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | DATETIME | The priority date. |
Evaluation | The accounts in the system are examined and the one account having the indicated priority date is returned. | |
Comments | Priority dates are a property of accounts. It is an error if no account has the specified priority date. It is an error if multiple accounts are found. See AccountNamesFromPriorityDate for a function that can be used when multiple accounts share a priority date. |
Description | This function returns a list of names of Accounts on a specified Object having the indicated Account type, sorted in ascending Account priority date order. Accounts which don’t have a priority date are at the end of the list, sorted in ascending name order. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
2 | STRING | Account type name (currently, one of Diversion, Storage, or PassThrough) or ALL. |
Evaluation | The set of Accounts on the Object are examined. The names of the Accounts having the specified account type are added to the returned list. If the Account type argument is ALL, then that attribute is ignored. The returned list will contain the names of ALL Accounts on the Object. The list is sorted as described above. | |
Comments | Priority dates are properties of Accounts. |
Description | This function returns a list of names of Accounts on a specified Object having the indicated WaterOwner, sorted in ascending Account priority date order. Accounts which don’t have a priority date are at the end of the list, sorted in ascending name order. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
2 | STRING | WaterOwner name or NONE or ALL |
Evaluation | The set of Accounts on the Object are examined. The names of the Accounts having the specified WaterOwner are added to the returned list. If the WaterOwner argument is NONE, then only Accounts having the default (unassigned) WaterOwner are included in the returned list. If the WaterOwner argument is ALL, then that attribute is ignored. The returned list will contain the names of ALL Accounts on the Object. The list is sorted as described above. | |
Comments | WaterOwners and priority dates are properties of Accounts. |
Description | This function returns a list of names of Accounts on a specified Object having the indicated WaterType, sorted in ascending Account priority date order. Accounts which don’t have a priority date are at the end of the list, sorted in ascending name order. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
2 | STRING | WaterType name or NONE or ALL |
Evaluation | The set of Accounts on the Object are examined. The names of the Accounts having the specified WaterType are added to the returned list. If the WaterType argument is NONE, then only Accounts having the default (unassigned) WaterType are included in the returned list. If the WaterType argument is ALL, then that attribute is ignored. The returned list will contain the names of ALL Accounts on the Object. The list is sorted as described above. | |
Comments | WaterTypes and priority dates are properties of Accounts. |
Description | This function returns a list of names of Accounts on a specified Object where the attributes of the outflow Supplies of the Accounts match the given ReleaseType and Destination. The list is sorted in ascending Account priority date order; Accounts which don’t have a priority date are at the end of the list, sorted in ascending name order. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | The set of Accounts on the Object are examined. The outflow Supplies on those Accounts are then examined. The names of the Accounts with Supplies that meet the following requirements are added to the returned list: • Link a different downstream Object, and • Have the indicated ReleaseType, and • Have the indicated Destination If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. The list is sorted as described above. The Intra version of the function will only look at transfer supplies that are within the object. | |
Comments | ReleaseTypes and Destinations are properties of Supplies; priority dates are properties of Accounts. |
Description | This function returns a list of the accounts having the specified priority date. This is useful when the model allows accounts to share priority dates. | |
Type | LIST of STRING | |
Arguments | Type | Meaning |
1 | DATETIME | The priority date. |
Evaluation | The accounts in the system are examined and the accounts having the indicated priority date are returned as a list of STRINGS. | |
Comments | Priority dates are a property of accounts. If there are no accounts with the specified priority date, an empty list is returned. See also AccountNameFromPriorityDate for a similar function that returns a STRING instead of a list. |
Description | This function returns the priority date of the Account, on the specified object, having the specified name. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | OBJECT | The Object |
2 | STRING | The Account name |
Evaluation | The Object’s accounts are examined. If an Account exists with the specified name its priority date is returned. | |
Comments | Priority dates are a property of Accounts. It’s an error if either the Object doesn’t have an Account with the specified name or the Account doesn’t have a priority date. |
Description | For the specified slot, compute the aggregated values using the specified function at the specified timestep size. | |
Type | LIST of {DATETIME, NUMERIC} | |
Arguments | Type | Meaning |
1 | SLOT | The slot to aggregate. This slot has the smaller timestep size. |
2 | DATETIME | Begin timestep of the returned (larger timestep) values |
3 | DATETIME | End timestep of the returned (larger timestep) values |
4 | STRING | Timestep to which to aggregate, "6 hours", "1 days", etc. This is the size of the larger timestep. |
5 | STRING | Aggregation function or filter to use. It must be one of the following: "SUM", "AVG", "MIN", "MAX", "FIRST", "LAST". |
6 | STRING | How to treat NaN values in the slot that is being aggregated. It must be one of the following: • “ERROR”: The function aborts the run and posts an explanation to diagnostics. • “TERMINATE”: If any value in the smaller timestep aggregation interval is NaN, the calling expression (for example, the rule) will terminate early. • “IGNORE”: If at least one value in the smaller timestep interval is valid, the interval is aggregated and the NaN value is ignored. If all values in the aggregation interval are NaN, the calling expression will terminate early as above. |
Evaluation | For the specified slot, compute the aggregated values using the specified function at the specified timestep size. | |
Comments | This function can be used to aggregate a series slot to return a list of larger timestep values. A use example from an initialization rule is shown: |
Description | Return the number of events which occurred on a slot in a given period. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | a slot |
2 | DATETIME | analysis period start date |
3 | DATETIME | analysis period end date |
4 | DATETIME | event period start date |
5 | DATETIME | event period end date |
6 | NUMERIC | value threshold |
7 | BOOLEAN | value threshold is upper bound |
8 | NUMERIC | event threshold |
9 | BOOLEAN | event threshold is upper bound |
Evaluation | See the on-line documentation for AnnualEventStats, which performs identical computation, but returns more information. This function returns only the number of events which occurred in the analysis period. | |
Comments |
Description | Return the number of event periods which occurred after the last event on a slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | a slot |
2 | DATETIME | analysis period start date |
3 | DATETIME | analysis period end date |
4 | DATETIME | event period start date |
5 | DATETIME | event period end date |
6 | NUMERIC | value threshold |
7 | BOOLEAN | value threshold is upper bound |
8 | NUMERIC | event threshold |
9 | BOOLEAN | event threshold is upper bound |
Evaluation | See the on-line documentation for AnnualEventStats, which performs identical computation, but returns more information. This function returns only the number of event periods which occurred after the last event. If no events occurred, then this is the number of event periods. | |
Comments |
Description | Collects and returns statistics on annual events occurring on a slot. | |
Type | LIST | |
Arguments | Type | Meaning |
1 | SLOT | a slot |
2 | DATETIME | analysis period start date |
3 | DATETIME | analysis period end date |
4 | DATETIME | event period start date |
5 | DATETIME | event period end date |
6 | NUMERIC | value threshold |
7 | BOOLEAN | value threshold is upper bound |
8 | NUMERIC | event threshold |
9 | BOOLEAN | event threshold is upper bound |
Evaluation | The analysis period start and end dates define the period during which the analysis will be performed. Within the analysis period, only the timesteps which occur on or between the day and month of the event period start and end dates are considered. Each of these periods within the analysis period is called an event period. At each event period, an event can either occur or not. An event is defined by the value threshold and comparison type and the subevent count threshold and comparison type. At each timestep within an event analysis period, the slot’s value is compared to the threshold value. If the value threshold is an upper bound and the slot’s value is greater than the value threshold, then a subevent is said to have occurred at that timestep; similarly, if the value comparison is a lower bound and the slot’s value is less than the value threshold, then a subevent is said to have occurred. After the subevents within an event analysis period have been noted, then they are counted up and compared to the subevent count threshold. If the subevent count threshold is an upper bound and the number of subevents which occurred in an event analysis period is greater than the subevent count threshold, then an event is said to have occurred, and similarly, if the subevent count comparison is a lower bound and the number of subevents which occurred in an event analysis period is less than the subevent count threshold, then an event is said to have occurred. The return list contains the following items (listed in order): • The total number of event periods. • The number of events which occurred. The number of event periods which occurred after the last event. If no events occurred, then this is the number of event periods. | |
Comments | As defined above, the first and last event periods might be of shorter duration than the other event periods. For example, if the analysis period is July 1, 1980 through June 30, 1989 and the event period is May 1 through September 30, then the first event period will be July 1, 1980 through September 30, 1980; subsequent event periods will be from May 1 through September 30, until the last event period, which will be from May 1, 1989, through June 30, 1989. If the event period contains the end of February, then event periods during leap years will also have a different duration. It is an error for the start or end date of the event period to be February 29, which does not exist in each year. Event periods can span year boundaries. For example, if the event period begin is December and the event period end is January, then each event period will be from December of one year to January of the next. One can leave the year field of the event period start or end date unspecified, if one is using a format which contains that component, such as the month/day/year format. E.g., one could specify the event start as @"6:00 May 1". The year component of the event period start and end date is ignored whether or not it is specified. Any missing value in the slot’s series is treated as a non-subevent. The comparison with the value threshold is done to within 0.01% of the threshold’s value. That is, values which are within 0.01% of the threshold’s value are considered to have exceeded the threshold. |
Description | Aggregates several objects’ values, each of which is the result of aggregating a slot’s values over time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start date |
7 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, each slot’s values are aggregated according to the aggregation function argument over the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, all of the object’s aggregated slot values are averaged. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Average several object’s slot values, for each timestep in a range. | |
Type | LIST{LIST{DATETIME, NUMERIC}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start date |
6 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be averaged are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the object’s slot values are averaged, yielding one value for each timestep in the time range of the datetime arguments. The function returns a list of two items, where the first and second items of the inner lists are the datetime and the average value, respectively. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Aggregate over a timeseries of values, each of which is the result of aggregating several objects’ slot values. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start datetime |
7 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the objects’ slot values are aggregated according to the aggregation function argument for each timestep in the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the timeseries of object aggregated slot values are averaged. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Average a slot’s values over a time range, for each object in a subbasin. | |
Type | LIST {LIST {OBJECT, NUMERIC}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start datetime |
6 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. For each object, the slot’s values are averaged over every timestep in the range of the datetime arguments. Any values which do not satisfy the aggregation filter argument are ignored during the calculation. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are first multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, this function also aborts RiverWare with an error. |
Description | The ceiling numeric operation, to a multiple of a factor. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the value |
2 | NUMERIC | the factor |
Evaluation | Converts the value into the units of the factor, then returns the smallest integral multiple of the factor which is not less than the converted value. The returned value has the units of the factor. | |
Comments | If the scalar portion of the factor is 1.0, then this function simply returns the ceiling of the value expressed in the units of the factor. If the two arguments are of a different unit type, this function aborts the run with an error. See also RoundToFactor and Floor. |
Description | Returns the labels associated with column of a table slot or aggregate series slot. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | A table slot or agg series slot. |
2 | NUMERIC | The column index (0-based). |
Evaluation | Returns the label of the column of the slot which has the given index. | |
Comments | It is an error to provide an illegal index (e.g., an index of 4 with a table which has only 4 columns). If the column index is legal but there is no label for that column, then the empty string is returned: " ". |
Description | Returns a list containing the column labels of a given table slot or agg. series slot, in order. | |
Type | LIST of STRING values | |
Arguments | Type | Meaning |
1 | SLOT | A table slot or agg. series slot |
Evaluation | Returns the column labels of the given slot. | |
Comments | It is an error if the input slot has a type other than table slot or agg. series slot. For each column, if no label exists the empty string is returned. |
Description | Fill in the missing components of a partially specified date/time. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a partially specified date/time. |
2 | DATETIME | a source date/time, used to complete the other date. |
Evaluation | Fills in the missing components of a partially specified date value. The missing component values are taken from the second parameter, a date value which, if not fully specified, should have at least the components which are missing from the date which is being completed. See the following syntax examples. See PreviousDate and NextDate for details on related functions. | |
Comments | The behavior is not defined if the resulting date is not valid; for example, if the day of month is not valid for the month and year. |
Description | Used to meet multiple water user demands using multiple reservoir diversions | |
Type | LIST{LIST {SLOT, NUMERIC, OBJECT}} | |
Arguments | Type | Meaning |
1 | STRING | The computational subbasin used for the calculations |
Evaluation | Returns a LIST of slot, value triplets. Each triplet is a LIST that contains a slot (at index zero) and the value to set on that slot (at index one). The slot, value triplets computed by this function are for the subslots on the Supply From Reservoirs slot on each Water User object and the Incoming Available Water slot on each Water User object. For each Water User in the specified subbasin: • A list of supply reservoirs is generated by following the links to the Supply From Reservoirs slot • The list of reservoirs is ranked by Operating Level in descending order. • Each reservoir makes a diversion to meet the Water User’s Diversion Requested value. This value is limited by: the Maximum Delivery Rate specified on the Water User object that applies to the current reservoir, the Max Diversion specified on the Diversion object that applies to the current reservoir, and the amount of water remaining in the conservation pool. • If the Limit by Reservoir Level method is selected (on the Water User object) a diversion cannot be made if the Demand Reservoir is in the flood pool or has a higher operating level than the supply reservoir. • Each reservoir is visited until the Diversion Requested is met or there are no reservoirs left to consider. • The function returns each subslot on each Supply From Reservoirs slot and the associated value. Also the Incoming Available Water slot on each Water User is returned with the value to be set on that slot. The Incoming Available Water is the sum of all the Supply From Reservoirs subslot values | |
Comments | The computational subbasin specified as the argument to this function must contain all the objects relevant to these calculations (Water Users, Diversion Objects, Reservoirs, etc.) The computational subbasin must have a method selected in the Diversions from Reservoirs category. Please consult the help file for the Computational Subbasin object (under Simulation Objects) for more details on this method category. The use of this function requires a specific configuration of objects and method selections. The schematic diagram below displays the required object and link configurations. See Reservoir Diversions in USACE‑SWD Modeling Techniques for details on using this function for USACE-SWD. |
Description | Compare two dates and return that which is chronologically greater. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a date |
2 | DATETIME | another date |
Evaluation | The two dates are resolved and compared, the one which is chronologically greater is returned. | |
Comments |
Description | Compare two dates and return that which is chronologically lesser. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a date |
2 | DATETIME | another date |
Evaluation | The two dates are resolved and compared, the one which is chronologically lesser is returned. | |
Comments |
Description | Given a periodic slot and a date, this function returns an ordered list of dates representing the beginning time of each interval which begins in the specific period containing the input (reference) date. | |
Type | LIST {DATETIME} | |
Arguments | Type | Meaning |
1 | SLOT | a periodic slot |
2 | DATETIME | a reference date |
Evaluation | Every periodic slot has a period associated with it and this period is divided into intervals. Intervals are either regular (e.g., Days) or irregular (e.g., the beginning of one interval might be 8:00 July 3 of each period). One can map a period (divided into intervals) onto a time line, leading to several specific periods (divided into specific intervals). For example, the period "Year" maps onto specific periods corresponding to each year, such as the specific period which is the year 2003. Providing a reference date serves to indicate a specific period, and this function returns the dates corresponding to the beginning of each time interval which begins in that specific period. | |
Comments | When the beginning of an interval occurs exactly at a period boundary (e.g., an interval beginning at "0:00 January 1" with an 1 Year period), then we consider that interval to begin in the period occurring after midnight, not the one before. Not all time intervals (rows) defined in a Periodic Slot will correspond to intervals in a specific period. For example, for a period of Month, an interval might be defined which begins at "12:00 Day 30". This interval does not exist in all months and so for example if the reference date is 12:00 February 1, 2003, then the list returned by this function would not include the date 12:00 February 30, 2003. |
Description | Given a Date/Time value, returns that date encoded as a numeric value of the type used by slots to containing date/time values. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | The date/time value to encode as a numeric value. |
Comments | Slots representing date/time values have unit type DateTime. The date/time value need not be fully specified, but the return value should only be assigned to a slot with appropriate units. For example, if the value @"January 1" should only be assigned to a slot with units "MonthAndDay". |
Description | This function returns a list of the names of all Destinations defined in the Water Accounting System Configuration. | |
Type | LIST {STRING} | |
Arguments | none | |
Evaluation | ||
Comments | Destinations are properties of Supplies. The returned list does not include the default (NONE) Destination. |
Description | This function returns a list of unique names of Destination Type of Supplies which represent outflows from a specified Object, and which have the indicated Release Type. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
2 | STRING | Release Type name or NONE or ALL |
Evaluation | The set of Accounts on the Object are examined. The outflow Supplies on those Accounts which link a different downstream Object and which have the indicated Release Type are considered. The names of the Destination Types of those Supplies are added to the returned list -- but any given Destination Type name will appear on the list only once. If the Release Type argument is NONE, then only Supplies having the default (unassigned) Release Type are considered. If the Release Type argument is ALL, then that attribute is ignored when considering Supplies. | |
Comments | Destination Type and Release Types are properties of Supplies. The returned list can include the default (NONE) Destination Type. Supplies which represent internal flows between two Accounts on the Object are not considered. |
Description | Returns the number of dispatch method executions that have occurred since the beginning of the current run. | |
Type | NUMERIC | |
Arguments | none | |
Comments | Returns the number of dispatch method executions that have occurred since the beginning of the current run, if called during a dispatching run (Simulation or Rulebased Simulation). Otherwise, returns the total number of dispatch executions in the previous dispatching run. |
Description | The last dispatch timestep. | |
Type | DATETIME | |
Arguments | none | |
Evaluation | Returns the DATETIME that is the last timestep at which the current controller allows dispatching. If this function is called from a context in which the current controller does not have a last dispatch timestep (i.e. optimization), then the end date of the run is returned. | |
Comments | The Number of Post-Run Dispatch Timesteps is set on the Run Control Parameters dialog for Simulation or Rulebased Simulation. See Number of Post-Run Dispatch Timesteps in User Interface for details on changing the Number of Post-Run Dispatch Timesteps. |
Description | Returns the accumulated time spent executing dispatch methods since the beginning of the current run. | |
Type | NUMERIC | |
Arguments | none | |
Comments | Returns the accumulated time spent executing dispatch methods since the beginning of the current run, if called during a dispatching run (Simulation or Rulebased Simulation). Otherwise, returns the total time spent executing dispatch methods in the previous dispatching run |
Description | Integer division of two numbers. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the numerator |
2 | NUMERIC | the units to which to convert the numerator |
3 | NUMERIC | the denominator |
4 | NUMERIC | the units to which to convert the denominator |
Evaluation | Converts numerator and denominator into the specified units, then returns the integral division of the converted values, where integral division of x and y is defined as: | |
Comments | If the denominator is equal to zero, this function aborts the run with an error. Each of the units arguments must have units which are compatible with the value with which they are associated, otherwise the run is aborted with an error. This function does not use the scalar portion of either of the units arguments. |
Description | Find the surface area corresponding to a reservoir’s elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
Evaluation | The pool elevation argument is looked up in the Pool Elevation column, of the Elevation Area Table, of the reservoir object argument, to determine the Surface Area. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding surface areas. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Elevation Area Table, the function aborts the run with an error (CRSSEvaporationCalc, DailyEvaporationCalc, PanAndIceEvaporation, or InputEvaporation must be selected as the Evaporation and Precipitation Category selected Method. This function will issue an error if the Time Varying Elevation Area method is selected (see Time Varying Elevation Area in Objects and Methods). Instead, use the ElevationToAreaAtDate function (see ElevationToAreaAtDate). |
Description | Find the surface area corresponding to a reservoir’s elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
3 | DATETIME | the datetime at which to do the conversion |
Evaluation | On the specified reservoir object argument, if the Time Varying Elevation Area method is selected (see Time Varying Elevation Area in Objects and Methods), the function will reference the Elevation Area Table Time Varying table (see Elevation Area Table Time Varying in Objects and Methods). The function will select the appropriate column to use based on the datetime argument. On timesteps that exactly match a modification date, the previous column is used. The relationship changes only at the end of that timestep and is taken into account when the reservoir dispatches. For this algorithm the previous column relationship is used. Otherwise, the Elevation Area Table is used and the datetime is ignored. Then, the pool elevation argument is looked up in the Pool Elevation column to determine the Surface Area from the appropriate Surface Area column. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding surface areas. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Elevation Area Table or Elevation Area Table Time Varying, the function aborts the run with an error (i.e. a method must be selected in the Evaporation and Precipitation Category). |
Description | Find the maximum regulated spill at a given reservoir elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
3 | DATETIME | datetime context for unit conversions |
Evaluation | The pool elevation argument is looked up in the Pool Elevation column, of the Regulated Spill Table, of the reservoir object argument, to determine the Max Regulated Spill. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding maximum regulated spills. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have a Regulated Spill Table, the function aborts the run with an error (Regulated; Regulated and Unregulated; Regulated and Bypass; Regulated, Bypass and Unregulated; or Bypass, Regulated and Unregulated must be the Spill category selected method). |
Description | Find the reservoir storage at a given elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
Evaluation | The pool elevation argument is looked up in the Pool Elevation column, of the Elevation Volume Table, of the reservoir object argument to determine the Storage. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding storage values. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, the function aborts the run with an error. If the reservoir is a Slope Power Reservoir, the calculation is based only on level storage and does not include any wedge storage effects. This function will issue an error if the Time Varying Elevation Volume method is selected (see Time Varying Elevation Volume in Objects and Methods). Instead, use the ElevationToStorageAtDate function described next. |
Description | Find the volume corresponding to a reservoir’s elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
3 | DATETIME | the datetime at which to do the conversion |
Evaluation | On the specified reservoir object argument, if the Time Varying Elevation Volume method is selected, the function will reference the Elevation Volume Table Time Varying table. The function will select the appropriate column to use based on the datetime argument. On timesteps that exactly match a modification date, the previous column is used. The relationship changes at the end of that timestep and is taken into account when the reservoir dispatches. For this algorithm, the previous column relationship is used. Otherwise, the Elevation Volume Table is used and the datetime is ignored. Then, the pool elevation argument is looked up in the Pool Elevation column to determine the Volume from the appropriate column. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding surface areas. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Elevation Volume Table or Elevation Volume Table Time Varying, the function aborts the run with an error. |
Description | Find the unregulated spill at a given reservoir elevation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | pool elevation |
3 | DATETIME | datetime context for unit conversions |
Evaluation | The pool elevation argument is looked up in the Pool Elevation column, of the Unregulated Spill Table, of the reservoir object argument, to determine the Unregulated Spill. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding unregulated spills. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Unregulated Spill Table, the function aborts the run with an error (Unregulated; Regulated and Unregulated; Regulated, Bypass and Unregulated; or Bypass, Regulated and Unregulated must be the Spill selected method). |
Description | Exponentiation of a dimensionless quantity. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the operand |
2 | NUMERIC | the exponent |
Evaluation | Returns the result of exponentiating the operand to the power given by the exponent. The return value is dimensionless (has no units). | |
Comments | The exponent is not restricted to being an integer (as with the "^" operator), but it is an error for the operand to have units. |
Description | Filter a list of objects to include only objects of the specified types. | |
Type | LIST {OBJECT} | |
Arguments | Type | Meaning |
1 | LIST | list of objects |
2 | LIST | list of object types to include, where each object type is expressed as a STRING. |
Evaluation | The list of object types to include is parsed and mapped to RiverWare object types. Then, the list of objects is evaluated in order, and each object which is one of the requested object types is added to the returned list.The spellings and capitalization of objects can be found in the Subbasin Manager under the Automatic tab. | |
Mathematical Expression | ||
Comments | The order of objects is preserved from the argument object list to the returned object list. The list arguments may contain any number of items. If either of the arguments is an empty list, the function evaluates to an empty list. |
Description | This function takes a list and replaces any lists contained within that list with the individual items from those lists. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | the list to be flattened |
Evaluation | For each item in the input list, if the item is not a list, it is appended to the answer list, if it is a list, then it is flattened and then all of its items are appended to the answer list in turn. | |
Comments |
Description | Invokes computational subbasin’s selected Flood Control method. | |
Type | LIST { LIST { SLOT, NUMERIC, OBJECT } } | |
Arguments | Type | Meaning |
1 | STRING | the name of the computational subbasin |
Evaluation | Runs the selected Flood Control method on the subbasin. Returns a list of { slot, value, object } sets. For each reservoir in the subbasin, three sets may be returned: one for the Outflow slot, one for the Flood Control Release slot on the reservoir, and one for the Target Balance Level on the reservoir. | |
Comments | The calling rule is expected to make the assignments of the values to the slots. Typically, this function should be called only once per timestep. To constrain this, use the following as an execution constraint: NOT(HasRuleFiredSucessfully("This Rule") ) See Low-flow Releases in USACE‑SWD Modeling Techniques for details on using this function for USACE-SWD. |
Description | The floor numeric operation, to a multiple of a factor. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the value |
2 | NUMERIC | the factor |
Evaluation | Converts the value into the units of the factor, then returns the largest integral multiple of the factor which is not greater than the converted value. The returned value has the units of the factor. | |
Comments | If the scalar portion of the factor is 1.0, then this function simply returns the floor of the value expressed in the units of the factor. If the two arguments are of a different unit type, this function aborts the run with an error. See also Ceiling and RoundToFactor. |
Description | The volume of water resulting from a steady flow over a timestep. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | constant flow to be converted |
2 | DATETIME | timestep over which to convert |
Evaluation | The number of seconds in the timestep of the datetime argument is determined. Then, the flow argument is multiplied by this number of seconds. Returns value in units of volume. | |
Mathematical Expression | ||
Comments | If the flow argument is entered in units containing a "/month" component, it is scaled to reflect the length of the month indicated by the timestep argument before being multiplied by this timestep length. When called from a series slot with expression, the flow to volume conversion uses the run timestep size, which may differ from the expression slot timestep size. (This is different from the VolumeToFlow function, which uses the expression slot timestep size for the conversion.) |
Description | The fractional remainder after division. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the numerator |
2 | NUMERIC | the denominator |
Evaluation | Converts the numerator into the units of the denominator, divides the result by the denominator, then returns the fractional portion of the division. In other words: The returned value has the units of factor. | |
Comments | If the scalar portion of the denominator is 1.0, then this function simply returns the fractional portion of the first argument when it is expressed in the units of the denominator. If the values are of a different unit type, this function aborts the run with an error. |
Description | Return the contents of a Table Slot that is structured for 3D table interpolation. | |
Type | LIST{LIST {NUMERIC LIST{NUMERIC} LIST{NUMERIC}}} | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values are to be returned. |
2 | NUMERIC | z column index (zero-based) |
3 | NUMERIC | x column index (zero-based) |
4 | NUMERIC | y column index (zero-based) |
Evaluation | Returns the contents of a 3D table as a list of the table values associated with successive z value. For each distinct z value in the table slot, the returned list contains a sublist with the following values: 1. Current z value 2. List of x values associated with the current z value 3. List of y values associated with the current z value | |
Comments | Units are not required for row and column indices and, if provided, will be ignored. In the context of rulebased simulation, if one of the slot’s values is NaN, the function exits the rule with an early termination. |
Operating Head (m) | Turbine Release (cms) | Power (HP) |
---|---|---|
320 | 0.00 | 0 |
320 | 120.32 | 470 |
340 | 5.00 | 10 |
340 | 127.32 | 500 |
Description | Return the contents of a Table Slot that is structured for 3D table interpolation. | |
Type | LIST{LIST {NUMERIC LIST{NUMERIC} LIST{NUMERIC}}} | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values are to be returned. |
2 | NUMERIC | z column index (zero-based) |
3 | NUMERIC | x column index (zero-based) |
4 | NUMERIC | y column index (zero-based) |
Evaluation | Returns the contents of a 3D table as a list of the table values associated with successive z value. For each distinct z value in the table slot, the returned list contains a sublist with the following values: 1. The current z value 2. The list of x values associated with the current z value 3. The list of y values associated with the current z value | |
Comments | Units are not required for row and column indices and, if provided, will be ignored. In the context of rulebased simulation, if one of the slot’s values is NaN, all values in that row and rows below it are ignored. |
Operating Head (m) | Turbine Release (cms) | Power (HP) |
---|---|---|
320 | 0.00 | 0 |
320 | 120.32 | 470 |
340 | 5.00 | 10 |
340 | 127.32 | 500 |
NaN | NaN | NaN |
Description | Return the name of a slot’s account. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | The slot whose account is returned. |
Comments | It is an error if the slot is not on an account. |
Description | The names of all user defined subbasins in the current model, expressed as strings. | |
Type | LIST {STRING} | |
Arguments | none | |
Evaluation | The function first retrieves a list of all defined subbasins in the model, then filters out any automatic subbasins (object type basins generated by RiverWare). | |
Comments | If there are no user defined subbasins in the model, this function evaluates to an empty list. |
Description | Get a column map value from a periodic slot given a date and a value. This is the inverse of the way values are usually accessed in periodic slots with column maps (i.e., given a date and column map value, find the corresponding slot value). | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | The periodic slot to be accessed. |
2 | DATETIME | The date to be used to index into the time dimension of the Periodic Slot (its row map). |
3 | NUMERIC | The value to use for the lookup, having the same type of units as the values in the periodic slot itself. |
Evaluation | If the default access method for the table is lookup, then we first find the row whose associated time interval contains the input date. We then find the two consecutive values in that row whose values bracket the input value. We then find the column map values associated with these two values, and return a value interpolated between them according to where the input value falls between its two bracketing values. If the default access method is interpolation then the procedure described above is followed for the row whose time interval follows the given date, and the return value is interpolated between the values found for the two rows. | |
Comments | The input slot must be a periodic slot with a column map, the numeric value must have units compatible with the units of the periodic slot, for the relevant time intervals, the slot values must be either a monotonically non-decreasing or monotonically non-increasing function of the column map values, and the input value must fall within the domain of that function. If there are multiple possible return values, i.e., if the input value appears for multiple columns, then the largest column map value is returned. |
Description | The index of the table slot or agg. series slot column whose name matches a string. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the table slot or agg. series slot in which to find a column |
2 | STRING | the name of the column to match |
Evaluation | The labels of the slot columns are compared to the string argument until a match is found. | |
Comments | Slot column and row indices are zero based and have units of type [NONE]. If the specified slot is not a table slot or agg. series slot, or the specified string is not the label of a column on the slot, this function aborts the run with an error. If several columns of the slot match the string argument, this function evaluates to the index of the left-most matching column. The matching process treats sequences of white space characters as a blank; for example, the input string “ ab c “ will match a column with the label “ab c.” This allows the method to match labels that are displayed on multiple lines because they contain a carriage return character. |
Description | Interpret a string as a date. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | STRING | Textual representation of a date/time. |
Evaluation | Returns the date which corresponds to the input text. Legal text is the same as is legal for symbolic date/times. For example, the expression: GetDate("January 1, Current Year") is exactly equivalent to the expression: @"January 1, Current Year". |
Description | Generate a list of datetimes between two datetimes at a given interval. | |
Type | LIST {DATETIME} | |
Arguments | Type | Meaning |
1 | DATETIME | starting datetime |
2 | DATETIME | ending datetime |
3 | STRING | string representation of a datetime interval expressed as an integer, a space, and a time unit. |
Evaluation | The starting datetime and ending datetime; which may be specified symbolically, are converted into actual datetimes. The string representation of the interval is resolved into a time length. Then, a list is created beginning with the starting datetime. The time length is added to each previous datetime in the list until the resulting datetime is later than the ending datetime. | |
Mathematical Expression | ||
Comments | If the ending date is before the starting date, the function evaluates to an empty list. If the ending date is equal to the starting date, or if the time interval is larger than the interval between the starting and ending dates, the function evaluates to a list which only contains the start date. The accepted datetime interval units are: • hours or Hours • days or Days • weeks or Weeks • months or Months • years or Years |
Description | Generate a list of datetimes separated by a given interval, and centered at a given date. If desired, dates not within the run duration are filtered out of the list. | |
Type | LIST {DATETIME} | |
Arguments | Type | Meaning |
1 | DATETIME | center datetime |
2 | NUMERIC | number of dates to return in the list |
3 | STRING | string representation of a datetime interval expressed as an integer, a space, and a time unit |
3 | BOOLEAN | whether to limit return dates to those within the run |
Evaluation | The center datetime, which may be specified symbolically, is converted into an actual datetime. The string representation of the interval is resolved into a time length. Then a list is created with the given number of dates, each separated by the given time interval. The center date is always included in this list, with an equal number of dates appearing before and after it (in the case of an odd number of dates). If their are an even number of dates, then there is one more date appearing before the center date than appear after. After the list has been created, if the user has specified that they only want dates within the run duration, then all other dates are filtered out of the return list. | |
Mathematical Expression | ||
Comments | The accepted datetime interval units are: • hours or Hours • days or Days • weeks or Weeks • months or Months • years or Years |
Description | The day of the month as a unit of time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime whose day of month to determine |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the day of the month in which the datetime is, is determined. This function requires that the datetime be at least partially specified with a valid month and day, E.g. @"January 1" or @"Current Month 23" will work. | |
Comments | When displayed, the return value will be displayed according to the active unit scheme’s time unit type rule. For example, if the active unit scheme displays Time values as Hours, then the return value for @”January 2” will be displayed as 48 “hours”. To convert the return value into a dimensionless value representing the number of days, divide it by 1 “day”. As elsewhere in RiverWare 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | The day of the year as a one-based integer in units of time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime whose day of the year to determine |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the day of the year in which the datetime is contained, is determined. This function requires that the specified datetime resolve to a fully specified datetime or an error will occur. | |
Comments | When displayed, the return value will be displayed according to the active unit scheme’s time unit type rule. For example, if the active unit scheme displays Time values as Hours, then the return value for @”January 2” will be displayed as 48 “hours”. To convert the return value into a dimensionless value representing the number of days, divide it by 1 “day”. As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | The number of days in the month in units of time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime of any time within the month |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the number of days in the month in which the datetime is contained, is determined. This function requires that the specified datetime resolve to a fully specified datetime or an error will occur. | |
Comments | When displayed, the return value will be displayed according to the active unit scheme’s time unit type rule. For example, if the active unit scheme displays Time values as Hours, then the return value for @”January 2” will be displayed as 744 “hours”. To convert the return value into a dimensionless value representing the number of days, divide it by 1 “day”. As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | This function takes a series or periodic slot and a date and returns the value of the slot at the given date, in units based on the display scale and units for that slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the series or periodic slot whose value is to be returned |
2 | DATETIME | the datetime of the value to be returned |
Evaluation | ||
Comments | The function returns an error and aborts the run if the input slot is not a series or periodic slot, if the date is not fully specified, or if the date is not contained in the series. |
Description | This function takes an agg series slot or periodic slot, a date, and a column, and returns the value of the slot in the given column and at the given date, in units based on the display scale and units for that slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the series or periodic slot whose value is to be returned |
2 | DATETIME | the datetime of the value to be returned |
3 | NUMERIC | the column, interpreted as a 0-based integral index |
Evaluation | The function returns and error and aborts the run if the input slot is not of an appropriate type, if the date is not fully specified, or if the date is not contained in the series. |
Description | Return the name of an element in an aggregate object, without the name of the object’s name prepended. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | OBJECT | the element of an aggregate object (e.g., a WaterUser within an AggDiversionSite) whose name is to be returned. |
Evaluation | The function returns the name of the element object. | |
Comments | This function returns only the name of the element itself, without the name of the parent aggregate object. If the full name is desired, then one may use the built-in RPL operation STRINGIFY. If the object argument is not an element of an aggregate object, then the run is aborted with an error. |
Description | Return the value for a trace keyword for the current trace executing in a run. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | STRING | the name of a trace metadata keyword. |
Evaluation | The function returns the value for the trace keyword for the currently executing run. | |
Comments | If the function is called outside of a run or if the trace metadata keyword cannot be found, then the function fails. This function would typically be called during a multiple run when input ensembles are used in the MRM configuration. If a single trace is configured for an ensemble dataset to use outside of a multiple run and a DMI with this dataset is invoked during a single run, the metadata for that trace would also be available to query. |
Description | Return the value for an ensemble keyword for the current run. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | STRING | the name of an ensemble metadata keyword. |
Evaluation | The function returns the value for the ensemble keyword for the currently executing run. | |
Comments | If the function is called outside of a run or if the ensemble metadata keyword cannot be found, then the function fails. This function would typically be called during a multiple run when input ensembles are used in the MRM configuration. If a single trace is configured for an ensemble dataset to use outside of a multiple run and a DMI with this dataset is invoked during a single run, the metadata for that ensemble would also be available to query. |
Description | The Julian date of the timestep in units of NONE. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime whose Julian date to evaluate to |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the Julian date of this timestep is determined. This function requires that the specified datetime resolve to a fully specified datetime or an error will occur. | |
Comments | Julian Dates are represented as the number of days from noon GMT on January 1, 4713 B.C. (47120101 12:00 P.M. GMT). Julian Dates in RiverWare also include the decimal fraction of the day down to 0.00001, the equivalent of 1 second. |
Description | Given a slot, returns a list of the Objects which contain the slots to which the input slot is linked. | |
Type | LIST {OBJECT} | |
Arguments | Type | Meaning |
1 | SLOT | the slots whose links are to be explored |
Evaluation | For each slot to which the input slot is linked, we determine if that slot is managed by a Objects; if so, it is added to the return list. Thus, an empty list is returned if the slot is not linked to any slots on a Objects. | |
Comments | It is considered an error if the input slot is not a Series Slot. |
Description | Returns the lower bound for the specified series slot | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the slot whose bound is to be returned. |
Evaluation | ||
Comments | It is considered an error if the specified slot is not a Series Slot with a valid lower bound. The lower bound is specified in the slot configuration. |
Description | Returns the lower bound for the column of the specified agg series slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the agg series slot whose bound is to be returned. |
2 | NUMERIC | the column index (0-based). |
Evaluation | ||
Comments | It is considered an error if the input slot is not an Agg Series Slot with a valid lower bound for the given column. The lower bound is specified in the slot configuration. |
Description | The maximum combined outflow of a reservoir, including outlet works or turbine release, and any possible regulated, unregulated, and/or bypass spills. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the given pool elevation; at the end of the specified timestep |
3 | DATETIME | the timestep at which to calculate |
Evaluation | • Unit Generator Power: The turbine release is the sum of the maximum releases for each available turbine, as specified in the Generators Available and Limit table. Each turbine’s maximum release is determined from a table interpolation in the Full Generator Flow table using the operating head as the lookup in the appropriate unit type’s Head for Type n column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Peak Power Equation with Off Peak Spill: The turbine release is the peak release over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Operating Head vs. Generator Capacity table. • Peak Power and Peak and Base: The turbine release is the peak flow over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Best Generator Flow table using the operating head as the lookup in the Head for Type 1 column. • LCRPowerCalc: Because this power method has no turbine release limit, a maximum outflow cannot be calculated. RiverWare issues an error message and aborts the execution of this rule. • Unregulated Spill (if an Unregulated Spill method is selected on the object): The maximum unregulated spill is determined from a table interpolation in the Unregulated Spill Table using the average pool elevation as the Pool Elevation. • Regulated Spill (if a Regulated Spill method is selected on the object): If the Regulated Spill slot is specified by the user (I, Z or R flag), the specified value is used as the maximum regulated spill. Otherwise the maximum regulated spill is determined from a table interpolation in the Regulated Spill Table using the average pool elevation in the Pool Elevation column. Note: If the MonthlySpill method is selected, the result of GetMaxOutflowGivenInflow is the value in the Maximum Controlled Release table slot. • Bypass (if a Bypass Spill method is selected on the object): If the Bypass slot is specified by the user (I, Z or R flag), the specified value is used as the maximum bypass. Otherwise the maximum bypass is determined from a table interpolation in the Bypass Table using the average pool elevation. All of the individual outflows are then summed to calculate the maximum outflow. The individual outflows are then summed to calculate the maximum outflow. | |
Mathematical Expression | ||
Comments | The Tailwater Base Value is automatically added as a dependency to the calling rule. |
Description | The maximum combined outflow of a reservoir, including outlet works or turbine release, and any possible regulated, unregulated, and/or bypass spills. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average inflow over the timestep, often the reservoir’s inflow slot value |
3 | DATETIME | the timestep at which to calculate |
Evaluation | A convergence algorithm is used in this function; see Reservoir Convergence in Objects and Methods for details. The function iterates to convergence by computing the end of timestep storage and pool elevation, the average pool elevation over the timestep, and the following outflows: • Release (if the object is a StorageReservoir): The maximum release is determined from a table interpolation in the Max Release table using the average pool elevation as the lookup in the Pool Elevation column. • Turbine Release (if the object is a LevelPowerReservoir or SlopePowerReservoir): The maximum turbine release is determined based on the selected Power method. This calculation is iterative, since the maximum outflow impacts the reservoir tailwater elevation and operating head, which affect the maximum turbine release. The selected Tailwater method is used to determine the tailwater elevation. • No Power Turbine Flow: The turbine release is determined from a table interpolation in the Max Flow Through Turbines table using the average pool elevation as the lookup in the Reservoir Elevation column. • Plant Power Coefficient: The turbine release is determined from a table interpolation in the Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Plant Efficiency Curve: The turbine release is determined from a table interpolation in the Auto Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Unit Generator Power: The turbine release is the sum of the maximum releases for each available turbine, as specified in the Generators Available and Limit table. Each turbine’s maximum release is determined from a table interpolation in the Full Generator Flow table using the operating head as the lookup in the appropriate unit type’s Head for Type n column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Peak Power Equation with Off Peak Spill: The turbine release is the peak release over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Operating Head vs. Generator Capacity table. • Peak Power and Peak and Base: The turbine release is the peak flow over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Best Generator Flow table using the operating head as the lookup in the Head for Type 1 column. • LCRPowerCalc: Because this power method has no turbine release limit, a maximum outflow cannot be calculated. RiverWare issues an error message and aborts the execution of this rule. | |
• Unregulated Spill (if an Unregulated Spill method is selected on the object): The maximum unregulated spill is determined from a table interpolation in the Unregulated Spill Table using the average pool elevation as the Pool Elevation. • Regulated Spill (if a Regulated Spill method is selected on the object): If the Regulated Spill slot is specified by the user (I, Z or R flag), the specified value is used as the maximum regulated spill. Otherwise the maximum regulated spill is determined from a table interpolation in the Regulated Spill Table using the average pool elevation in the Pool Elevation column. Note: If the MonthlySpill method is selected, the result of GetMaxOutflowGivenInflow is the value in the Maximum Controlled Release table slot. • Bypass (if a Bypass Spill method is selected on the object): If the Bypass slot is specified by the user (I, Z or R flag), the specified value is used as the maximum bypass. Otherwise the maximum bypass is determined from a table interpolation in the Bypass Table using the average pool elevation. in the Pool Elevation column. Once the iteration has converged on an ending storage and pool elevation, all of the individual outflows are summed to calculate the maximum outflow | ||
Mathematical Expression | ||
Comments | This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots in addition to Tailwater Base Value are automatically added as dependencies to the calling rule. |
Description | The maximum combined outflow of a reservoir, including outlet works or turbine release, and any possible regulated, unregulated, and/or bypass spills. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the given storage, at the end of the specified timestep |
3 | DATETIME | the timestep at which to calculate |
Evaluation | The ending pool elevation is determined from the ending storage in argument 2 and is averaged with the previous timestep’s ending Pool Elevation to yield an average pool elevation over the timestep. The average pool elevation is then used to compute the following outflows: • Release (if the object is a StorageReservoir): The maximum release is determined from a table interpolation in the Max Release table using the average pool elevation as the lookup in the Pool Elevation column. • Turbine Release (if the object is a LevelPowerReservoir or SlopePowerReservoir): The maximum turbine release is determined based on the selected Power method. This calculation is iterative, since the maximum outflow impacts the reservoir tailwater elevation and operating head, which affect the maximum turbine release. The selected Tailwater method is used to determine the tailwater elevation. • No Power Turbine Flow: The turbine release is determined from a table interpolation in the Max Flow Through Turbines table using the average pool elevation as the lookup in the Reservoir Elevation column. • Plant Power Coefficient: The turbine release is determined from a table interpolation in the Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Plant Efficiency Curve: The turbine release is determined from a table interpolation in the Auto Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Unit Generator Power: The turbine release is the sum of the maximum releases for each available turbine, as specified in the Generators Available and Limit table. Each turbine’s maximum release is determined from a table interpolation in the Full Generator Flow table using the operating head as the lookup in the appropriate unit type’s Head for Type n column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Peak Power Equation with Off Peak Spill: The turbine release is the peak release over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Operating Head vs. Generator Capacity table. • Peak Power and Peak and Base: The turbine release is the peak flow over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Best Generator Flow table using the operating head as the lookup in the Head for Type 1 column. • LCRPowerCalc: Because this power method has no turbine release limit, a maximum outflow cannot be calculated. RiverWare issues an error message and aborts the execution of this rule. • Unregulated Spill (if an Unregulated Spill method is selected on the object): The maximum unregulated spill is determined from a table interpolation in the Unregulated Spill Table using the average pool elevation as the Pool Elevation. • Regulated Spill (if a Regulated Spill method is selected on the object): If the Regulated Spill slot is specified by the user (I, Z or R flag), the specified value is used as the maximum regulated spill. Otherwise the maximum regulated spill is determined from a table interpolation in the Regulated Spill Table using the average pool elevation in the Pool Elevation column. Note: If the MonthlySpill method is selected, the result of GetMaxOutflowGivenInflow is the value in the Maximum Controlled Release table slot. | |
Evaluation (continued) | • Bypass (if a Bypass Spill method is selected on the object): If the Bypass slot is specified by the user (I, Z or R flag), the specified value is used as the maximum bypass. Otherwise the maximum bypass is determined from a table interpolation in the Bypass Table using the average pool elevation. All of the individual outflows are then summed to calculate the maximum outflow. The individual outflows are summed to calculate the maximum outflow. | |
Mathematical Expression | ||
Comments | The Tailwater Base Value is automatically added as a dependency to the calling rule. This function will issue an error if the Time Varying Elevation Volume method is selected (see Time Varying Elevation Volume in Objects and Methods) and the specified timestep is a modification date on the table. |
Description | The maximum release of a reservoir, through outlet works or turbine release. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average inflow over the timestep |
3 | DATETIME | the timestep at which to calculate |
Evaluation | A convergence algorithm is used in this function; see Reservoir Convergence in Objects and Methods for details. The function iterates to convergence by computing the end of timestep storage and pool elevation, the average pool elevation over the timestep, and the release: • Release (if the object is a StorageReservoir): The maximum release is determined from a table interpolation in the Max Release table using the average pool elevation as the lookup in the Pool Elevation column. • Turbine Release (if the object is a LevelPowerReservoir or SlopePowerReservoir): The maximum turbine release is determined based on the selected Power method. This calculation is iterative, since the maximum outflow impacts the reservoir tailwater elevation and operating head, which affect the maximum turbine release. The selected Tailwater method is used to determine the tailwater elevation. • No Power Turbine Flow: The turbine release is determined from a table interpolation in the Max Flow Through Turbines table using the average pool elevation as the lookup in the Reservoir Elevation column. • Plant Power Coefficient: The turbine release is determined from a table interpolation in the Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Plant Efficiency Curve: The turbine release is determined from a table interpolation in the Auto Max Turbine Q table using the operating head as the lookup in the Operating Head column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Unit Generator Power: The turbine release is the sum of the maximum releases for each available turbine, as specified in the Generators Available and Limit table. Each turbine’s maximum release is determined from a table interpolation in the Full Generator Flow table using the operating head as the lookup in the appropriate unit type’s Head for Type n column. If the average pool elevation is less than the Minimum Power Elevation, the turbine release is zero. • Peak Power and Peak and Base: The turbine release is the peak flow over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Best Generator Flow table using the operating head as the lookup in the Head for Type 1 column. • Peak Power Equation with Off Peak Spill: The turbine release is the peak release over the entire timestep. This is calculated by iterating the selected Tailwater method and operating head calculation with a table interpolation in the Operating Head vs. Generator Capacity table. • LCRPowerCalc: Because this power Method has no turbine release limit, a maximum Outflow cannot be calculated. RiverWare issues an error message and aborts the execution of this rule. | |
Mathematical Expression | ||
Comments | This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots in addition to Tailwater Base Value are automatically added as dependencies to the calling rule. |
Description | The minimum required spill through unregulated and regulated spillways. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average inflow over the timestep |
3 | NUMERIC | the average release over the timestep |
4 | DATETIME | the timestep at which to calculate |
Evaluation | This function calls the getMinSpillGivenInflowRelease() function on the given reservoir object at the given timestep, and provides it with the average inflow and release over the timestep. A convergence algorithm is used in this function; see Reservoir Convergence in Objects and Methods for details. The function iterates to convergence by computing the end of timestep storage and pool elevation, the average pool elevation over the timestep, and the spill: • unregulated spill: calculated from the Unregulated Spill Table based on the average Pool Elevation. See the spill method for more details on how this is computed • regulated and bypass spills: assumed to be zero unless input by the user, set by a rule, or if if Regulated Spill includes Closed Gate Overflow; if input or set by a rule, that specified value is used; if Closed Gate Overflow is included, it is calculated based on the updated average pool elevation at each iteration (see Closed Gate Overflow in Objects and Methods for details on how Closed Gate Overflow is calculated). • outflow: sum of the calculated spill and the release specified in the function. • pool elevation: solved for by mass balance using the specified inflow and calculated outflow. | |
Mathematical Expressions | ||
Comments | This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots in addition to the previous timestep’s Pool Elevation and Storage are automatically added as dependencies to the calling rule. Since the function evaluation depends on these slots, any change to their values at the indicated timestep, may impact the function result. Caution should be used when calling this function if Regulated Spill or Bypass is an input or has been set by a rule. If the inflow and/or release given to the function, combined with the specified Regulated Spill and/or specified Bypass results in a max Regulated Spill or Bypass capacity that is less than the specified value, the function will issue an error. |
Description | The month number, base 1, in units of NONE. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime of any time within the month |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the number of the month in which the datetime is contained, is determined. This function requires that the specified datetime resolve to at least a partially specified datetime in the “Month day, year” format with the month specified. | |
Comments | As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | The month name. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime of any time within the month |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the name of the month in which the datetime is in, is determined. This function requires that the specified datetime resolve to at least a partially specified datetime in the “Month day, year” format with the month specified. | |
Comments | As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | Returns a sequence of values in a given range with a given offset. | |
Type | LIST | |
Arguments | Type | Meaning |
1 | NUMERIC | the start value |
1 | NUMERIC | the end value |
1 | NUMERIC | the offset |
Evaluation | The end value and offset are converted into the units of the start value. A list is created whose first item is the start value, the second item is the start value plus the offset, and so on, until the next value to be added to the list would not be in the range defined by the start and end value. | |
Comments | The units of all values must be compatible. If the offset is positive and the start value is greater than the end value, the return list is empty; similarly, if the offset is negative and the start value is less than the end value, the return list is empty. |
Description | Return the object with a given name. | |
Type | OBJECT | |
Arguments | Type | Meaning |
1 | STRING | the name of the object for which to search. |
Evaluation | The function returns the object with the given name, if it exists. | |
Comments | If no object with the given name exists on the global workspace, then the run is aborted with an error. |
Description | The total debt which can be paid by this object. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the object who’s debt to calculate |
2 | DATETIME | the timestep at which to calculate the debt |
Evaluation | The function loops over all supplies, on all accounts, on the given object. If a supply is an exchange payback source, the value of its debt slot at the given timestep (if known) is added to the cumulative debt of the object. | |
Mathematical Expression | ||
Comments | If the debt slot of a payback supply at the given timestep is not known, its debt is assumed to be zero. If there are no payback supplies on the given object, the total debt is zero. |
Description | Return a slot’s parent object. | |
Type | OBJECT | |
Arguments | Type | Meaning |
1 | SLOT | The slot whose object is returned. |
Comments | It is an error if the slot is not on a Simulation Object or an account (which is on an Object). |
Description | The debt at a payback source. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | the payback source supply whose debt to calculate |
2 | DATETIME | the timestep at which to calculate the debt |
Evaluation | The function begins by verifying that the string argument is an accounting supply, and that this supply is a payback source. If so, the function evaluates to the value of the payback’s debt slot at the given timestep. | |
Mathematical Expression | ||
Comments | If the string argument is not a valid supply, or the supply is not a payback source, this function aborts the run with an error. If the debt slot of the payback for which this supply is a source does not contain a value at the given timestep, the function evaluates to zero. |
Description | The index of the table slot row whose name matches a string. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the table slot in which to find a row |
2 | STRING | the name of the row to match |
Evaluation | The labels of the slot rows are compared to the string argument until a match is found. | |
Comments | Table row and column indices are zero based and have units of type [NONE]. If the specified slot is not a table slot or the specified string is not the label of a row on the slot, this function aborts the run with an error. If several rows of the table slot match the string argument, this function evaluates to the index of the topmost matching row. |
Description | Given a slot with rows indexed by date, this function returns the 0-based index corresponding to a given date. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the slot in which to find a row |
2 | DATETIME | date of the row to match |
Comments | The value -1 is returned if the given date is not within the date range of the slot. This function is applicable to the following types of slot: • Series Slots • Table Series Slots • Periodic Slot It is considered an error if the slot is not indexed by date (i.e, not one of these types). |
Description | Returns the 1-based index of the current cycle through the timesteps in the run time range, in units of NONE. | |
Type | NUMERIC | |
Arguments | none | |
Comments | Rulebased simulations can cycle through the run timesteps more than once each run (see Run Cycles in Solution Approaches). This function provides access to the current run cycle, which can be used, for example, within execution constraints to control the cycle on which a rule should execute. If called from outside of a run or when the controller is not Rulebased Simulation or Inline Rulebased Simulation and Accounting, the behavior of this function is undefined. |
Description | The number of the currently executing model run, base 1, in units of NONE. | |
Type | NUMERIC | |
Arguments | none | |
Comments | If the current run is not a Multiple Run Management run, this function evaluates to 1. If called from within a pre-MRM run rule of an iterative MRM run, this function evaluates to 1. If called from within a post-run rule of an iterative MRM, this function evaluates to the index of the run which just completed. |
Description | Given an object and a user method category name, return the name of the selected method. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | OBJECT | the simulation object |
2 | STRING | name of the user method category |
Comments | An error is issued if the object or the category name is not found. |
Description | Returns a list of all of the visible Series Slots on an object. | |
Type | LIST{SLOT} | |
Arguments | Type | Meaning |
1 | OBJECT | The object whose Series Slots are to be returned. |
Comments | If no object with the given name exists on the global workspace, then the run is aborted with an error. |
Description | Return the slot with a given name. | |
Type | SLOT | |
Arguments | Type | Meaning |
1 | STRING | the name of the slot for which to search. |
Evaluation | The function returns the slot with the given name, if it exists. | |
Comments | If no slot with the given name exists on the global workspace, then the run is aborted with an error. |
Description | Return the slot name portion of a slot’s full name. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | The slot whose name is returned. |
Comments | If the slot is a column of an aggregate series slot and if it is the first column, then the agg series slot name is returned. If the input slot is a column of an aggregate series slot other than the first column, the column label is returned. For example, assume that data.Agg is a two column aggregate series slot series slot with columns labeled • GetSlotName(data.Agg) = “Agg” • GetSlotName(data.Agg.0) = “Agg” • GetSlotName(data.Agg.zero) = “Agg” • GetSlotName(data.Agg.1) = “one” • GetSlotName(data.Agg.one) = “one” See also GetSlotNameAndCol, which behaves differently when the input slot is an aggregate series slot. |
Description | Given a slot, return the slot name portion of the full name, combined with the column label when the input slot is an aggregate series slot or a column of an aggregate series slot. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | The desired aggregate series slot. |
Comments | For example, assume that data.Agg is a two column aggregate series slot with columns labeled and • GetSlotNameAndCol(data.Agg) = “Agg.zero” • GetSlotNameAndCol(data.Agg.0) = “Agg.zero” • GetSlotNameAndCol(data.Agg.zero) = “Agg.zero” • GetSlotNameAndCol(data.Agg.1) = “Agg.one” • GetSlotNameAndCol(data.Agg.one) =”Agg.one” See also GetSlotName, which behaves differently when the input slot is an agg. series slot. |
Description | This function evaluates to a list composed of the values of a given series slot within a time range. GetSlotVals can also be used on a periodic slot, while GetSlotValsNaNToZero, cannot. | |
Type | LIST{NUMERIC} | |
Arguments | Type | Meaning |
1 | SLOT | the series (or periodic slot) whose values to get |
2 | DATETIME | start datetime |
3 | DATETIME | end datetime |
Evaluation | A list is generated by looking up each value in the given slot, beginning with the start datetime, and ending with the end datetime. All slot values in the range are returned, regardless of the slot data’s timestep resolution vis-a-vis that of the run control. | |
Mathematical Expression | ||
Comments | If the start datetime or end datetime does not match one of the slot’s values’, or if the start datetime is after the end datetime, this function aborts the run with an error. For GetSlotVals, if one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. For GetSlotValsNaNToZero, it converts any NaNs into zero. For periodic slots and GetSlotVals, the dates used are those within the range and falling on a run timestep; the column used is the first (column 0). |
Description | This function evaluates to a list composed of the values in a column of a given Agg Series Slots (or for GetSlotValsByCol, it could be a periodic slot) within a time range. | |
Type | LIST{NUMERIC} | |
Arguments | Type | Meaning |
1 | SLOT | the agg series slot (or for GetSlotValsByCol, it could be a periodic slot) whose values to get |
2 | DATETIME | start datetime |
3 | DATETIME | end datetime |
4 | NUMERIC | the column (interpreted as a 0-based integral index) |
Evaluation | A list is generated by looking up each value in the given column of the slot, beginning with the start datetime, and ending with the end datetime. All slot values in the range are returned, regardless of the slot data’s timestep resolution vis-a-vis that of the run control. | |
Mathematical Expression | ||
Comments | If the slot is an Agg Series Slot and the start datetime or end datetime does not match one of the slot’s values’, or if the start datetime is after the end datetime, this function aborts the run with an error. For GetSlotValsByCol, if one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. For GetSlotValsByColNaNToZero, it converts any NaNs into zero. For periodic slots and GetSlotValsByCol, the dates used are those within the range and falling on a run timestep. |
Description | All of the values of a table slot column between two rows. | |
Type | LIST{NUMERIC} | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values to get |
2 | NUMERIC | column |
3 | NUMERIC | start row |
4 | NUMERIC | end row |
Evaluation | A list is generated by looking up each value in the given column of the given table slot beginning with the start row, and ending with the end row (inclusive). Rows and columns are numbered beginning with zero. | |
Mathematical Expression | ||
Comments | Units are not required for row and column indices and, if provided, will be ignored. If the column, start row, or end row does not exist in the slot, or if the start row is greater than the end row, this function aborts the run with an error. For the GetTableColumnVals function, if one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. For the GetTableColumnValsSkipNaN variation of this function, these values are just omitted from the return list. |
Description | All the values of a table slot column between two columns. | |
Type | LIST{NUMERIC} | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values to get |
2 | NUMERIC | row |
3 | NUMERIC | start column |
4 | NUMERIC | end column |
Evaluation | A list is generated by looking up each value in the given row, of the given table slot beginning with the start column, and ending with the end column (inclusive). Rows and columns are numbered beginning with zero. | |
Mathematical Expression | ||
Comments | Units are not required for row and column indices and, if provided, will be ignored. If the row, start column, or end column do not exist in the slot, or if the start column is greater than the end column, this function aborts the run with an error. For the GetTableRowVals function, if one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. For the GetTableRowValsSkipNaN variation of this function, these values are just omitted from the return list. |
Description | Returns the Text Series Slot value as a STRING | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | The text series slot |
2 | DATETIME | The timestep at which to lookup |
Evaluation | Text Series Slots store text as a number encoded on the slot. See Text Series Slots in User Interface. This function returns the value of the specified Text Series Slot at the specified date as a STRING. An error will be issued if the slot is not a Text Series Slot or the DATETIME is not fully specified. If the slot does not have a value at the date then the function returns an invalid value, which will cause the calling block to terminate early. | |
Comments | See TextSlotNumericToString for a similar function. See StringToTextSlotNumeric for the opposite conversion function. |
Description | The length of a timestep, in units of "sec". | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime of the end of the timestep |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the length of the timestep within which this time is, is determined. This function requires that the specified datetime resolve to a fully specified datetime or an error will occur. | |
Comments | If the given datetime corresponds to the moment when one timestep ends and another begins, this function evaluates to the length of the timestep which is ending. As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | The number of the currently executing trace run in units of NONE. | |
Type | NUMERIC | |
Arguments | none | |
Comments | If the current run is not a Multiple Run Management run, this function evaluates to 1. If called from a rule within concurrent MRM, if the multiple run is configured to begin with trace M then GetTraceNumber() returns traces M..(M+N-1) (with the exception of using the Select Years input mode). See Input DMIs in Solution Approaches for more information. For distributed multiple runs, as described in Distributed Concurrent Runs in Solution Approaches, each multiple run is configured to begin with different trace numbers so, for example 80 traces distributed across 4 RiverWare instances, GetTraceNumber() would return 1..20, 21..40, 41..60 and 61..80 for the 4 RiverWare instances (with the exception of using the Select Years input mode). If used with the MRM Select Years input mode, GetTraceNumber() returns the selected year that identifies each trace, whether using interactive or distributed MRM. See Select Years in Solution Approaches for more information. If called from within a pre-MRM run rule of an iterative MRM run, this function evaluates to 1. If called from within a post-run rule of an iterative MRM, this function evaluates to the index of the run which just completed. |
Description | Returns the upper bound for the given series slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the slot whose bound is to be returned. |
Evaluation | ||
Comments | It is considered an error if the specified slot is not a series slot with a valid upper bound. The upper bound is specified in the slot configuration under the view menu. |
Description | Returns the upper bound for the specified column of the given aggregate series slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the agg slot whose bound is to be returned. |
2 | NUMERIC | the column index (0-based). |
Evaluation | ||
Comments | It is considered an error if the input slot is not an Agg. Series Slot with a valid upper bound for the given column. The upper bound is specified in the slot configuration under the view menu. |
Description | The year, expressed as a number in units of NONE. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the year within which this time is, is determined. This function requires that the datetime be at least partially specified with a valid year, E.g. @"Year 2010" or @"Current Year" will work. | |
Comments | As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | The year as a string. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime and the year is returned as a string. This function requires that the datetime be at least partially specified with a valid year, E.g. @"Year 2010" or @"Current Year" will work. | |
Comments | As elsewhere in RiverWare, 24:00 hours is considered to be the day which is ending, and 00:00 hours is considered to be the day which is just beginning. |
Description | Use to test the flag status of a slot at a given datetime. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | SLOT | The slot to test |
2 | DATETIME | The datetime at which to test |
3 | STRING | The flag to test. The flag is specified by string, which can be the single letter version of the flag or the full flag name: • O: Output • I: Input • R: Rules • B: Best Efficiency • M: Maximum Capacity • i: Iterative MRM • Z: DMI Input • U: Unit Values • T: Target • TB: Target-Begin • tb: Target-Begin-RiverWare • S: Surcharge Release • G: Regulation Discharge • D: Drift • m: Method • A: Account • P: Propagated |
Evaluation | The function returns whether or not the slot has the flag at that date. If the slot does not have a value at the date then the function returns that an invalid value was found (which will cause the calling block to terminate early). | |
Comments | An error is returned if the slot is not a Series Slot or if the date is not a legal timestep for that slot. Note: See IsInput, which is a more limited function used to test for the I or Z flag. Unlike the HasFlag function, IsInput returns FALSE when the slot does not have a value. |
Description | Returns whether or not the rule with a given name has successfully executed (with or without effect) during the current timestep of a rulebased simulation. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | STRING | The name of the rule. The special string "Current Rule", “This Rule”, or “Current Method” (not case sensitive; can specify with or without a space) is interpreted as a reference to the currently executing rule. |
Evaluation | This function returns TRUE if either: • The rule finished successfully (that is, at least one assignment is attempted and none fail), or • The rule finished ineffectively (that is, the rule is evaluated but the logic within the execution constraint or within the body of the rule decides no assignment is necessary or the rule attempts assignment, but priority is junior so no assignment is made). The function returns FALSE if either: • The rule has not yet fired, or • The rule has fired but terminated early (the rule encountered a NaN in a slot value). Note: As mentioned above, if the input name is “Current Rule” or “This Rule” or “Current Method” (with or without a space), then this is taken to be a reference to the currently executing rule. Using the structure NOT HasRuleFiredSuccessfully("This Rule") will cause the that rule to only execute successfully once. | |
Comments | HasRuleFiredSuccessfully behaves as follows for the various RPL Sets: • Rulebased Simulation Rules—has the rule fired in the current timestep, as described above. • Initialization Rules—has the rule fired in the current single run. • Iterative MRM Rules—has the rule fired in the current MRM iteration (single run). • Global Functions—sets the behavior for the caller • Other—not applicable; aborts with an error message. |
Description | Calculates the additional outflow necessary to meet an unmet load, if any exists. The function limits the additional release to ensure that additional downstream flooding does not occur. | |
Type | LIST { LIST { SLOT, NUMERIC, OBJECT } } | |
Arguments | Type | Meaning |
1 | STRING | the name of the computational subbasin |
Evaluation | The function does the following: 1. Prioritizes the power reservoirs in the basin according to the relative Load shortage using the equation below. If Load is unknown because the Seasonal Load Time method is selected, it is calculated. The calculated shortage then is a value less than one. The reservoirs with the highest values are first, the lowest reservoirs last. 2. Runs the selected Additional Hydropower Release method on the each power reservoir in the subbasin to calculate the proposed additional release required to meet the load within outflow constraints. 3. In order of priority, hypothetically makes the additional release, visits downstream control points until it reaches a tandem reservoir or the end of the subbasin, whichever comes first. If the release causes (additional) flooding at a control point, it reduces the release until flooding is not caused or the release becomes zero. Resulting releases are then hypothetically routed to downstream control points to make adjustments to their available space hydrographs. A control point’s available space hydrograph (in units of flow projected into the future based on the routing coefficients on the control point) is calculated as: Inflow includes the value of the Inflow slot (at the time of the last dispatch) and the additional inflow resulting from the hypothetical additional releases from upstream reservoirs. It also contains the proposed flood control release hydrograph from the last pass of the flood control method. Note: If the Releases Not Constrained by Flooding method is selected in the Hydropower Flooding Exception category on the control point (see Releases Not Constrained by Flooding in Objects and Methods), the control point is ignored, i.e. flooding is allowed at that control point. Once all power reservoirs have been visited (in priority order), the HydropowerRelease function returns to the calling rule. For each reservoir in the subbasin, three triplets may be returned: • Additional Power Release: This is the additional release to meet the load. If the proposed release is positive, but the additional power release was constrained to zero, the triplet {reservoir.Additional Power Release, 0.0, reservoir} will be returned. If the proposed release is zero, the Additional Power Release (of zero) triplet will not be returned. • Outflow: If the new Outflow is the same as the existing Outflow, no Outflow triplet is returned because the value of the Outflow slot will not change as a direct result of this rule. Otherwise the value for outflow is the existing Outflow plus the additional power release. • Load: the Load triplet is only returned if the Seasonal Load Time method (see Seasonal Load Time in Objects and Methods) is selected on the reservoir. The calling rule is expected to make the assignments of the values to the slots. | |
Comments | This function is dependent on having executed the predefined function FloodControl() on a computational subbasin using the Operating Level Balancing method. This flood control method operation sets up the network topology and necessary data. HydropowerRelease requires that the reservoirs in the subbasin have already dispatched and have valid values in the Regulation Discharge, Outflow, Energy, and Load slots. See HydropowerRelease Function—Detailed Description of Logic in USACE‑SWD Modeling Techniques for details on using this function for USACE-SWD. |
Description | Given a control slot and a limit slot, limit date/time, and limit 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 limit slot’s maximum value in this range 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 limit slot exist as well as all other objects necessary to compute the limit 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 values 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 limit slot, the slot whose value you would like to attain a certain value. |
7 | DATETIME | The end limit date/time, the end of the time range during which you are concerned with the limit slot’s value. |
8 | NUMERIC | The limit value, the value which you would like the limit slot to achieve but not exceed during the limiting time range. |
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 maximum limit slot value which differs by no more than the tolerance from the desired limit 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 | 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 limit slot’s value is a monotonic function of the control slot’s value. See Hypothetical Simulations; all comments mentioned there apply here as well. |
Description | Given a control slot and a limit slot, limit end date/time, and limit 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, end limit date], then the limit slot’s maximum value in this range 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. A four-item list is returned. The first item in the list is a boolean TRUE value if a satisfying control slot value was found, FALSE otherwise. If the first item is TRUE, then the second item is the satisfying control slot value, otherwise this value is as close as the function could get to finding such a value. The third item is a list of the control slot values used in the solution. These values will all be the same as the second item, except if some of the values were constrained due to physical limitations. The fourth item is a list of the limit slot values that correspond to the control slot values given in the previous list. Note: This function is similar to HypLimitSim. The only difference is that HypLimitSim fails if it can not find a satisfying control slot value, whereas this function does not fail, rather it still returns a value, along with the indication that this value does not achieve the limit and the additional information discussed above. | |
Type | LIST {BOOLEAN, NUMERIC, LIST, LIST} | |
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 limit slot exist as well as all other objects necessary to compute the limit 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 values 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 limit slot, the slot whose value you would like to attain a certain value. |
7 | DATETIME | The end limit date/time, the end of the time range during which you are concerned with the limit slot’s value. |
8 | NUMERIC | The limit value, the value which you would like the limit slot to achieve but not exceed during the limiting time range. |
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 maximum limit slot value which differs by no more than the tolerance from the desired limit 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 | There are two conditions in which that function will fail but this function will return false as the first item in the return list: • The minimum and maximum control slot values lead to a range of limit values which does not include the input limit value. In this case the value returned is the minimum or maximum control slot value, which ever leads to a limit slot value closest to the input limit value. • The tolerance is not achieved within the iteration limit. In this case, the value returned is the current best guess. If Hypothetical Simulation diagnostics are turned on, then if HypLimitSimWithStatus can not find a satisfying control value, a diagnostic will be posted describing why it failed to do so. | |
Comments | See also documentation for HypLimitSim for more details; the differences between these two functions are how problems are dealt with, this function is more flexible (as described in the Evaluation section). See Hypothetical Simulations; all comments mentioned there apply here as well. |
Description | Hypothetically simulate a portion of the workspace with user input values and return requested result values. | |
Type | LIST {NUMERIC} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name over which to perform the hypothetical simulation. 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 | LIST { LIST { SLOT, NUMERIC, DATETIME } } | Fixed values 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. |
3 | LIST { LIST { SLOT, DATETIME } } | Outputs to get back from the simulation - each output must specify the slot and the timestep from which to return a value |
4 | 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 | When function is executed, a hypothetical simulation is initiated where the fixed values are set on the specified slots, the portion of the workspace specified by the Subbasin is simulated, and the values of the output slots are returned as a list. | |
Comments | This simulation is hypothetical in that none of the actual values on any objects in the workspace will be modified by hypothetical simulation within a rule. HypSim does not support accounting or optimization functionality. Note: HypSim was originally named HypotheticalSimulation. See Hypothetical Simulations; all comments mentioned there apply here as well. |
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 values 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 | In general, the function 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 (100-200 cfs) implied by the input control slot minimum and maximum values. Mathematically, this is the assumption that the target slot’s value is an always a monotonic function of the control slot’s value. There is an exception that relaxes the constraint that the control slot values must lead to target values that bound the solution. If either the minimum or maximum control slot values fails to lead to a valid target value because the simulation fails to dispatch successfully with that control value, the search algorithm will effectively treat that bound as infinite. The search will then continue until either the interval becomes bounded and a satisfying control value is found, or the maximum iteration limit is reached. Note: HypTargetSim was originally named HypotheticalTargetSimulation. See Hypothetical Simulations; all comments mentioned there apply here as well. |
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. A three-item list is returned. The first item in the list is a boolean TRUE value if a satisfying control slot value was found, FALSE otherwise. If the first item is TRUE, then the second item is the satisfying control slot value, otherwise this value is as close as the function could get to finding such a value. The third item is a list of the control slot values used in the solution. These values will all be the same as the second item, except if some of the values were constrained due to physical limitations. Note: This function is similar to HypTargetSim. The only difference is that HypTargetSim fails if it can not find a satisfying control slot value, whereas this function does not fail, rather it still returns a value, along with the indication that this value does not achieve the target and the list of control slot values. | |
Type | LIST {BOOLEAN, NUMERIC, LIST} | |
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 values 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 | There are two conditions in which that function will fail but this function will return false as the first item in the return list: • The minimum and maximum control slot values lead to a range of target values which does not include the input target value. In this case the value returned is the minimum or maximum control slot value, which ever leads to a target value closest to the input target value. • The tolerance is not achieved within the iteration limit. In this case, the value returned is the current best guess. If Hypothetical Simulation diagnostics are turned on, then if HypTargetSimWithStatus can not find a satisfying control value, a diagnostic will be posted describing why it failed to do so. | |
Comments | See also documentation for HypTargetSim for more details; the differences between these two functions are how problems are dealt with, this function is more flexible (as described in the Evaluation section). See Hypothetical Simulations; all comments mentioned there apply here as well. |
Description | Returns a string representation of a numeric value interpreted as an integer. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | NUMERIC | a value |
Evaluation | Given a numeric value, IntegerToString returns a string representation of that value rounded to the nearest integer and with the units removed. | |
Comments | This function uses the RPL units of the specified NUMERIC. In the example, below, the RPL units are cfs as it is a literal value. But, if you reference a slot value, it will return the string using the relevant RPL units, which are often, but not always, internal units, cms, m, and so on. For more flexibility with units, see IntegerWithUnitsToString. |
Description | Returns a string representation of a numeric value interpreted as an integer after the specified value is converted to the given units. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | NUMERIC | a value to convert and truncate |
2 | NUMERIC | a value whose units are those to which the first value should be converted |
Evaluation | Given a numeric value, IntegerWithUnitsToString converts that value to the display units of a second input value, and then returns a string representation of the converted value with the fractional part of the value and the units removed. | |
Comments | It is an error if the two numeric input values do not have compatible units (i.e., are not of the same unit type). For the second argument, only its display units are involved in the computation; the scalar portion of this value is ignored. This value should typically be specified as a literal value, not the result of computation or lookup on a slot, so that the units of this value will be known with certainty. |
Description | Returns true if and only if the current controller is Optimization. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
Evaluation | ||
Comments |
Description | Returns true if and only if the current controller is Rulebased Simulation (RBS) or Inline Rulebased Simulation and Accounting. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
Evaluation | ||
Comments |
Description | Returns true if and only if the current controller is Simulation or Inline Simulation and Accounting. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
Evaluation | ||
Comments |
Description | Returns true if and only if the input value (rounded down) is even. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | NUMERIC | a value |
2 | NUMERIC | the units in which to determine evenness. |
Evaluation | Converts the value into the desired units, rounds down to the nearest integer, then returns whether or not this value is even. | |
Comments |
Description | The input status of a slot at a given datetime. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | SLOT | the series slot |
2 | DATETIME | the datetime |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. Then, the flag of the value in the series slot at that time is compared with the user input flags. If the flag is an I or Z, true is returned. An “i” is considered a user input within an iterative MRM run, but not a user input within a single run or outside of a run. The R flag is not considered an input. Also, IsInput returns false if the slot[datetime] is NaN. But, this function does NOT terminate the executing rule if the value at the given datetime is a NaN. See also HasFlag, which is a similar but more general function. |
Description | Returns true if and only if the input value (rounded down) is odd. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | NUMERIC | a value |
2 | NUMERIC | the units in which to determine oddness. |
Evaluation | Converts the value into the desired units, rounds down to the nearest integer, then returns whether or not this value is odd. | |
Comments |
Description | Whether or not a given datetime is in a leap year (containing 366 days instead of 365). | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | DATETIME | the datetime |
Evaluation | The datetime argument; which may be specified symbolically, is converted into an actual datetime. If the date of this year is a leap year, true is returned, otherwise false. | |
Comments |
Description | This function evaluates to a list of linked downstream objects that are between two specified objects, inclusive. | |
Type | LIST {OBJECT} | |
Arguments | Type | Meaning |
1 | OBJECT | The upstream object at which to start the search |
2 | OBJECT | The downstream object at which to finish the search |
Evaluation | ListDownstreamObjects searches links downstream from the first object until it finds the second object. It returns a list of all objects that it finds, inclusive of the specified objects. | |
Comments | Notes / Limitations to this function: • To find the next downstream object, the function traverses links from main channel outflow slots. These slots typically include Outflows from each object; the table below shows the main channel outflow slot for each object • If a Bifurcation or Pipe Junction has more than one outflow link, an error is issued. • Object 1 must be upstream of Object 2. That is, if Object 2 is not found in the search, an error is issued. • For Aggregate Reaches and Agg Distribution canals, only the elements are returned, not the aggregate (but each element includes the agg name, E.g. %“AggReach:Element1”). |
Object Type | Main channel outflow slots |
---|---|
Agg Diversion Site | Total Outflow |
Agg Distribution Canal | Total Return Flow |
Agg Reach Confluence Control Point Distribution Canal Groundwater Inline Power Inline Pump Pipeline Reach Reservoir | Outflow |
Bifurcation | Outflow1, Outflow2 |
Diversion Object, | NONE |
Pipe Junction | Flow 1, Flow 2 |
Stream Gage | Gage Outflow |
Water User | NONE |
Description | The slots in the given Slot Set. | |
Type | LIST {SLOTS} | |
Arguments | Type | Meaning |
1 | STRING | The name of a Slot Set defined in the model. |
Evaluation | The Slot Sets in the model are searched for a match to the given string. Then, a list is generated from the member slots of that set. | |
Comments | Both static and dynamic Slot Sets may be referenced. Dynamic Slot Sets are resolved when the function is called. Member slots are listed in the order in which they appear in the Slot Set Manager dialog (from the Workspace menu, select Workspace, then Slots, then Slot Set Management). If there is no Slot Set with the given name in the model, this function aborts the run with an error. |
Description | The objects in the given subbasin. | |
Type | LIST {OBJECT} | |
Arguments | Type | Meaning |
1 | STRING | the name of the subbasin |
Evaluation | The list of subbasins in the model is searched for a match to the given string. Then, a list is generated from the member objects of that subbasin. | |
Comments | Both predefined and user defined subbasins may be referenced. Member objects are listed in the order in which they appear in the Edit Subbasins dialog. If there is no subbasin with the given name in the model, this function aborts the run with an error. |
Description | The natural logarithm of a number. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the value |
2 | NUMERIC | the units in which to compute the logarithm |
Evaluation | Converts the value into the desired units, and then computes the natural logarithm of this value. The solution is this number in the units of the converted value. | |
Comments | The natural logarithm may only be evaluated for values greater than zero. This function aborts the run with an error, if it is evaluated with a value less than or equal to zero. The two arguments must have compatible units, otherwise the run is aborted with an error. This function does not use the scalar portion of the units argument. |
Description | The base10 logarithm of a number. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the value |
2 | NUMERIC | the units in which to compute the logarithm |
Evaluation | Converts the value into the desired units, and then computes the base 10 logarithm of this value. The solution is this number in the units of the converted value. | |
Comments | The base10 logarithm may only be evaluated for values greater than zero. This function aborts the run with an error, if it is evaluated with a value less than or equal to zero. The two arguments must have compatible units, otherwise the run is aborted with an error. This function does not use the scalar portion of the units argument. |
Description | The greater value. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the first value |
2 | NUMERIC | the second value |
Evaluation | The two numbers are converted to a common unit and compared. The greater of the two numbers is returned. | |
Comments | If the values are of a different unit type, this function aborts the run with an error. |
Description | The greatest value. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | the list of values |
Evaluation | The numbers in the input list are converted to a common unit and compared. The greatest number is returned. | |
Comments | If the list is empty, one of the items is not numeric, or they do not all have compatible types, this function aborts the run with an error. |
Description | The largest of several object’s values, each of which is the result of aggregating a slot’s values over time. | |
Type | LIST {OBJECT, NUMERIC, DATETIME} | |
Arguments | Type | Meaning |
1 | STRING | subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start date |
7 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, each slot’s values are aggregated according to the aggregation function argument over the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the largest of the objects’ aggregated slot values is determined. This value is returned as the first value in a list. If there is a date/time associated with this value, it is returned as the second value in the list. This will be the case if the MIN or MAX aggregation function is specified for the fifth argument. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | The largest of several object’s slot values for each timestep in a range. | |
Type | LIST{LIST{DATETIME, NUMERIC, OBJECT}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start date |
6 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values whose maximum to find are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the object’s slot values are compared, yielding one maximum value for each timestep in the time range of the datetime arguments. The function returns a list of two items, where the first and second items of the inner lists are the datetime and the largest value, respectively. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Largest over a timeseries of values, each of which is the result of aggregating several objects’ slot values. | |
Type | LIST {DATETIME, NUMERIC, OBJECT} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start datetime |
7 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the objects’ slot values are aggregated according to the aggregation function argument for each timestep in the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the largest value in the timeseries of object aggregated slot values is determined. This value is returned as the second value in a list. The first item is the date/time associated with this value. If there is an object associated with the value, it is returned as the third value in the list. This will be the case if the MIN or MAX aggregation function is specified for the third argument. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Largest value in a slot over a time range, for each object in a subbasin. | |
Type | LIST {LIST {OBJECT, NUMERIC, DATETIME}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start datetime |
6 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. For each object, the largest slot value over every timestep in the range of the datetime arguments is determined. Any values which do not satisfy the aggregation filter argument are ignored during the calculation. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are first multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, this function also aborts RiverWare with an error. |
Description | Computes the Low Flow Release from each reservoir so that the low flow requirement at the specified control point is met. | |
Type | LIST{ LIST{Slot, Value, Object}} | |
Arguments | Type | Meaning |
1 | STRING | The subbasin used to perform the calculations |
2 | OBJECT | The control point whose low flow requirement needs to be met |
Evaluation | Returns a LIST of LISTs with the inner list containing a triplet. Each triplet is a slot (at index zero), the value to set on that slot (at index one), and the object of the slot (at index two). The function returns each Low Flow Release slot and the value to set on that slot. Also, the Outflow slot for each reservoir is returned with the new outflow value (Outflow plus Low Flow Release). The function computes the release for each contributing reservoir. The contributing reservoirs are specified in a slot called Low Flow Reservoirs on the Control Point. The rule executes as follows: First, the specified low flow reservoirs are sorted in descending order according to Operating Level. Reservoirs that are below the bottom of the conservation pool are excluded. Next, each reservoir (beginning with the most full reservoir) makes a release until the requirement (in the Computed Low Flow Requirement slot on the Control Point) is met, the Maximum Low Flow Delivery Rate (on the reservoir) is met, or the reservoir reaches the bottom of the conservation pool (whichever value is lowest). In addition, as each reservoir is making releases, the function calls the getMaxOutflowGivenInflow function to calculate the maximum flow that can be released from the reservoir. If the calculated low flow release is greater than this max, the release is reduced to the max. The Low Flow Release and updated Outflow value (limited by max constraints) for each reservoir is returned by the RPL function to the calling rule. The rule sets these slots using the syntax given below. After the rule executes, the system solves and routes the values downstream. Note: Each time this rule function is evaluated, it adds to the existing value in the Low Flow Release slot on reservoir objects. This is because each reservoir may contribute to the low flow requirement of more than one control point. So if the user wants to recompute all the low flow releases, they must all be reset to zero. In other words, this function is designed to execute once for each control point, adding to the Low Flow Releases made for previous control points. | |
Comments | A rule needs to be created for each Control Point that has a low flow requirement. Each rule will call the MeetLowFlowRequirement function for the specified Control Point. After simulating the new releases, the next rule will be executed for the next low flow Control Point. The specified subbasin needs to include all the relevant objects (reservoirs, control points). Within the function execution, no routing of low flow releases is considered between the reservoir and the control point. But, during the simulation after the rule finishes, routing is considered. As a result, the water released may not make it to the control point on a single timestep. Each reservoir must have the Conservation and Flood Pools method selected in the Operating Levels category. The reservoirs specified in the Low Flow Reservoirs slot on each control point MUST be upstream of the control point. RiverWare does not check this and the results will be incorrect if the user does not enforce this. Also, no tandem operations are considered by this RPL function, i.e. the function assumes that reservoir releases can travel directly to a control point without passing through another reservoir. See Low-flow Releases in USACE‑SWD Modeling Techniques for details on using this function for USACE-SWD. |
Description | Returns the RiverWare process’s current virtual memory usage, in kilobytes (KB). | |
Type | NUMERIC | |
Arguments | Type | Meaning |
Evaluation | ||
Comments | This function can be useful for performance analysis, for example to identify which rules in a rulebased simulation use the most memory. |
Description | The lesser value. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the first value |
2 | NUMERIC | the second value |
Evaluation | The two numbers are converted to a common unit and compared. The lesser of the two numbers is returned. | |
Comments | If the values are of a different unit type, this function aborts the run with an error. |
Description | The smallest value. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | the list of values |
Evaluation | The numbers in the input list are converted to a common unit and compared. The smallest number is returned. | |
Comments | If the list is empty, one of the items is not numeric, or they do not all have compatible types, this function aborts the run with an error. |
Description | The smallest of several object’s values, each of which is the result of aggregating a slot’s values over time. | |
Type | LIST{OBJECT, NUMERIC, DATETIME} | |
Arguments | Type | Meaning |
1 | STRING | subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start date |
7 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, each slot’s values are aggregated according to the aggregation function argument over the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the smallest of the objects’ aggregated slot values is determined. This value is returned as the first value in a list. If there is a date/time associated with this value, it is returned as the second value in the list. This will be the case if the MIN or MAX aggregation function is specified for the third argument. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | The smallest of several object’s slot values, for each timestep in a range. | |
Type | LIST{LIST{DATETIME, NUMERIC, OBJECT}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start date |
6 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values whose maximum to find are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the object’s slot values are compared, yielding one minimum value for each timestep in the time range of the datetime arguments. The function returns a list of two items, where the first and second items of the inner lists are the datetime and the smallest value, respectively. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Smallest over a timeseries of values, each of which is the result of aggregating several objects’ slot values. | |
Type | LIST {DATETIME, NUMERIC, OBJECT} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start datetime |
7 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the objects’ slot values are aggregated according to the aggregation function argument for each timestep in the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the smallest value in the timeseries of object aggregated slot values is determined. This value is returned as the second value in a list. The first item is the date/time associated with this value. If there is an object associated with the value, it is returned as the third value in the list. This will be the case if the MIN or MAX aggregation function is specified for the third argument. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Smallest value in a slot over a time range, for each object in a subbasin. | |
Type | LIST {LIST {OBJECT, NUMERIC, DATETIME}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start datetime |
6 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. For each object, the smallest slot value over every timestep in the range of the datetime arguments is determined. Any values which do not satisfy the aggregation filter argument are ignored during the calculation. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are first multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, this function also aborts RiverWare with an error. |
Description | Integer modulus of two numbers. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the numerator |
2 | NUMERIC | the units to which to convert the numerator |
3 | NUMERIC | the denominator |
4 | NUMERIC | the units to which to convert the denominator |
Evaluation | Converts numerator and denominator into the specified units, then returns the integral modulus of the converted values, where integral modulus of x and y returns the integral remainder after integral division of x and y, which can be defined as follows: | |
Comments | If the denominator is equal to zero, the run is aborted with an error. Each of the units arguments must have units which are compatible with the value they are associated with, otherwise the run is aborted with an error. This function does not use the scalar portion of either of the units arguments. |
Description | Minimum diversion required to meet all Water Users’ requests. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the aggregate diversion site or diversion object |
2 | DATETIME | the timestep |
Evaluation | If the object is an Aggregate Diversion Site and is linked with the No Structure or Lumped Structure, this function evaluates to the current value of the Total Diversion Requested slot. If the object is an Aggregate Diversion Site and if the Aggregate Diversion Site is linked with the Sequential Structure, the function sets a total diversion requirement equal to the topmost Water User’s Diversion Requested and then loops over the remaining Water Users. The water available at each element is calculated based on the upstream elements’ diversions and their return flows. If this water is enough to satisfy the Water User’s Diversion Requested, the total diversion requirement is not modified. If this water is not enough to satisfy the Water User’s Diversion Requested, the total diversion requirement is increased to satisfy this Water User. If the object is a diversion object, this function evaluates to the current value of the Diversion Request slot. Note: The diversion object cannot use the Percent of Available method. | |
Mathematical Expression | For sequential agg diversion sites: | |
Comments | This function exits with an early termination if any of the required data used to solve the diversion is unknown. The required data is the same as that needed for the objects to fully dispatch, except Total/Incoming Available Water, which need not be known. For sequentially linked Agg Diversion Sites, the function takes into account whether Return Flow, or Surface Return Flow are linked to another object, or unlinked and available to the next Water User in the diversion. |
Description | Minimum Inflow required to meet all diversion requests and minimum flows. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | the subbasin’s Reach and Confluence objects in downstream order |
2 | DATETIME | the timestep at which to calculate |
Evaluation | The subbasin diversion requirement is originally set to zero. Each of the objects in the subbasin list is processed in the downstream order in which they are provided. If the object is a Reach, the following calculations are performed: • If an Aggregate Diversion Site or Diversion Object is linked to the Reach’s Diversion slot, the NetNonShortDiversionRequirement function is executed on the diversion. If a water user is linked, then the Water User’s Diversion Request is used. This step determines the diversion request from the Reach. • The Reach’s minimum flow just below the diversion point is determined from the Reach’s Minimum Diversion Bypass slot. If this slot does not exist because of the selected User Method in the Min Diversion Bypass category, the minimum flow requirement is zero. • If nothing is linked to the Diversion slot, but a value exists in the slot, this value is assumed to be the diversion requirement for this reach. In this case, there is no minimum flow requirement below the diversion point. • The subbasin diversion requirement is recalculated as the greater of the previous subbasin diversion requirement or the Reach diversion requirement plus the minimum flow requirement plus any cumulative upstream diversions minus any cumulative upstream return flows minus any cumulative upstream tributary inflows. • Any Local Inflow to the Reach is added to the cumulative tributary inflows. • If the Return Flow slot has a valid value, it is added to the cumulative return flows. If the Return Flow slot does not have a valid value, but a Water User or an Aggregate Diversion Site object is linked to it, the return flow is estimated. Return flow is estimated by subtracting the object’s (Total) Depletion Requested from its (Total) Diversion Requested. The estimated return flow is then added to the cumulative return flows. If the object is a Confluence, the Inflow1 and Inflow2 slots are checked to determine which is the main subbasin flow, and which is the tributary inflow. The objects linked to the inflow slots are checked against the last Reach object to be processed. When a match is found, the other Inflow, if valid, is added to the cumulative tributary inflows. The loop continues until all objects in the list have been processed. The largest subbasin diversion requirement calculated at any diversion point is the total subbasin diversion requirement. | |
Mathematical Expression | ||
Comments | This function exits its calling rule with an early termination if any of the required data used to solve the diversions are unknown. The required data is the same as that needed for the NetNonShortDiversionRequirement predefined function for each Aggregate Diversion Site along the subbasin. This function aborts the run with an error if an object other than a Reach or Confluence is in the subbasin list. One of the Confluence Inflows must be linked to the previous Reach object upstream, or an Aggregate Reach which contains the previous Reach object upstream as its last element. If this condition is not met, the Confluence cannot determine which slot is the tributary inflow and the function aborts the run with an error. All subbasin diversion requirement calculations are performed at the given timestep. Subbasin diversion requirement will not be correct if there are lags in Reaches. This predefined function is recommended for use in long timestep models or for subbasins where there is no lag between top and bottom. |
Description | Resolves a partially specified date/time into the next (with respect to a reference date) date/time which matches the specified fields. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a reference date/time. |
2 | DATETIME | a partially specified date/time. |
Evaluation | The unspecified fields with a coarser resolution are resolved into the future with respect to the reference date. If there are finer resolution fields, they are filled in with default values (e.g., time with 24:00, day of the month with the last day of the month). Note: If the partial date can be resolved into the current date, it is. See the Syntax Examples below. | |
Comments | If the reference date/time is not fully specified or if the partial date/time is, then the run is aborted with an error. |
Description | Given a numeric encoding of a date/time, returns the corresponding date/time value. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | NUMERIC | The numeric encoding of a date/time value. |
Comments | Slots representing date/time values have unit type DateTime. Internally these values are represented as numbers although the interface displays them as date/times. Looking up a value on such a slot will retrieve the numeric encoding, this function converts that number to a date/time value as required to treat it as a date within policy. If the unit for the slot corresponds to a partially specified date/time format, then the result will a partially specified date/time value. |
Description | Given a numeric value, NumberToYear returns a DATETIME with only the year. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | NUMERIC | A number. |
Evaluation | NumberToYear truncates the specified numeric value and returns the value as a year DATETIME. |
Description | Returns the number of columns/rows in a table slot or periodic slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | a table or periodic slot. |
Comments | If the slot is not a table or periodic slot, the run is aborted with an error. |
Description | This function finds a list of objects, accounts and supplies that match the given arguments. It returns a list of triplets{ OBJECT object, STRING account, STRING supply }, where the object^account is served by the supply, and the object is in the given subbasin (argument 1), the supply has the given release type and destination type (arguments 3 and 4), and the supplying account (upstream end of the supply in the returned triplet) has the given water type (argument 2). | |
Type | LIST ( LIST { OBJECT, STRING, STRING } ) | |
Arguments | Type | Meaning |
1 | STRING | The name of the subbasin in which to search. |
2 | STRING | The water type of the upstream end of the supplies returned. The string ALL means that any water type will satisfy this filter. The string NONE means that only supplying accounts lacking a water type will satisfy this filter. |
3 | STRING | The release type of the supply returned. The string ALL means that any release type will satisfy this filter. The string NONE means that only supplies lacking a release type will satisfy this filter. |
4 | STRING | The destination type of the supplies returned. The string ALL means that any destination type will satisfy this filter. The string NONE means that only supplies lacking a destination type will satisfy this filter. |
Comments | This function is meant to be used in conjunction with the water rights solvers (SolveWaterRights()). It looks for supplies that are appropriation points for legal water accounts as defined for the water rights solver. In the solver, these supplies are identified by the water type of the account at the point of appropriation. Usually these supplies directly supply the object^account in the returned triplets. The one exception to this is when the supply serves an offstream reservoir. In this case, the offstream reservoir is supplied through a diversion object, and so a passthrough account on the diversion object sits between the point of diversion and the receiving object^account. This is the only case in which any indirection is detected, and the function looks two hops upstream to check the supplying account’s water type. In all other cases, the function looks only one hop upstream. |
Description | For the specified Object and a string representing an attribute, return the value for that particular Object, as a string | |
Type | STRING | |
Arguments | Type | Meaning |
1 | OBJECT | The Object |
2 | STRING | The name of the Attribute |
Evaluation | ||
Comments | If the attribute is not found on the object, an error is issued. If the object or attribute is not found in the model, an error will be issued. |
Description | Return whether the particular Object has the specified Attribute Value. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | OBJECT | The Object |
2 | STRING | The name of the Attribute |
3 | STRING | The Value of the Attribute. |
Evaluation | When evaluated, the function looks at the particular object and checks to see if it has the given Attribute and Value. | |
Comments | If the attribute or value is not found on the object, FALSE is returned. If the object, attribute or value is not found in the model, an error will be issued. |
Description | Returns the objective value from the last successful solution to the Optimization problem. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
Comments | If there is no solution information available (e.g., if an Optimization run has not occurred), the run is aborted with an error diagnostic. |
Description | Returns a list of the objects that contain an account with the given name and account type. | |
Type | LIST{OBJECT} | |
Arguments | Type | Meaning |
1 | STRING | The name of the account. |
2 | STRING | The name of the account type, e.g, “Storage”. The string ALL for account type designates all account types. |
Comments |
Description | Given a string representing an attribute and a string representing a value, return a list of all of the objects that have that value for the attribute | |
Type | LIST {OBJECT, OJBECT, ...} | |
Arguments | Type | Meaning |
1 | STRING | The name of the Attribute |
2 | STRING | The Value of the that Attribute. |
Evaluation | When evaluated, the function looks throughout the model and finds all objects that have the Attribute Value pair.The set of matching objects is returned in a list. | |
Comments | If the attribute or value is not found in the model, an error will be issued. |
Description | Returns a list of the objects that have an account with given water type and account type. | |
Type | LIST{OBJECTS} | |
Arguments | Type | Meaning |
1 | STRING | The water type. The string ALL for water type designates all water types, and the string NONE designates the default water type. |
2 | STRING | The name of the account type, e.g, "Storage". The string ALL for account type designates all account types. |
Comments |
Description | Returns the date/time which is some number of timesteps added to or subtracted from an input date/time. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a date/time. |
2 | NUMERIC | the number of timesteps to add (a negative number will subtract). Should have units of NONE. |
3 | STRING | a timestep specification. This specification includes an integer which can be positive or negative. Examples include “1 Months”, “2 hours”. Case is not important in this string. The valid timestep units are “Minutes,” “Hours,” “Days,” “Weeks,” “Months,” “Years.” |
Evaluation | Adds the given timestep, to the given date, to the given number of times, then returns the result. | |
Comments | If the second argument has units other than NONE, or if the third argument is not recognized as a timestep, then the run is aborted with an error. Tip: Although you can put any integral amount within the timestep specification, if you make this integer 1, then the second argument allows you to vary the increment (second argument) at the time of rule execution. See Datetime Math in RiverWare Policy Language (RPL) for details on datetime math. |
Description | Find the maximum turbine release at a given reservoir operating head. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | power reservoir object |
2 | NUMERIC | operating head |
3 | DATETIME | datetime context for unit conversions |
Evaluation | The operating head argument is looked up in the Operating Head column, of the Max Turbine Q table, of the power reservoir object argument, to determine the Turbine Capacity. If the exact operating head is not in the table, the lookup performs a linear interpolation between the two nearest bounding operating heads and their corresponding turbine capacities. | |
Mathematical Expression | ||
Comments | If the object is not a power reservoir, the function aborts the run with an error. If the Power Reservoir does not have a Max Turbine Q table, Plant Power Coefficient must be selected as the Power selected method, or this function exits the rule with an early termination. |
Description | Returns a physical constraint’s dual price as calculated during the most recent Optimization solution. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | Desired object |
2 | STRING | Physical constraint name |
3 | DATETIME | Date at which to return the value |
Evaluation | This function returns the dual price calculated during the last optimization run for a physical constraint, where the constraint is specified by three inputs: a simulation object, the name of a physical constraint, and a date. | |
Comments | If there is no physical constraint corresponding to the inputs, the run is aborted. If the physical constraint exists, but has no dual price, then an invalid value is returned. The interpretation of the dual price is the change in the objective function value per one unit increase in teh constraint right hand side. The units are objective function units / constraint units Currently the only physical constraint supported is Mass Balance. |
Description | Returns a slot variable’s reduced cost as calculated during the most recent Optimization solution. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Desired Slot |
2 | DATETIME | Date at which to return the value |
Evaluation | This function returns the reduced cost for the given slot at the given timestep as part of the most recent optimization problem solution of the last run using the Optimization controller. | |
Comments | If there is no optimum reduced cost for the slot at that timestep, an invalid value is returned. This function supports the return of reduced costs which are associated with decision variables, that is to variables which are contained in the problem and are not replaced with linear combinations or substitutions of other variables. If called for slots whose variables are not decision variables, an error message will be posted, and the run will be aborted. |
Description | Returns a slot variable’s reduced cost as calculated during the most recent Optimization solution for a variable associated with a particular column of an agg series slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Specified Agg Series Slot |
2 | NUMERIC | Column index (0-based) |
3 | DATETIME | Date at which to return the value |
Evaluation | This function returns the reduced cost for the given slot and column at the given timestep as part of the most recent optimization problem solution of the last run using the Optimization controller. | |
Comments | If there is no reduced cost for the slot and column at that timestep, an invalid value is returned. This function supports the return of reduced values which are associated with decision variables, that is, to variables which are contained in the problem and are not replaced with linear combinations or substitutions of other variables. If called for slots whose variables are not decision variables, an error message will be posted, and the run will be aborted. |
Description | Returns a slot variable’s optimal value as calculated during the most recent Optimization solution. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Desired Slot |
2 | DATETIME | Date at which to return the value |
Evaluation | This function returns the optimal value for the given slot at the given timestep as part of the most recent optimization problem solution of the last run using the Optimization controller. See Create a Post-optimization Ruleset in Optimization for an example of the typical use of this function. | |
Comments | If there is no optimum value for the slot at that timestep, but there is a slot cache value, then the cached value is returned. If neither value is valid, an invalid value is returned. In the future the return of the cached value is likely to be eliminated. This function supports the return of slot values which correspond to decision variables, that is to variables which are contained in the problem and are not replaced with linear combinations of other variables. If called for slots whose variables are not decision variables, an error message will be posted and the run will be aborted. The OptValuePiecewise function allows access to the piecewise approximation of non-decision variables for which the piecewise approximation technique is applicable. |
Description | Returns a slot variable’s optimal value as calculated during the most recent Optimization solution for a variable associated with a particular column of an agg series slot. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Specified Agg Series Slot |
2 | NUMERIC | Column index (0-based) |
3 | DATETIME | Date at which to return the value |
Evaluation | This function returns the optimal value for the given slot and column at the given timestep as part of the most recent optimization problem solution of the last run using the Optimization controller. See Create a Post-optimization Ruleset in Optimization for an example of the typical use of this function. | |
Comments | If there is no optimum value for the slot and column at that timestep, but there is a slot cache value, then the cached value is returned. If neither value is valid, an invalid value is returned. In the future the return of the cached value is likely to be eliminated. This function supports the return of slot values which correspond to decision variables, that is, to variables which are contained in the problem and are not replaced with linear combinations of other variables. If called for slots whose variables are not decision variables, an error message will be posted and the run will be aborted. |
Description | Returns a slot variable’s piecewise approximation value as calculated during the most recent Optimization solution. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Specified Slot |
2 | DATETIME | Date at which to return the value |
Evaluation | Given a Series Slot and a date, this function returns the piecewise approximation of the slot at the given date, as computed during the most recent problem solution of the last optimization run. | |
Comments | The function will fail if the variables associated with the slot are not approximated (i.e., are decision variables or are replaced by a linear combination of other variables). If there is no approximation value available, perhaps because the quantity was not referenced in the optimization policy or there has been not been a successful optimization run, the function returns an invalid value. |
Description | This function returns the pth percentile from a list of values. In other words, it returns the value with a given percentile from a distribution. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | A list of NUMERIC values representing the distribution. |
2 | NUMERIC | The probability p for which you wish the corresponding value. Note: p should be between 0 and 1 inclusive. |
Evaluation | The list in argument one describes the distribution by providing independently sampled values from that distribution. The function returns an estimate of the value which has the given probability p of being greater than a value taken from the distribution. Consequently, for an input probability p at most (100*p)% of the values in the data set will be less than the return value (and at most 100*(1-p)% will be greater than this value). Several methods exist for computing the percentile; the following is the technical definition used by the Percentile function: for the pth percentile, Percentile(list, p): Compute p x (N + 1) where N is the number of items in the data set. Then set k and d, where k + d = p x (N + 1), k is an integer, and d is a fraction greater than or equal to 0 and less than 1. Essentially k is the integer part and d is the decimal part of p x (N + 1). Then, sort the numeric values in the list in increasing order. The function Y[i] denotes the isorted value of the numeric list, where i is between 1 and N, inclusive. Then: If k = 0, Percentile(list, p) = Y[1] If 0 < k < N, Percentile(list, p) = Y[k] + (d)(Y[k+1] - Y[k]) If k = N, Percentile(list, p) = Y[N] See NIST/SEMATECH e-Handbook of Statistical Methods for details: | |
Comments | This function is sometimes called the quantile function. Excel’s, Percentile function sets 1+p(N-1) equal to k + d, then proceeds as above. The two methods give similar results. |
Description | Find the rank of a given value within a list of values as a percentage of the number of values in the list. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST | a list of numeric values |
2 | NUMERIC | the value for which to determine the rank |
Evaluation | This function provides a measure of the relative standing of a value within a data set. If the value whose percent rank is being determined, x, is one of the input values, then the return value is computed by: Otherwise, interpolation is used to combine the percent ranks for the closest data points on either size of x. If the input values are viewed as a sample from some distribution, then PercentRank can be viewed as a smooth estimate of the empirical cumulative distribution function. | |
Comments | This function produces the same results as Excel’s PercentRank function. |
Description | Resolves a partially specified date/time into the previous (with respect to a reference date) date/time which matches the specified fields. | |
Type | DATETIME | |
Arguments | Type | Meaning |
1 | DATETIME | a reference date/time. |
2 | DATETIME | a partially specified date/time. |
Evaluation | The unspecified fields with a coarser resolution are resolved into the past with respect to the reference date. If there are finer resolution fields, they are filled in with default values (e.g., time with 24:00, day of the month with the last day of the month). Note: If the partial date can be resolved into the current date, it is. See Syntax Examples, below. | |
Comments | If the reference date/time is not fully specified or if the partial date/time is, then the run is aborted with an error. |
Description | Returns the next number in a pseudo-random sequence. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | a number which is ignored except that the units are taken as the units to be returned. |
Evaluation | Returns the next number in the pseudo-random series, given a seed. | |
Comments | This function should not be called within a user-defined function which has no arguments, if that user-defined function might be called multiple times within a single block (rule). This is because functions with no arguments are actually evaluated only once per rule and return this same result on each function call during the execution of that block. This is not a very good random number generator, but is implemented in this way for historical reasons. If ResetRanDev() has not been called before this function, then the results are unpredictable. |
Description | Returns a given number in a pseudo-random sequence. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | a numeric value which is rounded down to an integer and used to identify a unique sequence of numbers -- calls with the same integral seed refer to the same random sequence of numbers. |
2 | NUMERIC | a numeric value which is rounded down to an integer and denotes the one-based index into the random sequence of the value to be returned. |
3 | NUMERIC | a number which is ignored except that the units are taken as the units to be returned. |
Evaluation | Random returns a number from a random sequence of numbers uniformly distributed in the range [0, 1.0]. RandomNormal returns a number from a random sequence of numbers whose distribution is normal with a mean of 0 and a standard deviation of 1. The unique sequence of numbers associated with each integral seed is the same on all platforms supported by RiverWare, allowing for repeatable results. The sequences are generated using the linear congruential method described in Park and Miller (1988) Communication of the ACM, vol 31, pages 1192-1201. Note: Random number generators such as this are often referred to as pseudo-random because they are not the result of an intrinsically random process; they are in fact predictably determined by the seed. | |
Comments | The time to evaluate a call to either of these functions is proportional to the magnitude of the index argument (because the entire sequence must be generated at least once per RiverWare execution). Thus, if performance is an important issue, one should choose to get numbers from the earlier portion of a sequence. |
Description | This function returns a list of the names of all ReleaseTypes defined in the Water Accounting System Configuration. | |
Type | LIST {STRING} | |
Arguments | none | |
Evaluation | ||
Comments | ReleaseTypes are properties of Supplies. The returned list does not include the default (NONE) ReleaseType. |
Description | This function returns a list of unique names of ReleaseTypes of Supplies which represent outflows from a specified Object. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | OBJECT | The Object. |
Evaluation | The set of Accounts on the Object are examined. The outflow Supplies on those Accounts which link a different downstream Object are considered. The names of the ReleaseTypes of those Supplies are added to the returned list -- but any given ReleaseType name will appear on the list only once. | |
Comments | ReleaseTypes are properties of Supplies. The returned list can include the default (NONE) ReleaseType. Supplies which represent internal flows between two Accounts on the Object are not considered. |
Description | Initialize internal data structures to permit RanDev() to return a pseudo-random sequence of numbers. This involves reading a file, each line of which has a date associated with it. Basically, this is a seeding function. | |
Type | BOOLEAN | |
Arguments | Type | Meaning |
1 | BOOLEAN | True if some lines in the initialization file should be skipped. |
2 | DATETIME | The date of the line to be skipped. |
Evaluation | Returns true if initialization was successful. | |
Comments | The recommendation is that this function be called within a block that contains only the following statement: obj.slot[] = IF (NOT ResetRanDev(...)) STOP_RUN "ResetRanDev failed" ENDIF This will never assign any values but will always evaluate the function call. An alternative is to embed the call within a Print statement, but if diagnostics are turned off then this statement will not get executed. This, and the RanDev() function are scheduled to be removed in the future and replaced with a more convenient and effective means of generating a sequence of pseudo-random numbers. |
Description | Reverses the order of items in a list. | |
Type | LIST | |
Arguments | Type | Meaning |
1 | LIST | a list of values |
Evaluation | Returns a list with the same values as the input list, in reverse order. | |
Comments |
Description | Round the specified numeric value to a multiple of the factor | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the value |
2 | NUMERIC | the factor |
Evaluation | Converts the value into the units of the factor, then rounds the value to the integral multiple of the factor. | |
Comments | When the value is halfway between two multiples of the factor, the value is rounded away from zero. The value and factor must have the same unit type. |
Description | Returns the label associated with a given row of a table slot. | |
Type | STRING | |
Arguments | Type | Meaning |
1 | SLOT | A table slot |
2 | NUMERIC | The row index (0-based). |
Evaluation | Returns the label of the row of the table slot which has the given index. | |
Comments | It is an error to provide an illegal index (e.g., an index of 4 with a table which has only 4 rows). If the row index is legal but there is no label for that row, then the empty string is returned: " ". |
Description | Returns a list containing the row labels of a given table slot, in order. | |
Type | LIST of STRING values | |
Arguments | Type | Meaning |
1 | SLOT | A table slot |
Evaluation | Returns a list of strings that represent the row labels of the table slot | |
Comments | It is an error if the input slot has a type other than table slot. For each row, if no label exists the empty string is returned. |
Description | RunStartDate and RunEndDate return the start or end date of the currently active controller, respectively. | |
Type | DATETIME | |
Arguments | Type | Meaning |
Comments | When evaluated from a Rule, Goal, or Method set, these functions are equivalent to @"Start Timestep" or @"Finish Timestep". But, for Expression Series Slots, the symbolic datetime specifications @"Start Timestep" and @"Finish Timestep" refer to the expression slot’s evaluation range, not the controller’s start or end dates. Thus, RunStartDate() may not be equivalent to @"Start Timestep" and RunEndDate() may not be equivalent to @"Finish Timestep". But, regardless of the set from which they are called, RunStartDate and RunEndDate functions provide a fixed references to the controller’s start and end dates, respectively. |
Description | Returns the number of seconds which have elapsed since the current run began, or if called from outside a run, the total number of seconds within the last run. | |
Type | NUMERIC |
Description | Returns a series slot’s value from the slot cache. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Series slot whose cache value is desired |
2 | DATETIME | Date for which the value is desired |
Evaluation | Returns the slot cache value for the given series slot at the given date. If there is no such value, an invalid value is returned. | |
Comments | The slot cache is a repository of series slot values that can be created from workspace series slots, allowing access within one run to values computed by a previous run. See Slot Cache in User Interface for details. Note: The slot cache is under development. For information on the current status of this feature, email: riverware-support@colorado.edu |
Description | Returns an aggregate series slot’s value from the slot cache. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Aggregate series slot for which a slot cache value is desired. |
2 | NUMERIC | Index of the column for which a value is desired. |
3 | DATETIME | Date for which a value is desired. |
Evaluation | Returns the slot cache value for the given series slot at the given date. If there is no such value, an invalid value is returned. | |
Comments | The slot cache is a repository of series slot values which can be created from workspace series slots, allowing access within one run to values computed by a previous run. See Slot Cache in User Interface for details. Note: The slot cache is under development. For information on the current status of this feature, email: riverware-support@colorado.edu |
Description | Computes a Series Slotvalues in that same time range as the weights. | |
Type | NUMERIC | |
Arguments | ||
1 | SLOT | Slot 1: the weighting slot |
2 | SLOT | Slot 2: the slot being averaged |
3 | DATETIME | Begin timestep for period of average - partially specified |
4 | DATETIME | End timestep for period of average - partially specified |
DATETIME | Reference timestep | |
Evaluation | The partially specified begin and end timesteps are converted to fully specified timesteps using the reference timestep to complete the missing information. The weighted average is then computed as the quotient of two summations over the averaging time period (begin timestep to end timestep): | |
Comments | For a calendar year weighting of 1 Month timesteps, the time arguments would be @“January”, @“December”, and @“t” For a water year weighting of 1 Month timesteps, the time arguments would be @“October 31, Previous Year”, @“September 30”, @“t”. For a monthly weighting, the time arguments would be @“DayOfMonth 1”, @“Max DayOfMonth”, @“t”. |
Description | The inflow to a reservoir given outflow and storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average outflow over the timestep |
3 | NUMERIC | the storage value to use in the mass balance calculation |
4 | NUMERIC | the previous (beginning) storage |
5 | DATETIME | the timestep at which to calculate |
Evaluation | This function calls the massBalanceSolveInflow() function on the given reservoir object at the given timestep, and provides it with the average outflow over the timestep, beginning storage, and ending storage. The function computes the end of timestep pool elevation, and then determines the average inflow over the timestep, taking into account the following sources and sinks. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows like Hydrologic Inflow, Return Flow, and Diversion are NOT included. The total inflow is then calculated as the difference between the ending and beginning storage over the timestep, plus the outflow, evaporation, bank storage, and seepage, minus precipitation. | |
Mathematical Expression | ||
Comments | The given outflow is a total outflow and should include any spills. The calculated inflow is a total inflow. |
Description | The monthly outflow of reservoir in a model with a 1 year timestep, given inflow and storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object for which to calculate |
2 | NUMERIC | average inflow over the specified month |
3 | NUMERIC | desired storage at the end of the specified month |
4 | NUMERIC | previous month’s storage |
5 | DATETIME | the monthly timestep at which to calculate |
Evaluation | This function can only be called if the run timestep is 1 Year. Also, the last argument, the DATETIME, must be a valid 1 Month timestep. This function solves the mass balance equation on the given reservoir object at the given timestep and provides it with the average inflow over the timestep, beginning storage, and ending storage. The function determines the average outflow over the timestep, taking into account the following sources and sinks, and thus they should not be included in the inflow value for Argument 2. • Evaporation is modeled using the Monthly Evaporation approach • Precipitation is not included • Bank Storage is modeled using CRSS Bank Storage • No Seepage is included • No other side inflows are included The outflow is then calculated as the difference between the ending and beginning storage over the timestep, plus the inflow, minus evaporation, and bank storage. | |
Mathematical Expression | ||
Comments | The calculated outflow is a total outflow and will include any spills. |
Description | The monthly storage of a reservoir in a model with a 1 year timestep | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object for which to calculate |
2 | NUMERIC | average inflow over the timestep |
3 | NUMERIC | average outflow over the timestep |
4 | NUMERIC | previous month’s storage |
5 | DATETIME | the monthly timestep at which to calculate |
Evaluation | This function can only be called if the run timestep is 1 Year. Also, the last argument, the DATETIME, must be a valid 1 Month timestep. This function solves the mass balance equation on the given reservoir object at the given timestep and provides it with the average inflow and outflow over the timestep, and previous month storage. The function must iterate to convergence due to the storage and pool elevation dependence of the following sources and sinks, which are included automatically: • Evaporation is modeled using the Monthly Evaporation approach • Precipitation is not included • Bank Storage is modeled using CRSS Bank Storage • No Seepage is included • No other side inflows are included At each iteration, the ending storage is calculated as the previous storage plus the inflow over the timestep, minus the outflow, evaporation, and bank storage over the timestep. | |
Mathematical Expression | ||
Comments | The specified outflow is a total outflow and should include any spills. |
Description | Compute the outflow from a reservoir given inflow and storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average inflow over the timestep |
3 | NUMERIC | the storage value to use in the mass balance calculation |
4 | NUMERIC | the previous (beginning) storage |
5 | DATETIME | the timestep at which to calculate |
Evaluation | This function calls the massBalanceSolveOutflow() function on the given reservoir object at the given timestep and provides it with the average inflow over the timestep, beginning storage, and ending storage. The function computes the end of timestep pool elevation, and then determines the average outflow over the timestep, taking into account the following sources and sinks, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. The outflow is then calculated as the difference between the ending and beginning storage over the timestep, plus the inflow, side inflows, and precipitation, minus evaporation, bank storage, and seepage. | |
Mathematical Expression | ||
Comments | The given inflow in argument 2 represents the main inflow only and should not include any side inflows. This is the same value which would be in the Inflow slot. The calculated outflow is a total outflow. It includes both Release/Turbine Release and Spill. The given timestep’s Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. are automatic dependencies of this function. Since the function evaluation depends on these slots, any change to their values at the indicated timestep, may impact the function result. |
Description | The outflow from a LevelPowerReservoir. | |
Type | NUMERIC | |
Arguments | ||
1 | OBJECT | the reservoir object for which to calculate (must be a LevelPowerReservoir) |
2 | NUMERIC | the energy value |
3 | NUMERIC | the inflow value |
4 | DATETIME | the timestep at which to calculate |
Evaluation | This function behaves identically to the solution of the LevelPowerReservoir in simulation. | |
Comments | This function assumes that the LevelPowerReservoir has solved for all the timesteps prior to the date specified in argument 4. This is necessary because the solution requires previous storage, inflow, and energy. This information is retrieved from slots on the object at timesteps prior to the date specified in argument 4. If any of this information is missing, an error is posted and the rule fails. If this function is called on the first timestep, the initial input data are used. These data are already required for the LevelPowerReservoir to dispatch in simulation mode. This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. |
Description | List containing the (Total) Diversion Shortage and (Total) Depletion Shortage | |
Type | LIST {NUMERIC, NUMERIC} | |
Arguments | Type | Meaning |
1 | OBJECT | the object on which to perform the calculations (either an AggDiversionSite or a Water User) |
2 | NUMERIC | the total water available for diversion |
3 | DATETIME | the timestep at which to calculate |
Evaluation | This function behaves identically to the solution of the object in simulation. It mimics the dispatch method of the given object. However, instead of setting slots, the method just returns the values for (Total) Diversion Shortage and (Total) Depletion Shortage. | |
Comments | This function exits its calling rule with an early termination if any of the required data used to solve the diversions are unknown. Depletion Requested is not required, if not specified it will be set equal to Diversion Requested. This function aborts the run with an error if an object other than a Water User or an AggDiversionSite is given as the first argument. |
Description | List containing the resulting outflow and the resulting storage value | |
Type | LIST {NUMERIC, NUMERIC} | |
Arguments | Type | Meaning |
1 | OBJECT | the object on which to perform the calculations (must be a Slope Power Reservoir) |
2 | NUMERIC | the inflow value |
3 | NUMERIC | the pool elevation value |
4 | DATETIME | the timestep at which to calculate |
Evaluation | This function behaves identically to the solution of the object in simulation. | |
Comments | This function assumes that the Slope Power Reservoir has solved (through simulation) for all timesteps prior to the date specified in argument 4. This is necessary because the solution requires previous inflow, outflow, storage and pool elevation data. This information is retrieved from slots on the object at timesteps prior to the date specified in argument 4. If any of this information is missing, an error is posted and the rule fails. If this function is called on the first timestep, the initial input data is used. This data is already required for the Slope Power Reservoir to dispatch in simulation mode. This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2, Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. |
Description | List containing the resulting pool elevation and the resulting storage value | |
Type | LIST {NUMERIC, NUMERIC} | |
Arguments | Type | Meaning |
1 | OBJECT | the object on which to perform the calculations (must be a Slope Power Reservoir) |
2 | NUMERIC | the inflow value |
3 | NUMERIC | the outflow value |
4 | DATETIME | the timestep at which to calculate |
Evaluation | This function behaves identically to the solution of the object in simulation. | |
Comments | This function assumes that the Slope Power Reservoir has solved (through simulation) for all timesteps prior to the date specified in argument 4. This is necessary because the solution requires previous inflow, outflow, storage and pool elevation data. This information is retrieved from slots on the object at timesteps prior to the date specified in argument 4. If any of this information is missing, an error is posted and the rule fails. If this function is called on the first timestep, the initial input data is used. This data is already required for the Slope Power Reservoir to dispatch in simulation mode. This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 2. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2, Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. |
Description | The storage of a reservoir. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir object for which to calculate |
2 | NUMERIC | the average inflow over the timestep |
3 | NUMERIC | the average outflow over the timestep |
4 | NUMERIC | the previous (beginning) storage |
5 | DATETIME | the timestep at which to calculate |
Evaluation | This function calls the massBalanceSolveStorage() function on the given reservoir object at the given timestep and provides it with the average inflow and outflow over the timestep, and beginning storage. The function must iterate to convergence due to the storage and pool elevation dependence of the following sources and sinks, which are included automatically: • The Evaporation and Precipitation Category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. At each iteration, the ending storage is calculated as the previous storage plus the inflow, side inflows, and precipitation over the timestep, minus the evaporation, bank storage, and seepage over the timestep | |
Mathematical Expression | ||
Comments | The given inflow in Argument 2 represents the main inflow only and should not include any side inflows. This is the same value which would be in the Inflow slot. The given outflow represents the total outflow. It should include both Release/Turbine Release and Spill. The given timestep’s Inflow 2 (Slope Power Reservoir only), Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage are automatic dependencies of this function. Since the function evaluation depends on these slots, any change to their values at the indicated timestep, may impact the function result. |
Description | Minimum Inflow required to meet all diversion requests and resulting Outflow. | |
Type | LIST {NUMERIC, NUMERIC} | |
Arguments | Type | Meaning |
1 | LIST | the subbasin’s Reach and Confluence objects in downstream order (can be included in a subbasin) |
2 | DATETIME | the timestep at which to calculate |
Evaluation | The subbasin diversion requirement is originally set to zero. Each of the objects in the subbasin list is processed in the downstream order in which they are provided. If the object is a Reach, the following calculations are performed: • If an Aggregate Diversion Site is linked to the Reach’s Diversion slot, the NetNonShortDiversionRequirement function is executed on the diversion. This determines the diversion requirement from the Reach. • If an Aggregate Diversion Site is linked to the Reach’s Diversion slot, the minimum flow just below the diversion point is determined from the Reach’s Minimum Diversion Bypass slot. If this slot does not exist because of the selected User Method in the Min Diversion Bypass category, the minimum flow requirement is zero. • If nothing is linked to the Diversion slot, but a value exists in the slot, this value is assumed to be the diversion requirement for this reach. In this case, there is no minimum flow requirement below the diversion point. • The subbasin diversion requirement is recalculated as the greater of the previous subbasin diversion requirement or the Reach diversion requirement plus the minimum flow requirement plus any cumulative upstream diversions minus any cumulative upstream return flows minus any cumulative upstream tributary inflows. • Any Local Inflow to the Reach is added to the cumulative tributary inflows. • If the Return Flow slot has a valid value, it is added to the cumulative return flows. If the Return Flow slot does not have a valid value, but a Water User or an Aggregate Diversion Site object is linked to it, the return flow is estimated. Return flow is estimated by subtracting the object’s (Total) Depletion Requested from its (Total) Diversion Requested. The estimated return flow is then added to the cumulative return flows. If Depletion Requested is not specified, it will be set equal to Diversion Requested. If the object is a Confluence, the Inflow1 and Inflow2 slots are checked to determine which is the main subbasin flow and which is the tributary inflow. The objects linked to the inflow slots are checked against the last Reach object to be processed. When a match is found, the other Inflow, if valid, is added to the cumulative tributary inflows. The loop continues until all objects in the list have been processed. The largest subbasin diversion requirement to have been calculated at any diversion point is the total subbasin diversion requirement. | |
Mathematical Expression | ||
Comments | This function exits its calling rule with an early termination if any of the required data used to solve the diversions are unknown. The required data is the same as that needed for the NetNonShortDiversionRequirement predefined function for each Aggregate Diversion Site along the subbasin. This function aborts the run with an error if an object other than a Reach or Confluence is in the subbasin list. One of the Confluence Inflows must be linked to the previous Reach object upstream, or an Aggregate Reach which contains the previous Reach object upstream as its last element. If this condition is not met, the Confluence cannot determine which slot is the tributary inflow and the function aborts the run with an error. All subbasin diversion requirement calculations are performed at the given timestep. Subbasin diversion requirement will not be correct if there are lags in Reaches. This predefined function is recommended for use in long timestep models or for subbasins where there is no lag between top and bottom. |
Description | This function computes the Turbine Release necessary to meet the specified Energy. If that energy cannot be met, the maximum turbine release is returned. | |
Type | LIST {NUMERIC, BOOLEAN} | |
Arguments | ||
1 | OBJECT | the reservoir object for which to calculate (must be a LevelPowerReservoir) |
2 | NUMERIC | the energy value |
3 | NUMERIC | the inflow value |
4 | DATETIME | the timestep at which to calculate |
Evaluation | This function behaves like the solution of the LevelPowerReservoir in simulation. If the given energy can be met by the turbine release, TRUE is returned in the list boolean. If the given energy cannot be met, the turbine release is calculated to be the maximum release as computed by GetMaxReleaseGivenInflow and FALSE is returned in the list boolean.The maximum turbine release may be reduced by specified Plant Power Limits and Plant Power Cap Fractions, as appropriate for the selected power method. | |
Comments | This function assumes that the LevelPowerReservoir has solved for all the timesteps prior to the date specified in argument 4. This is necessary because the solution requires previous Storage. This information is retrieved from slots on the object at timesteps prior to the date specified in argument 4. If any of this information is missing, an error is posted and the rule fails. If this function is called on the first timestep, the initial input data are used. These data are already required for the LevelPowerReservoir to dispatch in simulation mode. This function takes into account the following sources and sinks automatically, and thus they should not be included in the inflow value for Argument 3. • The Evaporation and Precipitation category selected Method. • The Bank Storage category selected Method. • The Seepage category selected Method. • Side inflows including: Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. These slots are automatically added as dependencies to the calling rule. Also, if there are Unregulated Spills, the unregulated spill is limited to be no greater than the max unregulated spill. This is described in the Unregulated Spill documentation on the Level Power Reservoir. For the Plant Power Coefficient and Plant Efficiency Curve power methods, if you have an input value on the Power Coefficient slot, the result of solveTurbineRelGivenEnergyInflow is non-unique. A value will be found, but there may be multiple solutions that meet the specified energy. |
Description | Invokes computational subbasin’s Water Rights Allocation method. | |
Type | SolveWaterRights: LIST { LIST { SLOT, NUMERIC } } SolveWaterRightsWithLags: LIST{ LIST{SLOT, DATETIME, NUMERIC} } | |
Arguments | Type | Meaning |
1 | STRING | the name of the computational subbasin |
2 | STRING | the name of the Water Type that identifies the allocatable flow supply chain |
3 | DATETIME | Controlling date for instream flow rights. Rights at or senior to (i.e., with priority date earlier or equal to) this date can make calls; instream flow rights junior to this date compute their Available Allocatable Flow. |
Evaluation | Runs the selected Water Rights Allocation method on the subbasin. For each water right account (has priority) in the subbasin, the function returns {slot, value} pairs for the following slots: • Appropriation Request on all rights, • Available Allocatable Flow on Instream Flow Accounts whose priority date is later than the controlling date (3rd argument), • Supply slot values representing appropriations to the water right accounts. For storage rights on in-line reservoirs, this is a Transfer In supply; for off-stream storage rights, this is a Diversion supply to the passthrough account on a Diversion object that supplies the off-stream storage right account. For diversion rights, this is a Diversion supply. A changing set of temporary slots (whose names begin with Temp) on the rights is also returned, for use by RiverWare developers. If no appropriation is to be made, a value of zero is returned so that old appropriations that are no longer valid will be invalidated by this rule. The SolveWaterRightsWithLags() predefined rule function works much like SolveWaterRights(), but is used when the subbasin passthrough accounts contain lags. It returns a list of {slot name, date-time, value} triplets, which the rule uses to place the value in the appropriate slot at the appropriate timestep. The timestep given will reflect the Local Timestep Offset of the account on which the slot resides. It is some number of timesteps after the current rules-controller timestep, and reflects the relationships of the account to other accounts in the subbasin based on their respective cumulative lag times to the end of the subbasin. See Solution Algorithm for SolveWaterRights in Accounting for detailed descriptions of the solution methods. | |
Comments | The calling rule is expected to make the assignments of the values to the slots. |
Description | Sort the items in a list. | |
Type | LIST | |
Arguments | Type | Meaning |
1 | LIST | a list of values to be sorted |
Evaluation | Returns a list with the same values as the input list, in increasing order. | |
Comments | Comparisons across type are defined by the following arbitrary ordering, on which users are advised against relying: BOOLEAN < NUMERIC < STRING < OBJECT < SLOT < DATETIME < LIST Within each type, ordering is as: • BOOLEAN: TRUE < FALSE • NUMERIC: values involving different dimensions are sorted by lexicographic ordering on the names of the units; within values of the same dimensionality, the sorting is based on standard numeric comparisons. • STRING: Lexicographic ordering • OBJECT: Lexicographic ordering on the object’s name • SLOT: Lexicographic ordering on the slot’s name • DATETIME: Same as RPL operator • LIST: Based on comparison of items within the list (left to right). |
Description | Sort a list of two-item lists. | |
Type | LIST | |
Arguments | Type | Meaning |
1 | LIST {LIST} | the list of lists to be sorted. |
Evaluation | The input list must be a list of lists, each member list must contain at least two items. The pairs are sorted into ascending/descending order by the second item’s value, and a list containing the first items of this sorted list of pairs is returned. Duplicates are not removed. | |
Comments | In the case that the items being compared are equal, the return order for SortPairsAscending will correspond to the order of the original list passed in as an argument, and the order for SortPairsDescending will be the reverse of the original list passed in as an argument. In other words the result from SortPairsDescending will always be the reverse of the result from SortPairsAscending. Comparisons across type are defined by the following arbitrary ordering, on which users are advised against relying: BOOLEAN < NUMERIC < STRING < OBJECT < SLOT < DATETIME < LIST Within each type, ordering is as: • BOOLEAN: TRUE < FALSE • NUMERIC: values involving different dimensions are sorted by lexicographic ordering on the names of the units; within values of the same dimensionality, the sorting is based on standard numeric comparisons. • STRING: Lexicographic ordering • OBJECT: Lexicographic ordering on the object’s name • SLOT: Lexicographic ordering on the slot’s name • DATETIME: Same as RPL operator • LIST: Based on comparison of items within the list (left to right). |
Description | Given a supply (specified by name), returns a list containing the source (upstream) account and object. | |
Type | LIST {STRING, OBJECT} | |
Arguments | Type | Meaning |
1 | STRING | The name of the supply. |
Evaluation | ||
Comments |
Description | Split a string up into component pieces. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | STRING | the primary string |
2 | STRING | the separator string |
Evaluation | This function returns a list of the strings which are contained within the primary string and separated by the separator string. Where ambiguity exists the left most occurrence of the separator string is used. | |
Comments | It is an error for the separator string to be the empty string. |
Description | Find the area of a given reservoir with a given storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | storage |
Evaluation | The storage argument is looked up in the Storage column of the Elevation Volume Table of the reservoir object argument to determine the Pool Elevation. If the exact storage is not in the table, the lookup performs a linear interpolation between the two nearest bounding storages and their corresponding pool elevations. The pool elevation is then looked up in the Pool Elevation column of the Elevation Area Table to determine the Surface Area. If the exact elevation is not in the table, another linear interpolation is performed. The function evaluates to the computed surface area. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir or the reservoir does not have an Elevation Area Table, the function aborts the run with an error (CRSSEvaporationCalc, DailyEvaporationCalc, PanAndIceEvaporation, heatBudgetEvaporation, or InputEvaporation must be selected as the Evaporation and Precipitation Category selected Method). If the reservoir is a Slope Power Reservoir, the calculation is based only on level storage and does not include any wedge storage effects. This function will issue an error if the Time Varying Elevation Volume method or Time Varying Elevation Area method is selected (see Time Varying Elevation Volume in Objects and Methods and Time Varying Elevation Area in Objects and Methods). Instead, use the StorageToAreaAtDate function, described next. |
Description | Find the surface area corresponding to a reservoir’s storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | storage |
3 | DATETIME | the datetime at which to do the conversion |
Evaluation | On the specified reservoir object argument, if the Time Varying Elevation Volume method is selected the function will reference the Elevation Volume Table Time Varying table. The function will select the appropriate column to use based on the datetime argument. On timesteps that exactly match a modification date, the previous column is used. The relationship changes at the end of that timestep and is taken into account when the reservoir dispatches. For this algorithm the previous timestep’s relationship is used. See Time Varying Elevation Volume in Objects and Methods and Elevation Volume Table Time Varying in Objects and Methods for details. Otherwise, the Elevation Volume Table is used. Then, the storage argument is looked up in the appropriate storage column to determine the elevation from the Pool Elevation column. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding surface areas.On the specified reservoir object argument, if the Time Varying Elevation Area method is selected, the function will reference the Elevation Area Table Time Varying table. The function will select the appropriate column to use based on the datetime argument. On timesteps that exactly match a modification date, the previous column is used. The relationship changes at the end of that timestep and is taken into account when the reservoir dispatches. For this algorithm the previous timestep’s relationship is used. Otherwise, the Elevation Area Table is used. Then, the computed pool elevation is looked up in the Pool Elevation column to determine the surface area from the appropriate column. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding surface areas. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Elevation Volume Table or Elevation Volume Table Time Varying AND Elevation Area Table or Elevation Area Table Time Varying, the function aborts the run with an error. |
Description | Find the reservoir elevation at a given storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | storage |
Evaluation | The storage argument is looked up in the Storage column of the Elevation Volume Table of the reservoir object argument to determine the Pool Elevation. If the exact storage is not in the table, the lookup performs a linear interpolation between the two nearest bounding storages and their corresponding elevation values. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, the function aborts the run with an error. If the reservoir is a Slope Power Reservoir, the calculation is based only on level storage and does not include any wedge storage effects. This function will issue an error if the Time Varying Elevation Volume method is selected (see Time Varying Elevation Volume in Objects and Methods). Instead, use the StorageToElevationAtDate function described next. |
Description | Finds the elevation corresponding to a reservoir’s storage. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | reservoir object |
2 | NUMERIC | storage |
3 | DATETIME | the datetime at which to do the conversion |
Evaluation | On the specified reservoir object argument, if the Time Varying Elevation Volume method is selected, the function will reference the Elevation Volume Table Time Varying table. The function will select the appropriate column to use based on the datetime argument. On timesteps that exactly match a modification date, the previous column is used. The relationship changes at the end of that timestep and is taken into account when the reservoir dispatches. For this algorithm, the previous timestep’s relationship is used. See Time Varying Elevation Volume in Objects and Methods and Elevation Volume Table Time Varying in Objects and Methods for details. Otherwise, the Elevation Volume Table is used and the datetime is not used. Then, the storage argument is looked up in the appropriate Storage column to determine the Pool Elevation. If the exact elevation is not in the table, the lookup performs a linear interpolation between the two nearest bounding elevations and their corresponding storages. | |
Mathematical Expression | ||
Comments | If the object is not a reservoir, or the reservoir does not have an Elevation Volume Table or Elevation Volume Table Time Varying, the function aborts the run with an error. |
Description | Converts a string into a numeric that can be set on a Text Series Slot | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | A string to encode. |
Evaluation | Text Series Slots store text encoded as a number. See Text Series Slots in User Interface. This function takes a STRING and returns a numeric encoding that can be set on the Text Series Slot. | |
Comments | See TextSlotNumericToString and GetTextSlotValueAsString for complimentary functions. Each numeric returned by this function is unique. Thus, StringToTextSlotNumeric("Apples") is not equivalent to StringToTextSlotNumeric("Apples") because each instance of “Apples” gets encoded to a different number. Instead, compare the strings directly. |
Description | Sum a non-empty list of numbers. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST{NUMERIC} | a list of numeric values. |
Evaluation | The numbers in the input list are added up, the total is returned. | |
Mathematical Expression | ||
Comments | If the input list is empty, one of the items in the list is not NUMERIC, or the unit types of items in the list are incompatible, this function aborts the run with an error. |
Description | The sum of slots of a given name and water type. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the object on which to sum |
2 | STRING | the water type of accounts to sum |
3 | STRING | the name of the slots to sum |
4 | DATETIME | the date at which to sum |
Evaluation | The function contains two nested loops. The outer loop iterates over all of the account types which may exist on the given object (Storage Account and/or Passthrough Account or Diversion Account). For each account type, a list is made of all of the accounts which are of the given water type. The inner loop iterates over all of these accounts and sums the values of the slots with the given name at the given time. | |
Mathematical Expression | ||
Comments | If the object cannot accept accounts, has no accounts, or has no accounts of the given water type, this function aborts the run with an error. If none of the accounts of the given water type has a slot with the given name, or the slot is not a series slot, this function aborts the run with an error. Any slots which contain a NaN at the given datetime are ignored for the purpose of summation. If all of the slots contain NaNs at the given datetime, the function forces an early termination of the calling rule. If the given datetime argument does not land on an interval of the series slot, this function aborts the run with an error. |
Description | Given a list of lists and an index, sum the values at the given index in each list. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST{LIST} | a list of lists. |
2 | NUMERIC | an index. |
Evaluation | All values located at the given index in each list contained within the input list are summed, the total is returned. | |
Mathematical Expression | ||
Comments | The input list must be non-empty. The index must be positive and a legal index for each of the lists contained within the values list. For example, if the index value is 3, the sublists must each contain at least 4 items. All items being summed must be numeric and have compatible dimensions. If any of these conditions is not met, this function aborts the run with an error. |
Description | The volume equivalent of flows over time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the series or periodic slot to sum |
2 | DATETIME | the start date |
3 | DATETIME | the end date |
Evaluation | The function loops through all of the slot values between the start and end datetime arguments. For each value, the flow is multiplied by the corresponding timestep’s length to convert it to a volume before adding it to the previous result. The function evaluates to the final result in units of m3. | |
Mathematical Expression | ||
Comments | If the unit type of the slot argument is not FLOW or the starting or ending datetime argument is not defined in the series slot, this function aborts the run with an error. For the SumFlowsToVolume function, if one of the slot values in the time range is a NaN, the function forces an early termination of the calling rule. The SkipNaN variation treats an invalid value (NaN) as 0.0. For periodic slots, the dates used are those within the range and falling on a run timestep and the column used is the first column. |
Description | This function sums a a column of a slot’s FLOW values between a starting timestep and ending timestep and evaluates to the corresponding volume of water | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the Agg Series Slot or periodic slot to sum |
2 | DATETIME | the start date |
3 | DATETIME | the end date |
4 | NUMERIC | the column (interpreted as a 0-based integral index) |
Evaluation | The function loops through all of the slot values of the given column between the start and end datetime arguments. For each value, the flow is multiplied by the corresponding timestep’s length to convert it to a volume before adding it to the previous result. The function evaluates to the final result in units of m3. | |
Mathematical Expression | ||
Comments | If the unit type of the given column of the slot is not FLOW or if the slot is an Agg Series Slot and the starting or ending datetime argument is not defined in the slot, this function aborts the run with an error. For the SumFlowsToVolumeByCol function, if one of the slot values in the time range is a NaN, the function forces an early termination of the calling rule. The SkipNaN variation treats an invalid value (NaN) as 0.0. For periodic slots, the dates used are those within the range and falling on a run timestep. |
Description | Sum several object’s values, each of which is the result of aggregating a slot’s values over time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start date |
7 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, each slot’s values are aggregated according to the aggregation function argument over the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, all of the object’s aggregated slot values are summed | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Sum several object’s slot values, for each timestep in a range. | |
Type | LIST{LIST{DATETIME, NUMERIC}} | |
Arguments | Type | Meaning |
1 | STRING | subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start date |
6 | DATETIME | end date |
Evaluation | A list of slots is generated by searching all of the objects in the subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be summed are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the object’s slot values are summed, yielding one value for each timestep in the time range of the datetime arguments. The function returns a list of two items, where the first and second items of the inner lists are the datetime and the summation value, respectively. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | The sum of a slot’s values over time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the series or periodic slot to sum |
2 | DATETIME | the start date |
3 | DATETIME | the end date |
Evaluation | The function loops through all of the slot values between the start and end datetime arguments. Each value is added to the previous result. | |
Mathematical Expression | ||
Comments | If the starting or ending datetime argument is not defined in the series slot, this function aborts the run with an error. For the SumSlot function, if one of the slot values in the time range is a NaN, the function forces an early termination of the calling rule. The SkipNaN variation treats an invalid value (NaN) as 0.0. For periodic slots, the dates used are those in the first column within the range and falling on a run timestep. |
Description | The sum the values in a column of a slot over a range of time. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the Agg Series Slot or periodic slot to sum |
2 | DATETIME | the start date |
3 | DATETIME | the end date |
4 | NUMERIC | the column (interpreted as a 0-based integral index) |
Evaluation | The function loops through all of the slot values in the given column between the start and end datetime arguments. Each value is added to the previous result. | |
Mathematical Expression | ||
Comments | If the slot is an Agg Series Slot and the starting or ending datetime argument is not defined in the slot, this function aborts the run with an error. For the SumSlotByCol function, if one of the slot values in the time range is a NaN, the function forces an early termination of the calling rule. The SkipNaN variation treats an invalid value (NaN) as 0.0. For periodic slots, the dates used are those within the range and falling on a run timestep. |
Description | Sum of the values of a table slot column between two rows. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values to sum |
2 | NUMERIC | column |
3 | NUMERIC | start row |
4 | NUMERIC | end row |
Evaluation | The function loops over each value in the given column of the given table slot, beginning with the start row and ending with the end row (inclusive). Each value is added to the previous sum. The function evaluates to this sum. Rows and columns are numbered beginning with zero. | |
Mathematical Expression | ||
Comments | Units are not required for row and column indices and, if provided, will be ignored. If the column, start row, or end row do not exist in the slot or if the start row is greater than the end row, this function aborts the run with an error. If one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. |
Description | Sum of the values of a table slot row between two columns. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | the table slot whose values to sum |
2 | NUMERIC | row |
3 | NUMERIC | start column |
4 | NUMERIC | end column |
Evaluation | The function loops over each value in the given row of the given table slot, beginning with the start column and ending with the end column (inclusive). Each value is added to the previous sum. The function evaluates to this sum. Rows and columns are numbered beginning with zero. | |
Mathematical Expression | ||
Comments | Units are not required for row and column indices and, if provided, will be ignored. If the row, start column, or end column do not exist in the slot or if the start column is greater than the end column, this function aborts the run with an error. If one of the slot values within the desired time range is a NaN, the function exits the rule with an early termination. |
Description | Sum of a timeseries of values, each of which is the result of aggregating several objects’ slot values. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation function (SUM, AVG, MIN, or MAX) |
4 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
5 | BOOLEAN | time conversion option (TRUE or FALSE) |
6 | DATETIME | start datetime |
7 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the subbasin argument for slots which match the slot name argument. If the time conversion option argument is TRUE, and the values to be aggregated are of the FLOW unit type, the values are multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. Next, all of the objects’ slot values are aggregated according to the aggregation function argument for each timestep in the time range of the datetime arguments. During each of these slot aggregations, any values which do not satisfy the aggregation filter argument are ignored. Finally, the timeseries of object aggregated slot values are summed. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, RiverWare aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, the SUM aggregation function yields an aggregated value of 0.0 for that slot, while the AVG, MIN, and MAX aggregation functions abort RiverWare with an error. |
Description | Sum a slot’s values over a time range, for each object in a subbasin. | |
Type | LIST {LIST {OBJECT, NUMERIC}} | |
Arguments | Type | Meaning |
1 | STRING | Subbasin name |
2 | STRING | slot name |
3 | STRING | aggregation filter (INPUT, OUTPUT, or ALL) |
4 | BOOLEAN | time conversion option (TRUE or FALSE) |
5 | DATETIME | start datetime |
6 | DATETIME | end datetime |
Evaluation | A list of slots is generated by searching all of the objects in the Subbasin argument for slots which match the slot name argument. For each object, the slot’s values over every timestep in the range of the datetime arguments are summed. Any values which do not satisfy the aggregation filter argument are ignored during the calculation. If the time conversion option argument is TRUE, and the values to be summed are of the FLOW unit type, the values are first multiplied by their corresponding timestep length to convert them to values of the unit type VOLUME. | |
Mathematical Expression | ||
Comments | If the time conversion option argument is TRUE, but the unit of the slot values is not FLOW, this function aborts the run with an error. If none of the values for a slot satisfy the aggregation filter argument, this function also aborts RiverWare with an error. |
Description | Given a supply (specified by name), returns a list containing the supply’s attributes, i.e., the supply’s release type and destination. | |
Type | LIST {STRING, STRING} | |
Arguments | Type | Meaning |
1 | STRING | The name of the supply. |
Evaluation | ||
Comments |
Description | This function returns a list of names of Supplies which represent outflows from given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {STRING} | |
Arguments | Type | |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the outflow Supplies that meet the following requirements: • Link an Account on a different downstream Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplyNamesFrom, for each of these Accounts being considered, the names of all related Supplies matching the criteria are added to the returned List. In the case of SupplyNamesFrom1to1, there should be zero or one matching Supplies: • If there are no Supplies matching the criteria, then an empty string (" ") is added to the returned List, or • If there is exactly ONE Supply matching the criteria, then the name of that Supply is added to the returned List, or • If there is more than one Supply matching the criteria, then an error is generated. In this way, the list returned by SupplyNamesFrom is guaranteed to contain exactly one string for each Account in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType or the Destination argument is ALL, then that Supply attribute is ignored. |
Description | This function returns a list of names of Supplies which represent internal flows (i.e. Transfer supplies) from given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {STRING} | |
Arguments | ||
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the outflow Supplies that meet the following requirements: • Link an Account on the SAME Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplyNamesIntra, for each of these Accounts being considered, the names of all related Supplies matching the criteria are added to the returned List. In the case of SupplyNamesIntra1to1, there should be zero or one matching Supplies: • If there are no Supplies matching the criteria, then an empty string (“ “) is added to the returned List, or • If there is exactly ONE Supply matching the criteria, then the name of that Supply is added to the returned List, or • If there is more than one Supply matching the criteria, then an error is generated. In this way, the list returned by SupplyNamesIntra is guaranteed to contain exactly one string for each Account specified in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType or the Destination argument is ALL, then that Supply attribute is ignored. | |
Comments | ReleaseTypes and Destinations are properties of Supplies. |
Description | This function returns a list of names of Supplies which represent inflows to given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the inflow Supplies that meet the following requirements: • Link an Account on a different upstream Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplyNamesTo, for each of these Accounts being considered, the names of all related Supplies matching the criteria are added to the returned List. In the case of SupplyNamesTo1to1, there should be zero or one matching Supplies: • If there are no Supplies matching the criteria, then an empty string (“ “) is added to the returned List, or • If there is exactly ONE Supply matching the criteria, then the name of that Supply is added to the returned List, or • If there is more than one Supply matching the criteria, then an error is generated. In this way, the list returned by SupplyNamesTo is guaranteed to contain exactly one string for each Account in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. | |
Comments |
Description | This function returns a list of names of Supplies which represent internal flows (i.e. Transfer supplies) to given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {STRING} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the inflow Supplies meet the following requirements: • Link an Account on the SAME Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplyNamesToIntra, for each of these Accounts being considered, the names of all related Supplies matching the criteria are added to the returned List. In the case of SupplyNamesToIntra1to1, there should be zero or one matching Supplies: • If there are no Supplies matching the criteria, then an empty string (“ “) is added to the returned List, or • If there is exactly ONE Supply matching the criteria, then the name of that Supply is added to the returned List, or • If there is more than one Supply matching the criteria, then an error is generated. In this way, the list returned by SupplyNamesToIntra is guaranteed to contain exactly one string for each Account specified in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType or the Destination argument is ALL, then that Supply attribute is ignored. | |
Comments | ReleaseTypes and Destinations are properties of Supplies. |
Description | This function returns a list of Supply slots of Supplies which represent outflows from given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {SLOT} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the outflow Supplies that meet the following requirements: • Link an Account on a different downstream Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplySlotsFrom, for each of these Accounts being considered, the Supply slots of all related Supplies matching the criteria are added to the returned List. In the case of SupplySlotsFrom1to1, there should be one matching Supply: • If there are no Supplies matching the criteria, or more than one, then an error is generated. • If there is exactly ONE Supply matching the criteria, then the Supply slot of that Supply is added to the returned List. In this way, the list returned by SupplySlotsFrom1to1 is guaranteed to contain exactly one slot for each Account in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. |
Description | This function returns a list of Supply slots of Supplies which represent internal flows (i.e. Transfer supplies) from given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {SLOT} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the outflow Supplies that meet the following requirements: • Link an Account on the SAME Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplySlotsIntra, for each of these Accounts being considered, the Supply slots of all related Supplies matching the criteria are added to the returned List. In the case of SupplySlotsIntra1to1, there should be one matching Supply: • If there are no Supplies matching the criteria, or more than one, then an error is posted. • If there is exactly ONE Supply matching the criteria, then the Supply slot of that Supply is added to the returned List. In this way, the list returned by SupplySlotsIntra1to1 is guaranteed to contain exactly one slot for each Account in the input list. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. | |
Comments |
Description | This function returns a list of Supply slots of Supplies which represent inflows to given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {SLOT} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the inflow Supplies meet the following requirements: • Link an Account on a different upstream Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplySlotsTo, for each of these Accounts being considered, the Supply slots of all related Supplies matching the criteria are added to the returned List. In the case of SupplySlotsTo1to1, there should be one matching Supply: • If there are no Supplies matching the criteria, or more than one, then an error is generated. • If there is exactly ONE Supply matching the criteria, then the Supply slot of that Supply is added to the returned List. In this way, the list returned by SupplySlotsTo1to1 is guaranteed to contain exactly one slot for each Account in the Source List. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. | |
Comments |
Description | This function returns a list of Supply slots of Supplies which represent internal flows (i.e. Transfer supplies) to given Accounts and which have the indicated ReleaseType and Destination. | |
Type | LIST {SLOT} | |
Arguments | Type | Meaning |
1 | LIST { LIST { OBJECT, STRING } } | Source List: A List of pairs (represented as Lists) containing an Object and an Account Name of an Account on that Object. |
2 | STRING | ReleaseType name or NONE or ALL |
3 | STRING | Destination name or NONE or ALL |
Evaluation | A temporary list of Accounts is created from the Source List. For each of those Accounts, we examine the inflow Supplies that meet the following requirements: • Link an Account on the SAME Object, and • Have the indicated ReleaseType, and • Have the indicated Destination In the case of SupplySlotsToIntra, for each of these Accounts being considered, the Supply slots of all related Supplies matching the criteria are added to the returned List. In the case of SupplySlotsToIntra1to1, there should be one matching Supply: • If there are no Supplies matching the criteria, or more than one, then an error is generated. • If there is exactly ONE Supply matching the criteria, then the Supply slot of that Supply is added to the returned List. In this way, the list returned by SupplySlotsToIntra1to1 is guaranteed to contain exactly one slot for each Account in the input list. If the ReleaseType argument or the Destination argument is NONE, then only Supplies having the default (unassigned) attribute of that type are considered. If the ReleaseType argument or the Destination argument is ALL, then that Supply attribute is ignored. |
Description | Table lookup with linear interpolation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | table slot in which to do lookup |
2 | NUMERIC | "from" column |
3 | NUMERIC | "to" column |
4 | NUMERIC | value in "from" column |
5 | DATETIME | datetime context for unit conversions |
Evaluation | The value argument is looked up in the “from” column of the given table slot to determine the corresponding value in the “to” column. If the exact value is not in the table, the lookup performs a linear interpolation between the two nearest bounding values in the “from” column and their corresponding values in the “to” column. Note: A key assumption of this function is that the “from” column has a value in every row and that those values are sorted in ascending order. NaNs at the bottom of the column are allowed. | |
Mathematical Expression | ||
Comments | If the given slot is not a table slot or if the “from” column or “to” column does not exist in the table, the function aborts the run with an error. Column numbers are zero based with a unit type of NONE. If the “from” value is not the same unit type as the “from” column, or the “from” value is not between the first and last value of the “from” column, the function aborts the run with an error. |
Description | Table lookup with double linear interpolation. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | Table slot on which to do the lookup |
2 | NUMERIC | This is the column number (zero based) corresponding to the first column of data in the table - the data to use for the outer/first interpolation |
3 | NUMERIC | The value to use for the first column |
4 | NUMERIC | This is the column number (zero based) corresponding to the second column of data in the table - the data to use for the inner/second interpolation |
5 | NUMERIC | The value to use for the second column |
6 | NUMERIC | This is the column number of the third column of data in the table - where the answer will be computed |
7 | DATETIME | datetime context for unit conversions |
Evaluation | ||
Mathematical Expression | ||
Comments | If the given slot is not a table slot or if the columns do not exist in the table, the function aborts the run with an error. Column numbers are zero based with a unit type of NONE. If a value is not the same unit type as the values in the corresponding column, the function aborts the run with an error. If the values in the table do not encompass the values passed into the function, the function aborts the run with an error. Also, the values in the columns used for both the inner and outer interpolations MUST BE IN ASCENDING ORDER. NaNs at the bottom of the column are allowed. |
Description | Table lookup to the nearest value, using a user defined tolerance. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | table slot in which to do the lookup |
2 | NUMERIC | "from" column |
3 | NUMERIC | "to" column |
4 | NUMERIC | value in "from" column |
5 | DATETIME | datetime context for unit conversions |
6 | BOOLEAN | whether to round up (or down) |
7 | NUMERIC | The tolerance (including units) to use when comparing the values in the “from” column. See also TableLookupDefaultTol that does not have this argument, but uses a default tolerance value 10-6 in standard units (m, cms, m3,etc) of the “from” column. |
Evaluation | The value argument is looked up in the “from” column of the given table slot to determine the corresponding value in the “to” column. If the round up argument is true and exact value is not in the table, the lookup finds the row whose value is the smallest value larger than the lookup value and returns the value in that row’s “to” column. If the round up argument is false and the exact value is not in the table, the lookup finds the row whose value is the largest value smaller than the lookup value and returns the value in that row’s “to” column. Note: A key assumption of this function is that the “from” column has a value in every row and that those values are sorted in ascending order. NaNs at the bottom of the column are allowed. | |
Comments | Column numbers are zero based with a unit type of NONE. Error conditions include: • the given slot is not a table slot • one of the two column indices are not valid for the table • the lookup value has units which are inconsistent with the from column of the table • the search value is not contained within the table • the tolerance value has units which are inconsistent with the from column of the table Note: Prior to version 7.5, the TableLookup function only had 6 arguments and used a default tolerance of 10-6 using the standard units of the “from” column. In 7.5, calls to TableLookup were replaced automatically with calls to the function TableLookupDefaultTol, described in TableLookupDefaultTol. |
Description | Table lookup to nearest value using a default tolerance. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | SLOT | table slot in which to do lookup |
2 | NUMERIC | "from" column |
3 | NUMERIC | "to" column |
4 | NUMERIC | value in "from" column |
5 | DATETIME | datetime context for unit conversions |
6 | BOOLEAN | whether to round up (or down) |
Evaluation | The value argument is looked up in the “from” column of the given table slot to determine the corresponding value in the “to” column. If the round up argument is true and exact value is not in the table, the lookup finds the row whose value is the smallest value larger than the lookup value and returns the value in that row’s “to” column. If the round up argument is false and the exact value is not in the table, the lookup finds the row whose value is the largest value smaller than the lookup value and returns the value in that row’s “to” column. Note: A key assumption of this function is that the “from” column has a value in every row and that those values are sorted in ascending order. NaNs at the bottom of the column are allowed. | |
Comments | Column numbers are zero based with a unit type of NONE. Error conditions include: • the given slot is not a table slot • one of the two column indices are not valid for the table • the lookup value has units which are inconsistent with the from column of the table • the search value is not contained within the table • the tolerance value has units which are inconsistent with the from column of the table TableLookupDefaultTol uses a tolerance of 10-6 in standard units in its comparison. See TableLookup for a version of this function with a user specified tolerance. Note: Prior to version 7.5, the TableLookup function, described in TableLookup, only had 6 arguments and used a default tolerance of 10-6 in the standard units of the “from” column. In 7.5, calls to TableLookup were replaced automatically with calls to the function TableLookupDefaultTol. |
Description | Computes the outflow required to meet a target pool elevation | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir on which to perform the calculation |
2 | DATETIME | the target begin date |
3 | DATETIME | the target date (target end date) |
4 | NUMERIC | the target pool elevation value |
5 | NUMERIC | the total inflow volume over the target range |
6 | NUMERIC | the previous storage value (before the target begin date) |
Evaluation | This function takes the target pool elevation value and converts it to a storage. This is the storage value desired at the target date. The difference between the target storage and the previous storage is the change in storage over the target range. Since the total inflow volume over the target range is given as an argument, the total outflow volume can be computed. Side flows are automatically included in the mass balance computation and thus should not be included in the inflow value provided in Argument 5. These include Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. If any of the side flow slots contain NaN on one of the target period timesteps, the value will be assumed to be zero on that timestep. Other sources and sinks, such as Evaporation, Precipitation, Bank Storage and Seepage are NOT included in the mass balance computation. The total outflow volume is then converted to a flow rate and divided by the number of timesteps in the target range. The result is a single timestep outflow value. This value needs to be set on the outflow slot for every timestep in the target range in order to meet the target pool elevation. | |
Mathematical Expression | ||
Comments | This function is intended to be used with Storage Reservoirs and Level Power Reservoirs. If using a Slope Power Reservoir, the TargetSlopeHWGivenInflow function should be used. Target operations cannot be done on a Pump Storage Reservoir. This function will issue an error if the Time Varying Elevation Volume method is selected and the target begin and end dates bound a table modification date. See Time Varying Elevation Volume in Objects and Methods for details. |
Description | Computes the outflow required to meet a target pool elevation | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | OBJECT | the reservoir on which to perform the calculation |
2 | DATETIME | the target begin date |
3 | DATETIME | the target date (target end date) |
4 | LIST | the inflow values over the target range (there should be one value for each date in the target range) |
5 | NUMERIC | the target pool elevation value |
6 | NUMERIC | the previous pool elevation value (before the target begin date) |
7 | NUMERIC | the previous storage value (before the target begin date) |
Evaluation | This function takes the target pool elevation value and converts it to a storage. This is an iterative procedure because there is not a one to one relationship between pool elevation and storage on a slope power reservoir. Once the target storage value has been computed, the change in storage over the target range is determined. Since the total inflow volume over the target range is given as an argument, the total outflow volume can be computed. Side flows are automatically included in the mass balance computation and thus should not be included in the inflow value provided in Argument 4. These include Inflow 2, Hydrologic Inflow Net, Diversion, Return Flow, Canal Flow, Flow FROM Pumped Storage, and Flow TO Pumped Storage. If any of the side flow slots contain NaN on one of the target period timesteps, the value will be assumed to be zero on that timestep. Other sources and sinks, such as Evaporation, Precipitation, Bank Storage and Seepage are NOT included in the mass balance computation. The total outflow volume is then converted to a flow rate and divided by the number of timesteps in the target range. The result is a single timestep outflow value. This value needs to be set on the outflow slot for every timestep in the target range in order to meet the target pool elevation. | |
Mathematical Expression | ||
Comments |
Description | Converts a Text Series Slot encoded text (a numeric) into a STRING | |
Type | STRING | |
Arguments | Type | Meaning |
1 | NUMERIC | The value of a text series slot |
Evaluation | Text Series Slots store text as an encoded number. See Text Series Slots in User Interface. This function looks up the numeric value and returns the text as a STRING. If the numeric value is not found in the dictionary of text slot values, i.e. the numeric has never been used on any slot, an error is issued. | |
Comments | See StringToTextSlotNumeric and GetTextSlotValueAsString for similar functions. |
Description | Convert a temperature to a given temperature scale. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | the temperature to convert |
Evaluation | These functions take as input a numeric value representing a temperature in some scale and return the equivalent value in another scale. | |
Comments | It is an error to try to convert a value that is not a temperature (i.e., is not in units of degrees Celsius, degrees Fahrenheit, or Kelvin. |
Description | The steady flow over a timestep corresponding to a volume. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | NUMERIC | volume to be converted |
2 | DATETIME | timestep over which to convert |
Evaluation | The number of seconds in the timestep of the datetime argument is determined. Then, the volume argument is divided by this number of seconds. | |
Mathematical Expression | ||
Comments | When called from a series slot with expression, the volume to flow conversion uses the expression slot timestep size, which may differ from the run timestep. (This is different from the FlowToVolume function, which always uses the run timestep size for the conversion.) |
Description | This function returns a list of the names of all WaterOwners defined in the Water Accounting System Configuration. | |
Type | LIST {STRING} | |
Arguments | none | |
Evaluation | ||
Comments | WaterOwners are properties of Accounts. The returned list does not include the default (NONE) WaterOwner. |
Description | This function returns a list of the names of all WaterTypes defined in the Water Accounting System Configuration. | |
Type | LIST {STRING} | |
Arguments | none | |
Evaluation | ||
Comments | WaterTypes are properties of Accounts. The returned list does not include the default (NONE) WaterType. |
Description | The normalized weighted sum of a list of numbers. | |
Type | NUMERIC | |
Arguments | Type | Meaning |
1 | LIST {NUMERIC} | the values to be summed |
2 | LIST {NUMERIC} | the weights of the values |
Evaluation | The following mathematical expression is computed and returned. | |
Mathematical Expression | ||
Comments | All values must have the same dimensionality but may have different units (e.g., all values could be flows, but some in units of cms and others in cfs). Similarly, all weights must have the same dimensionality. Currently, if the dimensionality of the values or weights involves temperature, then all items in that list must have identical units (e.g., it would not be permitted for some values to have units of Celsius/meter and others to have units of Fahrenheit/meter). |