Thursday, May 31, 2018

Extended Period Dynamic Simulation (Unsteady Flow) in InfoSewer SA

Extended Period Dynamic Simulation (Unsteady Flow)

InfoSewer SA tracks the movement of wastewater flowing through the network over an extended period of time under varying wastewater loading and operating conditions. The extended period simulation (EPS) model implemented in InfoSewer SA is a fully dynamic (unsteady) model and is predicated on solving a simplified form of the full 1D Saint-Venant equations neglecting local acceleration.

 

The Saint-Venant equations or full dynamic wave equations for open channel flow routing consist of the conservation of momentum equation and the equation of continuity. The momentum equation is:

The continuity (mass conservation) equation is:

                                                                                                

where

 

x          =          distance along the pipe (longitudinal direction of sewer)

 

A          =          flow cross sectional area normal to x

 

y          =          coordinate direction normal to x on a vertical plane

 

d          =          depth of flow of the cross section, measured along y direction

 

Q         =          discharge through A

 

V          =          cross sectional average velocity along x direction

 

S0         =          pipe slope, equal to sin θ

 

θ          =          angle between sewer bottom and horizontal plane

 

Sf            =          friction slope

 

g             =          gravitational acceleration

 

t              =          time

 

β          =          Boussinesqmomentum flux correction coefficient for velocity distribution

 

These complete unsteady flow equations (momentum together with continuity) along with appropriate initial and boundary conditions are rather tedious and computationally expensive to solve, especially for large sewer collections systems. As a result, acceptable simplifications and improved solution methods have been proposed including non-inertial, kinematic wave and dynamic wave simplifications. Hydraulically, the dynamic wave approach is the most accurate model among the approximations. The Muskingum-Cunge explicit diffusion wave dynamic flow routing model, obtained by neglecting local acceleration term in the momentum equation, is the most commonly used dynamic wave model.

In InfoSewer SAH20Map SewerPro, unsteady open channel (free surface) flow is simulated using Muskingum-Cunge technique whereas pressurized flow in any pipe is modeled assuming the pipe is flowing full and the energy equation is applied to the entire pipe section.

Muskingum-Cunge:       

where

                       

Here c is the dynamic wave celerity and B is the top width at normal depth for discharge Q. This highly efficient and accurate flow routing algorithm is used by InfoSewer SA to track the spatial and temporal variation of flows throughout the collection system.

In this method (a.k.a., one sweep explicit solution method), the network flow dynamic equations are formulated by using an explicit finite difference scheme such that the flow depth, discharge, or velocity at a given location and the current time can be solved explicitly from the known information at the previous locations at the same time level, as well as known information at the previous time level. Thus, the solution is obtained segment by segment, pipe by pipe, over a given time interval for the entire sewer network before progressing to the next interval for another sweep of individual solutions of the network flow equations for the entire network. A variable time step approach (based on the Courant number  is used to minimize numerical dispersion and ensure robustness and stability of the numerical scheme. Complex flow attenuation calculations can be explicitly carried out to more accurately simulate the movement and transformation of sanitary sewer flows in the collection system.

An excellent review and comparison between simulated and observed hydrographs of the various numerical methods for solving unsteady flow in simple and compound channels was presented by Chatila (Chatila 2003). In terms of overall performance, the Muskingum unsteady solution scheme compared favorably and proved to be a simple and reliable method avoiding complicated mathematical and numerical computations for the cases considered.

Flooding at manholes and wet-wells in InfoSewer is not modeled during an extended period dynamic simulation. Instead, the flows at the flooded structures are conserved and are not lost by the occurrence of flooding at the manholes. In actual flooding situations, flows may be diverted away from the flooded structures and out of the sewer collection system. However, a surcharged pipe or manhole is generally an indication of poor hydraulic performance of the sewer system. InfoSewer SA Pro assumes that the downstream pipes of flooded manholes are flowing full.

Sanitary sewer systems are typically designed to flow less than full and have an upper pressure limit of 4 to 6 psi. Sewer systems operating under pressurized flow condition may run the risk of violating local, state, and federal health codes. The USEPA regulations would also be in violation if raw sewage were discharged into the ground, potentially affecting groundwater. For these reasons, pressurized flows in sanitary sewers not designed to sustain pressures can be dangerous and in some cases can present an unlawful activity.

Surcharge

Sewer pipes can flow full with water under pressure, which is often known as surcharge flow. Surcharge flow occurs in under-designed pipes (or under extreme flows) when the flow rate Q exceeds the full pipe capacity Qf .

Flow conditions are unstable at the transition between open-channel (free surface) flow and full pipe flow. A wave or surge can induce full flow in the pipe in the unstable range. Surcharge in sewer pipes is modeled in InfoSewer SA using energy and continuity principles. The energy equation between sections 1 and 2 in a pipe can be written as:

Here z denotes the invert elevation; d represents the water depth; and HL designates the head loss between sections 1 and 2. The energy equation is used to determine the difference in hydraulic grade line elevation (which is added at the upstream manholes) needed to pass downstream flows under the surcharge condition.

The procedure for analyzing surcharge in sewer pipes is illustrated using the figure below as a reference.

 

Assuming that pipe 4 (between manholes 4 and 5) is under-designed, Q4 will exceed its full flow capacity and the hydraulic grade line at manhole 4 will increase based on energy consideration to allow Q4 to pass through pipe 4 (note that water always flows from higher to lower energy) as continuity must be satisfied. This forces the hydraulic grade line at manhole 3 to increase in order for Q3 to pass through pipe 3. The procedure continues upstream until the slope of the energy grade line needed to transport the flow allows open-channel flow condition to occur in the pipe. The projected hydraulic grade line will then intersect the uniform water surface flow to complete the backwater curve.

The energy equation is also used to model the flow in siphons, which can occur in adverse pipes. InfoSewer assumes that the siphon flows full, with a continuous liquid column throughout it.  This image shows how an adverse sloped link InfoSewer looks

Flow Attenuation

When a flow hydrograph is injected and propagates downstream in sewer pipes the bulk of the water will normally travel slower than its induced disturbance or wave. That is, if the water is injected with a tracer then the tracer lags behind the disturbance. The speed of the disturbance depends on parameters such as depth, width and flow velocity. This disturbance will tend to flatten, or spread out, the peak flow in the downstream direction along the sewer pipes.

Flow attenuation in a sewer system is defined as the process of reducing the peak flow rate by redistributing the same volume of flow over a longer period of time as a result of friction (resistance), internal storage and diffusion along the sewer pipes. InfoSewer SA  uses the distributed Muskingum-Cunge flow routing method based on diffusion analogy, which is capable of accurately predicting hydrograph attenuation or peak flow damping effects (peak subsidence). The method is attractive since the routing parameters can be directly calculated as a function of pipe and flow properties, is applicable for a wide range of flow conditions, and does not require calibration or any iterative scheme. The Muskingum coefficients are derived from the pipe diameter, length, discharge, dynamic wave celerity, and slope of the flow. The magnitude of attenuation depends on parameters such as the peak discharge, the curvature of the hydrograph, and the width of flow. An example of flow attenuation process as a hydrograph is routed through a sewer system is illustrated in the figure below.

Hydrograph Aggregation/Flow Accumulation

Proper aggregation of multiple hydrographs with distinct time steps is essential in a sewer collection system as the flows are routed in both time and space. Aggregation normally occurs when laterals are merging around manholes and wet-wells. This can create offset of time-steps, which can affect accurate determination of flow peaks and volumes. InfoSewer SA utilizes a highly accurate dynamic hydrograph aggregation method that allows preservation of both flow peaks and flow volumes when multiple hydrographs with different time steps are added. The method is Lagrangian in nature and tracks the hydrograph ordinates as they are transported along the sewer pipes and mix together at manholes and wet-wells. A variable time step is used to minimize numerical dispersion, enhance stability, and maximize computational efficiency. See the User Guide for more information on Extended Period Simulations.

 

 

 

Sunday, April 8, 2018

How to Force SWMM5 to use ONLY the Wet Well area for a Pump

Problem:  As SWMM5 is a link node network, the area of a Storage Node is both the area of the Wet Well and typically ½ the surface area of the connecting links.  There is no surface area for the Pump(s) downstream of the Wet Well (Storage) but the area of the upstream links will add to the surface area of the Wet Well.   One Answer:  You can eliminate this issue by adding a in a Dummy link to connect the upstream Gravity Main links to the Wet Well. The Dummy link has no surface area and sets the Outflow of the link to the Total Inflow of the Upstream Node to the Dummy link.   The Wet Well will then only have the surface area of the Wet Well.



An important difference between Capacity d/D and Surcharge d/D in InfoSWMM

An important difference between Capacity d/D and Surcharge d/D in InfoSWMM, Capacity is based on Area and Surcharge d/D is based on Depth



InfoSWMM is a comprehensive tool for the design and management of wastewater and stormwater systems. In InfoSWMM, the terms 'Capacity' and 'Surcharge' are used to describe different aspects of the system's performance under various flow conditions.

Capacity d/D:

The term 'Capacity d/D' in InfoSWMM refers to the ratio of the flow depth (d) to the diameter (D) of the pipe. However, when we talk about 'Capacity', it's crucial to understand that this is derived based on the area of flow within the pipe, not the depth. The 'd/D' ratio here gives us an understanding of how full the pipe is under normal flow conditions. The 'Area' here refers to the cross-sectional area of the flow within the pipe.

This ratio gives an idea of how much of the pipe's total potential flow area is being used. When the ratio is low, the pipe has plenty of additional capacity. When the ratio is close to or at 1, the pipe is at or near its total flow capacity, and any additional flow could result in surcharging.

Surcharge d/D:

'Surcharge d/D', on the other hand, refers to the situation where the flow depth (d) exceeds the pipe's diameter (D) - in other words when water rises above the crown of the pipe. Unlike 'Capacity', which is based on the area of flow, 'Surcharge' is directly concerned with the actual depth of the water above the pipe crown.

In this situation, the pipe is essentially functioning as a pressurized conduit, as it is completely filled with water and the water level in upstream manholes (or other structures) is higher than the crown of the pipe. This is a situation that typically needs to be avoided in gravity-fed systems, as it can lead to backups and overflows.

In conclusion, 'Capacity d/D' and 'Surcharge d/D' represent different operational conditions in a drainage system modeled by InfoSWMM. 'Capacity d/D' is an indicator of how much of the pipe's flow area is being used under normal conditions, while 'Surcharge d/D' is an indicator of conditions when the water level exceeds the top of the pipe, potentially leading to problematic conditions in the system.



Monday, February 12, 2018

How to turn on the option in InfoSWMM to show the SWMM5 RPT file output table for each node, link and Subcatchment

How to turn on the option in InfoSWMM to show the SWMM5 RPT file output table for each node, link and subcatcment; go to the Report Option dialog (1), turn of report all of report selection list (2) and in the output file you will get a time series of the node, link or subcatchment data for making time series (3).

Saturday, February 10, 2018

How to Compile Older SWMM 5 C Engines in Visual Studio 2012

As I move from one PC to another and want to go back  and recompile an earlier version of SWMM5 in a newer version of Visual Studio, I often have file issues.  Here is how I cope using the earlier version of SWMM 5 :
  1. Use Visual Studio 2012 and make a SWMM 5.1011 directory with two sub directories,  C and Delphi Code and the model files needed to run your networks,
  2. Copy the C and H files to the SWMM5 Sub folder  D:\SWMMandSoftware\SWMM5.1.011\SWMM5_Code from the SWMM5 engine zip folder
  3. Rename the vcxproj files so they correspond to the version of SWMM5,  SWMM55101_VC2012-DLL.vcxproj in the D:\SWMMandSoftware\SWMM5.1.011\SWMM5_Code\swmm51011_engine folder
  4. You should be able to compile the Debug or Release versions, the SWMM5.DLL  file will be made in the debug or release D:\SWMMandSoftware\SWMM5.1.011\SWMM5_Code\swmm51011_engine\Release  You can change this location later for testing.


Sunday, January 28, 2018

PySWMM Documentation which is a Python package the allows seamless interaction with the USEPA-SWMM5

Source of this file is https://pypi.python.org/pypi/pyswmm/

Start here to begin working with pyswmm.

The pyswmm package allows seamless interaction with the USEPA-SWMM5
data model.  Parameter getters/setters and results getters have been
exposed, allowing the user to see results while a simulation is
running as well as update link settings.

Loading a Model
---------------

There are three options to load a model. If there is no desire to
interact with the simulation then the simplest way to run the
model is the following:

.. code-block:: python

>>> from pyswmm import Simulation
>>>
>>> sim = Simulation('./testmodel.inp')
>>> sim.execute()


The following method allows the user to read in a model and
manually step through the simulation and get/set parameters and
results.  This scenario is the cleanest solution using a
with statement. It automatically cleans up after the
simulation is complete. 

.. code-block:: python

>>> from pyswmm import Simulation
>>>
>>> with Simulation('./testmodel.inp') as sim:
... for step in sim:
... pass
... sim.report()

One feature that pyswmm adds to the modeling world is the simulation
stride function ``step_advance``.  Assuming a user has developed all
of their control rules in in a Python script, to reduce simulation
time a user can specify how often Python controls should be evaluated. 

For example, let's assume ``testmodel.inp`` has a 30 second routing step
(using the dynamic wave solver, this step could vary significantly).  If
complex control scenarios are developed, evaluating rules could add
significant time to the simulation.

.. code-block:: python

>>> from pyswmm import Simulation
>>>
>>> with Simulation('testmodel.inp') as sim:
... sim.step_advance(300)
... for step in sim:
... print(sim.current_time)
... # or here! sim.step_advance(newvalue)
... sim.report()

2015-11-01 14:05:00
2015-11-01 14:10:00
2015-11-01 14:15:00
2015-11-01 14:20:00

Nodes
-----

For interacting with nodes a :py:class:`pyswmm.nodes.Nodes` object must be initialized.
See the following example. Once the ``Nodes`` object is initialized,
you can then initialize a :py:class:`pyswmm.nodes.Node`

.. code-block:: python

>>> from pyswmm import Simulation, Nodes
>>>
>>> with Simulation('./testmodel.inp') as sim:
... node_object = Nodes(sim)
...
... #J1 node instantiation
... J1 = node_object["J1"]
... print(J1.invert_elevation)
... print(J1.is_junction())
...
... #Step through a simulation
... for step in sim:
... print(J1.total_inflow)
...
... sim.report()


Links
-----

For interacting with nodes a :py:class:`pyswmm.links.Links` object must be initialized.
See the following example. Once the ``Links`` object is initialized,
you can then initialize a :py:class:`pyswmm.links.Link`

.. code-block:: python


>>> from pyswmm import Simulation, Links
>>>
>>> with Simulation('./testmodel.inp') as sim:
... link_object = Links(sim)
...
... #C1:C2 link instantiation
... c1c2 = link_object["C1:C2"]
... print(c1c2.flow_limit)
... print(c1c2.is_conduit())
...
... #Step through a simulation
... for step in sim:
... print(c1c2.flow)
... if c1c2.flow > 10.0:
... c1c2.target_setting = 0.5
...
... sim.report()


Subcatchments
-------------

For interacting with subcatchments a :py:class:`pyswmm.subcatchments.Subcatchments`
object must be initialized. See the following example. Once the ``Subcatchments`` object is initialized,
you can then initialize a :py:class:`pyswmm.subcatchments.Subcatchment`

.. code-block:: python


>>> from pyswmm import Simulation, Subcatchments
>>>
>>> with Simulation('./testmodel.inp') as sim:
... subcatch_object = Subcatchments(sim)
...
... #SC1 subcatchment instantiation
... SC1 = subcatch_object["S1"]
... print(SC1.area)
...
... #Step through a simulation
... for step in sim:
... print(SC1.runoff)
...
... sim.report()


In the example above we introduce the option to change a link's settings.

PySWMM Controls
---------------

The pyswmm package exposes new possibility in interfacing with models.  All control
rules can now be removed from USEPA SWMM5 and brought into Python.  Now that this
functionality exists, open-source Python packages can now be used in conjunction
with pyswmm to bring even more complex control routines. 

The following example illustrates the use of functions for
comparing two depths.

.. code-block:: python

>>> from pyswmm import Simulation, Links, Nodes
>>>
>>> def TestDepth(node, node2):
>>> if node > node2:
>>> return True
>>> else:
>>> return False
>>>
>>> with Simulation('./testmodel.inp') as sim:
... link_object = Links(sim)
...
... #C1:C2 link instantiation
... c1c2 = link_object["C1:C2"]
...
... node_object = Nodes(sim)
... #J1 node instantiation
... J1 = node_object["J1"]
... #J2 node instantiation
... J2 = node_object["J2"]
...
... #Step through a simulation
... for step in sim:
... if TestDepth(J1.depth, J2.depth):
... c1c2.target_setting = 0.5
...
... sim.report()

If an EPA-SWMM5 Model has existing control actions within, any control
rules developed using pyswmm will have the highest priority.  All pyswmm
control actions are evaluated at the end of each simulation step, after
EPA-SWMM native controls have been evaluated.  If control actions are reported,
any control action updated by pyswmm will be output to the *.rpt file.


Generate Node Inflows
---------------------

Among the newest features pyswmm brings to SWMM5 modeling is the ability to
set a nodes inflow.  This can enable the user to model different behavior such as
runoff or seasonality. 

.. code-block:: python

>>> from pyswmm import Simulation, Nodes
>>>
>>> with Simulation('/testmodel.inp') as sim:
... j1 = Nodes(sim)["J1"]
... for step in sim:
... j1.generated_inflow(9)

Thursday, January 18, 2018

How to Set your Model Preferences in InfoSWMM_SA

InfoSWMM SA Preferences



The Operation tab allows the user to control project settings relating to the management of various InfoSWMM SA operations. It should be noted that all the changes made on the Preferences dialog box must be saved prior to closing the dialog box. Many preferences set with this command will be reflected as the default choices on other dialog boxes.  You may change those settings as desired on those dialog boxes.
Contents of the Operation Settings tab of the preferences dialog is described below:
NAME
DESCRIPTION
Auto Length Calculation
Auto Length/Area Calculation
Auto Record Saving
Auto Database Packing
Delete Confirmation
Auto Link Node Inclusion
Check Update / Upgrade
Batch Import on Open
Batch Export on Save
Allow Duplicated Report
Store Absolute Conduit Invert
Allow Project Database Editing Buffer
Edit Diameter of (Filled) Circular Pipe in inch/mm in Attribute Browser
Include Extra Summary Data for Map Display
Use the Simulation Task Manager
Display Each Help Item in its Own Window
On some computers you may need to select this option for the online help to display properly
Text Editor
Length Scaling Factor
Area Scaling Factor
Auto Output Relate Update
Auto Output Retrieval
Auto Output Remembering
Enable Output Save As
Auto Link Delete
Single Output Report Loading
Display Calibration Data in Graph
Sewer Interface
Store Absolute Junction Rim

The Display tab controls visual effects and features within InfoSWMM SA. All changes made on the Preferences dialog box must be saved prior to closing the dialog box.  Many preferences set with this command will be reflected as the default choices on other dialog boxes.  You may change those settings as desired on those dialog boxes.
Contents of the Display Settings tab of the preferences dialog is described below:
NAME
DESCRIPTION
Node Locate Map Extent %
Pipe Locate Zoom Factor
Decimal Placement
Roughness Decimal Placement
Default Domain Highlighting Color
Selection Highlighting Color
Default Inactive Element Color
Default Google Maps Link
Google Maps can be launched from the Attribute Browser.  Choose the default view that the map will be opened in.
Height of Note Editing Box
Show Inactive Elements at a Default Display
Show Link Direction
Arrow Symbol Size
Show Domain With Color Coding
Show Inactive Elements with Color Coding
Show Subcatchment Linkage

The Preferences - Selection Settings command is used to set the user's preferences during selection of elements in InfoSWMM SA project using the available selection tools. All changes made on the Preferences dialog box must be saved (by clicking the OK button) prior to closing the dialog box.  Many preferences set with this command will be reflected as the default choices on other dialog boxes.  You may change those settings as desired on those dialog boxes.
A brief explanation of the elements of the contents:
NAME
DESCRIPTION
Selection Shape
Selection Mode
Selection Tolerance
This setting describes how many pixels away from the mouse pointer will be evaluated for the existence of map elements.  This setting has more significance when you are trying to single-click on a map element instead of trying to select it with the Window or Crossing methods.

The Default Symbols Size tab is used to adjust the size (graphical appearance) of the InfoSWMM SA data elements listed in the dialog editor shown below. All changes made on the Preferences dialog box must be saved prior to closing the dialog box. Many preferences set with this command will be reflected as the default choices on other dialog boxes. You may change those settings as desired on those dialog boxes.
The ID and Description tab allows the user to change InfoSWMM SA defaults for data element naming, data sets, curves, patterns, etc. All changes made on the Preferences dialog box must be saved prior to closing the dialog box. Many preferences set with this command will be reflected as the default choices on other dialog boxes.  You may change those settings as desired on those dialog boxes.
Contents of the ID and Description tab of the preferences dialog is described below:
NAME
DESCRIPTION
ID Suggestion
Data Type
ID Prefix
Next
Increment
Description

This section of the Preferences dialog box provides you with the tools to customize InfoSWMM's SA label settings. All changes made on the Preferences dialog box must be saved prior to closing the dialog box. Many preferences set with this command will be reflected as the default choices on other dialog boxes.  You may change those settings as desired on those dialog boxes.
Contents of the Labeling tab of the preferences dialog is described below:
NAME
DESCRIPTION
Node/Link/Subcatchment Label Settings
Enables specifying different node/link/Subcatchment label settings.
  • Symbol - This launches the Symbol Selector dialog box. Specify the font, color, font size, font color, font fill style and other advanced features here. All the options that you specify here will be used while labelling the nodes/links/Subcatchments.
  • Placement - Use this to specify the label placement. This option is not available for Subcatchments.
  • Text Style Previewer - Once you specify the label text, a preview is displayed in this section. If you do not like the text properties you may change it by clicking on the Symbol button.
Label Node/Link/Subcatchment With IDs
Use this button to label all your nodes/links/Subcatchments.
Clear Node/Link/Subcatchment With IDs
Use this to clear your InfoSWMM SA map node/link/Subcatchment labels by clicking on  this button.


GitHub code and Markdown (MD) files Leveraging

 To better achieve your goal of leveraging your GitHub code and Markdown (MD) files for your WordPress blog or LinkedIn articles, consider t...