# RiverWare_Ruleset 5.1.1 Patch
# Created 13:19 July 27, 2009
#
RULESET
AGENDA_ORDER ASCENDING;
DESCRIPTION "";
PRECISION 2;
BEGIN
CATEGORY_GROUP "Storage Account Slot Inflow";
CATEGORY_NAME "Storage Account Slot Inflow";
DESCRIPTION "";
ACTIVE TRUE;
BEGIN
RULE "BlueLake_SlotInflows";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "Split the Hydrologic Inflow in half.";
$ "BlueLake^GreenMtn.Slot Inflow" [] := 0.50000000 * $ "BlueLake.Hydrologic Inflow" [];
$ "BlueLake^Highland.Slot Inflow" [] := 0.50000000 * $ "BlueLake.Hydrologic Inflow" [];
END;
RULE "LongLake_Slot Inflows";
DESCRIPTION "The idea is that once we get above a certain pool elevation, the rest cannot be stored. It becomes available for fish. Below that level, we will divide it evenly for regular users.";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "Set the Slot Inflow on the three storage accounts: Fish, City, and BigBear";
IF_STATEMENT ($ "LongLake.Hydrologic Inflow" [] > $ "LongLakeData.InflowThreshold_Low" [] AND $ "LongLake.Pool Elevation" [@"t - 1"] < $ "LongLakeData.MaxFloodLevel" []) THEN
DESCRIPTION "If the inflow is above the lower threshold and the pool is below the max flood level";
IF_STATEMENT ($ "LongLake.Hydrologic Inflow" [] > $ "LongLakeData.InflowThreshold_High" []) THEN
DESCRIPTION "Fish is assured to get the lower threshold, and gets any inflows that are above the upper threshold; Big Bear and City split the rest.";
$ "LongLake^Fish.Slot Inflow" [] := "Max"( $ "LongLakeData.InflowThreshold_Low" [], $ "LongLake.Hydrologic Inflow" [] - $ "LongLakeData.InflowThreshold_High" [] );
$ "LongLake^BigBear.Slot Inflow" [] := 0.50000000 * ( $ "LongLake.Hydrologic Inflow" [] - "Max"( $ "LongLakeData.InflowThreshold_Low" [], $ "LongLake.Hydrologic Inflow" [] - $ "LongLakeData.InflowThreshold_High" [] ) );
$ "LongLake^City.Slot Inflow" [] := 0.50000000 * ( $ "LongLake.Hydrologic Inflow" [] - "Max"( $ "LongLakeData.InflowThreshold_Low" [], $ "LongLake.Hydrologic Inflow" [] - $ "LongLakeData.InflowThreshold_High" [] ) );
ELSE
DESCRIPTION "Fish gets the lower threshold, BigBear and City split the remaining inflows.";
$ "LongLake^Fish.Slot Inflow" [] := $ "LongLakeData.InflowThreshold_Low" [];
$ "LongLake^BigBear.Slot Inflow" [] := 0.50000000 * ( $ "LongLake.Hydrologic Inflow" [] - $ "LongLakeData.InflowThreshold_Low" [] );
$ "LongLake^City.Slot Inflow" [] := 0.50000000 * ( $ "LongLake.Hydrologic Inflow" [] - $ "LongLakeData.InflowThreshold_Low" [] );
END_IF_STATEMENT;
ELSE
DESCRIPTION "Fish gets ALL of the Hydrologic Inflow when it is low (less than the threshold) or high (greater than the threshold)";
$ "LongLake^Fish.Slot Inflow" [] := $ "LongLake.Hydrologic Inflow" [];
$ "LongLake^BigBear.Slot Inflow" [] := 0.00000000 "cfs";
$ "LongLake^City.Slot Inflow" [] := 0.00000000 "cfs";
END_IF_STATEMENT;
END;
RULE "HappyLake_SlotInflows";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "Fish is allocated all of the Hydrologic Inflows.";
$ "HappyLake^Fish.Slot Inflow" [] := $ "HappyLake.Hydrologic Inflow" [];
DESCRIPTION "The passthrough accounts on the reservoir are assigned zero slot inflows.";
FOREACH (STRING account IN "AccountNamesByAccountType"( ThisObject, "PassThrough" )) DO
ThisObject ~ ( account CONCAT ".Slot Inflow" ) [] := 0.00000000 "cfs";
ENDFOREACH;
END;
END;
CATEGORY_GROUP "Storage Account Gain Loss";
CATEGORY_NAME "Storage Account Gain Loss";
DESCRIPTION "";
ACTIVE TRUE;
BEGIN
RULE "BlueLake_Gain Loss";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "The Evaporation is split between the two accounts.
In the physical system, Evaporation is a positive number.
In the accounting system, for Gain Loss a gain is positive, a loss is negative; hence the negative sign.";
$ "BlueLake^GreenMtn.Gain Loss" [] := - ( 0.50000000 * $ "BlueLake.Evaporation" [] );
$ "BlueLake^Highland.Gain Loss" [] := - ( 0.50000000 * $ "BlueLake.Evaporation" [] );
END;
RULE "LongLake_Gain Loss";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "The Evaporation is split between the City and BigBear accounts proportional to the storage in the respective accounts.
In the physical system, Evaporation is a positive number. In the accounting system, for Gain Loss a gain is positive, a loss is negative; hence the negative sign.";
$ "LongLake^City.Gain Loss" [] := - ( $ "LongLake.Evaporation" [] * ( $ "LongLake^City.Storage" [@"t - 1"] / ( $ "LongLake^City.Storage" [@"t - 1"] + $ "LongLake^BigBear.Storage" [@"t - 1"] ) ) );
$ "LongLake^BigBear.Gain Loss" [] := - ( $ "LongLake.Evaporation" [] * ( $ "LongLake^BigBear.Storage" [@"t - 1"] / ( $ "LongLake^City.Storage" [@"t - 1"] + $ "LongLake^BigBear.Storage" [@"t - 1"] ) ) );
$ "LongLake^Fish.Gain Loss" [] := 0.00000000 "acre-ft";
END;
RULE "HappyLake_Gain Loss";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "The Evaporation is allocated to the Fish account and the passthroughs are set to zero gain loss.
In the physical system, Evaporation is a positive number. In the accounting system, for Gain Loss a gain is positive, a loss is negative; hence the negative sign.";
$ "HappyLake^Fish.Gain Loss" [] := - ( $ "HappyLake.Evaporation" [] );
FOREACH (STRING account IN "AccountNamesByAccountType"( ThisObject, "PassThrough" )) DO
ThisObject ~ ( account CONCAT ".Gain Loss" ) [] := 0.00000000 "acre-ft";
ENDFOREACH;
END;
END;
CATEGORY_GROUP "Reach PassThrough Slot Inflow";
CATEGORY_NAME "Reach PassThrough Slot Inflow";
DESCRIPTION "";
ACTIVE TRUE;
BEGIN
RULE "DeepCreek_Slot Inflow";
DESCRIPTION "";
ACTIVE TRUE;
RULE_EXEC_CONSTRAINT TRUE;
BEGIN
DESCRIPTION "On this reach, the Fish account receives all of the local inflow as Slot Inflows.
The remaining passthrough accounts are assigned zero slot inflow.
This syntax is useful as we can add a passthrough account to the reach and
not have to think about adding an assignment to this method.";
FOREACH (STRING account IN "AccountNamesByAccountType"( ThisObject, "PassThrough" )) DO
ThisObject ~ ( account CONCAT ".Slot Inflow" ) [] := IF ( account == "Fish" )
THEN
$ "DeepCreek_LocalInflow.Local Inflow" []
ELSE
0.00000000 "cfs"
ENDIF;
ENDFOREACH;
END;
END;
END