diff --git a/concept/allocation.html b/concept/allocation.html index e0d43fbbd..5a0d38b06 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
- 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[TabulatedRatingCurve #7] : F[(Basin #5, TabulatedRatingCurve #7)] - F[(TabulatedRatingCurve #7, Terminal #8)] = 0
- flow_conservation[Basin #2] : F[(FlowBoundary #1, Basin #2)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(UserDemand #3, Basin #2)] - F[(Basin #2, UserDemand #3)] = 0
+ flow_conservation[Basin #5] : F[(LinearResistance #4, Basin #5)] - F[(Basin #5, LinearResistance #4)] - F[(Basin #5, UserDemand #6)] + F[(UserDemand #6, Basin #5)] - F[(Basin #5, TabulatedRatingCurve #7)] = 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[(FlowBoundary #1, Basin #2)] - F[(Basin #2, LinearResistance #4)] + F[(LinearResistance #4, Basin #2)] + F[(UserDemand #3, Basin #2)] = 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, TabulatedRatingCurve #7)] - F[(Basin #5, UserDemand #6)] + F[(UserDemand #6, Basin #5)] = 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
  source[(FlowBoundary #1, Basin #2)] : F[(FlowBoundary #1, Basin #2)] ≤ 172800
- source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
  source_user[UserDemand #6] : F[(UserDemand #6, Basin #5)] ≤ 0
+ source_user[UserDemand #3] : F[(UserDemand #3, Basin #2)] ≤ 0
+ F[(Basin #2, UserDemand #3)] ≥ 0
  F[(FlowBoundary #1, Basin #2)] ≥ 0
  F[(Basin #2, LinearResistance #4)] ≥ 0
  F[(LinearResistance #4, Basin #2)] ≥ 0
  F[(LinearResistance #4, Basin #5)] ≥ 0
  F[(Basin #5, LinearResistance #4)] ≥ 0
- F[(UserDemand #3, Basin #2)] ≥ 0
- F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
  F[(Basin #5, UserDemand #6)] ≥ 0
- F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
- F[(Basin #2, UserDemand #3)] ≥ 0
  F[(UserDemand #6, Basin #5)] ≥ 0
+ F[(TabulatedRatingCurve #7, Terminal #8)] ≥ 0
+ F[(Basin #5, TabulatedRatingCurve #7)] ≥ 0
+ F[(UserDemand #3, Basin #2)] ≥ 0
 
diff --git a/guide/delwaq.html b/guide/delwaq.html index f448eca45..aac663dac 100644 --- a/guide/delwaq.html +++ b/guide/delwaq.html @@ -878,36 +878,36 @@

0 2020-01-01 00:00:00 1 -1.0 -Initial +0.0 +Foo 1464 2020-01-01 00:00:00 1 0.0 -Tracer +Precipitation 2928 2020-01-01 00:00:00 1 0.0 -UserDemand +FlowBoundary 4392 2020-01-01 00:00:00 1 0.0 -Precipitation +UserDemand 5856 2020-01-01 00:00:00 1 -0.0 -Foo +1.0 +Initial ... @@ -920,36 +920,36 @@

11711 2020-12-31 00:00:00 9 -0.999999 -Continuity +0.029654 +LevelBoundary 13175 2020-12-31 00:00:00 9 -0.0 -Drainage +0.509381 +Bar 14639 2020-12-31 00:00:00 9 -0.029654 -LevelBoundary +0.0 +Terminal 16103 2020-12-31 00:00:00 9 -0.509381 -Bar +0.999999 +Continuity 17567 2020-12-31 00:00:00 9 -1.008239 -Cl +0.0 +Drainage @@ -958,7 +958,7 @@

-
{'Initial', 'Tracer', 'UserDemand', 'Precipitation', 'Foo', 'Terminal', 'FlowBoundary', 'Continuity', 'Drainage', 'LevelBoundary', 'Bar', 'Cl'}
+
{'Foo', 'Precipitation', 'FlowBoundary', 'UserDemand', 'Initial', 'Cl', 'Tracer', 'LevelBoundary', 'Bar', 'Terminal', 'Continuity', 'Drainage'}
@@ -986,337 +986,337 @@

8 2020-01-03 00:00:00 1 -0.044259 -Initial +0.034251 +Foo 1472 2020-01-03 00:00:00 1 -0.92149 -Tracer +0.177087 +Precipitation 2936 2020-01-03 00:00:00 1 -0.0 -UserDemand +0.744403 +FlowBoundary 4400 2020-01-03 00:00:00 1 -0.177087 -Precipitation +0.0 +UserDemand 5864 2020-01-03 00:00:00 1 -0.034251 -Foo +0.044259 +Initial 7328 2020-01-03 00:00:00 1 -0.0 -Terminal +1.164538 +Cl 8792 2020-01-03 00:00:00 1 -0.744403 -FlowBoundary +0.92149 +Tracer 10256 2020-01-03 00:00:00 1 -1.0 -Continuity +0.034251 +LevelBoundary 11720 2020-01-03 00:00:00 1 0.0 -Drainage +Bar 13184 2020-01-03 00:00:00 1 -0.034251 -LevelBoundary +0.0 +Terminal 14648 2020-01-03 00:00:00 1 -0.0 -Bar +1.0 +Continuity 16112 2020-01-03 00:00:00 1 -1.164538 -Cl +0.0 +Drainage 9 2020-01-03 00:00:00 3 -0.029275 -Initial +0.851086 +Foo 1473 2020-01-03 00:00:00 3 0.119639 -Tracer +Precipitation 2937 2020-01-03 00:00:00 3 0.0 -UserDemand +FlowBoundary 4401 2020-01-03 00:00:00 3 -0.119639 -Precipitation +0.0 +UserDemand 5865 2020-01-03 00:00:00 3 -0.851086 -Foo +0.029275 +Initial 7329 2020-01-03 00:00:00 3 -0.0 -Terminal +28.936922 +Cl 8793 2020-01-03 00:00:00 3 -0.0 -FlowBoundary +0.119639 +Tracer 10257 2020-01-03 00:00:00 3 -1.0 -Continuity +0.851086 +LevelBoundary 11721 2020-01-03 00:00:00 3 0.0 -Drainage +Bar 13185 2020-01-03 00:00:00 3 -0.851086 -LevelBoundary +0.0 +Terminal 14649 2020-01-03 00:00:00 3 -0.0 -Bar +1.0 +Continuity 16113 2020-01-03 00:00:00 3 -28.936922 -Cl +0.0 +Drainage 10 2020-01-03 00:00:00 6 -0.032499 -Initial +0.03994 +Foo 1474 2020-01-03 00:00:00 6 -0.927561 -Tracer +0.178862 +Precipitation 2938 2020-01-03 00:00:00 6 -0.0 -UserDemand +0.748699 +FlowBoundary 4402 2020-01-03 00:00:00 6 -0.178862 -Precipitation +0.0 +UserDemand 5866 2020-01-03 00:00:00 6 -0.03994 -Foo +0.032499 +Initial 7330 2020-01-03 00:00:00 6 -0.0 -Terminal +1.357952 +Cl 8794 2020-01-03 00:00:00 6 -0.748699 -FlowBoundary +0.927561 +Tracer 10258 2020-01-03 00:00:00 6 -1.0 -Continuity +0.03994 +LevelBoundary 11722 2020-01-03 00:00:00 6 -0.0 -Drainage +0.748699 +Bar 13186 2020-01-03 00:00:00 6 -0.03994 -LevelBoundary +0.0 +Terminal 14650 2020-01-03 00:00:00 6 -0.748699 -Bar +1.0 +Continuity 16114 2020-01-03 00:00:00 6 -1.357952 -Cl +0.0 +Drainage 11 2020-01-03 00:00:00 9 -0.0078 -Initial +0.002296 +Foo 1475 2020-01-03 00:00:00 9 -0.078971 -Tracer +0.029421 +Precipitation 2939 2020-01-03 00:00:00 9 -0.0 -UserDemand +0.04955 +FlowBoundary 4403 2020-01-03 00:00:00 9 -0.029421 -Precipitation +0.0 +UserDemand 5867 2020-01-03 00:00:00 9 -0.002296 -Foo +0.0078 +Initial 7331 2020-01-03 00:00:00 9 -0.0 -Terminal +31.049776 +Cl 8795 2020-01-03 00:00:00 9 -0.04955 -FlowBoundary +0.078971 +Tracer 10259 2020-01-03 00:00:00 9 -1.0 -Continuity +0.913229 +LevelBoundary 11723 2020-01-03 00:00:00 9 -0.0 -Drainage +0.04955 +Bar 13187 2020-01-03 00:00:00 9 -0.913229 -LevelBoundary +0.0 +Terminal 14651 2020-01-03 00:00:00 9 -0.04955 -Bar +1.0 +Continuity 16115 2020-01-03 00:00:00 9 -31.049776 -Cl +0.0 +Drainage diff --git a/guide/examples_files/figure-html/cell-56-output-1.png b/guide/examples_files/figure-html/cell-56-output-1.png index d0914e2c1..ed19b4599 100644 Binary files a/guide/examples_files/figure-html/cell-56-output-1.png and b/guide/examples_files/figure-html/cell-56-output-1.png differ diff --git a/reference/node/basin.html b/reference/node/basin.html index 4a010ef62..9d80d3990 100644 --- a/reference/node/basin.html +++ b/reference/node/basin.html @@ -476,7 +476,7 @@

1.2.1 Interpolation

At the given timestamps the values are set in the simulation, such that the timeseries can be seen as forward filled.

-
+
Code
import numpy as np
@@ -675,7 +675,7 @@ 

1.4.1.1 Level to area

The level to area relationship is defined with the Basin / profile data using linear interpolation. An example of such a relationship is shown below.

-
+
Code
fig, ax = plt.subplots()
@@ -758,7 +758,7 @@ 

\[ S(h) = \int_{h_0}^h A(h')\text{d}h'. \]

-
+
Code
storage = np.diff(level) * area[:-1] + 0.5 * np.diff(area) * np.diff(level)
@@ -803,7 +803,7 @@ 

1.4.1.3 Interactive basin example

The profile data is not detailed enough to create a full 3D picture of the basin. However, if we assume the profile data is for a stretch of canal of given length, the following plot shows a cross section of the basin.

-
+
Code
import plotly.graph_objects as go
@@ -918,9 +918,9 @@ 

fig.show()

-