## 1. Introduction

Recirculating Aquaculture Systems (RAS) have been increasingly used due to the growth of the aquaculture industry [

1]. They can be defined as systems where less than 10% of the total water volume is replaced per day and respond to the need of more intensive practices, growing environmental constraints on water consumption and effluent quality, as well as the possibility to supply fish in places where it would be otherwise difficult [

2,

3]. The main drawback of these systems is the accumulation of some toxic compounds, such as ammonia, when there is no proper treatment. Ammonia can be introduced into the system by fish excretion, 60–70% of the nitrogen consumption by fish being excreted as ammonia through the gills, or the degradation of uneaten feed [

4]. The nitrogen removal process reduces the ammonia level using microorganisms that transform it into nitrate (nitrification). The latter, although much less toxic for fish, also accumulates in the system and needs to be removed to avoid system sustainability and environmental issues. Thus, another unit is often considered in order to convert nitrate into nitrogen gas (denitrification). The use of anaerobic denitrification to remove nitrate is not yet widely applied to commercial RAS due to its level of efficiency, its complexity and cost [

5]. The complexity of RAS, created by its intrinsic closed-loop and the interactions between water treatment and fish grow-out, implies to build dynamic models to analyze the process behavior and to optimize it (configuration, size, fish, feed, flows etc) with respect to cost, robustness and water quality [

6]. Indeed, manual control of denitrifying biofilters may easily lead to an unstable process performance and high cost [

7]. Nitrite, which is toxic for fish, can accumulate in transient phases [

8]. It is an intermediate compound in the denitrification process, a set of four reactions converting nitrate

$N{O}_{3}^{-}$ to nitrogen

${N}_{2}$. Particularly, the lack of carbon source for complete denitrification could make this problem more severe. The absence of nitrite/nitrate/oxygen, however, if large quantities of organic matter exist, causes the production of sulfides (such as hydrogen sulfide) which are also extremely toxic [

9]. Although nitrate control has been addressed many times regarding municipal wastewater treatment, its application in the context of RAS is not widespread [

7,

10,

11,

12]. A multivariable PID control, manipulating recirculation flowrates and aeration to control nitrate levels is proposed in [

12] while an online control strategy/algorithm optimizing a denitrification biofilter through carbon dosage and backwash is shown in [

7]. In [

10], a simple feedback control strategy by methanol addition is used to minimize nitrite production and [

11] proposes an output-feedback control scheme for a wastewater treatment biofilters in order to regulate nitrate and nitrite concentrations.

In this study, a global assessment of nitrate control using acetic acid (pH is considered regulated and constant) as manipulated variable is first achieved and two different control methodologies are considered: a classical PID control whose parameters are estimated by a SIMC tuning method [

13], and a simple model-based linearizing control. PID control is widely used in process industries [

14], and have been extensively used to control WWTPs. Unfortunately, PID controllers may present robustness limitations when applied to nonlinear systems with modeling uncertainties as well as measurement noise. They might indeed require tuning each time the operating conditions significantly vary. Linear controllers, on the other hand, take advantage of the availability of accurate nonlinear models often based on reaction networks and mass balances. However, as bioprocess models generally present uncertain kinetic structures, adaptive and/or robust solutions are required [

15,

16,

17,

18]. Taking advantage of both controller structures, a cascade of PI and linearizing control (accounting for possible model inaccuracies) is further proposed and compared with an adaptive linearizing strategy. The controller performances are tested with regard to typical industrial plant variations: changes in fish density, biofilter nitrate conversion efficiency, effluent guidelines regarding nitrate and water/acid pump malfunction in the denitrification reactor.

## 3. Control Implementation: Classical Approach

This section aims at first designing a classical PID controller to regulate the nitrate level in the denitrification reactor. From the corresponding model of differential Equations (3) and (4), acetic acid is obviously the sole manipulated variable and the following control law is proposed:

where

$\overline{{F}_{Acid}}$ represents the initial acetic acid flowrate ensuring the industrial plant nominal steady-state (

$\overline{{F}_{Acid}}=6.4$ L/h),

$e\left(t\right)$ represents the measurement error,

${K}_{C}$ is the proportional gain,

${\tau}_{I}$ and

${\tau}_{D}$, respectively, are the integral and derivative time constants,

${S}_{NO3}^{*}$ is the desired nitrate concentration setpoint and

${S}_{NO3}\left(t\right)$ is the measured nitrate concentration. Expression (13) therefore aims at compensating any deviation from the chosen nominal steady-state trajectory which is assumed to be a priori knowledge from heuristics. Although (13) only presents three parameters, finding optimal settings without resorting to a systematic procedure may be complex. One way to design the gains is to first focus on the Proportional-Integral (PI) (i.e.,

${\tau}_{D}=0$) part in order to set a satisfactory steady-state response (no steady-state error) and then consider the derivative part to improve the transient response [

13,

23].

In this study, the SIMC design method, as presented in [

13], is chosen since it involves the transfer function of the system which can be easily computed considering a specific operating point and the corresponding step response, for instance, using the MATLAB model identification toolbox.

As shown in

Figure 3, a one pole model already provides a very good approximation, and reads:

The numerator of (15) shows that the system presents a steady-state gain (

$G\left(0\right)$) equal to

$-32$ and no delay (

$\theta =0$) while the denominator provides the system time constant (

${\tau}_{1}$) which, as expected, is particularly large (890 h). Such slow systems, according to [

13], may be approximated by a simple integrator:

using the ratio between the gain

$G\left(0\right)$ and the time constant

${\tau}_{1}$, denominated

${k}^{\prime}$, to determine PI-settings in a much shorter time frame (see

Figure 4).

${k}^{\prime}$ is therefore calculated as follows:

where

$\Delta y$ represents the variation in nitrate concentration during

$\Delta t$ hours, for a variation in acid flowrate

$\Delta u$.

The SIMC method then proposes, for a general first-order process with delay, the PID tuning rules presented in

Table 2, where

${\tau}_{C}$ represents the time constant of the desired first-order response of the system. The second row shows how this method is applied to the considered industrial-scale plant.

Considering

y, the current nitrate concentration in the denitrification filter,

${y}_{S}$ the desired setpoint, and

$\theta $ the time delay, Equation (18) shows the relation between these variables and

${\tau}_{C}$:

The rate at which nitrate is produced/consumed in the system depends on either the quantity of ammonia released by fish (and consequent quantity converted into nitrate) or the amount of nitrate the denitrification biofilter is able to convert into nitrogen (gas). Regarding nitrate consumption, an increase in available carbon source induces biomass growth and nitrate consumption increases (assuming that the biofilter size is properly designed). However, nitrate production is entirely driven by the quantity of ammonia produced in the system.

${\tau}_{C}$ is then limited by the “maximum” production rate of nitrate and can be estimated using the quantity of ammonia produced by the fish. This can be further explained by Equation (18), considering

$\theta =0$, represented in

Figure 5. It has to be noticed that

${\tau}_{C}$ should always be greater than

${\frac{d\left(\frac{y}{ys}\right)}{dt}}_{max}$, that is,

${\tau}_{C}\ge {\tau}_{C,min}$ as shown in

Figure 5, depending on the amount of ammonia excreted by fish.

The controller parameter calculation conditions, related to the case-study, are presented in

Table 3. All the ammonia introduced in the system is considered as completely converted into nitrate.

As shown in

Figure 6, where setpoint changes of +15/−15 gN/m

^{3} are simulated, an anti-windup configuration (using Equation (19)) is recommended to avoid detrimental effects due to input saturation and the control law reads:

with

${e}_{aw}$ being the anti-windup term calculated by the following equation:

${e}_{aw}$ is only greater than 0 when the controller output is greater than the allowed maximum value (

${F}_{acid,max}=200$ L/h) or lower than its minimum value (

${F}_{acid,min}=0$ L/h). When this happens, the control action is limited and

${e}_{aw}$ is calculated accordingly (

${K}_{aw}$ is the anti-windup gain).

Figure 6 shows the effect of the anti-windup when a

${K}_{aw}$ value of −1 is used. When the nitrate setpoint is increased, the controller decreases the acid flowrate accordingly. However, nitrate concentration will continue to increase due to the ammonia conversion reaction which causes the integral term of the PI controller to go on increasing. When the nitrate concentration finally reaches the desired setpoint, the accumulated integral action entails overshoot.

${K}_{aw}$ values chosen between −0.1 and −10 are sufficient to solve the issue. Nevertheless, using a high

${K}_{aw}$ value tends to slow down setpoint tracking. A

${K}_{aw}$ value of

$-1$ is ideally chosen and used in future simulations.

The design of the derivative gain is achieved following the analysis of the controller response to setpoint changes. Comparative results using different derivative gain values (driven by the choice of

${\tau}_{D}$) can be found in

Figure 7. The input calculated by the PID therefore reads:

where the derivative term is approximated by a continuous high-pass filter using

$\eta $ as intermediate variable. Including the derivative action leads to the new results of

Figure 7, where oscillations are attenuated and the tracking is improved. A

${\tau}_{D}$ value of 1 provides the most satisfactory result and is therefore selected.

The resulting PID performance is assessed in

Figure 8 where, following several setpoint changes and step disturbances in waste production (

${\vartheta}_{{S}_{NH}}$), robust and fast tracking is achieved. Values of

$-11.6$ L·m

^{3}/(g·h), 6.9 h, 1 h and

$-1$ are, respectively, used for

${K}_{C}$,

${\tau}_{I}$,

${\tau}_{D}$ and

${K}_{aw}$. Robustness analysis with respect to other operating condition disturbances is also presented in

Figure 9. Variations in the available biomass concentration

${X}_{BH}$ and the bypass flowrate

${F}_{denitri}$ are identified as severe system disturbances. A sudden increase in biomass decay rate (

${b}_{H}$ term in

Table S2 is increased 3 fold, from

$2.6\times {10}^{2}$ to

$7.8\times {10}^{-2}$ h

^{−1}) is therefore simulated and indeed causes response oscillations, as shown in

Figure 9, while step variations on the bypass flowrate are compensated very fast.

For the exact same perturbation in the biomass decay rate as in the previous test, the situation gets worse when adding measurement noise, as shown in

Figure 10, where a Gaussian noise with zero mean and

$10\%$ relative standard deviation is added to the measured variable (

${S}_{NO3}$). A sampling time of

$0.01$ h is also used to match the probe measurement sampling process. The controller obviously faces tracking problems, sometimes reaching unacceptable nitrate concentration values even when trying to retune the controller proportional gain (

Figure 10 shows the results for two values of the gain). To avoid this undesired effect, two solutions could be considered—they are, (a) low-pass filtering of the output signal or (b) replacing the PID by a PI, which is, in essence, less sensitive to measurement noise.

## 4. Linearizing Control

A linearizing control strategy, as illustrated in

Figure 11, may also be proposed as an alternative solution.

The control law is established based on a simplified ASM1 model [

19] (in order to limit the quantity of measured variables) and the following assumptions:

Only the denitrification reactor is considered;

This reactor only contains heterotrophic bacteria;

Since the oxygen concentration is low, no nitrification can occur;

Biomass is retained in the tank $({X}_{BH,out}=0)$;

Only three other components besides biomass are considered: oxygen (${S}_{O}$), easily biodegradable organic matter (${S}_{S}$) and nitrate (${S}_{NO3}$);

Only two reactions are assumed to occur:

Aerobic growth of heterotrophs:

Anoxic growth of heterotrophs on nitrate:

Acid is added as a carbon source and $\phi $ represents the conversion of acid flowrate (${F}_{acid}$, $L/h$) into easily biodegradable carbon source flowrate ($gCOD/h)$).

Applying mass balances to (23) and (24), the following simplified differential equation system is obtained:

where

${\varphi}_{SS}$ and

${\varphi}_{NO3}$ are the easily biodegradable organic matter and nitrate reaction rates given by:

where

${\upsilon}_{SS,aerob}$,

${\upsilon}_{SS,anox}$ and

${\upsilon}_{NO3}$ are stoichiometric coefficients depending on biomass yield

${Y}_{H}$ as in:

and

${\rho}_{1}$ and

${\rho}_{2}$ are the aerobic and anoxic growth rates of heterotrophs:

Considering a first-order linear reference as in (33):

where

${S}_{NO3}^{*}$ is the desired nitrate concentration setpoint. Replacing Equation (33) in Equation (26):

In steady-state,

${S}_{S}$ variation tends to zero:

and injecting (34) into (25), assuming (35), yields:

As previously mentioned, an anti-windup term should be added to cancel input saturation effects:

As shown in

Figure 12, the linearizing controller provides good performances even in the presence of measurement noise with zero mean and

$10\%$ relative standard deviation, and biomass concentration decrease. However, in an attempt to decrease the undesired oscillations, two additional strategies, which aim at being more robust to model uncertainties, are proposed in the following section, one combining both control structures in cascade and another estimating the biomass unknown dynamics.

#### 4.1. Cascade Control

The cascade control methodology takes advantage of linearizing control to impose a first-order closed-loop dynamic in the inner loop, and a PI controller is used in the outer loop (see

Figure 13). This cascade structure provides robustification, for instance, to model uncertainties, as follows:

where

#### 4.2. Adaptive Linearizing Control

Lumping the kinetic uncertainties into one single parameter

$\widehat{\theta}$, Equation (38) can be re-written:

with

where

$\tilde{\theta}$ represents parameter mismatch

$\tilde{\theta}=\theta -\widehat{\theta}$. An adaptive scheme, as described in [

16,

24], can be designed to develop an asymptotically stable control law, considering the following positive Lyapunov candidate function:

and its time derivative:

where

${\tilde{S}}_{NO3}={S}_{NO3}^{*}-{S}_{NO3}$,

$\tilde{\theta}=\theta -\widehat{\theta}$ and

$\gamma $ is a striclty positive parameter. All the terms in

${\rho}_{Lin}$ are assumed to be slowly varying so that

$\frac{d\theta}{dt}=0$ and we get:

Considering possible parameter mismatch, the error dynamics may be written:

Replacing Equations (50) and (51) in (49), we obtain:

Considering Lyapunov stability theory,

$\dot{{V}_{L}}$ should be negative and since the first term of (52) is, as long as the second and third terms cancel each other, the stability of the closed-loop is verified, as in:

The adaptive control law reads:

with

It should be noticed that the adaptive linearizing controller is equivalent to (38) where an integral action is added.

#### 4.3. Numerical Results

Simulation results aim at assessing the controller performance following an increase in biomass (death rate) considering measurement white noise with zero mean and

$10\%$ standard deviation on all measured variables (

${S}_{NO3}$,

${S}_{S}$,

${S}_{O}$ and

${X}_{BH}$), as shown in

Figure 12. A sampling time of

$0.01$ h is used to simulate the corresponding probe behavior. Regarding the linearizing controller, the parameters 0.5 h

^{−1}, 6 L/h

^{2} m

^{3} and

$-10$ are, respectively, used for

${\lambda}_{lin}$,

${\lambda}_{lin,I}$ and

${K}_{aw,lin}$. The PI used in cascade is parameterized with

${K}_{C,cascade}=0.001$ and

${\tau}_{I,cascade}=0.5$ h (keeping

${\lambda}_{lin}=0.5$ h

^{−1}) and the adaptive controller uses

$\gamma =5$ (keeping

${\lambda}_{lin}=0.5$ h

^{−1}). All the controllers perform reasonably well when noise is added and both the adaptive and cascade controllers are capable of attenuating the previously described oscillations.

In addition, comparative results between the linearizing controller with the cascade and the adaptive controller for several system disturbances are shown in

Figure 14,

Figure 15,

Figure 16 and

Figure 17.

It is noticeable from

Figure 9 (left) and

Figure 12 that all controllers oscillate following a perturbation in the biomass concentration. This is related to the operating point of the RAS and, by setting a new higher nitrate setpoint, it is possible to obtain a smoother response, as shown in

Figure 18.