New Real-Time Digital Twin Can Forecast Storm Water Overflows

March 7, 2022
Designing better digital twins can help address the escalating dynamics that cause water quality and overflow risks for urban areas

Digital twins for modeling urban storm water flows are becoming more sophisticated as researchers develop greater insight through a new set of equations. This makes real-time, interactive control of water systems possible. The free, open-source code for the “pipedream” software toolkit for water systems is now on Github. It was developed by researchers at University of Texas at Austin and University of Michigan. 

How does this new toolkit differ from the previous digital twins many cities are using? The answer is in the October 2021 paper from ScienceDirect, “Pipedream: An interactive digital twin model for natural and urban drainage systems,” that shows what the mathematical model is for the Python code. It is real-time data assimilation that sets pipedream apart from earlier models.   

“There is currently no fully physically-based interactive storm-water model that provides real-time data assimilation capabilities,” the paper said. “To ensure that storm-water systems achieve desired outcomes, water managers are now seeking to build digital twins of real-world networks that use embedded sensors and online models to monitor system dynamics in real-time.”

Water-Utility Risks Cities Face 

Designing better digital twins can help address the escalating dynamics that cause water quality and overflow risks for urban areas. As climate change deepens, city populations grow and cities get older, water systems are at risk of flooding and contamination, the paper said. 

“Flooding, in general, is the number one cause of natural-disaster fatalities,” said Matt Bartos, Assistant Professor of Civil, Architectural and Environmental Engineering at University of Texas at Austin, who is the lead author of the paper. 

Finding out what is happening in underground tunnels can be challenging. Pipedream can help water-utility managers interactively discover what is happening in tunnels where sensors are only at a few locations. 

“You can use [pipedream] to try to estimate flooding at points in the sewer network where you don’t have sensors,” Bartos said. “You can send targeted alerts to motorists to avoid people getting trapped at crossings. You could adaptively route traffic around flooded roadways.” 

These are only a few of the advantages real-time control provides. It can also help with two other issues: handling combined sewer overflows and managing contaminants in runoff.  

RELATED: Runoff Treatment

“Some cities have separated sewer systems in which the sanitary systems are separate from the sewer pipes. Older cities have combined systems,” Bartos said. “It’s become a big concern for many cities. They’re looking at ways to control the combined sewer systems.”  

Chemicals can also be washed off roadways into water systems, Bartos said. “Contaminants can cause algal blooms. Pollutants settle out in detention basins.” 

Mathematical Insights

With these challenges facing water utilities, how can insights from this new digital twin help? Its enhanced real-time control can empower managers with an interactive model that shows them exactly what is happening. 

With the three types of equations in pipedream that are shown in the diagram below, water-utility staff can predict overflows throughout their systems – not just at specific points – at any point in time.  

The first group of equations are the “gold standard” for modeling unsteady flow in pipes or channels, Bartos said. They are known in engineering terms as Saint-Venant equations. They have two parts: a mass equation and a force equation. The mass going into the system equals the mass going out of it. And the force equals the mass multiplied by its acceleration. (This second equation is famous: it’s Newton’s second law.) 

  1. The second group consists of the Green-Ampt equations that predict runoff and infiltration based on rainfall and ponding data. 
  2. The third set of equations acts to clean up the quality of the data and bring the digital twin closer to the physical model. They introduce Kalman filtering, which Bartos said removes several types of white noise. The white noise can come from several sources in the pipe and sensor system. 

Digital-Twin Inputs and Outputs

The versatility of inputs and outputs to the data model differentiates pipedream from some other models that are available for water utilities today. As inputs, programmers can put in hydraulic-control actions and forcings, sensor data and surface meteorological analyses, the paper said. For example:  

  • The digital twin takes rainfall and tides into account. 
  • The model includes direct inflows from wastewater-treatment facilities. 
  • The equations also incorporate real-time control inputs from pumps, weirs and orifices. (A weir is a low dam built across a river which regulates flow or moves water upstream.) 
  • The Kalman filter takes in depth- and pressure-sensor data.   

Given these inputs, pipedream calculates the results – the hydraulic and hydrologic data at each point in time. (Hydraulic data relates to liquid moving in systems under pressure. Hydrology is a scientific field that focuses on the properties, distribution and circulation of water on and below the Earth’s surface.)  These results include pressures, discharges and depths. They also include soil infiltration and runoff. 

Programmers can make use of these outputs for data visualization, analysis and control. 

A Combined Sewer System Where Pipedream Could Work  

These equations provide a model that behaves like a real-world river. The authors of the paper modeled flows in one Midwestern river successfully. 

There are many communities where pipedream could provide advantages. One of the many cities that could benefit from pipedream is Alexandria, Virginia, which is currently building an improved system to manage its combined-sewer-system outflows and prevent water contamination. 

In projects like this one, pipedream could provide extensive and interactive detail about flows at a variety of points in the system. Continuous monitoring in combination with real-time control has reduced combined sewer overflows impressively before, the paper said. These improved controls help to save money for water utilities. 

“Our combined sewer system sits in the old part of the city,” said Caitlin Feehan, RiverRenew Program Director at Alexandria Renew Enterprises. “The project is driven out of a 2017 Virginia law regarding remediation of our combined sewer system.” The system improvements are required to be completed by 2025. 

The digital twin for the project was built by Jamie Lefkowitz, National Analytics Engineering Lead at Brown and Caldwell. She said she used a linear-regression model to fit rainfall and rainfall-intensity data to the flow at an outfall of the sewer system. This is more sophisticated than what she sees many cities doing.   

“We set up a pilot of a data model to simulate outflows at Outfall 2,” Lefkowitz said. “We have historic model runs and a hydraulic model. It takes about 20 years of historic rainfall data and collects likely flows throughout the collection system. The coefficients are what we developed with these historic data.”

The output variables are the overflow volume from the outfall and the peak flow rate from the outfall, said Justin Carl, RiverRenew Program Advisor at Alexandria Renew Enterprises. The inputs are the tunnel inflow volume, the peak value of the inflow rate and the duration of the event. 

“Those outfalls will overflow practically every time it rains. That’s what the law was targeting,” Carl said. “After the program, [there will be] less than 17 million gallons on an annual basis. The tunnel picks up flows from Outfalls 1 and 2 and goes to the plant, where we’ll pump it out instead of discharging to the waterways. That will help improve the health of the water bodies.”    

Carl said the weather-forecast data come from the National Oceanographic and Atmospheric Administration. The data analysis is based on a model from Innovyze called XPSWMM. “What we’re doing now is we’re training a regression model for each outflow. That machine learning is looking at a synthetic forecast.”


Cities are currently using a variety of existing models derived from the EPA Stormwater Management Model (SWMM). 

An early MatLab/Python library called MATSWMM simulated real-time control strategies, the paper said. It is no longer being updated. 

Another model, pySWMM, has been used very effectively to simulate real-time control strategies, but has limited representation of system dynamics. So it is difficult to use Kalman filtering with it. 

Opportunities to Create Better Models

As programmers in the water industry work to improve their models, they can reach out to Bartos and his coauthor about collaboration. There are opportunities to make pipedream more user-friendly, for example. The Python toolkit does not have a graphical user interface. It could be developed into a commercial product if it had a polished interactive presence. 

“The term digital twin can take on a lot of different meanings depending on who you’re talking to. What gave me the idea for creating this model was that it fills a need that I saw,” Bartos said. “There was a company I’ve worked with throughout my graduate studies that did this kind of work. [It] had a large sensor system deployed in a city. I saw ways that it could be improved by bringing in some of the theory on how data and physical models should be best reconciled.”

Bartos said he is taking a transparent approach so software developers can use his code. “I’m a big proponent of open source. It’s my responsibility to give that project back to the public.”

A previous version of the paper appeared on EarthArXiv in 2020.

About the Author

Kat Friedrich

Kat Friedrich is an editor and content analyst at Raptor Maps. She also reports for environmental, energy and technology publications. She has edited five news magazines and has a graduate degree from the University of Wisconsin-Madison. You can reach her at or on Twitter at @katsciwriter.