1 Introduction

It is known that the control of nonlinear processes is not simple and sometimes even very hard. Unfortunately, a major group of systems from industry is nonlinear and control of such processes with the conventional controllers with fixed parameters could lead to unstable, inaccurate or unwanted output response when the state of the system changes or the disturbance occurs. The adaptive control[1] is one way how we can solve these problems. This control method uses idea from the nature where plants or animals “adapt” their behavior to the actual state or environmental conditions. The adaptive controller adapts parameters or the structure to parameters of the controlled plant according to a selected criterion[2].

The adaptive approach here is based on the choice of the external linear model (ELM) as a linear approximation of the originally nonlinear system, parameters of which are identified recursively and parameters of the controller are recomputed according to identified ones. The dynamic analysis is used for the choice and the order of ELM. The delta-models[3] used here for identification are special type of discrete-time (DT) models whose parameters are recomputed according to the sampling period and approaches to the continuous-time ones.

The continuous-time controller is designed via the polynomial synthesis[4], spectral factorization and the linear quadratic (LQ) approach. These methods satisfy basic control requirements such as the stability, the reference signal tracking and the disturbance attenuation[4].The resulted controller is called “hybrid” because it works in continuous-time but its parameters are recomputed in discrete time intervals together with the ELM delta-model identification.

First, the simulation techniques are used in the practical part. The isothermal continuous stirred-tank reactor (CSTR) is used as a theoretical example. The mathematical model of this reactor is described by the set of five ordinary differential equations (ODE)[5] which is then subjected to the steady-state and dynamic analyses[5]. The steady-state analysis mathematically means numerical solving of the set of nonlinear algebraic equations. The Simple iteration method[6] is employed to this numerical solution. On the other hand, numerical solving of the set of ordinary differential equation as a mathematical model of the system uses Runge-Kutta’s method. Advantage of these methods can be found in the easy programmability and Runge-Kutta’s methods which are also build-in functions in Matlab.

The steady-state is also very important because it provides initial conditions to the dynamic analysis and it could also help in finding the optimal working point. On contrary, the dynamic analysis produces step responses that results in the choice of the ELM for the adaptive controller[2].

The importance of the simulation grows nowadays with the increasing computation power and decreasing costs of industrial computers. A big advantage of the simulation is that once we have simulation program we can perform simulations very quickly, safely and mainly much cheaper than the experiments on the real model.

On the other hand, the disadvantage of the simulation is in the reliability of the model. If we do not compare simulation results with the real measurements, there is no guarantee that the abstract model is accurate enough. The proposed control techniques here are tested on the real model of CSTR with the dissolution of the salt in the water inside.

This paper is divided into five main parts. The description of the hybrid adaptive LQ technique is in the second part after this introduction. The third part presents simulation results on the mathematical model of the isothermal CSTR, the fourth part is verification of the control technique on the real model and the last, fifth part is devoted to the conclusion.

All simulations in the work are done in the mathematical simulation program Matlab, Version 7.

2 Adaptive LQ control

The adaptivity, or let us say sensitivity, to the change of the state or conditions of the control could be satisfied for example by the recursive identification during the control. The most of the processes have nonlinear behavior and identification of such processes is very complex. We can overcome this inconvenience by the ELM as a linear representation of the originally nonlinear system. Two major groups of the ELM are continuous-time (CT) and DT. Each ELM has its pros and cons. The method used here employs so called delta models as special type of DT models parameters of which are related to the sampling period and it means that they are close to the more accurate CT ones[7].

The polynomial theory is used in the controller design here. The scheme of the one degree-of-freedom (1DOF) control scheme is in Fig. 1, where G(s) represents the transfer function (i.e., ELM) of the controlled output and Q (s) denotes the transfer function of the controller, generally,

$$G(s) = {{b(s)} \over {a(s)}},\quad Q(s) = {{q(s)} \over {p(s)}}$$
(1)

where q (s) and p (s) are again commensurable polynomials with the properness condition.

Fig. 1
figure 1

1DOF control scheme

The Laplace transform of the transfer function G (s) is

$$G(s) = {{y(s)} \over {U(s)}} \Rightarrow Y(s) = G(s) \cdot U(s)$$
(2)

where Laplace transform of the input signal u is from Fig. 1.

$$\matrix{{U(s) = Q(s) \cdot E(s) + V(s) = \cdots } \cr {Q(s) \cdot [W(s) - Y(s)] + V(s).} \cr }$$
(3)

If we put polynomials a (s), b (s), p (s) and q (s) into (3) instead of Laplace transforms G (s) and Q (s), (2) has form

$$\matrix{{Y(s) = {{b(s)q(s)} \over {a(s)p(s) + b(s)q(s)}} \cdot W(s) + \cdots } \cr {{{a(s)p(s)} \over {a(s)p(s) + b(s)q(s)}} \cdot V(s).} \cr }$$
(4)

Both fractions in (4) have the same denominators which are called a characteristic polynomial of the closed loop and this polynomial can be rewritten in the form

$$a(s) \cdot p(s) + b(s) \cdot q(s) = d(s)$$
(5)

where d (s) is a stable optional polynomial. The whole equation (5) is called Diophantine equation[4]. The stability of the control system is fulfilled for the stable polynomial d (s) on the left side of the Diophantine equation (5). Asymptotic tracking of the reference signal and disturbance attenuation is attained if the polynomial p (s) includes the least common divisor of denominators of transfer functions of the reference w and disturbance v:

$$p(s) = f(s) \cdot \tilde p(s).$$
(6)

With condition that these signals are from the range of the step functions, the polynomial f (s) = s and the Diophantine equation (5) is

$$a(s) \cdot s \cdot \tilde p(s) + b(s) \cdot q(s) = d(s)$$
(7)

and the transfer function of the feedback controller is

$$\tilde Q(s) = {{q(s)} \over {s \cdot \tilde p(s)}}.$$
(8)

As it is written above, the polynomial d (s) on the right side of the Diophantine equation (7) is the stable optional polynomial. There are several ways how we can construct this polynomial. The simple one is the based on pole-placement method where d (s) is divided into one or more parts with double, triple, etc., roots, e.g.

$$d(s) = {(s + \alpha )^m},d(s) = {(s + {\alpha _1})^{{m \over 2}}} \cdot {(s + {\alpha _2})^{{m \over 2}}}, \cdots $$
(9)

where the only condition is that α > 0. The disadvantage of this method can be found in the uncertainty. There is no general rule which can help us with the choice of roots which are, of course, various for different controlled processes. One way how we can overcome this unpleasant feature is to use spectral factorization of the polynomial a (s) in the denominator of the transfer function G (s). A big advantage of this method is that it can make stable roots from every polynomial, even if it is unstable. The polynomial d (s) is in this case

$$d(s) = n(s) \cdot g(s)$$
(10)

where parameters of the polynomial n (s) are computed from the spectral factorization of the polynomial a (s), i.e.,

$$n*(s) \cdot n(s) = a*(s) \cdot a(s).$$
(11)

In (11), n* (s) and a* (s) denotes stable mirrors from the spectral factorization of the possible non-stable polynomials n (s) and a (s). The second part, polynomial g (s), could be designed via pole-placement method similarly as in (9) or we can use the LQ[8] method which is based on the minimizing of the cost function in the complex domain

$${J_{{\rm{LQ}}}} = \int_0^\infty {\{ {\mu _{{\rm{LQ}}}} \cdot {e^2}(t) + {\varphi _{{\rm{LQ}}}} \cdot {{\dot u}^2}(t)\} {\rm{d}}t}$$
(12)

where µ LQ > 0 and φ LQ > 0 are weighting coefficients, e (t) is the control error and denotes the difference of the input variable. It practically means, that parameters of the polynomial g (s) are computed from the spectral factorization

$$\matrix{{(a(s) \cdot f(s))* \cdot {\varphi _{{\rm{LQ}}}} \cdot a(s) \cdot f(s) + \cdots + } \cr {b*(s) \cdot {\mu _{{\rm{LQ}}}} \cdot b(s) = g*(s) \cdot g(s)} \cr }$$
(13)

where * again denotes stable mirror from the spectral factorization similarly as in previous case. Degrees of unknown polynomials \(\tilde p\left( s \right)\), q (s) and d (s) are for the fulfilled properness condition generally:

$$\matrix{{\deg \tilde p(s) \geqslant \deg a(s) - 1} \cr {\deg q(s) = \deg a(s) + \deg f(s) - 1} \cr {\deg d(s) = 2\deg a + 1} \cr {\deg n(s) = \deg a(s)} \cr {\deg g(s) = \deg d(s) - \deg n(s).} \cr }$$
(14)

It is good if the controlled output could be tuned somehow. In our case, the weighting coefficients µ LQ and φ LQ are tuning parameters which could affect the speed of the control, overshoot of the output variable or the course of the input variable. There is also the opportunity to choose what is more critical for the control — to have minimal control error e (t) or minimal changes of the input variable u (t). The control error could be affected by choice of the weighting coefficient µ LQ and the run of the input variable is tuned by the choice of the second weighting coefficient φ LQ in (12).

3 Simulation experiment

The nonlinear system under the consideration is an isothermal continuous stirred tank reactor with complex reaction[5]. The schematic representation of this reactor is in Fig. 2.

Fig. 2
figure 2

Scheme of the isothermic continuous stirred tank reactor

The reactions inside the reactor could be described by the scheme:

$$\matrix{A + B\mathop{\longrightarrow}\limits^{k_1} X \cr B + X\mathop{\longrightarrow}\limits^{k_2} T \cr B + Y\mathop{\longrightarrow}\limits^{k_1} Z.}$$
(15)

We assume that the reactant inside is perfectly mixed and the volume is constant during experiments. We can now introduce the mathematical model of the system which comes from material balances inside the reactor:

$$\matrix{{{{{\rm{d}}{c_A}} \over {{\rm{d}}t}} = {q \over V}({c_{A0}} - {c_A}) - {k_1} \cdot {c_A} \cdot {c_B}} \cr {{{{\rm{d}}{c_B}} \over {{\rm{d}}t}} = {q \over V}({c_{B0}} - {c_B}) - {k_1} \cdot {c_A} \cdot {c_B} - \cdots - } \cr {{k_2} \cdot {c_B} \cdot {c_X} - {k_3} \cdot {c_B} \cdot {c_Y}} \cr {{{{\rm{d}}{c_X}} \over {{\rm{d}}t}} = {q \over V}({c_{X0}} - {c_X}) - {k_1} \cdot {c_A} \cdot {c_B} - {k_2} \cdot {c_B} \cdot {c_X}} \cr {{{{\rm{d}}{c_Y}} \over {{\rm{d}}t}} = {q \over V}({c_{Y0}} - {c_Y}) - {k_2} \cdot {c_B} \cdot {c_X} - {k_3} \cdot {c_B} \cdot {c_Y}} \cr {{{{\rm{d}}{c_Z}} \over {{\rm{d}}t}} = {q \over V}({c_{Z0}} - {c_Z}) - {k_3} \cdot {c_B} \cdot {c_Y}} \cr }$$
(16)

where q denotes volumetric flow rate, V is used for volume of the reactant, c A , c B , c x , c Y and c Z are concentrations, k 1–3 are rate constants and t is time. The fixed parameters are in Table 1[5].

Table 1 Parameters of the reactor

The system has theoretically six input variables: the volumetric flow rate q, input concentrations of the compounds A, B, X, Y, Z — c A 0, C B 0, c x 0, c y 0, c Z 0 and five state variables final concentrations of the compounds A, B, X, Y and Z — C A , C B , C X , C Y and C Z .

The mathematical model in (16) shows that this system belongs to the class of nonlinear lumped-parameters systems. Nonlinearity comes from the multiplication of the state variables and the set of ODE (16) is typical for systems with lumped parameters unlike system with distributed parameters which are described by the partial differential equations (PDE).

3.1 External linear model (ELM)

As it written above, the choice of the external linear model comes from the static and dynamic analyses inside the reactor. First, the static analysis observes the behavior of the system in the steady-state (SS), i.e., t →∞. Mathematical meaning of SS is \({{{\rm{d}}(\cdot)} \over {{\rm{d}}t}} = 0\) and the set of ODE (16) is then transformed to the set of nonlinear algebraic equations. The static analysis here was performed for the different values of the volumetric flow rate of the reactant q and the results can be found in Figs. 3 and 4.

Fig. 3
figure 3

Steady-state values of the concentrations c A , c B and c Z for different volumetric flow rate of the reactant q

Fig. 4
figure 4

Steady-state values of the concentrations c X and c Y for different volumetric flow rate of the reactant q

All responses in the previous figures have shown the nonlinearity of the system. As the output concentration of the compound B will be chosen later as a controlled variable, there cannot be clearly found an optimal working point, so the volumetric flow rate q s = 1 × 10−4 m3 · s−1 has been chosen as a working point for the next studies. The second, dynamic analysis observes the behavior of the system after the step change of the input variable. In our case, four step changes of the volumetric flow rate of the reactant Δq = −50%, −25%, 25% and 50% of the q s were done. The output variables y 1 and y 2 displayed in the following graphs represent difference of the actual concentrations of the compounds A and B from their steady-state value which is actually initial condition (starting value) for the dynamic study, e.g.

$$\matrix{{{y_1}(t) = {c_A}(t) - c_A^s,} \cr {{y_2}(t) = {c_B}(t) - c_{B.}^s} \cr } \quad [{\rm{kmol}} \cdot {{\rm{m}}^{{\rm{ - 3}}}}]$$
(17)

The change of the volumetric flow rate q is chosen as a manipulated (input) variable from the practical point of view and control variable is the change of the concentration of the product B. The input and output variables are then:

$$\matrix{{u(t) = {{q(t) - {q^s}} \over {{q^s}}} \cdot 100\;[\% ];} \cr {y(t) = {c_B}(t) - c_B^s\;[{\rm{kmol}} \cdot {{\rm{m}}^{{\rm{ - 3}}}}].} \cr }$$
(18)

Although dynamic analyses in Figs. 5 and 6 looks like first order transfer function, the controlled output y (t) was described by the second order continuous-time transfer function (ELM), i.e.,

$$G(s) = {{b(s)} \over {a(s)}} = {{{b_1}s + {b_0}} \over {{a_2}{s^2} + {a_1}s + {a_0}}}.$$
(19)
Fig. 5
figure 5

Step responses of the output y 1 to the step change of the volumetric flow rate of the reactant Δq

Fig. 6
figure 6

Step responses of the output y 2 to the step change of the volumetric flow rate of the reactant Δq

The choice of the second order ELM covers more working points where the output response could be more complex than in this concrete choice. Degrees of the polynomials in (14) are then

$$\matrix{{\deg q(s) = 2 \Rightarrow q(s) = {q_2}{s^2} + {q_1} + {q_0}} \cr {\deg \tilde p(s) = 2 \Rightarrow \tilde p(s) = {s^2} + {p_1}s + {p_0}} \cr {\deg g(s) = 3 \Rightarrow g(s) = {s^3} + {g_2}{s^2}{g_1}s + {g_0}} \cr {\deg n(s) = 2 \Rightarrow n(s) = {s^3} + {n_1}s + {n_0}} \cr {\deg d(s) = 5 \Rightarrow d(s) = {s^5} + {d_4}{s^4} + {d_3}{s^3} + \cdots + } \cr {{d_2}{s^2} + {d_1}s + {d_0}.} \cr }$$
(20)

Polynomials n (s) and g (s) are computed as a result of spectral factorizations (11) and (13):

$$\matrix{{{g_0} = \sqrt {{\mu _{{\rm{LQ}}}}b_0^2,} \quad {g_1} = \sqrt {2{g_0}{g_2} + {\varphi _{{\rm{LQ}}}}a_0^2 + \mu b_1^2} } \cr {{g_2} = \sqrt {2{g_1}{g_3} + {\varphi _{{\rm{LQ}}}}(a_1^2 + 2{a_0})}, \quad {g_3} = \sqrt {{\varphi _{{\rm{LQ}}}}} } \cr {{n_0} = \sqrt {a_0^2}, \quad {n_1} = \sqrt {2{n_0} + a_1^2 - 2{a_0}}.} \cr }$$
(21)

Polynomials a (s) and b (s) of the ELM (19) are computed by the well-known and easily programmable recursive least-squares method[9]. As it was already mentioned, the deltamodels used for the ELM here have parameters estimated in the discrete time intervals but as they are related to the sampling period T v , we assume that they are close to the continuous ones. This assumption allows the usage of these parameters in computations of the controllers parameters. The vector of parameters and the data vector in this case are

$$\matrix{{{\phi _\delta }(k - 1) = {{[ - {y_\delta }(k - 1), - {y_\delta }(k - 2),{u_\delta }(k - 1),{y_\delta }(k - 2)]}^{\rm{T}}}} \cr {{\theta _\delta }(k) = {{\left[ {a_1^\delta, a_0^\delta, b_1^\delta, b_0^\delta } \right]}^{\rm{T}}}} \cr }$$
(22)

where y δ and u δ denotes the recomputed output and input variables of the delta-model:

$$\matrix{{{y_\delta }(k) = {{y(k) - 2y(k - 1) + y(k - 2)} \over {T_v^2}}} \cr {{y_\delta }(k - 1) = {{y(k - 1) - y(k - 2)} \over {{T_v}}}} \cr {{y_\delta }(k - 2) = y(k - 2)} \cr {{y_\delta }(k - 1) = {{u(k - 1) - u(k - 2)} \over {{T_v}}}} \cr {{u_\delta }(k - 2) = u(k - 2).} \cr }$$
(23)

The vector of parameters is computed from:

$${y_\delta }(k) = \theta _\theta ^{\rm{T}}(k) \cdot {\phi _\delta }(k - 1) + e(k)$$
(24)

where e (k) is a general random immeasurable error. The vector of parameters is then computed by the recursive least squares (RLS) method[9]. Advantages of this method can be found in the simplicity and easy programmability[10].

3.2 Simulation results

The goal of simulations is to explore effect of the weighting factors µ LQ and φ LQ as a tuning parameters and find optimal combinations of these parameters.

All simulations were performed with the same conditions. The simulation time was T f = 20000 s, five different step changes of the reference signal were done during this time, sampling period was T v = 10 s. The input variable was limited inside the bounds u (t) = 〈−100%; 100%〉.

The first simulation analysis presented in Figs. 7 and 8 shows impact of the weighting factor φ LQ on the course of the output variable. The second parameter was fixed to the value µ LQ = 2.

Fig. 7
figure 7

Courses of the reference signal, w (t) and the output signal y (t) for various values of weighting factor φ LQ, for the simulation model

Fig. 8
figure 8

Courses of the input signal, u (t), for various values of weighting factor φ LQ, for the simulation model

It is clear, that increasing value of φ LQ results in slower, but smoother course of the output. Also the input variable is good from the practical point of view which in our case is volumetric flow rate, and is represented by twist of the valve on the input pipe and shocking or quick changes of this variable could affect service life of the valve. Simulations for the different µ LQ and fixed value of φ LQ = 0.1 were performed in the second study.

Effect of the parameter µ LQ in Figs. 9 and 10 is opposite to the previous one. In this case, increasing value of µ LQ results in the quicker output response but with bigger overshoots. The only problem of both simulation studies can be found at the very beginning of the control where the course of the input variable and course of the output variable is very inaccurate. This is caused by the recursive identification which is purposely started from the general point θ δ (k) = [0.1, 0.1, 0.1, 0.1]T and it takes time 50–100s to get to the right vector of parameters. The chosen course of the identified parameter \(a_1^\delta \) is shown in Fig. 11. It is clear, that after some initial adaptation time, the estimation runs reliably. The course of the other parameters is very similar.

Fig. 9
figure 9

Courses of the reference signal, w (t) and the output signal y (t) for various values of weighting factor µ LQ, for the simulation model

Fig. 10
figure 10

Courses of the input signal, u (t), for various values of weighting factor µ LQ for the simulation model

Fig. 11
figure 11

Courses of the identified parameter, \(a_1^\delta \left( t \right)\), for various values of weighting factor φ LQ, for the simulation model

Both responses in graphs Figs. 710 have similar courses which lead us to explore the effect of the ratio φ LQ: µ LQ to the results of the control. There were used also quantitative criteria S u and S y besides visual comparisons which were computed as

$$\matrix{{{S_u} = \sum\limits_{i = 300}^N {{{(u(i) - u(i - 1))}^2}} } \cr {{S_y} = \sum\limits_{i = 300}^N {{{(w(i) - y(i))}^2}} } \cr }$$
(25)

for N = T f /T v where T f is final time and T f = 20 000 s.

These criteria were computed not for all simulation time but it starts after the first step change and last to the end of the simulation. This was because of the objectivity of the results as the courses of both input and output variables are suboptimal at the very beginning due to inaccurate recursive identification as it was mentioned above. The results are shown in Table 2 where the upper side of the table is related to the first simulation analysis (effect of the parameter φ LQ) and lower side presents results of the second study for Table the different µ LQ.

Table 2 Qualitative results of the control

Now it is clear, that results of both studies are comparable and ratio φ LQ : µ LQ could be used as the qualitative criteria — bigger ratio produces quicker output response but with the possibility of overshoots.

4 Verification of simulations

As it is written at the very beginning, modeling and simulation results are not reliable if they are not verified on the real model.

The control methods suggested and tested above were verified on the multifunctional process control teaching system PCT40 from the Armfield. This system consists of several very interesting and useful systems from the control point of view such as a heat exchanger, a water tank and CSTR which was used in our case. This reactor is small representation of the real chemical reactor with the volume of the model 1 liter. There could be two reactions performed inside the reactor 1) dissolution of salt in water where the conductivity is measured and controlled and 2) neutralization of the acid and base where pH is measured. In our case, the first reaction was used.

The schematic representation of the CSTR is in Fig. 12. The system has two input pipes, the first for the pure water and the second for the 10% solution of the NaCl. The conductivity of this solution is around 60 mS which must be taken into the account for the choice of the reference signal. Both inputs, water and solution, are fed inside the reactor via peristaltic pumps and these pumps cause also the nonlinearity of the system.

Fig. 12
figure 12

Scheme of CSTR reactor in PCT40

As the system have two inputs, the operation speed of the peristaltic pump in % which feds clean water was chosen as an input variable. In fact, this operation represents also the volumetric flow rate of the water. The second input is fixed to the 30% during all operations.

The static and dynamic analyses are shown in Figs. 13 and 14. They present a nonlinear behavior of the system and there could be used the same ELM (19) as in previous case.

Fig. 13
figure 13

Steady-state analysis for different operation of the pump

Fig. 14
figure 14

Dynamic analysis for different step changes of the operation of the pump as an input variable

The control was tested for three changes of the reference signal

$$w(t) = 15[1 - \exp ( - 01t)]\>{\rm{mS}}\quad {\rm{for}}\>t \in [0;360]{\rm{s}}$$
(26)
$$w(t) = 18\>{\rm{ms}}\quad {\rm{for}}\>t \in [360;540]{\rm{s}}$$
(27)
$$w(t) = 14\>{\rm{ms}}\quad {\rm{for}}\>t \in [540;720]{\rm{s}}$$
(28)

The reason why we use exponential function at the first change is that it provides much better results due to inaccurate estimation of the ELMs parameters at the very beginning of the control when the adaptive controller needs some time for the adaptation. The courses of both input and output variables are shown in following figures.

It can be clearly seen from Figs. 15 and 16 that the used hybrid adaptive LQ control strategy provides good control results also on the real system. The only weakness is at the very beginning due to inaccurate identification and also usage of the 1DOF controller. The usage of 2DOF controller which has one part in the feedback and one part in the feedforward branch of the control scheme provides much better results mainly for the reference signal tracking[11].These experiments confirm this but the results are not shown here due to length of the contribution.

Fig. 15
figure 15

Courses of the reference signal, w (t) and the output signal y (t) for various values of weighting factor φ LQ, real model

Fig. 16
figure 16

Courses of the input signal, u (t), for various values of weighting factor µ LQ, real model

5 Conclusions

The paper deals with hybrid adaptive LQ control of the nonlinear system. The polynomial approach, spectral factorization and LQ approach were used for constructing the continuous-time controller. Although the delta ELM belongs to the class of discrete-time models, its parameters approach to the continuous ones. That is why we call this controller hybrid — it runs in continuous-time, but parameters of the delta ELM are identified recursively in the defined sampling intervals.

This adaptive controller has two tuning parameters — weighting factors which give attention to the output error or the change of the input variable. It was proved that there are not important values of these weighting factors separately, but ratio of them, e.g., φ LQ : µ LQ. Decreasing value of this ratio produces slower speed of the control but smoother course of both the input and the output variables. Simulation tests were done on nonlinear mathematical model of the CSTR and also on the real model of CSTR with dissolution of the salt inside the water. Both experiments have shown usability of the proposed control.