Fuzzy logic approach to coupled level control

ABSTRACT Liquid level in coupled tanks is difficult to control by classical techniques because the plant is nonlinear, multivariable, often with no self-regulation and no model. Fuzzy logic (FL) enables a successful stable and robust control by simple means and a model-free design. This paper suggests a procedure for the design of two-variable FL controllers (FLCs) for the levels in a laboratory coupled-tank system. First a model-free two-variable Mamdani FLC is empirically developed and applied for real-time levels control. The plant input and output experimental data are then used for derivation via genetic algorithms optimization of a Takagi–Sugeno–Kang (TSK) plant model needed for FLC improvement. The TSK model is validated on a different set of experimental data and used in designing of two-variable linear proportional-plus-integral (PI) controller and parallel distributed compensation with local linear PI controllers. The performance of the systems with the designed controllers is compared in real-time levels control.


Introduction
The control of levels in coupled tanks is important for keeping material and energy balance in many installations -wastewater treatment tanks, boilers, evaporators, reactors, distillation columns, etc. (Jantzen, 2007;Neshkov, Yordanova, & Topalova, 2007;Shinskey, 1979;Stephanopoulos, 1984). It is, however, difficult by the model-based classical control techniques. The coupling among the variables, the plant nonlinearity and the lack of plant self-regulation in the case of pumped out outflow complicate the derivation of simple and reliable plant model analytically or via identification. Intelligent approaches using fuzzy logic (FL) and genetic algorithms (GAs) (Basil, Fernando, & Jiménez, 2003;Jantzen, 2007;Precup, David, Petriu, & Radac, 2013) are successfully implemented in level control (Ahmad, Ahmad, Redhu, & Gupta, 2012;Kumar & Dhiman, 2011;Yordanova, 2015). The coupled level control, however, requires the use of more advanced techniques (Kanagasabai & Jaya, 2014). Most of them are based on a plant model, simulations and classical FL controllers (FLCs) with many rules and do not consider the multivariable character of the plant.
The aim of the present paper is to design two-variable controllers using FL and GAs -linear proportional-plusintegral (PI), Mamdani PI-FLC and parallel distributed compensation (PDC) with local linear PI controllers for the real-time control of the liquid levels in a specially designed two-tank system in the absence of a plant CONTACT Snejana Yordanova sty@tu-sofia.bg model, accounting for the coupling among the variables and the lack of plant self-regulation. The novelty concludes in the implementation of the two-variable principle in the two types of FLCs and in the transfer functions based TSK plant modelling necessary for the design of the PDC which enables the control of an ill-defined nonlinear plant. The plant of two connected tanks with pumps for filling and emptying is specially constructed to model soda production and waste water treatment processes.

A laboratory two-tank system
The plant -a laboratory two-tank system -is depicted in Figure 1. It consists of a collective tank and two identical tanks each equipped with a level transducer for measurement of the controlled variables -the levels H 1 and H 2 , and pumps -Pump 1 for filling in Tank 1 with liquid, and Pump 2 for emptying of Tank 2. The two tanks are connected at the bottom via a pipe with an orifice. The control of the levels is carried out with the help of a computer via an interfacing board with Analog-to-Digital Converters (ADCs) and Digital-to-Analog Converters (DACs) using a MATLAB™ Simulink model of the controller ('Fuzzy Logic Toolbox', 1998;'MATLAB -Genetic algorithm', 2004;'MATLAB -Real time', 1992  are computed and passed via DACs to the pumps amplifiers that command the pumps. The plant is two-variable with main channels U i -H i and cross-connected channels A linear model in a given operation point can be represented by the following transfer matrix (Neshkov et al., 2007;Shinskey, 1979;Stephanopoulos, 1984): where P ij (s) is the transfer function from plant input U j to output y i (y i = H i ). The plant output y i is a sum of the outputs from the main and the cross channels or H 1 = H 11 + H 12 = P 11 (s)U 1 + P 12 (s)U 2 and H 2 = H 21 + H 22 = P 21 (s)U 1 + P 22 (s)U 2 . An increase of U 1 results in a continuous increase of H 1 and H 2 , while an increase of U 2 causes a decrease in the levels, which shows that the plant across the channels U 2 -H 2 and U 2 -H 1 has negative gains. Besides, the plant as a whole is without self-regulation -an increase in each input U i separately leads to an incessant increase or decrease in the levels till the tanks overflow or dry, respectively. Besides, nonlinearities are expected due to various reasons: pumps' thresholds and work at variable load when pumping up liquid and overcoming different liquid pressures in the piping; bounds both on controls -U i ∈ [0, 10] (V), and levels -H i ∈ [10, 40] (cm). The transfer functions in Equation (1) can hardly be determined by analytical modelling or identification in all operation zones of the nonlinear plant. The design of a two-variable linear controller requires knowledge of P(s). Development of a PDC (Tanaka & Wang, 2001;Yordanova, 2014;Yordanova & Sivchev, 2014;Yordanova & Yankov, 2015) is possible once a Takagi-Sugeno-Kang (TSK) model of the plant is derived. TSK plant models are derived either from existing nonlinear plant models (Tanaka & Wang, 2001), here nonapplicable, or from available experimental data via GAs  parameter optimization of an expert suggested model structure (Yordanova, 2014;Yordanova & Sivchev, 2014;Yordanova & Yankov, 2015). Since the plant shows no selfregulation and the two-variables are coupled, the experimental data needed can be provided from its closed-loop real-time control. Therefore, a model-free two-variable Mamdani FLC has first to be empirically designed. In Figure 2, a possible structure of the necessary FLC is suggested of coupled PI-FLCs -FLC 1 and FLC 2 with cross connections between them. The fuzzy units (FUs) are identical with two inputs -the normalized main channel error e in and cross-channel error e * jn , and one output o i . The membership functions (MFs) and the rule base are standard and are shown in Figure 3(a). The nonlinear control surface is depicted in Figure 3(b). The post-processing is also identical -PI algorithms with transfer functions C i (s) = K pi + K Ii /s, where the proportional and integral gains K pi and K Ii , respectively, are empirically tuned -K pi = 5 and K Ii = 5/100, to ensure operation with U i in the range [0, 10] (V) for references H ir in the range [10, 40] (cm). The pre-processing gains are tuned for maximal expected error |e i | max = 10 (cm) so that the FU inputs are normalized in the range [−1, 1] -K e1 = 0.1 and K e2 = −0.1 -the negative sign is used to inverse the logic of the FU in order to reflect the negative gains of the plant with respect to input u 2 . The scaling factors (ScFs) K2 ejn are empirically tuned -K2 e2n = −0.2 in FLC 1 and compensates the negative ScF K e2 in FLC 2, K2 e1n = 1 in FLC 2.
Various references' step responses, shown in Figure 4, result from the real-time control of the levels in the twotank system. The plant inputs and outputs (U i , H i ) are further used for the TSK plant modelling and the model validation.
The structure of the TSK plant model accepted follows the plant transfer-matrix representation. It consists of two symmetrical components associated with each level. In Figure 5 the component with output y 1TSK = H 1TSK is depicted. It is assumed that the plant operates in three linearization zones and its dynamic behaviour in each zone can be represented by time lags. The overlapping linearization zones are expert defined by two Sugeno models with the corresponding level as the input and three singletons yielding the MFs μ k i of belonging of the current measured value for H i to each zone k as the outputs. The input MFs 'Zone i k ' are standard -triangles for the norm terms and trapezoidal symmetrical on both sides of the norm. The norm term for H 1 is about 30 (cm) and for H 2 -about 15 (cm) and is in the middle of the corresponding universe of discourse [0,60] in Sugeno 1 and [0,30] in Sugeno 2. The fuzzy rules according to Figure 5 are: The unknown TSK plant model parameters are the gains and the time constants of the time lags in the four main and cross channels: They are computed from the requirement to minimize the sum of the relative integral squared modelling errors with respect to the two outputs H 1 and H 2 using GAs ('MATLAB -Genetic algorithm ', 2004): where inputs to the TSK plant model are the laboratoryscale plant inputs and outputs (U i , H i ) from its real-time control with the designed two-variable PI-FLC, and its outputs are y iTSK (t) = H iTSK (t).
A GAs-based optimization is selected here as the most proper approximation and modelling technique for the parallel random search of global extremum of a non-analytically defined multi-modal function of many parameters. The assigned parameters of the GAs are 20 generations (end condition), a single-point crossover, mutation in one bit and roulette type selection. According to GAs each array m of coded current plant model parameters q TSKm constitutes a chromosome. The parameters of the chromosomes that build the first generation are randomly generated from initial guess for the parameters' ranges. Then the chromosomes are improved by pairing, crossover and mutation in the next generations, so that the accepted fitness function (2) reduces its value and the TSK plant model responses H iTSK (t) to the experimental real plant inputs U i (t) become close to the experimental real plant responses H i (t) to the same inputs. A TSK plant model simulation is used to evaluate offline the cost (fitness) function (2) for each chromosome (model parameter set). The GAs minimization of Equation (2) ends with the last generation and then the best TSK plant model parameters (chromosome) that lead to minimal value for Equation (2) are obtained. The modelling is considered successful if for these optimal parameters, the simulated responses of the TSK plant model are close to the experimental responses of the real plant. Else the GAs optimization is restarted with new randomly generated chromosomes for the first generation or/and changed initial guess for the ranges of the model parameters.
In order to successfully model the plant nonlinearity, the data (U i , H i ) should be rich in magnitudes and frequencies. The values (U i , H i ) for the GAs optimization of (2) are selected from Figure 4 from the time ranges t = 0-800; 1000-1300; 1500-1700 in order to avoid uninformative steady-state values and to reduce the sample size.
The optimal values for the parameters (F TSKmin = 3.92) determined are: The step responses H iTSK (t) and U iTSK (t) of a simulated closed-loop system with the FLC and the TSK plant model for t = 0-2000 are overlaid in Figure 4 to facilitate the assessment of the modelling accuracy. The error E i = H i −H iTSK is small -below 2 (cm), and the difference in the controls is also small which gives grounds to consider that the TSK plant model is accurate even for values (U i , H i ) not used for modelling. This can be considered a successful model validation. The validation is repeated with different data set from real-time control for step changes of the references with different magnitudes and application time and the deflection from the experimental levels and controls remains small. So, the TSK model is not dependent on the specific experimental data for which it is obtained and can be trustfully used in further investigations.

Design of a linear two-variable decoupling level controller
The design of the linear controller aims at testing whether the plant nonlinearity is negligible. If the closed-loop system performance in different operation points is satisfactory and better than the empirically tuned PI-FLC, the simple linear controller is used. Since in two of the plant transfer functions the gains are negative, the general condition for controlling each output variable independently by a single-input-single-output controller sign[P ij (s)] = −1 for i, j = 1, 2, is violated (Neshkov et al., 2007). Therefore, a design of a two-variable controller has to be considered.
The linear two-variable controller is described by the following transfer matrix: The main controllers are selected to be PI controllers -C ii (s) = K pii + K Iii /s. The cross controllers are designed to ensure decoupling C ji (s) = −P w ji (s)C ii (s)/P w jj (s), where the plant main and cross-channel transfer functions P w jj (s) and P w ji (s) describe the Z-N models of the worst case plant (Neshkov et al., 2007;Shinskey, 1979;Stephanopoulos, 1984). The presence of integrators in the main controllers C ii (s) prompts a successful approximation of the cross controllers to PI. Each control action is computed as a sum of two components -from the main channel controller u ii and from the cross controller u ij − u The block diagram of the two-variable controller is shown in Figure 6. In the decoupled closed-loop system, the main controllers are tuned considering an equivalent plant with the following transfer function: The algorithm for the design of the linear two-variable controller can be concluded in the following steps.
(1) Simulation of the step responses of the two equivalent plants (3) (i = 1, 2) for the two main PI controllers and graphical Z-N approximation, illustrated in Figure 7(a). (2) Tuning of the main PI controllers from the requirements to ensure a minimal overshoot σ and short settling time t s in the decoupled closed-loop systems with the equivalent plants using an engineering approach (Jantzen, 2007;Neshkov et al., 2007;Shinskey, 1979;Stephanopoulos, 1984) for A = 0.9 and B = 1.8, (A = 0.1-1; B = 0.1-2): (3) Simulation of the step responses of the decoupling cross controllers and their graphical approximation with PI controllers, illustrated for C 21 (s) in Figure 7(b).
In operations between transfer functions the feasibility conditions are observed before simulation of equivalent plants or cross controllers -the resultant time delay should be positive and the degree m of the Laplace polynomial in the nominator should be less or equal to the degree n of the polynomial in the denominator -n ≥ m, conditions related to a cause-result sequence of signals in a real world element. Negative time delays are approximated by the first term of the Taylor's series expansion e τ s ≈ τ s + 1, and violation of the polynomial degrees condition is corrected by adding a time lag (exponential filter) of corresponding order, gain 1 and much smaller time constant T o − F(s) = 1/(T o s + 1) m−n .
The final parameters of the two-variable decoupling PI controller are shown in Table 2.

Design of a PDC for level with local linear two-variable decoupling controllers
The development of a PDC is based on the TSK plant model (Yordanova, 2014;Yordanova & Sivchev, 2014;Yordanova & Yankov, 2015). The block diagram of the PDC is shown in Figure 8. For each local linear two-variable plant with transfer matrix for the kth linearization zone (k = 1-3) P k (s) = P k 11 (s) P k 12 (s) P k 21 (s) P k 22 (s) a local linear two-variable decoupling PI controller with a transfer matrix for the kth zone is designed in the same manner as the linear decoupling controller for the linear worst case plant from the previous section. The difference is in the local plant and the engineering approach constants A = 0.3 and B = 0.9. The finally computed parameters of the local controllers for each zone are presented in Table 2. The TSK-PDC derived is the base for nonlinear closed-loop system stability analysis (Tanaka & Wang, 2001;Yordanova, 2014;Yordanova & Sivchev, 2014;Yordanova & Yankov, 2015).

Real-time control of levels in two-tank system: results and discussion
The levels in the two tanks are controlled in a closed-loop system with the designed two-variable PI controllers - Mamdani FLC, linear and PDC, in MATLAB™ real time. Different step changes in the levels references are applied in order to compare the systems' responses with respect to levels and control actions at different operation points and using different controllers. The first step response is not accounted for as it starts from non-equilibrium initial conditions for levels H 1 = H 2 = 15 (cm).  The systems' step responses for the levels are presented in Figure 9, and for the controls -in Figure 10. In Figure 11 the accumulated control action Sum(U i ) for the whole time of the experiment is considered as a measure for energy efficiency EEF i -the greater the control -the more electrical power is consumed by the pumps. So, the most energy-efficient controller has the smallest Figure 11. Energy efficiency estimates of systems with designed controllers.
Sum(U i ). The step change of H 1r = 15-25 (cm) results in the response of H 11 from the first main channel and a response H 21 -expression of the coupling effect. The last step responses are provoked by simultaneous changes of the references H 1r = 25-30 (cm) and H 2r = 15-20 (cm). In Table 3 are systemized the estimated maximal deviation H im = max(H imax −H 1r ) from reference, overshoots σ i , settling times t si , maximal control actions U imax and energy efficiency measures EEF i of the various step responses of the systems investigated. The most economical is the PDC and it is also the best with respect to fast transient responses, range of control action and the worst with respect to maximal deviation and overshoot. The linear controller is the worst in every aspect. The decoupling is the best with the FLC.

Conclusion and future research
Three types of two-variable controllers are developed on the basis of FL and GAs for the control of the levels in a two-tank nonlinear system with no model and no self-regulation. The plant can be controlled only by combining the multivariable control approach with the model-free empirical design of a Mamdani FL controller. Further improvements are suggested after derivation of a transfer-matrix based TSK plant model using data from the real-time FLC control and GAs optimization. A general worst case linear plant model, deduced from all local plants, enables the development of a simple linear twovariable controller. To better consider the plant nonlinearity, a PDC is designed with local linear two-variable controllers. All designed controllers are compared in realtime closed-loop control in different operation points. The system with the PDC outperforms the other controllers in economic control and short settling. The novelty is the design approach of two-variable FL controllers for the control of ill-defined two-variable nonlinear plants which cannot be modelled and controlled by classical means. The suggested approach can be applied for the control of other complex plants besides coupled levels for which no model can be derived and the design of the controller has to account for the plant nonlinearity, cross coupling and instability.
The future research will focus on programming of the PDC on an industrial programmable logic controller (PLC) and testing of the algorithm in real-time control. The PLC can facilitate the implementation of the PDC for controlling of various processes.

Disclosure statement
No potential conflict of interest was reported by the authors.

Funding
The author expresses her gratitude to the Technical University of Sofia for the support of this research by [grant number 152-pd0006-08/2015].