Starting from the 80’s the increasing interest for the protection of the water ecosystems, and thus for biotechnologies applied to the wastewater treatment (WWT), lead to the development of equations for the description of the processes occurring inside the plants. These equations and their further developments were put together in the so called “Activated Sludge Models” (ASMs) which, as the name suggest, can provide a complete description of the biological processes related to the biomasses involved in the wastewater treatment. Nevertheless, even if the ASMs allowed to precisely simulate almost every plant configuration, at that time there were no tools (i.e. PC) available for the solution of the differential equations systems needed as well as user friendly interfaces, so the ASMs could only be applied for research purposes until recent times. Starting from the ASMs, writing mass balances related to specific configurations and applying simplifications to decrease the complexity of the equations, the formulas still reported in the WWT engineering manuals were developed, representing for a long time the only available calculation method.

The nowadays technology, together with the continuous improvement of the ASMs, allow to reproduce almost every activated sludge plant configuration, and so the simulation of the related processes without the need of any simplification in the mass balances.

### How does a simulation software actually work?

Let’s consider Figure 2 which shows a particularly complex configuration reproduced through a simulation software.

**Figure 2**:example of complex configuration reproduced through a simulation software

Let’s focus on the bioreactor called “Ox 1.1” which is zoomed in Figure 3.

**Figure 3**: zoom on the element “Ox 1.1”

The bioreactor “Ox 1.1” is simulated as a CSRT (Completely Stirred Tank Reactor) i.e. as a volume inside which there are no concentrations gradients in any direction, thus showing the same homogeneous concentration inside the volume itself and in the outlet flowrate.

For every state variable the software can calculate the reactor mass balance which can be expressed as:

*IN ± R – OUT* **= ?**

**Equation 1**: mass balance of a chemical/biochemical reactor

Where:

**IN**: is the inlet load;**R**: is the factor considering the chemical/biological transformation the compound undergoes;**OUT**: represents the outlet load.

If, for example, we consider the state variable related to the ammonia nitrogen (N-NH_{4}^{+}), the software calculates the inlet load as the sum of the loads coming in through the inlet flowrates 1,2 and 3 and then, depending on the dissolved oxygen (DO) concentration realized in the tank (which is calculated through another mass balance related to the DO conc. state variable), on the TSS concentration, on the SRT (Solid Retention Time) and many other factors, calculates the rate of every reaction related to the ammonia nitrogen which are:

**Consumption of N-NH**_{4}^{+}because of the oxidation performed by AOB (Ammonia Oxidizing Bacteria);**Production of N-NH**_{4}^{+}through ammonification of organic nitrogen;**Consumption of ammonia nitrogen for the synthesis of the biomass.**

This mass balance is the base of every calculation related to the chemical and biochemical reactors, but the calculation of the mass balances through a simulation software brings some advantages:

**It is possible to reproduce almost every plant configuration regardless of the complexity**, and the software can describe the processes through a differential equations system specifically built on the basis of the scheme to simulate. This is the main difference between the conventional calculation methods which are based on formulas only suitable for certain configurations which they’re developed for;**The software calculates the mass balance for every state variable (N-NH**automatically providing the values of the concentrations in very point;_{4}^{+}, N-NO_{3}^{–},N-NO_{2}^{–}, P-PO_{4}^{3-}, COD etc…) and in every point of the specified scheme,- If a
**steady state simulation**is run, as per mathematical definition, the software applies a numerical method to solve the differential equations system describing the plant, i.e. determining the values of the state variables which nullify all the above mentioned differential equations. Essentially in the previously considered mass balance, the value of the ammonia nitrogen concentration has to nullify the mass balance itself at steady state. If the operating conditions don’t allow the steady state, the software is not able to find a steady state solution! **If the plant is not in steady state conditions, a dynamic simulation can be run!**A typical example is when the excess sludge flowrate to get a higher TSS (Total Suspended Solids) concentration in the reactors. In this situation, the software can calculate the value of every state variable in each moment, providing the outlet concentration profile over time for the whole period of TSS accumulation.