diff --git a/concept/allocation.html b/concept/allocation.html index f04a45848..bf15de555 100644 --- a/concept/allocation.html +++ b/concept/allocation.html @@ -578,7 +578,7 @@

4.4 Example

The following is an example of an optimization problem for the example shown here:

-
+
Code
using Ribasim
@@ -600,27 +600,27 @@ 

println(p.allocation.allocation_models[1].problem)

-
Min F[(Basin #5, UserDemand #6)]² + F[(Basin #2, UserDemand #3)]²
+
Min F[(Basin #2, UserDemand #3)]² + F[(Basin #5, UserDemand #6)]²
 Subject to
- F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
- F[(LinearResistance #4, Basin #5)] ≥ 0
- F[(Basin #5, LinearResistance #4)] ≥ 0
+ F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
+ F[(Basin #2, UserDemand #3)] ≥ 0
+ F[(UserDemand #3, Basin #2)] ≥ 0
+ F[(UserDemand #6, Basin #5)] ≥ 0
  F[(Basin #2, LinearResistance #4)] ≥ 0
  F[(LinearResistance #4, Basin #2)] ≥ 0
  F[(Basin #5, UserDemand #6)] ≥ 0
+ F[(LinearResistance #4, Basin #5)] ≥ 0
+ F[(Basin #5, LinearResistance #4)] ≥ 0
  F[(FlowBoundary #1, Basin #2)] ≥ 0
- F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
- F[(UserDemand #3, Basin #2)] ≥ 0
- F[(UserDemand #6, Basin #5)] ≥ 0
- F[(Basin #2, UserDemand #3)] ≥ 0
- flow_conservation[Basin #2] : -F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(FlowBoundary #1, Basin #2)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, UserDemand #3)] = 0
+ F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
+ flow_conservation[Basin #5] : -F[(Basin #5, TabulatedRatingCurve #7)] + F[(UserDemand #6, Basin #5)] - F[(Basin #5, UserDemand #6)] + F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] = 0
+ flow_conservation[LinearResistance #4] : F[(Basin #2, LinearResistance #4)] - F[(LinearResistance #4, Basin #2)] - F[(LinearResistance #4, Basin #5)] + F[(Basin #5, LinearResistance #4)] = 0
  flow_conservation[Terminal #8] : F[(TabulatedRatingCurve #7, Terminal #8)] = 0
- flow_conservation[Basin #5] : F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] - F[(Basin #5, UserDemand #6)] - F[(Basin #5, TabulatedRatingCurve #7)] + F[(UserDemand #6, Basin #5)] = 0
- flow_conservation[LinearResistance #4] : -F[(LinearResistance #4, Basin #5)] + F[(Basin #5, LinearResistance #4)] + F[(Basin #2, LinearResistance #4)] - F[(LinearResistance #4, Basin #2)] = 0
- flow_conservation[TabulatedRatingCurve #7] : -F[(TabulatedRatingCurve #7, Terminal #8)] + F[(Basin #5, TabulatedRatingCurve #7)] = 0
+ flow_conservation[Basin #2] : -F[(Basin #2, UserDemand #3)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(FlowBoundary #1, Basin #2)] = 0
+ flow_conservation[TabulatedRatingCurve #7] : F[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 0
  source[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 172800
- source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
  source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
+ source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
 
diff --git a/dev/callstacks.html b/dev/callstacks.html index ca5123909..00237daf6 100644 --- a/dev/callstacks.html +++ b/dev/callstacks.html @@ -297,7 +297,7 @@

On this page

1 Call stacks

-
+
Code
using CairoMakie
@@ -319,7 +319,7 @@ 

1 Call stacks

1.1 Parameter initialization

Parameter initialization is the process of reading the parameter values from the input files and storing them in data structures for easy access in the core. Most notable here is the convergence of many paths to load_structvector and parse_static_and_time, as these are needed for parameter initialization for most node types.

-
+
Code
using SQLite
@@ -353,7 +353,7 @@ 

1.2 water_balance!

water_balance! is the right hand side function of the system of ODEs that is solved by the Ribasim core (for more details see here). The various formulate_flow! methods are for flow rates as determined by different node types.

-
+
Code
using OrdinaryDiffEqCore: get_du
@@ -375,7 +375,7 @@ 

1.3 Allocation initialization

In this part of the code the data structures for allocation are set up. Most endpoints in allocation_init.jl set up data structures as defined in JuMP.jl.

-
+
Code
toml_path = normpath(
@@ -401,7 +401,7 @@ 

1.4 Allocation run

Running the allocation algorithm consists of running the optimization itself (which is handled in JuMP.jl), and all Ribasim functions around it are used for communicating data between the optimization problem and the physical layer, as well as gathering output data. Fore more information on the allocation algorithm see here.

-
+
Code
model = Ribasim.Model(toml_path)
@@ -420,7 +420,7 @@ 

1.5 Discrete control

Discrete control works by a FunctionCallingCallback, changing parameters when a change in control state is detected (see also here).

-
+
Code
toml_path =
@@ -444,7 +444,7 @@ 

1.6 Writing output

Writing output (currently) happens only after the full simulation is finished. For more information on the different output tables see here.

-
+
Code
toml_path = normpath(@__DIR__, "../../generated_testmodels/basic_transient/ribasim.toml")
@@ -899,7 +899,7 @@ 

-