This model uses the Hardy Cross method to calculate flows in a network of interconnected pipes. This method uses iteration (a Looping Container) that solves for flows inside the network when the flows outside are known. The method balances heads using an initial guess that satisfies continuity of flow at each junction and then balances the flows until continuity of head loss potential is also achieved over each loop in the system.

The method is as follows:

- Guess the flows in each pipe, making sure that the
*total in flow*is equal to the*total out flow*at each junction.*In GoldSim, I Splitter, Sum, and Allocator elements to establish continuity of flow.* - Determine each closed loop in the system. In this model, there are 4 loops. Also find the pipes that are shared by more than 1 loop. These are considered the "common segments".
- For each loop, determine the clockwise head losses and counterclockwise head losses. Head loss in each pipe is calculated using the Hazen-Williams friction loss equation. Clockwise head losses are from flows in the clockwise direction and likewise for counterclockwise.
- Determine the total head loss in the loop by subtracting the counterclockwise head loss from the clockwise head loss.
- For each loop of the Looping Container, find change in flow and head without reference to direction (all values should be positive).
- If the change in flow is positive, apply it to all pipes of the loop in the counterclockwise direction. If the change in flow is negative, apply it to all pipes of the loop in the clockwise direction. Subtract the change in flow from the common segment of other loops, if applicable.
- Continue from step 3 until the change in the maximum flow is within a satisfactory range.

Here is a screen capture of the elements used to initialize pipe flows in all the loops while maintaining continuity of flow. This is done for every time step of the model. In the case of this model, I use Stochastic elements to define the changing inflows and demands on the network.

A Submodel is used to run the Hardy Cross looping. The Submodel allows me to re-initialize the first guess of flows before the looping starts. Calculated flows are then exposed on the output interface of the Submodel to view in the Dashboard as shown in the first image above.

The head loss and change in flow calculations are done in separate Containers for each of the flow loops in the network.

The Looping Container stops iterating when convergence is achieved.

To test to make sure flows can change direction, I shut off Node D outflow from hour 12-18. During this time, all the discharge is re-routed over to Node F.

## Comments

0 comments

Please sign in to leave a comment.