skip to main content
Water Quality : Water Quality Overview : How Water Quality Modeling Works
How Water Quality Modeling Works
When water quality modeling is enabled and the methods are selected, the water quality slots are instantiated. The water mass balance simulation proceeds as usual with objects dispatching when dispatch conditions are met. Similarly, there are separate dispatch methods for the water quality used to solve how the constituents move through the objects. Water quality dispatch methods are described for each of the objects. Each dispatch method calls a number of utility methods that typically do the work.
Like the mass balance dispatch method, water quality dispatch methods have dispatch conditions. Whenever the water quality dispatch conditions are met for a given method, the object is added to the queue. Water quality dispatch conditions also include water quantity slots. For example, for a reservoir to dispatch for water quality it needs to know Inflow, Outflow, and Storage as well as the inflow salt concentrations, temperature, etc (depending on constituents modeled). The water quality dispatch condition are always solved top down, i.e. after the water balance has been executed for that object. It is not possible to specify or “request” a particular salinity at the lower end of the river and have the system solve for the flow with that salinity. It must first solve for the water quantity, before it can solve for water quality.
The water quality dispatch methods are processed based on the selected process, either Inline or Post, as follows:
• Inline Process: If the Inline Process is selected, at any time dispatch conditions are met, the water quality controller may dispatch object’s water quality dispatch methods. In Inline water quality, there is one dispatch queue that contains both mass balance and water quality dispatch methods. The queue is processed “first in, first out” so mass balance and water quality dispatching may be interspersed.
• Post Process: If the Post Process is selected, water quality dispatching only happens at the end of the run. Two separate queues are maintained, one for mass balance dispatching and one for water quality dispatching. The mass balance queue is processed as usual (at each timestep) while the water quality queue is only processed at the end of the run.
Execution Order
Following is the order of operations for a water quality calculation as part of a regular simulation.
1. Initialization: reset all Output slots to NaN, set Input values, propagate links, and determine first dispatch timestep.
2. Execute Beginning of Run behavior on all objects including Water Quality Beginning of Run checks and evaluation of start of run expression slots.
3. Execute each timestep, as follows:
a. Execute start of timestep expression slots.
b. Execute the Beginning of Timestep on all objects.
c. Execute Timestep: process the dispatch queue until it is empty. If water quality is configured to be an Inline Process, process the water quality dispatch methods when they are on the queue. The queue is first in, first out order.
d. Execute End of Timestep on all objects.
e. Execute end of timestep expression slots.
4. Advance the timestep and repeat the five steps above.
5. Execute End of Run behavior on all objects.
6. If water quality is configured to be Post Process, process the water quality dispatch queue which contains water quality dispatch methods as necessary.
7. Evaluate all end of run expression slots.
Combining water quality with Rulebased Simulation allows the rules to reference water quality slots in making operating decisions. The Inline Process water quality dispatching happens during the timestep when the required dispatch conditions are met. This means that water quality can dispatch multiple times during a timestep based on the values that the rules set and whether the dispatch slots are reset.
In a rulebased simulation run with the Post Process water quality selected, dispatching happens at the end of the run. Rules cannot reference water quality information as it has not been solved yet.
Viewing Water Quality Dispatch Information
The Model Run Analysis tool is used to show dispatching information. See Simulation in Debugging and Analysis for a general description. This utility by default shows object dispatching information for the water quantity solution. When Water Quality is enabled as described above, a Water Quality checkbox is shown on the main Model Run Analysis dialog. When checked, the dialog shows dispatch information for the water quality solution. Double clicking on a cell opens the Dispatch Behavior Details dialog. This dialog has an analogous WQ check box. This details dialog shows the required knowns and unknowns for each dispatch method and the known and unknown status of each slot.
Figure 1.1  Model Run Analysis dialog settings to view water quality data
Note:  You can also show the details dialog docked in the Model Run Analysis using the Details button.
The Water Quality check boxes represent a single state shared among the Model Run Analysis and all instances of the Dispatch Behaviors Detail dialog; clicking the check box in any of these dialogs also changes the check box in all open dialogs of either type.
Note:  When running rulebased simulation and water quality, the model run analysis for water quality only shows the icons indicating dispatch state. There is no analogous Rules Grid for water quality.
Revised: 01/10/2022