Experimental Design of an Adaptive LQG Controller for Battery Charger/Dischargers Featuring Low Computational Requirements

: The growing use of DC/DC power converters has resulted in the requirement that their complex controllers be cheaper and smaller, thus using cost-effective implementations. For this purpose, it is necessary to decrease the computational burden in controller implementation to minimize the hardware requirements. This manuscript presents two methods for tuning an adaptive linear–quadratic–Gaussian voltage controller for a battery charger/discharger, implemented with a Sepic/Zeta converter, to work at any operating point. The ﬁrst method is based on a lookup table to select, using the nearest method, both the state feedback vector and the observer gain vector, solving the Riccati’s differential equation ofﬂine for each practical operating point. The second method deﬁnes a polynomial function for each controller element that is based on the previous data corresponding to the system operating points. The adaptability of the two controllers to ﬁxed voltage regulation and reference tracking was validated using simulations and experimental tests. The overshoot and settling time results were lower than 11% and 3.7 ms, which are in the same orders of magnitude of a control approach in which the equations are solved online. Likewise, three indices were evaluated: central processing unit capacity, cost, and performance. This evaluation conﬁrms that the controller based on polynomial interpolation is the best option of the two examined methods due to the satisfactory balance between dynamic performance and cost. Despite the advantages of the controllers in being based on a lookup table and polynomial interpolation, the adaptive linear–quadratic–Gaussian has the beneﬁt of not requiring an ofﬂine training campaign; however, the cost saving obtained with the lookup table controllers and polynomial interpolation controllers, due to the possible implementation on small-size microcontrollers with development tool simple and easy maintenance, will surely be desirable for a large number of deployed units, ensuring that those solutions are highly cost-effective.


Introduction
Power processing is the most critical activity in electric and electronic systems, and one device most used for this purpose is the DC/DC power converter. Power converters are used to drive DC sources, storage devices, and loads. Moreover, power converters require a controller for safely performing power processing tasks. Due to the wide range of controllers reported in the literature, evaluating functional and non-functional characteristics to choose the most suitable one for an industrial system is of significant relevance [1].
It is crucial to have performance criteria for controllers because they provide an objective way to assess the quality of their work. The evaluation criteria for DC/DC power converter controllers include factors such as precision of voltage regulation, system stability, efficiency, load-carrying capacity, and dynamic response [2][3][4][5]. They can also have advanced features such as overcurrent and overvoltage protection to ensure safe and reliable system operation. Moreover, some non-functional characteristics such as size, cost, and computational burden should be considered.
The viability of implementing a solution in control theory is a problem that can be solved if an algorithm with moderate computational requirements exists [6]. The moderate computational requirements mean that the computational resources (fundamentally processor and memory) that need to solve the problem are within the acceptable costs. Being inside these limits facilitates implementation and helps in reaching the system performance specifications [7]. The acronyms used here are summarized in Table 1. The high complexity of the current systems requires the development of advanced control strategies to achieve the performance demanded by the application. These control strategies, in turn, require devices with high power processing, thus raising energy consumption and increasing the heat dissipation and costs. In order to develop cheaper solutions, with small and efficient implementations, it is necessary to reduce the computational burden of the control strategies without significantly impacting the response accuracy; for this, it is useful to simplify the models to reduce the number of differential equations, replace some dynamic equations with lookup tables, linearize some nonlinear relations, or eliminate redundant calculations. In the particular case of power converter control, strategies frequently used, apart from classical proportional-integral-derivative (PID) topologies, are model predictive control (MPC), robust control, and adaptive control, whose implementations are generally complex and produce a significant computational burden. Some works found in reviews of the state of the art implement those controllers, but there are few reported attempts to reduce the computational burden.
For example, in [8], the computational burden of a conventional finite control set MPC applied to a T-type 3P-3L (three-phase three-level) converter is reduced by implementing three improvements: a better optimization method to determine the vector for current tracking without vector enumeration; an algorithm for capacitor charge balance with the aim of obtaining the vector for neutral point potential balance, thus eliminating weight factor; and, finally, introducing a hybrid vector output mode to give full consideration to current tracking and neutral point potential balance. With these changes in the algorithm, it an improvement factor of 1.6 was achieved in the execution time of the implementation with C-language on the DSP TMS320F28335. However, although the system performance is improved in the solution, the complexity and processor requirements are high. In [9], the authors implemented a finite control set MPC variant, named fast MPC, applied to a multilevel inverter in a photovoltaic system. In this work, the change in the algorithm avoids testing all possible states of the multilevel converter and evaluate a cost function, reducing the six-factor computation time without effecting the dynamic response (the controller was implemented on a TMS320F28335 DSP). However, the finite control set MPC proposed in that work still executes complex operations, such as Lagrange extrapolation, that still overload the processor.
A method that has recently had a huge boom is deterministic artificial intelligence, which has shown tremendous improvement of performance in systems control compared to nonlinear adaptive methods. For example, some works present the control of the DC motor or the actuator of an unmanned underwater vehicle, where it is evident that the performance improvements are not due to the coefficient estimation but to the modeling methods [10] and the discretization [11][12][13][14]. This is why the deterministic artificial intelligence method is highly recommended for applications that require high levels of accuracy, consistency, and precision, such as in power electronics, although in the reviewed works, the controller does not directly control the DC motor driver, namely the power converter. However, these works do not report performance metrics related to computational burden.
A sliding mode controller that requires a processor with high performance is presented in [15]. The strategy consists of an adaptive-gain/super twisting sliding mode controller applied to two electro-pneumatic actuators, which is a slow system. This work does not evaluate the computational complexity; however, it requires a DS1104 board from DSpace to implement the control law, which is a costly device. Other works show some practical applications utilizing bidirectional buck-boost converters: a high-gain sliding controller in a supercapacitor in [16], a sliding-mode controller of the electro-mechanical actuator current of an aircraft powered by a supercapacitor in [17], and in [18][19][20][21][22][23], a current sliding-mode controller accompanied by supervisory control that carries the charge state of the battery, its charge/discharge current, the regulation of the high-voltage side, or maximizes generator current. These works highlight the advantages of these nonlinear controllers, but they do not feature their requirements for hardware, lower [19] when implemented using an M4 processor, nor their computational burden.
A methodology for combined design of controllers, both adaptive and linear quadratic regulator (LQR), is presented in [24]. The adaptive controller portion deals with the unknown dynamics of the plant. At the same time, the LQR control, based on a Kalman filter, is used to minimize the effects of the external disturbances. Unfortunately, this work only shows simulations without experimental validation, and there are neither simplifications nor strategies that could decrease the computational burden. Similarly, proposed in [25] is a combination of adaptive and LQR control for a grid-connected inverter. The current control is frequency-adaptive, while the optimal LQR selects desirable gains for the full-state feedback controller and full-state observer. However, the computational burden of the implementation is high, requiring a DSP TMS320F28335 with a sampling period of 100 µs, which is after decreasing the computational requirements by designing a discrete-time observer in the stationary reference frame.
A useful strategy to significantly reduce the computational burden is to perform any optimization process offline; this is, for example, defining the controller adjustments in several operation points before the dynamic behavior takes it there. Therefore, when the system evolves to one of those operations points, the controller parameters must be selected from a table and not dynamically calculated. This solution is reported in some practical cases. For example, the use of a lookup table for power converter control is reported in [26]; this work proposes two new lookup table methods for a three-level AC/DC converter supplied from the grid. The first method improves the nonlinear direct power control by rotating the orientation of the coordinates; the second method is an improvement of the first in which a new optimal division of the current error plane is introduced, which allows for better voltage vector assignment. Another example is reported in [27], which proposes a direct power control strategy using a switching table that can simultaneously control both active and reactive power in an electrical grid. It uses an extended p-q theory better suited for unbalanced grid voltages than the original p-q theory. The extended p-q theory is combined with voltage-oriented control to mitigate the influence of grid voltage unbalances. Nevertheless, the disadvantages of direct power control are evident: small scalability, requirement for high synchronization, does not work well with interference, and limited range [28,29].
Adaptive lookup table-based variable on-time control is proposed in [30] for critical mode boost power factor corrector converters, which combines the advantages of both the conventional lookup table method and the real-time calculation method. The paper realizes the adaptability of proposed control within the universal AC input, and the entire load range through a simple linear calculation. Furthermore, the proposed controller reduces the required memory space for variable on-time tables and significantly shortens the computation time, leading to low system cost.
In general, the parameters of PID controllers for nonlinear industrial systems are dynamically tuned using lookup tables. A method based on a cost function to tune the lookup table parameters used in gain-scheduled PID control is proposed in [31], where the L2 norm is adopted to prevent overlearning. This strategy allows the controller to work at any operation point.
Presented in [32] is a lookup table of maximun power point tracking (MPPT) algorithm for boost converters in photovoltaic systems, which has lower accuracy than a perturbed and observer (P&O) algorithm but a better response to sudden changes in temperature or irradiance. Instead, the works reported in [33,34] describe a digital PID for regulating the voltage on class E buck-boost converter and buck converter, respectively. The compensator is based on a lookup table and implemented with multi-phase digital pulsewidth modulation.
Lookup tables are also used in MPC implementations. For example, ref. [35] proposes an offline optimization and online lookup table for a two-layer model predictive control to reduce the computational burden. The work examines the properties of computation complexity, steady-state operation, and robustness of the proposed strategy through detailed simulations.
A longitudinal movement/optimal controller for heavy-duty vehicles is solved offline in [36] using a mixed integer quadratic program. Then, if the position is known, those trajectories can be used as lookup tables to find the reference for both velocity and freewheeling. However, this solution does not directly act on the actuators in the vehicle, limiting its accuracy. Another work that does not involve the actuator was reported [37], in which an adaptive lookup table algorithm is introduced that can accurately and automatically update the static table of an air compressor system. The algorithm has better dynamic performance, such as shorter regulating time and lower overshoot in comparison with the traditional control method (PI + static feedforward strategy).
Presented in this paper are similar strategies to reduce the computational burden of complex controllers applied to battery charger/dischargers. In particular, this works focuses on the battery charger/discharger discussed in [38], which is based on a Sepic/Zeta converter interfacing a battery with the DC bus of a microgrid. The implementation consists of a linear-quadratic-Gaussian (LQG) controller designed to adapt to any operation, with the aim of regulating the DC bus voltage to ensure safe microgrid operation. This controller uses an adaptive law to adjust the controller parameters depending on the operating point; it also requires a full-state observer to reduce the number of sensors, thus reducing the cost. The implementation reported in [38] has a high computational burden due to the online calculation of both the adaptive part and the observer in which a DSP TMS320F28379D is required for experimental deployment.
Therefore, this work proposes using an offline process to calculate the adaptive controller described in [38], thus preserving the required operation range. Two methods were designed to calculate the state matrix, calculate the input matrix, and to solve the Ricatti differential equations: the lookup table method and the polynomial interpolation method. The first method requires calculating the matrices, solving the Ricatti equation once for each operating point, and storing the controller parameters in a lookup table. The second method defines a polynomial function representing the changes in the state feedback vector and the observer gain vector. The polynomial degree is defined to achieve a significantly small root mean square error. Both solutions are evaluated using numerical metrics, circuital simulations, and experimental implementations. Moreover, the performance/cost balance is also analyzed and contrasted with the original implementation reported in [38], which provides a selection guide depending on the charger/discharger requirements in terms of dynamic performance and implementation cost.
This manuscript is divided into five parts: Section 2 presents the power stage and the mathematical model; Section 3 presents the design of the adaptive LQG voltage controller, describing the controller processing using both the lookup table and the polynomial interpolation methods. Section 4 presents a design example and simulation results, and Section 5 reports the experimental validation, comparison, and discussion of the two solutions. Finally, the conclusions of the work are reported in Section 6.

Modeling of the Power Stage
The battery charger/discharger based on a bidirectional Sepic/Zeta converter is shown in Figure 1. This charger/discharger circuit is discussed in [38], where deep circuit and mathematical analyses are provided. The variables used for the circuit analysis are summarized in Table 2.  In this circuit, the main objective is to regulate the output voltage v dc , which corresponds to the voltage at the DC bus of a microgrid. In this way, the charger/discharger ensures the safe operation of all the devices connected to the DC bus.
For realistic purposes, the parasitic resistances in both the MOSFETs and inductors are considered for the analysis. A control-oriented model for this charger/discharger circuit is provided in [38]. In summary, the modeling procedure consists of obtaining the differential equations for the inductor currents and capacitor voltages, which are extracted from circuital analyses (charge and volt-second balances). Such a process is performed when the MOSFET control signal has ON (u = 1) and OFF (u = 0) states; then, those equations are combined using the control signal u to obtain the following switched model: It is difficult to use the previous switched model in the design of continuous controllers. Therefore, such a discontinuous model is averaged within the switching period T sw , which is performed by replacing the binary control signal u by the continuous duty cycle d. Moreover, for the sake of simplicity, the ON resistances of the MOSFETs are considered equal (R on1 = R on2 = R on ). The resulting averaged model is nonlinear; thus, it is described in terms of small-signal variables in state space representations, which will be used to design the controller. Applying the previous procedure leads to the small-signal model given in (5) and (6), where A m (state matrix), B m (input matrix), and C m (output matrix) must be evaluated in the desired operating point. The quantitiesx,ỹ, andd are the smallsignal changes in the state vector, output, and duty cycle, respectively. Finally, the state vector variables arex 1 The previous small-signal model is used in the following section to design the controller, aimed at regulating the DC bus voltage in a microgrid.

Adaptive LQG Voltage Controller
The controller aims to regulate the DC bus voltage under any operation condition, which are battery charge and discharge and standby modes. Moreover, the control system must remain stable over the entire operating range, and this means for different relations among battery and DC bus voltages. To achieve this performance, a linear-quadratic-Gaussian (LQG) controller with adaptive parameters is proposed. The LQG consists of three fundamental blocks: a linear quadratic integral (LQI) to regulate the DC bus, an optimal state observer to estimate the system states, and a dynamic process to determine the LQG parameters according to the operating point. Two methods are proposed to calculate the parameters values of controller in any operating condition: lookup table and polynomial interpolation.

LQI Controller Design
The regulation of the DC bus is defined as an optimal control problem, and its analytical design procedure was developed in [38]. In short, the quadratic cost function given in (7) is defined, which is solved using the linear quadratic regulator (LQR) approach [39], and an integrator is added to eliminate the steady-state error.
In Equation (7) r is a positive scalar value, Q is 5 × 5 positive matrix, andz is the extended state vector resulting from the inclusion of the error integral, namedx i . The state feedback law is defined in (8), where K x is a gain vector that multiplies the statesx, and K i is a scalar that multipliesx i . Then, the extended system is defined as reported in (9).
The optimization problem is solved using the Hamiltonian matrix, the equation of states and co-states, and the stable state values, all of which are described in [38]. In such a procedure, the optimal value ofd * is calculated as given in (10).
Then, K is defined as (11); to perform the calculation of K, the S m matrix must be solved from the Riccati differential equation reported in (12).
Finally, this problem is formulated as an optimal regulator of infinite time, hence S m corresponds to the steady-state solution of (12).

State Observer
In order to reduce the number of sensors required in the state feedback control system, the observer described by (13) and (14) is used. The design of the observer considers the linear model of the system (5) and (6) and the state feedback control law (8) [40]. The outputs of the observer are the estimated statesx, and the inputs of the observer are y and d, which correspond to the measured DC bus voltage v dc and the duty cycle, respectively.x The observer gain is calculated using an optimization process, which guarantees the convergence of the estimated states to the real values. The calculation of , given in (15), requires solving the Riccati differential equation reported in (16). In such an expression, S o corresponds to the optimal error covariance matrix of the state observer, and γ is a scalar used to adjust the convergence speed of the observer states as explained in [41].

Adaptive Parameters of the LQG Controller
In this section, two adaptive methods to adjust the control parameters under any operating condition are proposed. Unlike the approach presented in [38], which consists of online iterative calculation of the parameters, in this work the parameters are selected from a lookup table or calculated using polynomial interpolation. Since the parameters are calculated offline, both proposed methods require lower computational resources than the method presented in [38], as no online solutions of matrix differential equations are needed. Table Method This method consists of calculating both the state feedback vector and the observer gain vector, solving the Riccati's differential equation offline for each practical operating point (v dc_re f and v b combinations). Subsequently, the controller parameters are stored in a lookup table to be inserted into the implementation device. The selection of the parameters from the lookup table consists of searching the closest value (nearest method) according to the measurements of both the bus reference v dc_re f and the battery voltage v b .

Adaptive Polynomial Interpolation Method
This method consists of defining a polynomial function that represents the variation of each element of both the state feedback and the observer gain vectors, being in agreement with the operating point. This polynomial interpolation is performed using the data calculated in the lookup table method. The order of the polynomial functions is defined in such a way that the root mean square error (RMSE) is significantly small. As a result, after calculating the value of the polynomial coefficients, functions depending on v b and v dc_re f are obtained for each adaptive parameter, which are subsequently implemented in a control device.

Structure of the Adaptive LQG Voltage Controller
The control scheme is shown in Figure 2, where the adaptive tuning block provides the matrices of the LGQ controller (A m , B m ), the observer gain ( ), and the control parameters (K x ), all according to the operating point (v dc_re f , v b ). Then, the LQG controller uses those parameters to calculate the optimal duty cycle d in real time.

Design Example and Simulation Results
This section carries out a design example, applying the proposed strategies to reduce the computational burden of adaptive controller implementation and verifying those solutions using detailed circuital simulations. The application example considers a power converter of 26 W, a switching frequency of 40 kHz, and battery and DC bus voltages between 10 and 26 volts. The application also requires a minimum efficiency of 90%, a maximum ripple of 20% on the inductor currents, and a maximum bus voltage ripple of 1%. The converter parameters to achieve those requirements are inductors (L 1 , L 2 ) of 680 µH and capacitors (C i , C dc ) of 330 µF. Those values are the same ones calculated in the design procedure reported in [38], with the objective of performing a comparison under the same operating conditions.

Calculation of Controller Parameters
The values of the matrices A m and B m of the observer are computed offline using Equation (5) of the state space system. The controller parameters K and are also calculated offline for both the lookup table and polynomial interpolation methods.

Adaptive Lookup Table
To generate the data for the lookup table, the controller parameters were obtained by varying the battery voltage and the DC bus voltage inside the established operating range. This calculation was performed using the LQR function of the Control System toolbox package from Matlab, and the controller parameters were calculated by varying v b and v dc_re f every 2 V. The adopted search algorithm is nearest, which returns the value of the table corresponding to the closest data according to the combination of the inputs (v b , v dc_re f ). The data obtained for this method are reported in Appendix A.

Adaptive Polynomial Interpolation
To establish the polynomial functions that represent the variation of the state feedback vector, polynomial interpolation was performed using the data generated in the lookup table method. Therefore, for each element of the vector, a function of the voltages v b and v dc_re f is generated. This process was conducted with the Curve Fitter tool from Matlab, which calculates the coefficients according to the polynomial degree selected for the inputs. In this application, the linear least squares method was selected to calculate those coefficients. Moreover, the results show that a fourth order polynomial for the state feedback vector and a third order polynomial for the observer gain vector were sufficient in such a way that a maximum RMSE equal to 0.026 was obtained. This means that the resulting polynomial functions represent the state feedback vector in the operation range with satisfactory accuracy. Figure 3 shows an example of the polynomial fit for the third element of the state feedback vector (K 3 ). It is evident that the resulting surface adequately represents the set of points generated for all the combinations of v b and v dc_re f in the defined range.
The previous procedure is also executed to calculate the coefficients of the polynomial functions related to the observer gain vector. Figure 4 shows the polynomial fit for the third element of the observer gain vector ( 3 ) as an example, obtaining a surface that adequately represents the variation of this observer parameter. Finally, the polynomials and coefficients for this method are reported in Appendix A.

Simulations Results
The charger/discharger and control system performance in the regulation of the DC bus voltage is tested using circuital simulations. The tests are conducted at multiple operating points within the defined operating range. The simulations were executed in Simulink ® from Matlab ® using the Simscape™ Electrical™ toolbox [42]. The adaptive parameter methods were implemented using a three-dimensional lookup table (first method), and using Matlab ® functions for the polynomial interpolation (second method). The simulations evaluate the solution performance in two scenarios: voltage regulation for a fixed reference value, which is the most common application; and reference tracking, which introduces a strong perturbation to test the system stability.

Bus Voltage Regulation for a Fixed Reference Value
This is the most common operation of any microgrid (fixed DC bus voltage), where the disturbances in the bus are generated by changes in the current (and power) profiles of both the loads and sources connected to the bus. Therefore, the simulations consider a current profile imposing the different modes of operation to the batteries, including charging, discharging, and standby. In addition, the tests are conducted with one and two batteries connected in series to test the scalability of the solution.
The first tests are carried out using the adaptive adjustment method based on the lookup table. Figures 5-7 show the performance of the lookup table solution considering a 12 V battery. Those simulation consider step changes in bus current every 50 ms: first, it starts in standby mode (i o = 0 A), then switches to discharge mode (i o > 0 A), followed by switching to charge mode (i o < 0 A), and finally returning to standby mode. The simulations confirm that the adaptive LQG with lookup table provides the desired performance, in terms of voltage regulation, under any battery operating condition. Similarly, such results also illustrate the bus voltage stability in any operation condition. Moreover, the tests also evaluate the solution under different ratios between the batteries and the DC bus voltages (buck, boost, unitary gain), where satisfactory (and stable) performance is also evident. Finally, the lookup table solution does not saturate the duty cycle, thus ensuring the correct operation of system.  Voltage (V) In order to test the adaptability of the controller to large changes in battery voltage, the tests are repeated considering two batteries connected in series, thus v b = 24 V. In this case, to validate the buck, boost, and unity gain modes, the bus voltage references are set to 20 V, 24 V, and 26 V. The results of the simulations are shown in Figures 8-10, where satisfactory DC bus voltage regulation is achieved. In this way, the adaptability of the controller is verified under any condition, and it can thus be used in applications with different numbers of batteries as long as the voltage of the batteries is considered for the lookup table calculation. Therefore, it is useful to perform such a lookup table calculation for the rated limits of the power converter.  The same tests are performed for the adaptive parameter method based on polynomial interpolation. The tests are carried out with one and two batteries connected in series and testing the different modes of the converter. The simulation results are reported in Figure 11 (buck mode), Figure 12 (unitary gain mode) and Figure 13 (boost mode) for a single battery (v b = 12 V) and in Figure 14  The tests of the adaptive controller with polynomial interpolation also show satisfactory voltage regulation in response to perturbations in the DC bus current in all the different modes of both the converter and battery. Hence, there are no significant differences in the transient behavior in contrast with the Lookup table method. Nevertheless, the choice of the method may be due to the limitations of the hardware to be implemented, since the lookup table method consumes more memory, but the polynomial interpolation method consumes more mathematical operations.  Table 3 summarizes the dynamic performance results of the tests in Figures 5-16. In addition, the table also reports the results of the online adaptive method reported in [38], which enables a fair comparison since all the simulations are conducted in the same operation conditions: the results show that the online solution exhibits a maximum overshoot of 9.7% and settling times under 10 ms in all cases, while the maximum overshoot is 10.9% and the settling times are under 10 ms for the offline adaptive LQG methods; hence, all the solutions fulfill the design requirements. It is noted that the online adaptive LQG method provides lower overshoot in the tests at v b = 12 V in comparison with the offline methods, and there is also a longer settling time. This is caused by small tolerances in the controller parameters obtained with the offline adaptive methods; thus, an error in the settling time is expected. However, the offline methods provide a close performance in terms of both overshoot and settling time and, hence, the lookup table and polynomial interpolation methods are suitable for practical (experimental) applications. Table 3. Summary of the dynamic performance for bus voltage regulation. Table   Polynomial Interp.

LQG Online
Lookup Table   Polynomial Interp. On the other hand, mean error and relative standard deviation percentages of the DC voltage of the tests in Figures 5-16 are presented in Table 4. It is observed that the lowest error is obtained by the polynomial interpolation method at reference DC voltage of 16 V. Moreover, the mean percentage error of polynominal interpolation is lower than those of lookup table method for all tested cases. In terms of relative standard deviation, the two proposed methods present similar values, which means that a low number of points of the dynamic voltage response deviate from the desired value.  Table   Polynomial Interp.

Reference Tracking
To evaluate the tracking of the bus voltage references and thereby evaluate the robustness of the solutions to large changes in the bus voltage value, changes were made at a rate of 60 V/s regarding the battery voltage. First, the system starts in discharge mode with a bus voltage higher than the battery voltage, then the reference is changed to a voltage lower than the battery voltage, then returning back to the initial voltage. At 35 ms, the DC bus current is switched from 1 A to −1 A, which forces switching between the discharge and charge modes of the batteries. Finally, the test conditions are repeated to test the reference tracking in both charge and discharge modes, and in both boost and bock modes. Figure 17 shows the simulation results for the lookup table method considering a singe battery and a reference profile changing between v dc = 16 V and v dc = 10 V. The tests show adequate tracking of the reference in all the conditions; however, unexpected small transients occur when the reference changes. This is caused by the sudden changes in the controller parameters when the operating point changes significantly; this is a consequence of the discretization introduced by the nearest method.
Next, the behavior of the lookup table solution is evaluated with the connection of two batteries in series, and in this case the voltage references changes between v dc = 20 V and v dc = 26 V. The results, reported in Figure 18, confirm that the controller ensures satisfactory tracking of the reference at any condition, but there are unexpected transients in the ramp zones, thus exhibiting the same discretization observed in the previous test, i.e., of a single battery. The next two simulations evaluate the performance of the adaptive method based on the polynomial interpolation. Figures 19 and 20 show the results for one and two batteries, respectively, where the polynomial interpolation method provides correct tracking of the reference in the different operation conditions. It is observed that, for this method, there are no unexpected transients in the ramp zones. This is achieved since the adaptive adjustment of the parameters correspond to non-discontinuous functions, unlike the lookup table method.
The tests performed on both offline adaptive methods, and reported in Figures 17-20, confirm the correct reference tracking under changes in the operating conditions. Finally, the following section validates the previous simulation results using an experimental prototype.

Experimental Validation
This section reports validations of the previous simulations using an experimental prototype of the Sepic/Zeta charger/discharger and adaptive control systems.

Experimental Implementation
The experimental scheme used to validate the proposed offline solutions is reported in Figure 21. The system includes one or two commercial batteries (12 V or 24 V), the Sepic/Zeta bidirectional converter, and a DC bus emulator constructed with a DC electronic load and electronic power supply, emulating the loads and sources connected to the microgrid bus, respectively. The battery and DC bus voltages are measured with LV25P sensors and signal conditioning circuits. The control card Delfino TMS320F28379D is used to implement the control system and adaptive method. It is worth noting that the control card uses an internal analog-to-digital converter (ADC) to digitize the measurements, and it uses an internal PWM module to produce the control signal for the MOSFETS drivers.
The experimental implementation of both the adaptive controller and charger/ discharger is shown in Figure 22, where the Sepic/Zeta converter, sensors, and control card are highlighted. Figure 23 shows the complete experimental test bench, which also exhibits the commercial batteries and the practical implementation of the DC bus emulator.

Experimental Validation of the Bus Voltage Regulation
The same test conditions adopted for the simulations are implemented in this experimental validation. Thus, the DC bus current profile includes increments and decrements and shifts between charge, discharge, and standby modes. Figure 24a,b show the performance of the adaptive LQG with both the lookup table and polynomial interpolation methods. In this experiment, the bus voltage is regulated at 10 V (buck mode) for the charging, discharging, and standby modes of the battery. These experiments demonstrate the correct operation of the two offline parameter adjustment methods in terms of regulation, and no appreciable differences are observed between them in terms of their performance. In the same way, Figures 27-29 report a good performance in terms of DC bus regulation at 20 V (buck mode), 24 V (unitary gain mode) and 26 V (boost mode), respectively, considering two series-connected commercial batteries (v b = 24 V). Therefore, the robustness of both offline methods is confirmed for large changes in the battery voltage. In general, in the experimental data concerning DC bus voltage regulation, both offline adaptation methods exhibit correct performance under charge, discharge, and standby conditions under different voltage conversion ratios (buck, boost, and unitary gain modes). In addition, the voltage variation of the battery pack enable the stability of both solutions at different operating points to be confirmed. Table 5 summarizes the performance criteria (overshoot and settling time) obtained with the proposed adaptive offline methods. For comparative purposes, the adaptive online LQG approach presented in [38] was also implemented and experimentally tested, and its performance criteria are included in Table 5. The results with a single battery (v b = 12 V) show that the adaptive online LQG exhibits lower overshoot and shorter stabilization time than the offline methods. However, in the test considering two batteries connected in series (v b = 24 V), the proposed offline methods provide better dynamic performance, except for the lookup table method in standby mode. Those experiments confirm that the proposed offline methods are a suitable option to adapt the LQG parameters in practical application, since the difference with the online option is small.  Table   Polynomial Interp.

LQG Online
Lookup Table   Polynomial Interp.

Experimental Validation of Reference Tracking
Several experiments were conducted to validate the adaptability of the offline methods to changes in the operating point by considering dynamic changes in the reference value. The changes in the bus reference are given in such a way that the converter changes between buck and boost modes. In the same way, the tests were repeated for the charge, discharge, and standby modes of the batteries. The experimental data of the reference tracking, for both lookup table and polynomial interpolation methods, are shown in the Figure 30, where a single battery (v b = 12 V) is considered in those experiments. The proposed offline adaptive methods guarantee correct tracking of the references under different operating points for different modes of the converter (buck and boost modes). In addition, the tracking performance was evaluated with two batteries connected in series (v b = 24 V). For this experiment, the bus voltage reference starts at 20 V (buck mode), changes to 26 V (boost mode), and finally returns to 20 V. Figure 31 shows the experimental behavior of both proposed offline methods; similarly to the previous experiments, the results indicate the correct performance of the adaptive methods for different operating points. In agreement with the simulation results, the lookup table method exhibits unexpected voltage transients when the reference voltage changes continuously, which is caused by the discretization of the method. However, these transients are more notable for a battery of 12 V, since the bus voltage is lower. This phenomenon can be reduced by increasing the resolution of the data stored in the lookup table; however, this increases the memory required in the control device and, also, the parametrization time for the method.

Performance and Cost Comparison
Since the main objective of the proposed offline methods is to reduce the computational resources required for the implementation of the adaptive LQG controller, this section evaluates the computational burden of the new solutions.
The control card TMS320F28379D has two cores, each providing 400 millions of instructions per second (MIPS), which means that the total capacity of the card is 800 MIPS. In the implementation, each adaptive offline proposed method is required to use a core at a time. Using the Matlab ® report, the processor load for each of the adaptive solutions was extracted, which includes the online approach reported in [38]. This information is summarized in Table 6, where the two proposed (offline) solutions require almost the same CPU utilization (MIPS required). Instead, the online method [38] requires between 7 and 8 times the MIPS for the adaptive process. Taking into consideration the maximum MIPS required by proposed method, a suitable control card available in the market is selected to evaluate the implementation cost. Control cards from TI C2000 MCU series are suitable due to the available PWM, ADC modules, and high processing capacity. For example, the TMS320F2800157 control card provides 120 MIPS, which is enough to implement the adaptive offline methods. Moreover, this control card also provides the additional hardware required to execute the control strategy for the battery charger/discharger, such as programming ports and communication ports, among others. The cost of this card is USD 59; instead, the control card required to implement the online method (with 714 MIPS required) is the TMS320F28379D, which costs USD 159 and is thus significantly more expensive.
The previous practical considerations were analyzed by proposing three indices: designed CPU capacity index (I p ), cost index (I cost ) and performance index (I cpu ). The I p index is calculated from the performance data reported in Table 5 using Equation (17), where a higher I p implies greater performance. In such an expression, E x(i) is the overshoot or stabilization time, and E re f (i) corresponds to the lowest value of the data under comparison. In this way, the solution with the lower overshoot or shortest stabilization time will always have I p (i) = 1, and the other solutions will have lower I p value. Finally, the I p (i) values for each method are averaged to obtain a general performance index I p for each adaptive method.
The I cpu index uses the data reported in Table 6 and Equation (18), where the higher I cpu , the lower the required MIPS. In (18), cpu x and cpu re f correspond to the MIPS required by the solution and the minimum CPU consumption of methods under comparison, respectively. In this way, the method with the lower MIPS requirement will have I cpu = 1, while the other methods will exhibit a lower I cpu value.
Finally, the I cost index is given in Equation (19), where cost x is the price of the corresponding control card, and cost re f is the price of the cheaper control card for all the implementations. As in the previous cases, the higher the index, the lower the required cost, where the solution with the lower cost will have an index equal to 1.
The results of applying three proposed indices to the solutions under comparison are reported in Table 7. A higher index value of I p implies a better dynamic performance, a higher value of I cpu indicates lower computational requirement, and a higher value of I cost means lower cost of the control card required to implement the adaptive method. It is observed that the polynomial interpolation method exhibits a better overall performance, also requiring the lowest CPU consumption and cost; therefore, that method is the best alternative for commercial implementation of the adaptive LQG controller for battery charger/dischargers. The previous data can be further processed to contrast both the offline (proposed) and online solutions. For this purpose, combined indicators are proposed: the performancecost, which adds both I p and I cost ; and the performance-CPU, which adds both I p and I cpu . Table 8 reports both combined indicators, where the polynomial interpolation method provides the best relation between performance of the charger/discharger and implementation cost. The second best method in this category is the lookup table, and the last is the online method reported in [38]. Similarly, the polynomial interpolation method provides the best relation between performance and CPU utilization, the second best method is the lookup table, and the last, again, is the online method. This last category is interesting, since it enables analyzing which method will leave higher resources, thus providing computing power for other tasks such as data logging, cloud storage, state of charge management, etc. Finally, this practical analysis confirms that both offline solutions provide an acceptable performance with much lower implementation costs. In particular, the polynomial interpolation method provides the best tradeoff and is thus the best solution for commercial applications.

Conclusions
Two adaptive offline methods for adjusting the parameters of a LQG controller and regulating the DC bus of a battery charger/discharger are proposed. The charger/discharger is based on the Sepic/Zeta converter, and the parameters of the controller are determined taking into account the conditions of both the batteries and converter. For the former, conditions may vary between charge, discharge, or standby modes. Moreover, depending on the voltage requirements of the input and output, the converter can be in boost, buck, or equal gain mode. For the LQG controller, a state feedback vector and an observer gain vector must be determined in an adaptive way. The first method consists of calculating the parameters of vectors for several operating points of load and input reference voltage, and those are stored in a lookup table. In the second method, an interpolation is developed among the values of the lookup table. In simulation and experimental results, for several operating conditions, the control signal remains far away from saturation, and the control system is stable, thus providing satisfactory results.
Three indices have been proposed to evaluate the performance of the proposed adaptive methods, which are suitable to evaluate dynamic performance, CPU capacity, and cost. These indices show that the lookup table and polynomial interpolation methods present similar dynamic performance and CPU requirements, but the combined indices show that polynomial interpolation is the best option for practical and commercial application. In addition, compared with the lookup table method, that method exhibits satisfactory performance over the entire operating range, and it does not introduce unexpected transients under any operating conditions. Moreover, polynomial interpolation requires low computational consumption in contrast to the online LQG method, which means considerably lower implementation costs.
The main drawback of both proposed offline solutions is the need for an offline training campaign, which is not needed in the online alternative already reported in the literature. However, with the aim of developing low-cost solutions for deployment in commercial applications, it could be acceptable to spend the time required for training if there is significant reduction of the implementation cost. Finally, for future improvement, evaluating more deployment-oriented platforms for implementation, such as FPGA or ASIC devices, could provide a much better cost/performance ratio.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A
This appendix reports the lookup table data used in the first proposed offline method. The data are distributed in eight tables, one for each parameter of both the controller and observer.            Similarly, the polynomial interpolation data are also reported. First, the polynomial for the controller is reported in (A1), and the parameters for such an interpolation are given in Table A9. In the same way, the polynomial for the observer is reported in (A2), and the parameters for such an interpolation are given in Table A10.