Next Article in Journal
Linking Coral Reef Remote Sensing and Field Ecology: It’s a Matter of Scale
Next Article in Special Issue
Wind Turbine Blade Life-Time Assessment Model for Preventive Planning of Operation and Maintenance
Previous Article in Journal
Jellyfish and Ctenophores in Limfjorden (Denmark)—Mini-Review, with Recent New Observations
Previous Article in Special Issue
Effluent Mixing Modeling for Liquefied Natural Gas Outfalls in a Coastal Ecosystem
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Hydrologic and Water Quality Model Development Using Simulink

1
Civil and Environmental Engineering Department, University of North Carolina at Charlotte, Charlotte, NC 28223, USA
2
Charlotte-Mecklenburg Storm Water Services, 600 East Fourth Street, Charlotte, NC 28202, USA
*
Author to whom correspondence should be addressed.
J. Mar. Sci. Eng. 2014, 2(4), 616-632; https://doi.org/10.3390/jmse2040616
Submission received: 4 December 2013 / Revised: 31 October 2014 / Accepted: 3 November 2014 / Published: 18 November 2014

Abstract

:
A stormwater runoff model based on the Soil Conservation Service (SCS) method and a finite-volume based water quality model have been developed to investigate the use of Simulink for use in teaching and research. Simulink, a MATLAB extension, is a graphically based model development environment for system modeling and simulation. Widely used for mechanical and electrical systems, Simulink has had less use for modeling of hydrologic systems. The watershed model is being considered for use in teaching graduate-level courses in hydrology and/or stormwater modeling. Simulink’s block (data process) and arrow (data transfer) object model, the copy and paste user interface, the large number of existing blocks, and the absence of computer code allows students to become model developers almost immediately. The visual depiction of systems, their component subsystems, and the flow of data through the systems are ideal attributes for hands-on teaching of hydrologic and mass balance processes to today’s computer-savvy visual learners. Model development with Simulink for research purposes is also investigated. A finite volume, multi-layer pond model using the water quality kinetics present in CE-QUAL-W2 has been developed using Simulink. The model is one of the first uses of Simulink for modeling eutrophication dynamics in stratified natural systems. The model structure and a test case are presented. One use of the model for teaching a graduate-level water quality modeling class is also described.

Graphical Abstract

1. Introduction

Mechanistic models of water quality have long been used for predicting the impact of wastewaters on natural water bodies. While the first use of models relied on analytical solutions to problems of point or distributed sources of conventional pollutants (e.g., biochemical oxygen demand (BOD), suspended solids) into rivers, most of the water quality modeling applications these days rely on very large computer codes written with a high-level programming language such as FORTRAN or C++.
Many of the most used water quality models were originally developed in the 1980s and 1990s using FORTRAN as the high-level programming language. FORTRAN is still widely used; for instance, in recent a review of fifteen lake ecosystem models [1], five were written in FORTRAN and another five were written in C++, with the remainder written in other high level languages. These models are similar in concept and execution in that they are capable of modeling the dynamics in multi-dimensional physical systems of water quality properties, nutrients, dissolved oxygen, organic matter, and biota by simultaneously solving conservation equations for heat, momentum, and constituent mass in numerous water volumes. Examples of these sorts of models include the Water Analysis Simulation Program (WASP) [2], the Environmental Fluid Dynamics Code (EFDC) [3] with the water quality formulations described in HEM-3D [4], Qual2E [5], CE-QUAL-ICM [6], and CE-QUAL-W2 [7]. These models are very commonly used in regulatory water quality management (e.g., [8,9]) or to investigate the dynamics of water quality indicators as influenced by dynamic anthropogenic pollutant loading (e.g., [10]).
All of the above referenced models are essentially very large, complex computer codes that are maintained, modified, and manipulated by only a very small group of expert model developers. Manipulation of the code for site-specific or research purposes is not practical for the vast majority of users. There are circumstances, however, when model development is warranted, either when new model state variables are needed, when a special set of water quality processes are appropriate, or when prediction accuracy could be improved by assimilating monitoring data rather than modeling it. Water quality model development is also an important part of education in the field. Making these powerful models more flexible in their formulation through user development could greatly improve their overall utility.
MATLAB/Simulink has been adopted in other fields of engineering as a means for modeling and simulating complex systems without the need to write thousands of lines of computer code during model development. Simulink systems are drawn using a graphical user interface as “block and arrow” diagrams. The Simulink block library is very large and includes math and logic functions, signal generation and processing, visualization, plus many specialized toolboxes (e.g., fuzzy logic, DSP, control systems, neural networks). Lines connecting the blocks represent data signals. Signals can be bundled into buses and selectively unbundled as input into “downstream” blocks. Simulink systems are often operated in a time stepping mode to model the dynamic behavior of the system. As an extension of the MATLAB environment, Simulink models can be easily integrated to read and write data from the workspace and to interact with scripts written with its own high-level programming language.
Simulink has been utilized previously to model the dynamics of engineered systems in a variety of disciplines. Examples of its use in non-environmental systems analysis include process modeling in the sugar industry [11] and building systems modeling [12]. In the area of environmental engineering, Simulink has been used for simulating wastewater treatment plants, either as individual unit processes [13,14], as benchmark simulations of an entire wastewater treatment plant [15,16], for simulation of stormwater systems [17,18], or for integrated models that include both engineered and natural surface water systems [19,20]. Simulink has also been used to model the hydrodynamics and water quality of a few surface water natural systems [21,22,23].
In this article we explore the benefits of Simulink for water quality model development in teaching and research. Of particular interest is how the graphical modeling environment of Simulink can assist new model developers without programming experience as they are introduced to mass-balanced based water quality simulation in a graduate-level course that intentionally includes both instruction and collaborative model development by students. Simulink has been frequently used in engineering education for situations where construction of powerful computational tools for system simulation is an integral part of the pedagogy. For example, Simulink has been used as a teaching aid in courses on digital and analog modulation [24], multiphase electric machines [25], river water quality [26], and wastewater treatment plant operation and control [27]. It has been recognized in the engineering education community that use of tools such as Simulink can provide a “learner-centered” environment whereby students are able to create simulation tools that allow personal experimentation of system behavior (e.g., [28]). Courses structured to include such features can positively affect student interactivity, participation, and course satisfaction [29].
As a case study of water quality modeling instruction and model development with Simulink, we present three examples that were developed either for use in the classroom and/or in research. The first model was developed as an alternative to a spreadsheet solution of conservative flushing and transport through a pond and channel. The second application is a Simulink version of a widely used stormwater runoff hydrology model. The third example describes the finite volume implementation in Simulink of the water quality model CE-QUAL-W2. This application represents one of the first uses of Simulink for modeling dynamic, spatially varying water quality in natural systems.

2. Models of Pollutant Transport for Teaching Water Quality Modeling

Many environmental engineering curricula include a course on mass-balance based surface water quality modeling. These courses build and expand upon the steady-state, one-dimensional dissolved oxygen/BOD modeling that is usually taught at the undergraduate level. The courses rely on process-based descriptions of fate and transport of constituents in surface water systems that are analyzed by solving mass balance equations for one or more of the constituents. The assignments in the courses typically are computationally intensive in keeping with the subject matter. A number of textbooks are available to teach such a course [30,31,32,33,34]; here we examine the use of Simulink in a graduate-level course that has been taught several times using the Chapra text.
An example problem from the Chapra text is used here to illustrate alternative means of model development for quantitative problem solving. In this particular problem (Problem 10.3), conservative dye is being flushed from a completely mixed pond into a channel by a river diversion (Figure 1). The dye exits the pond as an exponentially decaying source of mass to a downstream channel. No mixing occurs in the channel. After a travel period downstream in the channel, the diverted river water containing the dye is conservatively mixed back into the river. The student is asked to calculate the concentration time history at the pond exit, the channel exit, and after mixing into the river.
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.
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.
Jmse 02 00616 g001
Students have typically solved this problem with a spreadsheet solution created using Microsoft Excel (Figure 2). Spreadsheet equations are used to calculate the three needed time histories; Excel charts are created to visualize the results. While not an onerous problem for the students, use of these spreadsheet solutions in the class can present several problems. Students generally know Excel, but they vary widely in their expertise with it. Complex problems can overwhelm their capabilities and their patience with cut and paste solutions, even when problem specific parameter names are used. Solutions often involve long complex equations that are difficult to impossible to debug. Solutions typically have no common look and feel and are therefore time consuming to grade. Finally, there is often little opportunity to reuse spreadsheet solutions from problem to problem.
The use of Simulink as a model development tool for problem solving in the graduate-level water quality modeling course was first piloted in an independent study version of the course. Two students who had previously taken the modeling course were offered an independent study to learn Simulink and demonstrate its use through problem-based model development. After a successful pilot program, Simulink was used as the primary means for student problem solving when the water quality modeling course was offered the following year. The course included one week of training in Simulink followed by another week in the computer lab solving some simple example problems from the Chapra text. Over the remainder of the semester, approximately two Simulink problems were assigned each week over the remainder of the fourteen-week semester. While not all textbook problems were amenable to Simulink solutions, there were sufficient problems available in all sections of the course that could be solved with a Simulink model.
Figure 2. Solution to pond-channel-river problem (Chapra 10.3) created in Excel.
Figure 2. Solution to pond-channel-river problem (Chapra 10.3) created in Excel.
Jmse 02 00616 g002
As an example, the corresponding Simulink solution created by one of the students for the problem described earlier is shown in Figure 3. The Simulink solution couples constituent mass-balance based solutions for the pond, channel, and river. The model also includes a separate subsystem for the volume balance in the pond (Figure 3). Simulink “scope” blocks are used to visualize the concentration time histories at the three locations. The system parameters and concentration time histories are bundled into data buses and passed between the subsystems that need the particular data.
Figure 3. Solution to pond-channel-river problem (Chapra 10.3) created in Simulink.
Figure 3. Solution to pond-channel-river problem (Chapra 10.3) created in Simulink.
Jmse 02 00616 g003
Solution of the constituent mass balance in the pond uses a continuous time integration of the mass balance equation for a completely mixed reactor:
d ( V C ) d t = W + Q i n C i n Q o u t C ± X
where C and Cin (g/m3) 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 Qin and Qout (m3/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 xy 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.
Figure 4. Simulink model of pond mass balance for a constituent.
Figure 4. Simulink model of pond mass balance for a constituent.
Jmse 02 00616 g004

5. Discussion and Conclusions

Our investigation of Simulink has shown that it is possible to create multi-dimensional, multi-constituent finite-volume based water quality models without the use of a high-level programming language. A version of the model with the complete set of CE-QUAL-W2 kinetics is being tested for research use. Currently the model is being tested with the data sets included with CE-QUAL-W2. Simulation times for a 400-day run are approximately 5 minutes. Significantly faster run times are expected once a fully compiled version of the model is created. Once the model has been thoroughly tested, we plan to use it as part of a study investigating toxic byproducts of algal production that have been observed in agricultural ponds in the Limousin region of France. This novel Simulink-based multi-dimensional water quality model seems like a particularly good choice for this application because additional constituents may be needed to simulate the processes that lead to toxin accumulation in the pond. The Simulink model environment has been found to be quite convenient for adding and deleting of constituents in the model depending upon project need.
The model as currently written could be applied for systems with a reasonably small number (1–5) of segments and layers. Additional development is focused on creating a model that can conveniently be applied to systems with many segments and many layers, as these models are commonly used. The model as shown in this article requires manual construction of data links between any new segments and layers, which makes expansion to many segments and layers difficult. In testing now is a procedure that uses the “for each subsystem” Simulink construct that allows for specification of a single set of subsystems (e.g., mass, heat, volume balances) that can simultaneously be applied to all segments and layers of the physical system. Use of this new construct should make the model much easier to expand to multiple horizontal segments and vertical layers.
Our experience with Simulink in the classroom is also promising. Students involved in the pilot test class and the first-time use in the regular course, report that problem solutions created with Simulink take approximately the same time as those earlier made with Excel and are much less tedious to debug and grade. Students report that the copy and paste feature for subsystems and objects makes reuse from problem to problem relatively simple. Overall they had a positive experience in using Simulink as a model development environment in the water quality model course. Based upon these experiences, Simulink will be used for model development the next time the course is taught.

Acknowledgments

This material is based on work supported by the National Science Foundation/National Institutes of Health joint program in ecology and evolution of infectious diseases under grant no. OCE-0813147.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. 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]
  2. 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]
  3. 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]
  4. 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]
  5. 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]
  6. Cerco, C.F.; Cole, T. Three-dimensional eutrophication model of chesapeake bay. J. Environ. Eng. 1993, 119, 1006–1025. [Google Scholar] [CrossRef]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. 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]
  16. Åmand, L.; Carlsson, B. Optimal aeration control in a nitrifying activated sludge process. Water Res. 2012, 46, 2101–2110. [Google Scholar] [CrossRef] [PubMed]
  17. 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]
  18. Ahlman, S.; Svensson, G. Modelling substance flows in urban sewer systems using Matlab/Simulink. Bridges 2002, 10, 101. [Google Scholar]
  19. 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]
  20. 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]
  21. 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]
  22. 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]
  23. 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]
  24. 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]
  25. 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]
  26. 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]
  27. 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]
  28. 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]
  29. 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]
  30. 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]
  31. Thomann, R.V.; Mueller, J.A. Principles of Surface Water Quality Modeling and Control; Harper & Row, Publishers: New York, NY, USA, 1987. [Google Scholar]
  32. Martin, J.L.; McCutcheon, S.C. Hydrodynamics and Transport for Water Quality Modeling; CRC Press: Boca Raton, FL, USA, 1998. [Google Scholar]
  33. Chapra, S.C. Surface Water-Quality Modeling; Waveland Press: Salem, WI, USA, 2008. [Google Scholar]
  34. 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]
  35. 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]

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

Article Metrics

Back to TopTop