Research Article  Open Access
Pedro M. Vallejo LLamas, Pastora Vega, "Analytical Fuzzy Predictive Control Applied to Wastewater Treatment Biological Processes", Complexity, vol. 2019, Article ID 5720185, 29 pages, 2019. https://doi.org/10.1155/2019/5720185
Analytical Fuzzy Predictive Control Applied to Wastewater Treatment Biological Processes
Abstract
A novel control fuzzy predictive control law is proposed and successfully applied to a wastewater treatment process in this paper. The proposed control law allows us to evaluate the control signal in an analytical way, each sampling time being a nonlinear and fuzzy alternative to other classic predictive controllers. The control law is based on the formalization of the internal fuzzy predictive model of the process as linear timevarying state space equations that are updated every discrete time instant to take into account the nonlinearity effects due to disturbance action and changes in the operating point with time. The model is then used to evaluate the predictions, and, taking them as a starting point and considering them as a paradigm of the predictive functional control strategy, a control law, it is derived in an analytical and explicit way by imposing on the outputs of the followup of certain reference trajectories previously established. The work presented here addresses the application of this particular strategy of intelligent predictive control to the case of an activated sludge wastewater treatment process successfully in a simulation environment of a real plant taking into account real data for the disturbance records. Such a process is multivariable, nonlinear, time varying, and difficult to control due to its biological nature. The proposed control law can be straightforwardly used within a dualmode MPC scheme to handle constraints, as a nonlinear and fuzzy alternative to the classic state feedback control law.
1. Introduction
The traditional strategy of modelbased predictive control (MBPC or MPC) [1–3] consists basically of the use of a prediction model to determine the necessary control actions at each instant, imposing the minimization of a cost function (which will generally include a term dependent on the error and another dependent on the control efforts, among other possible scenarios). This strategy includes however multiple variants or approaches depending on various factors, mainly on the type of model that will be used to calculate the predictions and the mathematical algorithm used to determine the control law. There are various fundamental methods based on linear models of the process which determine the control variable by means of optimization (the minimization of the cost function chosen). Other methods consider nonlinear mathematical models (fuzzy models [4], models formalized by means of artificial neuronal networks [5], or other alternatives), but they also determine the control signal by means of optimization in the same way as the first ones. In [6], an orderly bibliographic review of the evolution of the linear and nonlinear MPC is carried out, detailing numerous contributions and approaches in this field of process control. Our study falls within the category of predictive control strategies based on nonlinear models and more specifically on fuzzy models: fuzzy modelbased predictive control (FMBPC). For the internal model of the process, a fuzzy model of the TakagiSugeno (TS) [7] type was chosen in which the premises of the rules are diffuse logical expressions while the conclusions are linear numerical combinations of the consequents. TStype fuzzy models are suitable for the identification and description of complex nonlinear processes from numerical inputoutput data and, if available, expert knowledge of the process. The parameters of our TS fuzzy model were deduced by identification as from inputoutput numerical data previously obtained in simulation. In [6, 8–15], several process control strategies can be seen, based on TakagiSugeno fuzzy models, some of them framed in the FMBPC field, with the identification made from available inputoutput data.
Concerning the calculation of the control variable, in our study, such a calculation is carried out following a methodology that could be considered as an extension of the socalled predictive functional control (PFC) [2, 16–18] (which was initially designed for linear systems) to nonlinear systems. The approach that we have chosen uses a fuzzy model of the process (for the calculation of the predictions) developed in the state space form and follows a PFC strategy for the derivation of a control law in an analytical explicit form, which can be an advantage in comparison with optimizationbased control schemes [10, 18]. In relation to this issue, it is possible to say that some strategies or approaches of MPC could be considered as analytical MPC algorithms, such as dynamic matrix control, generic model control, or predictorcorrector control (in case of unconstrained linear MPC problems with quadratic cost functions, the control rules can be expressed in an analytical form and even for nonlinear MPC problems, if the model is linearized). But in the case of these algorithms, the analytical obtaining of a control law implies the statement and solution of a problem of optimization of a cost function. However, the PFC strategy offers us a method for the obtaining of the control law in which it is not necessary to solve an optimization problem, which is mathematically less complex. In addition, our approach deals with nonlinear models in a direct and practical way, by formalizing the fuzzy model in the form of timevarying state space equations (with coefficients that must be updated at each discrete time instant) and without this supposing a great increment in the complexity of the mathematical derivation of the control law.
The main contribution of our work to the FMBPC field is the application of this approach to a multivariable, with disturbances, strongly nonlinear, with a complex dynamic and of a biological nature case study (carried out by simulation), with the aim of a future generalization.
No parameters have been included to handle constraints in the proposed control law, that is, it is an unconstrained control law. But our control law can be used, as base law, within a MBPC scheme that is designed to satisfy previously fixed constraints (on the control action, on the control action increment, on the plant output, etc.). In particular, following the approach of the MPC schemes proposed by Rossiter [3] could be used (OLP or CLP dualmode MPC schemes).
To obtain the control law by means of the procedure mentioned above, some relevant mathematical tasks must be carried out. It will be necessary to deduce the mathematical expression that relates the model outputs, for a certain prediction horizon, to the control variable, that is, the appropriate expression for calculating the predictions, making use of the fuzzy model of the process. In addition, it will also be necessary to specify the control objective for the outputs of the plant, which in our case will consist in the imposition of the tracking of the previously established reference trajectories. And, of course, we must also formalize mathematically the modelbased predictive control characteristic or nature, by means of some kind of relationship between the model and the process (the plant). We will establish such a relationship using the incremental equivalence principle between the model and the plant (equivalence between the plant outputdesired increment and the model output increment) [2, 16, 17]. Finally, combining appropriately all the relationships and equations mentioned, it will be necessary to find the control variable that guarantees the control objective established at each sampling instant. Due to the multivariable character of the process considered and the intrinsic mathematical complexity of the fuzzy models, in order to obtain the control variable in an analytical and explicit manner, we need to start from a (fuzzy) mathematical model expressed compactly and clearly. In addition to working with matrix expressions, therefore, in this study, we have formalized the expressions of the fuzzy model with a format similar to that of state equations, with the peculiarity that the coefficients of the various terms are not constant but depend on the instant of sampling. This is due to the fact that they depend on the instantaneous premise vector (more specifically on the levels of compliance with the various rules by the premise vector at each instant); it is therefore necessary for these coefficients to be updated (recalculated) during each period. This particular strategy of predictive control considered in this paper has previously been approached by other authors; to be precise, it is developed in [10] for a case study with a manipulated input and a single controlled output and without considering disturbances (previously, something similar was also developed in [18], for another case study). This work however approaches the case of a multivariable system and disturbances in the input are considered. To be precise, our system has three inputs: a manipulated input and two disturbances. It also has two outputs, both of which are controlled. Its multivariable character involves working with matrices, which leads to an increase in mathematical complexity. Moreover, due to the existence of two disturbances and a single manipulated input, it is assumed that it will not be easy to control the process, especially taking into account that the process considered is of a biological nature (significantly more unpredictable than many industrial physicalchemical processes). Tackling all these complexities is another of the contributions of this paper.
The present work has focused on the application of our fuzzy predictive control strategy to wastewater treatment biological processes. In our case study, the plant to be controlled was a wastewater treatment plant (WWTP) that originally had a relatively simple architecture (something that is clearly advantageous for the purposes of the study) and whose depuration method was the wellknown activated sludge process. The entire study was implemented through simulation.
The control of the biological processes present in wastewater treatment plants is a rather complex problem, due to the nonlinear character of the corresponding physicalchemical reactions and also to the abrupt changes that can occur (sometimes unpredictably) in the influent input flow rate and in its degree of contamination (disturbances). The proposals that have been made to improve the control and operation of biological processes (generic or related to WWTPs) have been numerous and different, highlighting in our case those that include some variant of nonlinear modelbased predictive control (NLMPC) and, especially, the proposals framed in the field of the fuzzy modelbased predictive control (FMBPC). In [19–34], some of these contributions can be seen. Our work tries to be, precisely, a contribution more in this last area, proposing a strategy of predictive control based on a fuzzy model (obtained from numerical inputoutput data), but formalizing the law of control in an analytical and explicit way.
The paper is organized as follows. Section 2 describes the case study chosen: a municipal WWTP with a relatively simple architecture and with a biological purification method, the socalled activated sludge. The subsection related to the mathematical model is complemented by the Appendix D. In Section 3, the fuzzy modeling and identification procedure of the treatment plant is developed, starting only from inputoutput numerical data and also the subsequent formalization of the fuzzy model in an equivalent model in the state space (with timedependent coefficients). In Section 4, we address the problem of control, in the FMBPC field, adopting a nonlinear PFC strategy based on a fuzzy model. In this section, all the mathematical tasks necessary to deduce an analytical and explicit control law for our case study are carried out (using Appendices A, B, and C). In Section 5, we explain the FMBPC scheme that will be implemented and we present and explain some experiments developed by simulation and their corresponding results. And, finally, Section 6 contains the conclusions of the work.
2. Case Study: Wastewater Treatment Processes
Our case study consists of applying the previously introduced the FMBPC strategy to a multivariable biological process, highly nonlinear and with complex dynamics, but with a simple architecture that can facilitate the extraction of useful conclusions. For this reason, a municipal wastewater treatment plant (WWTP) located in Manresa (in the province of Barcelona, Spain) [35], equipped with only the elements and processes necessary for the purification of basic organic water pollution, that is, for the purification of the substrate, was chosen. The study was carried out in a simulation environment, for obvious reasons of feasibility and availability.
2.1. Plant Description and InputOutput Configuration
The wastewater treatment plant chosen was originally designed to achieve a relatively simple purification process, without including a nitrificationdenitrification process. So, the central objective of the overall process of purification in this plant was mainly the reduction of the concentration of the substrate, carried out through the socalled activated sludge process, of a biological nature. The plant had a single subprocess of substrate biological depuration (with six reactors working in parallel, arranged in two lines of three, which can be considered equivalent to one only for the purposes of mathematical modeling) and, following the reactors, a single decantation subprocess (with two settlers working in parallel, which can also be considered as one, for modeling purposes). The equivalent architecture of the considered plant corresponds to that shown in Figure 1 with a single aerated biological reactor followed by a secondary settler; the meaning of the main variables of the WWTP can be seen in Table 1.

As already indicated in the introductory chapter, the purification technique used in this plant is consisting of the elimination of organic pollutants by means of activated sludge (a mixed culture of microorganisms in suspension in the aerated biological reactor), with the recirculation of this sludge being the main control action and the sludge recirculation flow rate to the reactor () being the only manipulated variable considered. The purification process that reduces the substrate concentration in the water is based on the interaction, through an aerobic reaction, between the microorganisms (the biomass) and the organic matter present in the water (the substrate). The microorganisms feed on the substrate (digest it), and consequently, its concentration decreases and therefore the contamination. This reaction takes place in the biological reactor (where the mix is supposed to be perfect) and requires a sufficient concentration of oxygen dissolved in the water. The concentration of oxygen () is one of the three variables involved in the basic mathematical models of the purification process and also needs to be controlled. However, in order to reduce the complexity of the case study, we will assume that the control of will be guaranteed by the implementation of an adequate aeration system (a set of aeration turbines) and one independent control loop (with a PID algorithm for example), with an appropriate sampling period. After the biological reaction, the treated water is sent to a secondary settler, where the clean water and the activated sludge are separated. The clean water is sent to the outside of the plant and the activated sludge is recirculated and divided in two flows: one part of the sludge () is purged from the bottom of the settler, and the other one () is recirculated into the reactor with the objective of maintaining the population of the microorganisms.
In our case study, we will control only the substrate and the biomass (, ). The input variables are the input flow rate (), the input substrate concentration (), and the sludge recirculation flow rate sent to the reactor (). The first two are the system disturbances and the third is the manipulated variable. Figure 2 shows the block diagram of the multivariable nonlinear system considered, with the input and output variables involved and their role in the control system (in the case of the inputs, an alternative notation has been used, between brackets, more suitable and usual in control systems).
The information relating to the considered inputs and outputs of the plant is shown more detailed in Table 2 including for each of them and also their biological or physicalchemical significance.

The system chosen has two disturbances in the input, and the ultimate objective is to simultaneously control two output variables (coupled) by means of a single manipulated variable. In this study, we consider the wastewater treatment plant basically as a multivariable system case study with a complex dynamic and strongly nonlinear, the model of which (that could be unknown in a generic case) is identified from inputoutput numerical data.
2.2. Mathematical Model of the Wastewater Treatment Process
The mathematical model of the wastewater treatment process taken as reference is based on mass balances for the substrate, biomass, and oxygen, and it is founded on the classical Monod and MaynardSmith model (with the assumption of a perfectly mixed tank reactor). This model could be considered a simplification of the standard model denominated as activated sludge model no. 1, which is better known by its initials, ASM1 [36], but it is the corresponding model to the plant considered, a simple plant in its origin, but real.
The equations that constitute the model and the values of the different parameters of the Manresa WWTP [35] can be seen in [23] and in Appendix D (in English language). We will use this model, in substitution or representation of the plant, both in the identification process and in the simulation study of the proposed control strategy. But we will only use the equations of the substrate and the biomass, taking into account the aforementioned, in the sense of assigning oxygen control to an independent loop. This simplification does not however make the study any less interesting because it approaches a general problem of interest: the possible utility of a predictive control scheme based on fuzzy models to control strongly nonlinear multivariable systems, starting only from the information implicit in inputoutput sets of data.
3. Fuzzy Identification and State Space Modeling of a Wastewater Treatment Plant
One of the great advantages of using fuzzy models is their potential for describing nonlinear behaviour. This capacity depends on the suitability of the identification process. Fuzzy identification is therefore a data treatment procedure (with modelling objectives) of great significance both in the general sector of the modelling of nonlinear systems and in the more specific one of predictive control based on models. However, the identification of fuzzy models and their use within predictive control strategies can be studied and applied from many points of view. Our study focuses on the application to nonlinear multivariable systems of a particular fuzzy modelling methodology which consists of the following: expressing a fuzzy model (previously obtained by means of identification) in the form of state equations in such a way that it can be useful in calculating predictions and in the search for and obtaining of an explicit analytical expression for the predictive control law within the framework of a fuzzy modelbased predictive control (FMBPC) system [14]. It is for this reason that in this article, we will concentrate more on the analytical formalization of the fuzzy model that has already been identified than on the identification itself.
In our case study, the wastewater treatment plant was identified starting from a series of inputoutput numerical data previously obtained by openloop simulation and subsequently treated with the fuzzy identification software tool known as FMID (fuzzy model identification toolbox) [37]. Some functions of the toolbox were (partially) adapted and some code complements were also included (in the Matlab and Simulink environment) so as to be able to make our calculations and carry out our experiments. This tool, which is based on clustering techniques by means of the GustafsonKessel algorithm, was developed by Babuška et al. as software support for the theories and techniques of fuzzy modelling and identification described in the book Fuzzy Modelling for Control [9].
3.1. InputOutput Data
The inputoutput numerical data of our system were obtained by means of simulation in open loop with the wastewater treatment plant represented by the differential equations corresponding to its traditional nonlinear mathematical model ([23], Appendix D). The identification process could also have been carried out with samples from the real system, but in this case, the predictive control tests would have been carried out with the real wastewater treatment plant, which is not usually possible.
The multivariable system to identify corresponding to our case study has 3 inputs and 2 outputs. Figure 3 shows another simplified block diagram of the wastewater treatment plant to emphasize the multivariable nature of the said system with multiple inputs and outputs (MIMO system).
The inputs of the considered plant were the following: the incoming water flow rate (influent), ; the substrate concentration in the influent (organic pollution of the incoming water), ; and the activated sludge recirculation flow rate, . The first two are disturbances and the third is an input variable that can be used as a control variable (manipulated variable). And the two outputs taken into account are the substrate concentration in the outgoing water (effluent), , and the biomass concentration (microorganisms that feed on the substrate and therefore purify the water) in the reactor, .
The values chosen for the first two inputs (disturbances) were chosen by taking as a reference data from real experimental campaigns of an industrial wastewater treatment plant, to be precise, of the municipal wastewater treatment plant of Manresa, in the province of Barcelona, Spain (see the physicalchemical parameters of such a treatment plant in Table 12, in subAppendix D1). These data originated from tests and measures carried out at this plant on the occasion of the work on predictive control carried out at the time by Moreno [35].
For the control variable, pseudorandom value sequences were chosen, initially taking as a reference the values of the control variable used in the aforementioned campaigns of the industrial wastewater treatment plant and subsequently incorporating modifications both in variability and in the extreme values, aiming to cover different areas of operation, all this with the aim of capturing and extracting sufficient information on the dynamics of the wastewater treatment plant. For each combination of values of the input variables (), we determined by simulation the corresponding output values (), thus obtaining (for each test) a matrix of inputoutput data with 5 columns and as many rows as samples (thousands of samples), with each line consisting of 5 values (three inputs and two outputs). The sampling period of the data set recorded in the campaign was of the order of one hour. But the data was extended by performing a mathematical interpolation between each two samples, obtaining intermediate estimated data every 0.2 hours (i.e., 12 minutes).
Figures 4 and 5 represent the inputoutput data of one of the numerous identification tests carried out, which we will refer to as case A. Figure 4 is a graphic representation of the sequences of values of the inputs, and Figure 5 is a graphic representation of the sequences of values of the outputs, the latter having been obtained by means of simulation in open loop (being the wastewater treatment plant represented by the aforementioned standard nonlinear mathematical model). The variable associated with the abscissa axis of both graphs is the sample number, not the time, but the samples were ordered temporarily, as is logical.
3.2. Fuzzy Model: Type, Structure, and Parameters
The internal model that we will use for to the predictions, in our modelbased predictive control frame, will be a TakagiSugenotype discrete time fuzzy model [7]. These models are composed of a series of ifthen rules, each of which represents a linear submodel corresponding to a certain subset or partition of the universe of fuzzy values of the antecedent vector (vector premise). The antecedent or premise of each of the rules is composed of several simple propositions connected by means of and logical operators. The simple propositions compare each of the components of the antecedent vector with a certain set or associated fuzzy value (characterised by its membership function). And the consequent or conclusion of each rule allocates to the output a linear combination of the variables that form the consequent vector, plus an independent term. Algorithm 1 shows the general form of this type of discrete time fuzzy models. The mathematical expression by means of which the numeric value that will allocate to the output is calculated is a function of the consequent vector and has been represented in the said algorithm by .

The composition of both the antecedent vector and the consequent vector, as well as the number of rules, is two of the main aspects of the structure of a fuzzy TS model. The first is directly related to the dynamics of the process we want to model, that is, will depend on the inputoutput dynamic dependencies or relationship, and the number of rules will depend on the number of clusters observed or considered in the product space of the available inputoutput data set. Another characteristic aspect of the fuzzy model (less intuitive) is the type of membership functions associated with different sets or fuzzy values.
Before carrying out the identification process, we must choose what structure we will consider, that is, what decision we will take on the characteristics mentioned above. Such a choice could be based on hypothesis or be the consequence of expert knowledge of the process to be identified (if such empirical information is available) and implies the need to set various concrete numerical parameters, such as the specific number of rules and the order of discrete time recursive models that make up each rule. Subsequently, after the appropriate identification process, based on our case in inputoutput numerical data, we will obtain the specific numerical values of the coefficients of the different terms of the mathematical expression of the consequent of each of the rules, as well as the centers of clusters and constants relating to the membership functions.
3.3. Analytical Expression of the Fuzzy Model Output
To calculate the outputs of the considered fuzzy models (given by several rules), a numerical calculation method should be applied from among those contemplated in the fuzzy logic theory, adding or combining all the rules, with the appropriate weight to the consequent of each rule; for example (in our case), by means of the centroid method: (i) (two outputs).(ii).(iii) is the number of rules of the output .(iv) is the number of components of the antecedent vector corresponding to .(v) is the membership grade of with respect to the fuzzy set .
And defining for each output and rule the following membership functions (normalized) for all the antecedent vector the numerical expression of the output will remain as where is the number of rules of the output .
3.4. Identification of the WWTP
The fuzzy identification process consists of searching, as from the inputoutput data map obtained, a fuzzy model to represent the behaviour of the system as faithfully as possible. As we said above, in order to do so, it is necessary to choose, previously, a certain type of fuzzy model with a specific structure and with determined dynamic characteristics and then to try to adjust unknown coefficients or parameters by means of an appropriate mathematical method. In our experiments, as has been mentioned in the introduction to this section, the whole of the identification process was carried out by using the FMID software tool [37], which is capable of extracting a fuzzy model of the TakagiSugeno type [7] for each of the outputs of the system to identify, as from the objective information implicit in the inputoutput data provided and according to the previous choice of certain parameters concerning the possible dynamics of the plant. Numerous identification tests were carried out with different inputoutput data set (corresponding to different campaigns) and with different choices for the values of various parameters (available in the tool) related to the dynamic characteristics of the recursive discrete model that will represent the plant. The result obtained in each of the tests carried out was a fuzzy model for each of the two outputs. Some of the experiments done are presented in [31, 32] and many others were subsequently carried out as the study and the research progressed. In this paper, we will refer to some of the case studied during the whole of the process, which we will refer to as case A, case B, case C, and case D.
The main dynamic structural parameters that need to be chosen to carry out the identification of the WWTP with the FMID software tool can be summarized in Table 3.

Next, in Table 4, we will specify the choice of parameters carried out in case D and its concrete meaning, as well as the relationship with the dynamics of the model.

The result of each identification test carried out consists of a fuzzy model of the TakagiSugeno type for each of the two outputs of the wastewater treatment plant. After the identification, all parameters of each fuzzy model are available in appropriate numerical structures and we did an adequate use of them for the automatic processing of information in our simulation study. The rules of the two fuzzy models that have been identified corresponding to case D of the WWTP identifications carried out can be seen as follows: in Algorithm 2, the fuzzy model corresponding to output 1 and in Algorithm 3, the fuzzy model corresponding to output 2. The relationship between the parameters contained in Table 4 (except ) and the structure of the rules of the fuzzy model of the two outputs is quite clear. Thus, the recursive dynamic models of and have the following structure:


In Tables 5 and 6, the consequent parameters and the cluster centers, respectively, can be seen corresponding to output 1, and in Tables 7 and 8, the consequent parameters and the cluster centers, respectively, can be seen corresponding to output 2. All these numerical coefficients are results provided by the identification tool that uses the GustafsonKessel algorithm. The clustering techniques implicit in the tool are decisive when identifying the linear submodels.




The identification tool also provides the necessary numerical information relating to the fuzzy sets or values , with which the components of the antecedent vectors are compared. Such information must be searched in the analytical expressions of the membership functions corresponding to such sets, which will be given in a parametric form. Using these parameters automatically and developing the suitable software, we can represent in graphic form the membership functions of each set. As an example, we show below a graph (Figure 6) with the membership functions corresponding to the six fuzzy sets (one for each rule) associated with the variable, which is one of the components of the antecedent vector of the rules of the output , for the case A.
Observing the previous tables, we can see the composition of the antecedent and consequent vectors of each of the two outputs. The antecedent vector of output1, , coincides with the consequent vector of output 1, , and the same is true for the antecedent vector and consequent vector of output 2, and . Therefore, we will refer to the antecedentconsequent vector of output 1 and the antecedentconsequent vector of output 2. The composition of such vectors and the physical meaning of each component are specified below. where
As can be seen by comparing (6) and (7), initially, the antecedentconsequent vectors of both outputs do not coincide. However, in this study, we decided to treat the mathematical expressions of the fuzzy models jointly for both outputs (using matrices), defining a single mixed antecedentconsequent vector formed by the union of the two antecedentconsequent vectors (considering, naturally, null factors where appropriate in the necessary mathematical developments). Such vector, antecedentconsequent common to both outputs, is as follows: where the involved variables are the same as those detailed in (8).
3.5. Validation of the Identified Fuzzy Models
An essential part of any identification process is the validation of the identified models. The FMID software tool [37] uses a specific mathematical procedure of validation and provides the results both in graphic form, comparing the real process output with the model estimated output and, numerically, by calculating and giving the validation index known as VAF (VAF: percentile variance accounted for between two signals), which is among those habitually used for giving validity to the identified models. In our study, the real process output was obtained by means of simulation (with the wastewater treatment plant represented by the nonlinear model mentioned in Section 2.2 and detailed in Appendix D, given in the form of differential equations) and the model estimated output was obtained by applying to the identified fuzzy model the same inputs as to the wastewater treatment plant simulated.
In our research process, numerous identifications were made with the same or different inputoutput data sets. Likewise, the use of the available inputoutput data was diverse, beginning with basic tests, using the same set of inputoutput data in the identification and validation of the model, and then carrying out more reliable tests in which a partition was made of the available inputoutput data, using a certain percentage of the data to identify the model and the rest to validate the model. On the other hand, and as we said at the beginning of Section 3.4, identifications with different dynamic characteristics of the recursive discrete model that will represent the plant were made. The presentation, analysis, and discussion of the results of all the identifications made, together with the study of the relationship between the used data or the choice of parameters of the structure of the fuzzy model and the goodness of the identification, are beyond the scope of this article. However, it is necessary to consider at least the four identification cases mentioned at the beginning of Section 3.4, cases A, B, C, and D, commenting in this section the graphic and numerical results of the validation process of the corresponding fuzzy models identified. We summarize in Table 9 the main characteristics of the four cases.

For case A and case B, dependence on and outputs with respect to input has not been considered. But it has been considered in case C and case D. We are interested in testing the effectiveness of the control algorithm, both in cases where the model is the result of more complete identification (C and D) and in cases where the identification is incomplete or less precise (A and B).
3.5.1. Results of the Validation Process for Case A and Case B
The results of the validation corresponding to case A are shown in Figure 7. This figure contains two graphic representations (one for each output of the wastewater treatment plant under study) and compares the values of the real process output with those of the model estimated output (for the same set of values of the inputs), including in addition the VAF index, which measures the goodness of the identification for each of the two partial identifications.
In case B, we have the same structure of rules for the fuzzy model as in the case A and therefore the same components for the antecedent vector and the consequent vector, but with the difference that in this case, the numerical inputoutput data sequences used in the identification process were different from those used in the validation process (the available inputoutput data were partitioned). The results of the corresponding validation, for the two outputs of the wastewater treatment plant, can be seen in Figure 8.
In relation to the two identifications shown above, we can give a brief comparative analysis of both cases, taking into account the corresponding graphs and validation indexes. In case A (Figure 7), the adjustment is quite precise for the two outputs, with very high VAF indexes (over 92%), while in case B (Figure 8), the adjustment is markedly lower with VAF indexes around 62% (output 1) and 42% (output 2). The difference is due to the fact that in the second case, the inputoutput data used to identify the model were not the same as the inputoutput data used to validate the model, a situation in which a more difficult adjustment can be expected. In case B, however, although the VAF indexes are lower, the response of the fuzzy model follows quite well the evolution of output 1 of the wastewater treatment plant and acceptably that of output 2, the tendency of which was at least detected by the identification. On the other hand, one of the potential complementary objectives of this study is precisely the assessing of the efficiency of fuzzy predictive control algorithms, including with imperfect models, as indeed we have checked in the control experiments (FMBPC) carried out with both fuzzy models and which we will subsequently discuss.
3.5.2. Results of the Validation Process for Case C and Case D
In case C and case D, dependence on and outputs with respect to input has been considered. Therefore, in principle, these two cases are more precise and realistic when it comes to identifying the model of the plant and one would expect a greater utility of the models within a strategy of predictive control based on models. The dynamic structure of the model considered for the identification of the plant is the same in both cases, as can be seen in Table 8, but they differ (as in the previous two cases) in that, in case D, the numerical inputoutput data sequences used in the identification process were different from those used in the validation process (the available inputoutput data were partitioned). The results of the validation, for the two outputs of the wastewater treatment plant, corresponding to case C and case D, can be seen in Figures 9 and 10, respectively.
In relation to the other two identifications shown above, we can also give a brief comparative analysis of both cases, considering the corresponding graphs and validation indexes shown. In case C (Figure 9), the adjustment is quite precise for the two outputs, with very high VAF indexes (around 99% for output 1 and of 87% for output 2). In case D (Figure 10), the adjustment is also quite precise for output 1 (95%) and quite acceptable for output 2 (around 66%). In addition, the responses of the two fuzzy models follow quite well the evolution of the corresponding outputs of the wastewater treatment plant (output 1 and output 2), that is, the tendency in the two outputs was detected very well by the identification. Finally, it is relevant to emphasize that the goodness of the validation of the model identified in case D is significantly better than that of case B. The difference between both cases is the consideration, in case D, of the dependence of the two outputs with respect to input. In the simulation study presented in Section 5, four different cases of predictive control (FMBPC) applied to the WWTP have been considered, each of them corresponding to the use of one of the four identified models (case A, case B, case C, and case D). We are interested in analyzing the possible influence of the models on the effectiveness of the control algorithm, although a detailed study of this aspect is not possible to address it in this article.
3.6. State Space Modeling
By using suitable definitions and mathematical treatments, we can describe or formalize the rules of the fuzzy models of the TakagiSugeno type in the form of state equations. This involves the huge advantage of being able to treat the fuzzy models in an analytical manner and also to calculate the predictions analytically and ultimately being able to express the control law in an analytical and explicit manner. The application of this methodology to the case study which concerns us constitutes one of the main contributions of our study, which follows the line previously initiated by other authors [10]. The mathematical development necessary for our case study has previously been presented [31]. The discrete time fuzzy models in the state space were formalized jointly for the two outputs of the water treatment plant (with the necessary definitions), and the equations corresponding to them both were grouped together using matrices to obtain a single state equation and a single output equation. The result of the mathematical formalization was as follows: where (i) is the extendedstate vector, integrated by the outputs and disturbances of the WWTP, at the kth instant(ii) is the extendedstate vector, at the th instant(iii) is the output of the model in the state space, integrated by the outputs of the WWTP, at the kth instant(iv)input of the model in the state space, integrated by the manipulated variable of the WWTP, at the kth instant and the previous one(v), and are the state matricesand the corresponding expressions are and the state matrices are where being that (i) are the coefficients of the antecedent vector and independent term in the jth rule of the output 1 fuzzy model of the WWTP.(ii) are the coefficients of the antecedent vector and independent term in the jth rule of the output 2 fuzzy model of the WWTP (with , , , and ).
It is important and relevant to point out that the matrix coefficients of the state equations obtained, and , depend on the antecedent vector (through ) and therefore also depend on the kth instant, because depends on time. This assumes that concerning the necessary calculations to achieve the simulation, it will be necessary to update those coefficients in each iteration after having updated the antecedent vector and subsequently . And as a conclusion to this process of formalization of the fuzzy models identified in the state space, we can summarize by saying that the behaviour of our nonlinear multivariable system, initially identified by fuzzy models, was finally represented by a state equation system with a linear shape, but with coefficients depending on time. In [10], two theoretical references are mentioned on the association of systems with nonlinear dynamics, with variant linear systems over time (Leith, D.J. and Leithead, W.E., 1998 and 1999).
4. The Control Law in Analytical Form
The next step of our fuzzy predictive control strategy consists of deducing an analytical and explicit control law, making use of the model in the form of state equations. As was mentioned in the introduction, the deduction method for the control law can be considered an extension of the socalled predictive functional control 1 [2, 16–18] for the multivariable case. To be able to use this method, the following will be necessary: on the one hand, to define both the desired behaviour of the closedloop system and the control goal and, on the other hand, to formalize the relationship between the model and the plant that allows carrying out a modelbased predictive control strategy. The desired behaviour will be defined by imposing on the plant outputs the followup of certain reference trajectories (one for each output), as faithfully as possible, and the control goal will consist on calculating the future control action so that the predicted plant output values coincide with the reference trajectory in at least one point. In our case, we will consider a single coincidence point. The difference between the current time (kth time instant) and the one corresponding to the coincidence point, measured on the number of sampling periods, is called coincidence horizon and it is usually represented by . Therefore, starting from time instant , the coincidence with each trajectory must occur at time instant .
The relationship between the model and the plant will be established assuming the socalled equivalence principle between the plant and the model, used in PFC. This principle consists in supposing that, for each output of the plant, the plant output increment, between and , necessary to coincide with the reference trajectory, , will be equal to the predicted model output increment, also between and , . This principle is analytically expressed by the following expression: which must be satisfied for each output of the plant. If we consider the equations of both outputs simultaneously, we would have a vector equality: , where is usually the socalled objective increment vector and is the model output increment vector. The idea of the PFC strategy and equivalence principle can be shown in graphical form (Figure 11).
4.1. Predictions Based on the Model
The control actions in the various existing predictive control strategies are not calculated in the same way in all cases; there are different methods and different formulas or algorithms that are applied. However, all these strategies share the use of some type of mathematical model to represent as faithfully as possible the process to be controlled (in our case, a fuzzy model formalized in the state space) and which serves to predict the future behaviour of the process and ultimately to determine the appropriate control action for compliance with the control objectives. We can therefore say that the mathematical basis of the predictive control strategies will be the general expression corresponding to , that is, the expression of the output at the instant , predicted by the model at the kth instant, with being the prediction horizon.
The deduction of such an expression, from the state equations previously obtained, is fairly extensive in our case and has for this reason been developed in its totality in Appendix A with the objective of facilitating the followup of the article. The calculation of step ahead prediction is done under the assumption of constant future manipulated variables, that is, . The final expression deduced is the following (see (A.26), at the end of Appendix A): where
4.2. Deduction of the Control Law in an Analytical and Explicit Way
As from the expression of , which allows the prediction at the kth instant of the evolution of the outputs of the model, periods further on, we can search an analytical and explicit expression for the control law. This is precisely the main objective of our paper. We detail below the necessary mathematical process. In the first place, we will find in (19), obtaining an expression that will be a function of and we will subsequently extract, of the vector variable obtained, the scalar variable , which will also be a function of . This first stage is developed in Section 4.2.1. Secondly, we will establish the desired behaviour of our system in a closed loop, imposing the followup by the outputs of the WWTP of certain reference trajectories, which will also condition to . And as from the relations obtained, we will deduct the expression of the control action which is necessary to comply with the control objective, which will be a function of the reference (set point) of the future outputs (at ). The second stage is developed in Section 4.2.2.
4.2.1. Manipulated Variable as a Function of
Leaving at (19) to one side of equality, the term in which is multiplying and grouping together terms for simplification, defining matrix as follows: