Jérôme Harmand

Farouk Aichouche

Francesco Corona

Antoine Haddon

Michela Mulas

Otacilio B L Neto

Alain Rapaport

Sébastien Roux

Eva Thorin

Contribution of modeling and control for improving nutrient recycling via reuse

Keywords: Automatic control for reuse, flexibility of treatment systems, modeling and simulation

Introduction

Reuse of treated wastewater, although known as not being a systematic solution to the water stress, is an important lever within circular economy approaches. Until recently, reuse essentially covered the area of water, taking only exceptionally into account the possibility of recycling the nutrients it contains in spite of the progresses that have been done in wastewater treatment plant (WWTP) capabilities and performances.

One important problem is that the actual WWTPs are designed to provide treated wastewater with a quality that complies with normative constraints compatible with their discharge into the environment. By definition, this makes their use for fertigation limited while increasing their functioning costs. Introducing flexibilitythe capacity of a wastewater treatment plant to modulate the quality of treated waterallows us to think the WWTP in terms of a waste resource recovery facility WRRF as long as the quality of the delivered water is used for agronomic purposes instead of only considering the quantity of water produced. If we can promote this flexibility, it will become possible to process wastewater on a tailored basis to provide a known quality of the treated water. The treated water then complies with normative constraints during periods where no water is needed for irrigation and, in addition, with plant/crop needs during irrigation periods, the whole under sanitary and environmental constraints [START_REF] Aichouche | Contribution of modelling and control approaches to improve the flexibility of treatment systems for REUSE of treated wastewater in agriculture[END_REF]. This flexibility, makes an intensive use of control theory necessary in order to precisely control the whole reuse chain not only to manage the quantity of water provided to plants for irrigation but also its quality optimally adapted todynamicallymatch plant needs. While this flexibility notion is directly related to the treatment step, this strategy directly refers to what we can name the "Water on Demand" concept (WoD) in the field of irrigation science [START_REF] Harmand | Digital sciences for bioeconomy of wastes, water and nutrients. 4 th International Congress on renewable energies and sustainable development[END_REF].

To promote this strategy, we claim that WRRF must definitely take over WWTP [START_REF] Regmi | The future of WRRF modellingoutlook and challenges[END_REF]. From a systemic viewpoint where the system of interest would be the "reuse chain" (say, a WWRF connected with the transport and possibly the storage of water, also considering soil and crop/plant), the input is the raw wastewaters characteristics and flux and the outputs the plant needs. From a control point of view, such a system may be controlled using the available controls (via "actuators") that are mostly situated at the treatment plant step (aeration power, hydraulic and solid fluxes, etc…) and the available measurements (via "sensors" and monitoring systems in general, preferentially "online", for instance the humidity in soils) able to monitor plant growth/biomass production. For such an approach to be put in practice, we need to couple input-output models of wastewater treatment plants (or WRRF here), of water transport and storage, of irrigation systems and others describing the soil and the growth of plants. For each of these reuse chains, such models exist in the literature. In addition, transport and storage models can be coupled with those describing WRRF dynamics. However, WRRF and crop models have been developed by experts of very different fields (typically IWA models for treatment plants have been developed by biotechnologists and engineers in process/chemical engineering, and by hydrologists or agronoms for others and in particular for plant growth modeling as proposed in [START_REF] Brisson | An overview of the crop model STICS[END_REF]). These models are different in nature, with distinct "characteristic times" and different inputs and outputs, usually not compatible with all models: it is thus a very challenging task to couple them.

Instead of following this approach, we propose to use these different models in another way: instead of trying to couple them all together, we use the plant growth models and WRRF models separately in a two step approach [START_REF] Neto | Predictive control of activated sludge plants to supply nitrogen for optimal crop growth[END_REF].In a first step, we apply control theory on plant growth models only. We solve the following optimal control problem: given i) a dynamical model of a culture, ii) an objective function to be optimized (for instance, maximize the final biomass produced) and iii) a set of constraints (for instance, the amount of resources available), the task is to find the dynamic control inputs (quantity and quality of water) to be delivered to the plant (by the WRRF), under given weather conditions. This problem can be solved analytically, if simple models are available or numerically otherwise, cf. for instance (Bouzama et al., 2021) or [START_REF] Haddon | Optimal Control of Irrigation and Fertigation for Wastewater Reuse with a Double Modelling Method[END_REF] who used the so-called "double modeling approach".In a second step, these optimal inputs are considered as "setpoints" for the WRRF model, in which different levers for actions (actuators) are used within "feedback loops" to follow them as best as possible. To do so, many control approaches may be mobilized and applied in practice [START_REF] Aichouche | Contribution of modelling and control approaches to improve the flexibility of treatment systems for REUSE of treated wastewater in agriculture[END_REF].

Since the weather conditions cannot be known a long time in advance, this scheme can be iterated over a given period of time, for example using "receding horizon control" or "adaptive optimal control" approaches.

The paper is organized as follows. First, models of the WRRF and of the crop growth are recalled. The general scheme is then presented in more detail: results of optimal control strategies using crop models are presented. Finally, the concept of flexibility and simulations results of interesting irrigation scenarios are presented before some conclusions and perspectives are drawn.

Material and Methods

From an automatic control viewpoint, the problem which is posed refers to the control of a nonlinear system (the WRRF) in the presence of disturbances (input water flow, water characteristics and weather…). More particularly, it is a problem called "setpoint tracking", such "setpoint" being the result of the resolution of an optimal control problem solved using crop models.

Generating the setpoint

The WoD concept refers to the ability of a decision system to deliver the appropriate quantity and quality of water needed by a plant at a given time t. The setpoint is generated by solving an optimal control problem of crop irrigation and fertigation with treated wastewater, with the objectives of maximising crop production and minimising environmental and farming costs (cf. for instance [START_REF] Boumaza | Optimal control of a crop irrigation model under water scarcity[END_REF] in which however the problem is solved without consideration of nitrogen. Although there are a variety of well validated crop models, most cannot be used for standard control techniques because their mathematical structure is unclear and they are essentially simulation models. Instead, a double modelling method can be used to benefit from both a modern detailed crop model -the simulation model -together with a low-order dynamical systems model -the control model as the one proposed in [START_REF] Pelak | A dynamical systems framework for crop models: Toward optimal fertilization and irrigation strategies under climatic variability[END_REF]. The control model is designed to capture the essential dynamics relating to the controlled inputs whilst being adapted to the resolution and understanding of the problem. The simulation model [START_REF] Brisson | An overview of the crop model STICS[END_REF] is considered for its detailed representation of the cropping system and is used to guarantee the validity of the results. In practice, for a given scenario (i.e. a fixed set of parameters of the simulation model), the control model parameters are calibrated to get a good agreement between outputs of both models. Then, the problem for the control model can be solved, for example with a dynamic programming technique. To deal with the multiple objectives, the problem can be recast as a constrained optimal control problem by considering an optimization criterion only on the final crop biomass and setting the other objectives as constraints. These are irrigation costs and the environmental impact of nitrate leaching and thus correspond to imposing an upper bound on the total amount of nitrogen added through irrigation. By solving the problem for different values of the constraint, a range of optimal controls is obtained, the so-called Pareto front, from which it is possible to analyze the trade-offs between the different objectives. Finally, the results can be further evaluated with the simulation model.

Controlling the WRRF

When amending plants with nitrogen, the form of nitrogen delivered is important from an agronomic viewpoint. In particular, nitrate is more easily accessible than ammonium. But it is also more mobile. The right amending policy will depend on soil characteristics (and notably its acidity), weather forecast, and notably the temperature, agricultural practices: all these parameters will be important to minimize N2O production and nitrogen washout in soil. In addition, it may happen that over some time period no water for irrigation is needed anymore: in such a case the WRRF must deliver a treated water complying with normative constraints, with nitrogen concentrations less than given thresholds. Different scenarios will be studied here: the production of ammonium, the production of nitrate and the total treatment of nitrogen by the WRRF.

A first condition is to consider a system, flexible enough, for each of these scenarios to be feasible. A candidate for such an objective is represented in Figure 1. The flexibility of the platform is obtained through the possibility of changing the position of three valves allowing to orientate the different fluxes of the wastewater to be treated through three oxic and anoxic tanks. Depending on the position of these valves, 6 configurations of interest, numbered C1-6, may be obtained. The sanitary risks are supposed to be controlled by the presence of an appropriate membrane before the treated water is rejected/sent to the soil/plant stage. To produce mainly NH4 (favouring neither nitrification nor denitrification), the C5 position is appropriate, whereas to produce a nitrate-rich effluent (favouring nitrification), one would rather use the C3 configuration. For a complete treatment (favouring both nitrification and denitrification), the configuration C1 should be preferred. Notice that in [START_REF] Aichouche | Contribution of modelling and control approaches to improve the flexibility of treatment systems for REUSE of treated wastewater in agriculture[END_REF], two specific cases were investigated in details: stretagy #1 was developed to control the output concentration in nitrate while the strategy #2 was able to control the ratio of the ammonium and nitrate concentrations. Industrial control structures, i.e. strategies in which the different possible configurations of the system were considered as disturbances, were proposed and evaluated [START_REF] Aichouche | Contribution of modelling and control approaches to improve the flexibility of treatment systems for REUSE of treated wastewater in agriculture[END_REF][START_REF] Neto | Predictive control of activated sludge plants to supply nitrogen for optimal crop growth[END_REF].

To simulate the system, the available models proposed by the IWA were used [START_REF] Henze | Activated sludge models asm1, asm2, asm2d and asm3[END_REF]. The ASM1 was modified to allow for the two step nitrification process to be simulated appropriately (obtaining the so-called ASM1-2ND model as proposed by [START_REF] Ostace | Cost reduction of the wastewater treatment plant operation by MPC based on modified ASM1 with two-step nitrification/denitrification model[END_REF]) while the stoichiometry and the consistency of kinetics of the whole was corrected according to [START_REF] Hauduc | ASM type biokinetic activated sludge models: theoretical and functional analysis toward a default parameter set[END_REF].

Results and Discussion

Proof of concept: open vs closed-loop control

The first control, presented as a proof of concept of the flexibility concept,is an openloop control strategy allowing the user to choose the most appropriate configuration of the pilot plant with respect to the setpoint to be tracked. This can be realized if the input characteristics of the water to be used are known in advance. In such a case, a database comprising a large number of cases can be established as a function of input characteristics, the available actuators for each of the possible configurations.

Comparing the required characteristics of the output (nitrogen level and its form) with those saved in the database, one can then decide which configuration and which set of functioning parameters are best appropriate to obtain an output concentration that is the closest to that one saved in the database. An example of the application of such a strategy is illustrated in Figure 2.

Closed-loop control

However, it is the rule rather than the exception that inputs are unknown. In such a case, closed-loop control (the fact to get online sensors providing information about the actual state of the system) is necessary. Once the setpoint has been generated, assuming a given weather forecast, the automatic control can be run. Since the weather conditions act as a disturbance, the predictions, and thus the optimum setpoints, have to be updated. An adaptive control strategy can then be followed. Results obtained with strategy #1 are plotted in Figure 3 with configurations C1 and C3 assuming a total input nitrogen of 50 mg/l over the whole period of time. Results show that the setpoint can satisfactorily be tracked as long as there is enough nitrogen in the wastewater to be treated, illustrating the notion of flexibility. As several configurations exhibit comparable results, one may need for different indices to be computed such as the quantity of nitrogen recovered for plants, or the total energy requirements which should be minimized and find the best compromise between profits and costs (data not shown).

Conclusions

The concepts of water on demand and flexibility of treatment systems must be developed and implemented to allow, in dynamic contexts, to adapt water quality to uses. Such concepts not only apply to agronomic needs but also to many others. Both in rural, peri-urban and urban areas, it is necessary to think globally, and dynamically to rethink the way we manage wastewater that definitely should be seen as resources:

• Flexible systems may be properly controlled to track setpoints generated by the appropriate coupling with crop and/or agronomic models both in terms of water quantity and quality to optimize criteria as productivity or nutrient washout;

• Dynamic control and adaptive systems may be used to address robustness issues with respect to systems that are only partially known and subject to disturbances;

• When used for agronomic purposes, appropriate sensors have to be installed when needed and their data processed in order to deliver the appropriate knowledge of actual state of soil and crops to be feedback for closing control loops.

Figure 1 :

 1 Figure 1: A flexible platform (Aichouche, 2021).

Figure 2 :

 2 Figure 2: An open loop control strategy: switching at the appropriate instant between the configurations C5 and C3 allows the control of the output concentrations of NH4 and NO3 in open loop (Aichouche, 2021).

Figure 3 :

 3 Figure 3: Closed-loop control of nitrogen needs for irrigation with C1 and C3 configurations -NO3 (blue), NH4 (green), NO2 (red) organic nitrogen (pink) concentrations, irrigation set-point (black dashed line) and total nitrogen in the effluent(brown dashed line).

Acknowledgement

This study has been done within the international project Control4Reuse with partners from Sweden, France and Brazil. The project is part of the IC4WATER programme, in the frame of the collaborative international consortium of the 2017 call of the Water Challenges for a Changing World Joint Programme Initiative (Water JPI). The authors from the Swedish partner would like to thank Formas (Project No 2018-02213), the authors from the French partners would like to thank the French National Research Agency under the contract ANR-18-IC4W-0002 and the authors from the Brazilian partners would like to thank FUNCAP (Project No JPI-00153-00004.01.00/19), for funding within the above mentioned initiative.