I'm using the 'SimpleRouting' objects from the Deltares library to
set up a water supply system in Modelica using a mass balance. Some
reservoirs are connected to some WTPs (water treatment plants) by
pipelines. The WTPs are represented by Terminal boundary conditions.
By applying goals and constraints in Python, the optimization results
in a water supply system that functions as expected. I succeeded in
setting target demands for the WTPs and constraining the connections
between the reservoirs and WTPs according to the real capacities of
In reality the pipelines between the reservoirs and WTPs not only
have a limited capacity, they also have leaks. I'm trying to include
these leaks in the Modelica model aswell, but so far I failed. I tried
by adding an extra node between the reservoir and WTP and connecting
it to another Terminal boundary condition. By setting the 'demand' of
this boundary Terminal to 10% of the demand of the WTP and assigning
it to a goal in the Python script using the same priority as the WTP
demand goal, I try to simulate a leakage of 10%.
However, this does not work since a WTP is connected to multiple
reservoirs and not all reservoirs are used simultaneously to supply
the WTP. And because of this, not all pipelines are used
simultaneously, but the solver still tries to supply water to the
´Leak Terminal´, while that pipeline might not be used during that timestep.
Do you have any suggestions on how to include these leaks in my
Thank you in advance,
With kind regards,
Here a quick idea:
Let's say the water system looks like this:
WTP – branch1 – node – branch2 – reservoir.
Now (following your idea), we connect another
branch (branch3) to node and let it end in a terminal.
For the leakage, we add an equation like
branch3.Qout.Q = 0.1 * branch2.Qout.Q
… would that do the trick?