Algorithms

Gravity

As seen in Gravity, the network of pipes is shaped as a tree. Ruralwater models the network of pipes as a directed acyclic graph (i.e.: a tree) whose nodes are the pathways.

here is a pdf file pdf

Check problem

The hydraulic check problem algorithm is the following:
  • create the hydraulic energy equations of the law of Bernoulli, where the known data are: the friction per unit water flow, the elevation at the spring and at all the reservoirs.

  • create the water flow continuity equations for each pathway that has children.

  • the unknowns are: the water flow in each pathway

  • create the symbolic equations of the law of Bernoulli

  • create the symbolic equations of the law conservation of water flow

  • consider the equations above as a system of equations and solve it.

  • once the system of equation is solved, consider the water flow obtained in each pathway and calculate the hydraulic energy along each pathway.

  • detect if at any point in any of the pathways, the resulting water pressure (hydraulic energy minus elevation) exceeds the pressure limit for the pipe used in that position.

Design problem

The overbanking energy, an introductory concept, is now introduced.

Overbanking energy

Water flows from higher to lower hydraulic energy… 💪 Therefore we set recursively the minimum hydraulic energy at a pathway’s tail end to be the energy at the head end plus “some energy” to allow a difference of hydraulic energy along the pathway and therefore the water flow. Typically the overbanking energy is the elevation plus “some energy”, but in the case that the pathway climbs a hill then the overbanking energy is the highest elevation point downstream plus “some energy”.

Steps of the algorithm

The idea is then to perform a “search” by inspecting all possible combinations of hydraulic energy the pathways. This is therefore a permutation. For the allowed value of energy, the root pathway has a tail end energy fixed (it is the elevation), each of the leaves have a head end fixed energy (their elevations). The permutations regard therefore the head energy of the root pathway, the tail energy of the leaves pathways and both tail and head energy of each pathway that are neither root nor leaf. Also, the permutation must be limited to those combinations that allow an energy differential between tail and head end. The goal of the coroutine is exactly to ensure the above conditions. This is so because the coroutine is a generator that allow to loop and ensure the above conditions. Since this process must be valid for each possible topology of the branched network, then the coroutine is in charge of tackling this problem in a generic approach valid for each topology.

Image “5_pathways_overbank - only maxmin hydr energy” shows this idea.

  • the “Tee Up” may have a max energy of X otherwise water could not flow from the spring

  • the “Tee left” must

  • the same logic applies to “Tee right”

  • The pathways are nodes and some of them are leaves.

  • the algorithm breaks down the tree of pathways into the pressure zones

  • for each pressure zone it executes the steps below

  • it sets the hydraulic energy at the tail end of the root node to be identical to the elevation at that end

  • it sets the hydraulic energy at the head end of each leaf node to be identical to the elevation at that end

  • it traverses the tree with a ‘depth-first search’ methodology

  • while performing such depth-first search, it sets the ‘over-banking’ hydraulic energy to each node (apart from the leaves nodes) tail end. QUESTA FRASE IN MAIUSCOLO EST INCOMPLETA : THIS OVERBANKING ENERGY IS SET RECURSIVELY TO BE “A BIT” GREATER THAN THE OVERBANKING ENERGY AT THE LEAF NODES. COSA FAI AI NODI INTERNI? NON LO HA DETTO

  • it permutes through all the combinations of over-banking energy at each non-leaf node. At this point each pathway has a value of tail end and head end hydraulic energy set.

  • it evaluates the most economic pipes for those values of energy; this is the XXX algorithm and is still source of study. The evaluation of which are the most economic pipes cannot be solved by use of the simplex algorithm (as other softwares do) becasue we are dealing with hilly profiles (rural indeed) and therefore the pipe pressure classes must be taken in account and the problem to solve becomes non-convex. So, no simplex algorithm of use here…. 😞

  • it sums the economic cost from each pathway

  • it selects the solution which led to the lowest economic cost.

The image below gives an idea:
_images/5_pathways_overbank.svg

Electric Station

Check problem

TODO

Design problem

TODO

Electricless Station

Check problem

TODO

Design problem

TODO