# Hydrologic and Water Quality Model Development Using Simulink

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Models of Pollutant Transport for Teaching Water Quality Modeling

**Figure 1.**Diagram of a representative problem (Chapra, Problem 10.3) where mass passes from a pond to a channel and is conservatively mixed into a river.

_{in}(g/m

^{3}) represent the constituent concentrations in the reactor and its inflow, W (g/day) is a mass load to the reactor, X (g/day) is the reaction term in the reactor, and Q

_{in}and Q

_{out}(m

^{3}/day) are the inflow and outflow of the reactor, which has a volume V. The pond constituent mass balance uses a solution to Equation (1) that has as its basis a solution for an earlier problem having only a single completely stirred reactor (Figure 4). As compared with previous years where students used either handwritten analytical solutions or Excel spreadsheets, student solutions created in Simulink were found to be much easier to grade. Similarity between student solutions was aided by including with the problem assignment example figures showing a recommended overall model structure and some example x–y plots. Students liked the ability to use components from previous problems in their solution and in general caught on quickly to creating solutions in Simulink. Reuse of the mass balance solution for later problems was found to be straightforward. The solution served as the basis of several problems later in the course.

## 3. A Simple Hydrologic Model Using Simulink

**Figure 5.**Soil Conservation Service (SCS) Method Runoff Calculation Model Using Simulink. Unit hydrograph generation model (

**a**) is run first with output passed to workspace. Runoff calculation (

**b**) reads unit hydrograph from workspace and convolutes signal with incremental runoff time history.

## 4. A Multi-Constituent Water Quality Model Created with Simulink

**Figure 6.**Uppermost system in the one-segment 3-layer water quality (W2SL3) model executed in Simulink. Each box is a separate subsystem for setting inputs and parameters (left) or solving volume, heat, and mass balances (right). Lines and arrows indicate data transfers between subsystems.

**Figure 7.**W2_SL model of segment 1. Separate subsystems (shown with boxes) calculate the heat and mass balances for each layer or the volume balance for all three layers. Lines and arrows indicate data transfers between subsystems.

**Figure 8.**W2_SL model of the mass balances for the surface layer of segment 1 as implemented in Simulink. Separate subsystems (shown with boxes) calculate the organic matter, nutrient, dissolved oxygen and other mass balances for each the layer. Lines and arrows indicate data transfers between subsystems.

**Figure 9.**CE-QUAL-W2 mass balance processes internal to a volume for labile particulate organic matter (LPOM).

**Figure 10.**Labile particulate organic matter (LPOM) constituent found with the nutrient mass balance subsystem within each segment and layer as executed in Simulink.

_{4}was the limiting nutrient) exactly balanced biomass losses through flushing, sinking, mortality, and respiration. Recycling of algal organic matter serves as a source of particulate and dissolved organic matter. As expected, an equilibrium condition was finally established where each water quality constituent asymptotically approached a constant concentration.

**Figure 11.**Comparison of model predictions in the surface layer for orthophosphate (PO

_{4}, top panel), labile particulate organic matter (LPOM, middle panel), and algal organic matter (AOM, bottom panel) for a test case of a pond modeled as one (Simulink) or two (CE-QUAL-W2) horizontal segments. For the CE-QUAL-W2 case, the most downstream of the two horizontal segments is shown.

_{4}, labile particulate organic matter—LPOM, and algal organic matter—AOM) as predicted by CE-QUAL-W2 and W2_SL (Figure 11), show nearly identical values for the asymptotic concentrations, but some transient differences in the concentrations in the first few days of the simulations. The final concentrations for the three constituents varied between 0.0 percent (PO

_{4}) and 0.87 percent (AOM). The PO

**concentration declined more rapidly in the Simulink case, reaching 10 percent of the initial concentration in 10.5 rather than 13.1 days (Table 1). Smaller relative differences were observed between the corresponding LPOM and AOM peak concentrations (1.63 and 0.88 percent) and the times to peak AOM concentration (11.1 percent, Table 1). These differences are thought to be due to the different physical configuration of the two systems and not to model errors or limitations of the modeling approach. We are currently developing a Simulink model having two horizontal segments that will allow for a better comparison test between the two models.**

_{4}**Table 1.**Comparison of representative statistics for predictions of orthophosphate (PO

_{4}), labile particulate organic matter (LPOM), and algal organic matter (AOM, bottom panel) for a test case of a pond modeled as one (Simulink) or two (CE-QUAL-W2) horizontal segments.

Statistic | Simulink Value | CE-QUAL-W2 | Percent Difference |
---|---|---|---|

PO_{4}, time to 10% of initial concentration (days) | 10.5 | 13.1 | 19.9 |

PO_{4}, final concentration (g/m^{3}) | 0.001 | 0.001 | 0.0 |

LPOM, peak concentration (g/m^{3}) | 2.054 | 2.021 | 1.63 |

LPOM, final concentration (g/m^{3}) | 1.640 | 1.648 | 0.49 |

AOM, peak concentration (g/m^{3}) | 5.826 | 5.878 | 0.88 |

AOM, time to peak (days) | 14.4 | 16.2 | 11.1 |

AOM, final concentration (g/m^{3}) | 4.514 | 4.475 | 0.87 |

**.**Small groups of students were assigned responsibility for creating submodels of individual constituents such as ammonia, dissolved oxygen, or BOD. Other students were responsible for connecting the submodels together and generating model solutions for the group.

## 5. Discussion and Conclusions

## Acknowledgments

## Conflicts of Interest

## References

- Mooij, W.M.; Trolle, D.; Jeppesen, E.; Arhonditsis, G.; Belolipetsky, P.V.; Chitamwebwa, D.B.; Degermendzhy, A.G.; DeAngelis, D.L.; Domis, L.N.D.S.; Downing, A.S. Challenges and opportunities for integrating lake ecosystem modelling approaches. Aquat. Ecol.
**2010**, 44, 633–667. [Google Scholar] [CrossRef] [Green Version] - Ambrose, R.B.; Wool, T.A.; Martin, J.L. The Water Quality Analysis Simulation Program, Wasp5, Part A: Model Documentation; Environmental Research Laboratory, US Environmental Protection Agency: Athens, GA, USA, 1993. [Google Scholar]
- Hamrick, J.M. A Three-Dimensional Environmental Fluid Dynamics Computer Code: Theoretical and Computational Aspects; Virginia Institute of Marine Science and College of William and Mary: Williamsburg, VA, USA, 1992. [Google Scholar]
- Park, K.; Kuo, A.Y.; Shen, J.; Hamrick, J.M. A Three-Dimensional Hydrodynamic-Eutrophication Model (Hem-3d): Description of Water Quality and Sediment Process Submodels; Virginia Institute of Marine Science: Gloucester Point, VA, USA, 1995. [Google Scholar]
- Brown, L.C.; Barnwell, T.O. The Enhanced Stream Water Quality Models Qual2e and Qual2e-Uncas: Documentation and User Manual; Environmental Research Laboratory, Office of Research and Development, US Environmental Protection Agency: Athens, GA, USA, 1987. [Google Scholar]
- Cerco, C.F.; Cole, T. Three-dimensional eutrophication model of chesapeake bay. J. Environ. Eng.
**1993**, 119, 1006–1025. [Google Scholar] [CrossRef] - Cole, T.M.; Buchak, E.M. CE-Qual-W2: A Two-Dimensional, Laterally Averaged, Hydrodynamic and Water Quality Model, Version 2.0, User Manual; Instruction Report EL-95-1; U.S. Army Corps of Engineers: Washington, DC, USA, 1995. [Google Scholar]
- Bowen, J.D.; Hieronymus, J.W. A ce-qual-w2 model of neuse estuary for total maximum daily load development. J. Water Resour. Plann. Manag.
**2003**, 129, 283–294. [Google Scholar] [CrossRef] - Bowen, J.D.; Rajbhandari, N. Estimating dissolved oxygen depletion from anthropogenic and riverine loadings using a three-dimensional water quality model. In Estuarine and Coastal Modeling, Proceedings of the Twelfth International Conference, St. Augustine, FL, USA, 7–9 November 2011; ASCE Publications: Reston, VA, USA, 2012; p. 274. [Google Scholar]
- Froelich, B.; Bowen, J.; Gonzalez, R.; Snedeker, A.; Noble, R. Mechanistic and statistical models of total Vibrio abundance in the neuse river estuary. Water Res.
**2013**, 47, 5783–5793. [Google Scholar] [CrossRef] [PubMed] - Peacock, S. The use of Simulink for process modelling in the sugar industry. Proc. S. Afr. Sug. Technol. Ass.
**2002**, 76, 444–455. [Google Scholar] - Kalagasidis, A.S.; Weitzmann, P.; Nielsen, T.R.; Peuhkuri, R.; Hagentoft, C.-E.; Rode, C. The international building physics toolbox in Simulink. Energy Build.
**2007**, 39, 665–674. [Google Scholar] [CrossRef] - Smets, I.Y.; Haegebaert, J.V.; Carrette, R.; Van Impe, J.F. Linearization of the activated sludge model asm1 for fast and reliable predictions. Water Res.
**2003**, 37, 1831–1851. [Google Scholar] [CrossRef] [PubMed] - Rosen, C.; Vrecko, D.; Gernaey, K.; Pons, M.-N.; Jeppsson, U. Implementing ADM1 for plant-wide benchmark simulations in Matlab/Simulink. Water Sci. Technol.
**2006**, 54, 11–19. [Google Scholar] [CrossRef] [PubMed] - Vrecko, D.; Gernaey, K.; Rosen, C.; Jeppsson, U. Benchmark simulation model no 2 in Matlab–Simulink: Towards plant-wide wwtp control strategy evaluation. Water Sci. Technol.
**2006**, 54, 65–72. [Google Scholar] [CrossRef] [PubMed] - Åmand, L.; Carlsson, B. Optimal aeration control in a nitrifying activated sludge process. Water Res.
**2012**, 46, 2101–2110. [Google Scholar] [CrossRef] [PubMed] - Achleitner, S.; Möderl, M.; Rauch, W. City drain
^{©}—an open source approach for simulation of integrated urban drainage systems. Environ. Model. Softw.**2007**, 22, 1184–1195. [Google Scholar] [CrossRef] - Ahlman, S.; Svensson, G. Modelling substance flows in urban sewer systems using Matlab/Simulink. Bridges
**2002**, 10, 101. [Google Scholar] - Astaraie-Imani, M.; Kapelan, Z.; Fu, G.; Butler, D. Assessing the combined effects of urbanisation and climate change on the river water quality in an integrated urban wastewater system in the UK. J. Environ. Manag.
**2012**, 112, 1–9. [Google Scholar] [CrossRef] - Fu, G.; Butler, D.; Khu, S.-T. The impact of new developments on river water quality from an integrated system modelling perspective. Sci. Total Environ.
**2009**, 407, 1257–1267. [Google Scholar] [CrossRef] [PubMed] - Giusti, E.; Marsili-Libelli, S.; Gualchieri, A. Modelling a coastal lake for flood and quality management. In Watermatex 2011, Proceedings of the 8th IWA Symposium on Systems Analysis and Integrated Assessment, San Sebastian, Spain, 20–22 June 2011; International Water Association: London, UK, 2011; pp. 396–403. [Google Scholar]
- Gnauck, A.; Luther, B.; Krug, W. Using a commercial optimisation tool for fine tuning of parameters of an eutrophication model. In Environmental Software Systems: Frameworks of Environment; Springer: Heidelberg, Germany, 2011; pp. 618–624. [Google Scholar]
- Mitreski, K.; Naumoski, A. Dynamic model and estimation of the future eutrophication for the Lake Prespa. In Proceedings of the 2nd IASME/WSEAS International Conference on Energy and Environment, Portoroz, Slovenia, 15–17 May 2007; World Scientific and Engineering Academy and Society (WSEAS): Portoroz, Slovenia, 2007; pp. 44–49. [Google Scholar]
- Boulmalf, M.; Semmar, Y.; Lakas, A.; Shuaib, K. Teaching Digital and Analog Modulation to Undergradute Information Technology Students Using Matlab and Simulink. In Proceedings of IEEE EDUCON Education Engineering 2010—The Future of Global Learning Engineering Education, Madrid, Spain, 14–16 April 2010; IEEE: Piscatway, NJ, USA, 2010; pp. 685–691. [Google Scholar]
- Tessarolo, A. Modeling and simulation of multiphase machines in the Matlab/Simulink environment. In Engineering Education and Research Using MATLAB; Assi, A.H., Ed.; InTech: Rijeka, Croatia, 2011; Chapter 1. [Google Scholar]
- Cathers, B.; Boyd, M.; Craig, E.; Chadwick, M. Modelling for environmental engineering students using Matlab and Simulink. In Proceedings of IEEE International Conference on Multi Media Engineering Education, Melbourne, Australia, 3–5 July 1996; IEEE: Piscatway, NJ, USA, 1996; pp. 261–268. [Google Scholar]
- Morgenroth, E.; Arvin, E.; Vanrolleghem, P. The use of mathematical models in teaching wastewater treatment engineering. Water Sci. Technol.
**2002**, 45, 229–233. [Google Scholar] [PubMed] - Bayrakceken, M.K.; Arisoy, A. An educational setup for nonlinear control systems: Enhancing the motivation and learning in a targeted curriculum by experimental practices [focus on education]. Control Systems IEEE
**2013**, 33, 64–81. [Google Scholar] [CrossRef] - Durán, M.J.; Gallardo, S.; Toral, S.L.; Martínez-Torres, R.; Barrero, F.J. A learning methodology using Matlab/Simulink for undergraduate electrical engineering courses attending to learner satisfaction outcomes. Int. J. Technol. Des. Educ.
**2007**, 17, 55–73. [Google Scholar] [CrossRef] - Schnoor, J.L. Environmental Modeling: Fate and Transport of Pollutants in Water, Air, and Soil; John Wiley and Sons: Hoboken, NJ, USA, 1996. [Google Scholar]
- Thomann, R.V.; Mueller, J.A. Principles of Surface Water Quality Modeling and Control; Harper & Row, Publishers: New York, NY, USA, 1987. [Google Scholar]
- Martin, J.L.; McCutcheon, S.C. Hydrodynamics and Transport for Water Quality Modeling; CRC Press: Boca Raton, FL, USA, 1998. [Google Scholar]
- Chapra, S.C. Surface Water-Quality Modeling; Waveland Press: Salem, WI, USA, 2008. [Google Scholar]
- Chin, D.A. Water-Quality Engineering in Natural Systems: Fate and Transport Processes in the Water Environment; John Wiley & Sons: Hoboken, NJ, USA, 2012. [Google Scholar]
- USDA. Urban Hydrology for Small Watersheds; Technical Release 55; Conservation Engineering Division, Natural Resources Conservation Service, United States Department of Agriculture: Washington, DC, USA, 1986; pp. 2–6. [Google Scholar]

© 2014 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Bowen, J.D.; Perry, D.N.; Bell, C.D.
Hydrologic and Water Quality Model Development Using Simulink. *J. Mar. Sci. Eng.* **2014**, *2*, 616-632.
https://doi.org/10.3390/jmse2040616

**AMA Style**

Bowen JD, Perry DN, Bell CD.
Hydrologic and Water Quality Model Development Using Simulink. *Journal of Marine Science and Engineering*. 2014; 2(4):616-632.
https://doi.org/10.3390/jmse2040616

**Chicago/Turabian Style**

Bowen, James D., David N. Perry, and Colin D. Bell.
2014. "Hydrologic and Water Quality Model Development Using Simulink" *Journal of Marine Science and Engineering* 2, no. 4: 616-632.
https://doi.org/10.3390/jmse2040616