# A Hyperbolic Tangent Adaptive PID + LQR Control Applied to a Step-Down Converter Using Poles Placement Design Implemented in FPGA

Authors: Marcelo Dias Pedroso; Claudinor Bitencourt Nascimento; Angelo Marcelo Tusset; Maurício dos Santos Kaster
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

This work presents an adaptive control that integrates two linear control strategies applied to a step-down converter: Proportional Integral Derivative (PID) and Linear Quadratic Regulator (LQR) controls. Considering the converter open loop transfer function and using the poles placement technique, the designs of the two controllers are set so that the operating point of the closed loop system presents the same natural frequency. With poles placement design, the overshoot problems of the LQR controller are avoided. To achieve the best performance of each controller, a hyperbolic tangent weight function is applied. The limits of the hyperbolic tangent function are defined based on the system error range. Simulation results using the Altera DSP Builder software in a MATLAB/SIMULINK environment of the proposed control schemes are presented.


---

## Body

## 1. Introduction

The technological evolution of electronic devices has been very significant in recent years. With the increasing performance of microcontrollers and Digital Signal Processors (DSP), as well as the ascension of Field-Programmable Gate Array (FPGA), associated with high speeds of current A/D converters, some concepts related to digital signal processing have been reevaluated, and new forms of mathematical processing and algorithms developed [1, 2].More powerful digital devices are needed to enable the implementation of complex control systems in several applications to help improve their performance, stability, and robustness. In the power electronics field, better control strategies can enhance power quality and efficiency [3], by reducing losses, which represents important goals in forthcoming appliances that must comply with government environmental policies for electric power generation.FPGAs are devices with flexible logic programming. They allow several product features and functions, adapt to new standards, and reconfigure hardware for specific applications, even after the device has been already installed in the end product. One can use a FPGA to implement any logical function that an application-specific integrated circuit (ASIC) could perform, but the ability to update the functionality after shipping provides advantages for many application areas such as automotive, broadcast, computer and storage, display, medical, military, test and measurement, wireless, wire line, and in a lot of other areas. The main advantage of FPGA is the ability to have its logical structures arranged to work in parallel as opposed to the inherent sequential execution in microcontrollers. This can drastically boost the overall performance of the device. Also, when compared to microcontrollers and DSPs, FPGAs offer many design advantages including rapid prototyping, shorter time to market, the ability to reprogram in the field, lower Nonrecurring Engineering (NRE) costs, and long product life cycle to mitigate obsolescence risk [4–6]. In the last years, FPGAs manufacturing costs decreased significantly, making possible its use in most common applications like power electronics applications [7–11]. In these applications, the use of FPGAs allows more complex control techniques that can be used to improve the system performance such as response time along with reduced overshoot.FPGAs can be programmed using Hardware Development Language (HDL) which describes the connections of the logic gates together to form adders, multipliers, registers, and so on. The HDL places a dedicated resource for the task and allows for parallel operation. However, the complexity of HDL coding can be a barrier for many electrical engineering applications [12].As an alternative to low-level HDL programming, there are some optimized frameworks with ready-to-use high-level blocks such as the Altera’s DSP Builder software, which provides graphical design blocks to run simulations into a MATLAB/SIMULINK environment. The same blocks are used by DSP Builder as the basis for autogenerating an optimized HDL code to be loaded into FPGA hardware. The use of DSP builder tool can reduce the implementation time of a project resulting in lower costs associated to human-related design efforts.In electrical power conditioning systems that use switched static converters, the integration of high performance hardware with linear and nonlinear control techniques implemented digitally has provided the improvement of system performance, resulting in increased efficiency as well as enhanced quality of power supply [3]. Several types of voltage and current controllers can be implemented, either in the analog or digital way.Regarding the control techniques employed in these applications, traditionally the Proportional-Integral (PI) controller is one of the mostly used techniques to carry out control of some aspects of the converters, like regulating the output voltage or correcting the power factor. In these applications, the derivative action is usually not considered because it can amplify high frequency noise caused by switches commutation. Due to the integral component, PID has been widely used because it presents a favorable characteristic of eliminating the steady-state error, but its response time is high when compared to other kinds of controllers when the system is subjected to external disturbances. Other linear control techniques are also widely used like, for example, the LQR control. As it is an optimal control, it is common to appear as significant overshoots. It is desired to improve the system response time without worrying about the overshoot, commonly resulted from load disturbance or reference change, which can be achieved by employing poles placement design. However, LQR control does not have integral action, and its use does not guarantee null steady-state error.In order to improve system performance in relation to the response time without causing overshoots, which could damage the load or circuit elements, and to obtain a steady-state null error, adaptive and nonlinear controllers have being used. The Feedback Linearization, Adaptive Control, Gain Scheduling, Sliding Mode control, and State Dependent Riccati Equation (SDRE), can be highlighted each with its own characteristics regarding their application or parameters such as stability, robustness, and computational cost [13–24]. Another possibility of enhancing the system performance is the integration of two or more controllers. In this sense, the system error is compensated according to the best independent performance of each controller. The combined action of the two controls is considered as an adaptive control [24, 25]. A common approach is the use of a decision function that establishes a limit value that supports the decision of which control will be used. Another approach is the use of both control actions in a weighted fashion, determined by a weight function.Along with the advances in digital control, the use of more complex theories, mainly related to nonlinear and adaptive controllers design, has been excelling ever more. Adaptive control techniques have been highlighted in various applications. Alternative forms of adaptive control techniques applied to power electronic circuits are presented in [18–24].In this context, this paper presents an adaptive control that uses the best responses of two linear controllers, that is, the PID and LQR controls. To reduce overshoot problems of the LQR controller, poles placement design is applied. As a result, a composite control law is obtained for two different controllers used at the same time, where the control actions are mathematically weighted according to system error by means of a hyperbolic tangent function. This function represents the decision function that establishes the weights of PID and LQR control actions into the resulting control action, referred to as Hyperbolic Tangent Adaptive Control (HTAC). The main objective of this control technique is to perform the output voltage control of a step-down converter operating in continuous conduction mode (CCM). This strategy was tested by means of simulations using the DSP Builder software in a MATLAB/SIMULINK environment applied to the output voltage control on a classic Buck converter. Load steps were applied to assess the performance of the Hyperbolic Tangent Adaptive Control (HTAC). The results show that the proposed technique achieves better responses than the controllers alone, with a fast transient response, a small overshoot, due to the poles placement design, and null steady-state error.


## 2. Control Strategies

### 2.1. Linear PID Control

Among the control structures used in the industrial segment, the classic parallel PID controller, shown in Figure1, stands out as one of the most widely used controllers due to well established practical implementation and tuning. There are various consolidated techniques which uses the PID transfer function and the system transfer function in order to obtain the proportional (Kplin), integral (Kilin), and derivative (kdlin) gains of the controller [26]. The design criteria, like overshoot and settling time for the closed loop system, are generally satisfactory when using this linear PID controller structure.Figure 1
Hyperbolic tangent adaptive control.The transfer function and the control law in the time domain of a PID controller with fixed gains are expressed by(1)C(s)=Kdlins2+Kplins+Kilins,
where kdlin represents the derivative linear gain, kplin the proportional linear gain, and kilin the integral linear gain.


### 2.2. LQR Control

The LQR controller is based on the minimization of a quadratic criterion associated with the state variables energy and the control signals. An optimal control provides a systematic way to calculate the gain matrix of the state feedback control [27, 28].As LQR is a consolidated control technique, the controller design will not be presented in this work.The problem formulation of optimal control (LQR) for the Buck converter can be ordered as follows: find a control functionu(t) ensuring that the output voltage of the converter is independent from the initial state to the reference value. The objective is to minimize the functional
(2)J=∫0∞(δTQδ+uTRu)dt,
where Q and R are symmetric and positive definite matrices, δ is a vector of the input errors, and u is the control signal. In addition, R can be chosen unitary without loss of generality [28].From the control law presented in (3), for R=1,
(3)u(t)=-Kx(t),
where
(4)K=-BTP.For the defined values of the matrixQ (where Q is a positive definite matrix), the matrix P (where P is a symmetric matrix) can be found, which is a solution for the Riccati equation:
(5)ATP+PA-PBBTP+Q=0.The limitation is that the LQR addresses a regulation problem and cannot originally be applied to a tracking problem, which is desired in practice [27].It is important to note that different values for the weight coefficient matrixQ are obtained for different trajectories, which implies that the range of values of Q matrix components influence the quality of the transient process.The technique of pole placement is proposed in this paper to find an optimal matrixQ (LQR formulation) which ensures the desired characteristics of transient response, ensuring achieving optimal regulation.To design the LQR controller feedback vector, the technique of pole placement is initially used [27, 28], since this control law works in the same way as the control law for the LQR controller. Thus, the state feedback K is found satisfying all conditions imposed by LQR controller, and the operating point of the closed loop system can be assured.Therefore, the vectorK can be defined, by the pole placement technique, by equation
(6)Kp=[αn-βnαn-1-βn-1⋯α2-β2α1-β1]T-1,
where αi is obtained from the characteristic polynomial:
(7)(s-μ1)(s-μ1)⋯(s-μ1)=sn+α1sn-1+⋯+αn-1s+αn,
where μi are the desired poles and the elements βi are the characteristic polynomial coefficients given by
(8)|sI-A|=sn+β1sn-1+⋯+βn-1s+βn.The transformation matrixT is given by
(9)T=MW,
where M is the controllability matrix given by (10) and W is given by (11).Consider(10)M=[BAB⋯An-1B],(11)W=[an-1an-2⋯a11an-2an-3⋯10⋮⋮⋱⋮⋮a11⋯0010⋯00].Replacing (6) in (4), the Riccati matrix (P) for gain vector (Kp) can be obtained by
(12)Pp=(BT)+Kp,
where (BT)+ is a pseudoinverse matrix.Replacing (12) in (5) yields
(13)Q=-ATPp-PpA+PpBBTPp.Through the solution of (13), the control that causes the system to the desired orbits minimizing the functional (2) can be defined, with the predefined transient behavior, where, by means of mathematical manipulations, one can find a matrix Q that satisfies the conditions of the LQR controller. The matrix Q must be positive. In this sense, a single test can be carried through an algorithm to prove that the obtained matrix Q is equal to QT. Thus, it can be said that the (Kp) state feedback vector corresponds to an optimal controller offered by LQR algorithm.


### 2.3. Proposed Hyperbolic Tangent Adaptive Control (HTAC)

After some analyses realized by numeric simulations, to be presented afterwards, and relating to the system response during a load disturbance and to the steady-state error, it is possible to observe that either the proposed LQR and PID controllers are effective to maintain the system over the dominant poles in closed loop defined in the control design. Also, it can be observed that the LQR control is more effective for the transient response and the PID control for the steady state.With the objective of obtaining a control that presents the combined efficiency of both controllers, enhancing the performance of the system in closed loop as well as reducing the overshoot and the settling time, a parallel combination of LQR and PID controls is proposed. The simplest approach is to switch which controller will actuate over the system given a specific rule, such as a predefined error value. The disadvantage of this approach is the occurrence of an abrupt change in the control structure. In order to avoid this abrupt commutation between the controllers, a weighted combination is proposed where their control actions are regulated by weights (wi) defined by a hyperbolic tangent function.The control law for the HTAC controller is defined by(14)u(t)=uC1(s)(t)*w1+uC2(s)(t)*w2,
where uC1(s)(t) and w1 represent the LQR control and its weight, respectively, and uC2(s)(t) and w2 represent the PID control and its weight, respectively, with w1+w2=1.The valuew1 is determined as a function of the system error, given by
(15)w1=tanh|e|,
where e is the normalized error.In this sense, it is possible to define the higher weightw1 for the controller with faster responses in situations of larger errors, this will be the controller with higher predominance in the control action.The valuew2 is defined by
(16)w2=1-w1.So, the weightw2 will be inversely proportional to the error and will present higher values in situations of small errors, bringing into spot the controller that ensures a null error in steady state. Considering this objective, a controller with an integrative term is a good choice.In Figure1, one can observe how the HTAC controller can be implemented.


## 2.1. Linear PID Control

Among the control structures used in the industrial segment, the classic parallel PID controller, shown in Figure1, stands out as one of the most widely used controllers due to well established practical implementation and tuning. There are various consolidated techniques which uses the PID transfer function and the system transfer function in order to obtain the proportional (Kplin), integral (Kilin), and derivative (kdlin) gains of the controller [26]. The design criteria, like overshoot and settling time for the closed loop system, are generally satisfactory when using this linear PID controller structure.Figure 1
Hyperbolic tangent adaptive control.The transfer function and the control law in the time domain of a PID controller with fixed gains are expressed by(1)C(s)=Kdlins2+Kplins+Kilins,
where kdlin represents the derivative linear gain, kplin the proportional linear gain, and kilin the integral linear gain.


## 2.2. LQR Control

The LQR controller is based on the minimization of a quadratic criterion associated with the state variables energy and the control signals. An optimal control provides a systematic way to calculate the gain matrix of the state feedback control [27, 28].As LQR is a consolidated control technique, the controller design will not be presented in this work.The problem formulation of optimal control (LQR) for the Buck converter can be ordered as follows: find a control functionu(t) ensuring that the output voltage of the converter is independent from the initial state to the reference value. The objective is to minimize the functional
(2)J=∫0∞(δTQδ+uTRu)dt,
where Q and R are symmetric and positive definite matrices, δ is a vector of the input errors, and u is the control signal. In addition, R can be chosen unitary without loss of generality [28].From the control law presented in (3), for R=1,
(3)u(t)=-Kx(t),
where
(4)K=-BTP.For the defined values of the matrixQ (where Q is a positive definite matrix), the matrix P (where P is a symmetric matrix) can be found, which is a solution for the Riccati equation:
(5)ATP+PA-PBBTP+Q=0.The limitation is that the LQR addresses a regulation problem and cannot originally be applied to a tracking problem, which is desired in practice [27].It is important to note that different values for the weight coefficient matrixQ are obtained for different trajectories, which implies that the range of values of Q matrix components influence the quality of the transient process.The technique of pole placement is proposed in this paper to find an optimal matrixQ (LQR formulation) which ensures the desired characteristics of transient response, ensuring achieving optimal regulation.To design the LQR controller feedback vector, the technique of pole placement is initially used [27, 28], since this control law works in the same way as the control law for the LQR controller. Thus, the state feedback K is found satisfying all conditions imposed by LQR controller, and the operating point of the closed loop system can be assured.Therefore, the vectorK can be defined, by the pole placement technique, by equation
(6)Kp=[αn-βnαn-1-βn-1⋯α2-β2α1-β1]T-1,
where αi is obtained from the characteristic polynomial:
(7)(s-μ1)(s-μ1)⋯(s-μ1)=sn+α1sn-1+⋯+αn-1s+αn,
where μi are the desired poles and the elements βi are the characteristic polynomial coefficients given by
(8)|sI-A|=sn+β1sn-1+⋯+βn-1s+βn.The transformation matrixT is given by
(9)T=MW,
where M is the controllability matrix given by (10) and W is given by (11).Consider(10)M=[BAB⋯An-1B],(11)W=[an-1an-2⋯a11an-2an-3⋯10⋮⋮⋱⋮⋮a11⋯0010⋯00].Replacing (6) in (4), the Riccati matrix (P) for gain vector (Kp) can be obtained by
(12)Pp=(BT)+Kp,
where (BT)+ is a pseudoinverse matrix.Replacing (12) in (5) yields
(13)Q=-ATPp-PpA+PpBBTPp.Through the solution of (13), the control that causes the system to the desired orbits minimizing the functional (2) can be defined, with the predefined transient behavior, where, by means of mathematical manipulations, one can find a matrix Q that satisfies the conditions of the LQR controller. The matrix Q must be positive. In this sense, a single test can be carried through an algorithm to prove that the obtained matrix Q is equal to QT. Thus, it can be said that the (Kp) state feedback vector corresponds to an optimal controller offered by LQR algorithm.


## 2.3. Proposed Hyperbolic Tangent Adaptive Control (HTAC)

After some analyses realized by numeric simulations, to be presented afterwards, and relating to the system response during a load disturbance and to the steady-state error, it is possible to observe that either the proposed LQR and PID controllers are effective to maintain the system over the dominant poles in closed loop defined in the control design. Also, it can be observed that the LQR control is more effective for the transient response and the PID control for the steady state.With the objective of obtaining a control that presents the combined efficiency of both controllers, enhancing the performance of the system in closed loop as well as reducing the overshoot and the settling time, a parallel combination of LQR and PID controls is proposed. The simplest approach is to switch which controller will actuate over the system given a specific rule, such as a predefined error value. The disadvantage of this approach is the occurrence of an abrupt change in the control structure. In order to avoid this abrupt commutation between the controllers, a weighted combination is proposed where their control actions are regulated by weights (wi) defined by a hyperbolic tangent function.The control law for the HTAC controller is defined by(14)u(t)=uC1(s)(t)*w1+uC2(s)(t)*w2,
where uC1(s)(t) and w1 represent the LQR control and its weight, respectively, and uC2(s)(t) and w2 represent the PID control and its weight, respectively, with w1+w2=1.The valuew1 is determined as a function of the system error, given by
(15)w1=tanh|e|,
where e is the normalized error.In this sense, it is possible to define the higher weightw1 for the controller with faster responses in situations of larger errors, this will be the controller with higher predominance in the control action.The valuew2 is defined by
(16)w2=1-w1.So, the weightw2 will be inversely proportional to the error and will present higher values in situations of small errors, bringing into spot the controller that ensures a null error in steady state. Considering this objective, a controller with an integrative term is a good choice.In Figure1, one can observe how the HTAC controller can be implemented.


## 3. Control Strategy Applied to a Step-Down Converter

Figure2 presents the control strategy scheme applied to the step-down converter.Figure 2
Control strategy scheme applied to the step-down converter.The design parameters for the converter are presented in Table1.Table 1
Parameters for the buck converter.
Parameters
Value
Input voltage (Vi)
48 V
Capacitance (Co)
3.33μF
Inductance (Lo)
1.1 mH
Resistance (Ro)
30Ω
Reference voltage (Vref)
30 VThe matrices that determine the state space system of the buck converter are presented in the following equation:(17)A1=A2=[01Co-1Lo1CoRo];B1=[01Lo];B2=[00];C1=C2=[01],D1=D2=0.As the duty cycle (D) is the ratio between the output reference voltage and the input voltage, the state matrices are rewritten as
(18)A1=A2=[0300300909.110010];B1=[0909.1];B2=[00];C1=C2=[01],D1=D2=0.Replacing the data in Table1 into (17), one can define the duty cycle to the output voltage transfer function of the Buck converter, as expressed in
(19)Gvod(s)=v^o(s)d^(s)=1,28e10s2+10000s+2.667e7.Having the transfer function of the converter, the design of the controllers is set so that the operating point of the closed loop system has a natural frequency according to:(20)wn=1LoCo=16333rad/s.The damping ratio (ξ) in open loop, determined by (20), is approximately 0.3 and is defined as a function of the settling time (ts) at 2% and the natural frequency of the system. The value of ts can be found from the step response of the open loop system:
(21)ξ=4wnts.From these data, the operating point of the closed loop system can be set to a new damping ratio near 0.8, which is the maximum acceptable value for second order systems. Thus, the set point is(22)s1=-13064±9798j.With the control design parameters of the converter defined, one can design the PID and LQR, so that the operation of the closed loop system occurs at the same operating point. So, having the controllers following the same operating sequence, a comparative analysis of the performance for each control scheme can be carried out with more accuracy.Following this analysis, the hyperbolic tangent function is applied in order to use the best responses of the applied controllers according to the error generated by possible disturbances.From the operating point of the closed loop system, defined in (22), it is possible to design the PID controller. The designed controller gains are Kp=0.0723, Ki=367.16, and Kd=0.000004037.For the LQR controller using the operation point of the closed loop system defined in (22), the state feedback gain found from the proposed algorithm is
(23)Kp=[409416078].Replacing (23) into (13) results in Q=108[0.05910.02830.02832.6274], achieving the optimal control given in
(24)u(t)=-4094vco-16078ico.Taking the previous designed results, the HTAC was implemented and presented in this paper using the combination of these two controllers. The limits of the hyperbolic tangent function are defined from the system error range.


## 4. Simulation Results

The hardware chosen for implementation of the proposed controllers in this project is a EP3C25Q240C8N Cyclone III FPGA, manufactured by Altera. The simulations are performed in the MATLAB/SIMULINK environment where the DSP Builder framework, provided by Altera, is installed as a toolbox, making, possible to simulate the model of the power converter itself and to export it to be compiled by the Altera Quartus II software without leaving Simulink.To obtain more accurate results, various factors of a real prototype are taken into consideration. The simulation step size period was defined in the Simulink as 25 nanoseconds. The signal obtained from the output voltage is adjusted by a block that simulates the conditioning circuit in order to satisfy the inputs of the analog-to-digital converter (A/D). The external A/D converter is necessary because the FPGA hardware does not have internal A/D converters.The chosen A/D converter is the AD7655, manufactured by Analog Devices, with a 16-bit resolution and sampling rate of 500 KSPS (samples per second). In the simulation, a system of blocks is used to represent the inherent delay of the digital conversion and quantization according to the sampling rate.The complete implementation of the HTAC controller using DSP Builder is shown in Figure3. It can be observed that the block diagram has a 16-bit input and a single output (single bit) which is connected to the pulse driver that actuates the switch.Figure 3
Block diagram implemented in DSP Builder.Figure4 presents the transient response for the Buck converter in closed loop for the two control techniques employed, PID and LQR. For the converter startup process, a 250 μs length ramp is used to achieve the rated output voltage.Figure 4
Startup process converter.Figure5 presents the responses of each system alone for a load disturbance. Figure 6 presents the steady-state output voltage of the converter for all controllers. Unlike LQR, PID presents a zero steady-state error.Figure 5
System response for a 50% load step.Figure 6
Steady-state output voltage of the converter for both controllers.Figure7 shows the current across the converter inductor Lo for the PID and LRQ. It can be observed that the inductor Lo currents have the same ripple value defined in the converter’s design. In relation to the load step response, it can be observed that for the initial overshoot the currents of PID and LRQ controllers are similar.Figure 7
CurrentiL with response for a 50% load step.Figure8 presents the transient for the Buck converter in closed loop, enabling comparison between the responses of the controllers implemented separately: PID, LQR, and HTAC. Figure 9 presents in detail the responses for a load disturbance. Thus, one can observe that the HTAC presents a response as fast as that for the LQR controller and a null error in steady state as for the PID controller. Figure 10 presents the responses of HTAC for a load disturbance of 50%.Figure 8
Startup process converter with HTAC control.Figure 9
System response for a 50% load step for PID, LQR and HTAC.Figure 10
System response for a 50% load step with HTAC.Figure11 shows the converter inductor current Lo for the hyperbolic tangent adaptive control.Figure 11
CurrentiL for the hyperbolic tangent adaptive control for a 50% load step.The variation on the weightsw1 and w2 applied to the HTAC controller, multiplied by the control action of the PID and LQR controllers, is presented in Figure 12, where it is possible to observe that in the moments when disturbances occur, the weights exhibit variations that goes up to the moment of stabilization.Figure 12
Variation of the weightsw1 and w2 of the HTAC controller.


## 5. Conclusions

This work presented the design and simulations of an adaptive PID + LQR control technique applied to a step-down converter. The pole placement technique was used to guarantee that the two controllers work in the same operation point and the system does not present excessive voltage and current overshoot. Knowing that the steady-state error of the converter output voltage for the PID is smaller than for the LQR control and the response time for LQR controller is smaller than for the PID, a parallel combination of the designed controllers is proposed, yielding an adaptive controller which improves the performance of the system, both in response to time and the reduction of overshoots of the controlled magnitudes.A hyperbolic tangent weight function is used to gather the best performance of each controller according to the system error. Thus, the best responses in settling time and overshoot and annulling the steady-state error are achieved as compared to independent implementation of each controller. The Altera DSP Builder framework was used in a MATLAB/SIMULINK environment for the implementation of the Hyperbolic Tangent Adaptive Control (HTAC) and to obtain real-time simulation results.



---

*Source: 101650-2013-11-18.xml*