Modeling a residential grid-connected PV system with battery–supercapacitor storage: Control design and stability analysis

The increased penetration of renewables and the variable behavior of solar irradiation makes the energy storage important for overcoming several stability issues that arise in the power network. The current paper examines the design and stability analysis of a grid-connected residential photovoltaic (PV) system with battery–supercapacitor hybrid energy storage. The battery and supercapacitor packs are connected to the common 400 V DC-bus in a fully active parallel configuration through two bidirectional DC–DC converters, hence they have different voltage levels and their power flow is controlled separately. A detailed small-signal stability analysis is considered for the design of the current controllers for the bidirectional converters of the battery and supercapacitor. An important contribution here is that a detailed stability analysis is performed for both the boost and the buck mode of operation for the battery and supercapacitor converters, resulting in more accurate tuning of the controllers. Moreover, the small-signal stability analysis of the voltage source inverter (VSI) is considered in order to design the DC-bus voltage controller, where a reference output current is obtained using a phase-locked loop (PLL) for grid synchronization. The proposed model is developed and simulated in the MATLAB/Simulink software environment, based on mathematical analysis and average modeling. The simulation results verify the dynamic performance of the proposed model, through several rapid changes in PV generation and in load demand. Also, the model works properly and responds extremely fast during different mode transitions, exhibiting a very fast DC-bus voltage regulation with a very small ripple voltage (a maximum of ± 0.625%). Finally, the supercapacitor handles the rapid changes occurring within 0.2 s, hence this can relieve the battery stress and extend the battery lifetime. © 2021TheAuthors.PublishedbyElsevierLtd.ThisisanopenaccessarticleundertheCCBYlicense (http://creativecommons.org/licenses/by/4.0/).


Introduction
Current rising electricity demand and climate change have reinforced the need for independence from conventional fuels and use of renewable energy sources.Solar photovoltaic (PV) is one of the most growing technologies in the world with a current growth rate of 35%-40% per year.Moreover, PV power generation can be considered as the most promising, widely available and essential renewable resource.On the other hand, the variable behavior of solar irradiation and, consequently, PV generation renders energy storage important for overcoming several problems that arise in the grid (Hemmati and Saboori, 2016;Argyrou et al., 2018a;Bocklisch, 2016).
Additionally, the hybridization of energy storage technologies can allow various applications in a system that may not be possible for a single storage technology.A notable such example is the battery-supercapacitor storage, which combines the shortterm (supercapacitor) and long-term (battery) storage, as well as the high power (supercapacitor) and high energy (battery) rating.Furthermore, supercapacitors can reduce stresses in battery storage and thus extend the battery life.The battery and supercapacitor pack are connected to the DC-bus through bidirectional DC-DC converters.The fully active parallel configuration provides flexibility as the battery and supercapacitor can operate in different voltages and be controlled separately (Argyrou et al., 2018c;Vazquez et al., 2010).

Related research on the techniques and design of controllers
The DC-bus voltage can be regulated by PV, storage or grid inverter, depending on the system configuration.If the system is grid-connected, then the DC-bus voltage can be regulated by the grid inverter, while if the system is stand-alone or in islanded mode then the DC-bus voltage can be controlled by PV, battery or supercapacitor.Following is a literature review of different systems, focusing on the design of controllers and the techniques used.Kollimalla et al. (2014) studied the design of the voltage and current controllers for battery and supercapacitor converters.The design was for a stand-alone PV system with DC load, where the DC-bus voltage control was implemented by the supercapacitor converter.Manandhar et al. (2018) used the same configuration in performing a stability analysis and the controllers design.However, none of the above studies considered the state-of-charge (SOC) of the battery and supercapacitor, which were assumed to be utilized within their acceptable limits.This can cause deep charge/discharge cycles and hence a decrease of battery lifetime.Hajiaghasi et al. (2018) proposed a stand-alone PV system with hybrid storage and DC and AC loads.The authors investigated the design for the voltage and current controllers of the converters.For the current control of the battery and supercapacitor converters, PI controllers were used.Also, regarding the DC-link voltage controller, a fuzzy controller was chosen.The results showed that the PI-fuzzy control strategy improved the dynamic stress and the peaks and ripples in the current of the battery.Yi et al. (2018) examined a unified control for a PV system with battery storage for both grid-connected and islanded modes.Specifically, in grid-connected mode, the inverter was responsible for the DC-bus voltage control and the reactive power control from the DC to AC side.Through the Phase Locked Loop (PLL) a reference current for the inverter was extracted.Moreover, the power flow of the battery converter was regulated using a PI controller.On the other hand, when the system was in islanded mode, the DC-bus voltage control was done either by the battery or the PV converter (if a battery was not available).Also, the inverter was responsible to regulate the output AC voltage.All the required controllers were chosen to be PI controllers.Singh and Lather (2020b) proposed a combined PI and SMC (Sliding Mode Control) method for a DC microgrid application including PVs and battery-supercapacitor hybrid storage.The DC-bus voltage control and the battery current control were monitored by PI controllers, while the supercapacitor current control by a SMC.Also, for the design of the PI controllers, a stability analysis was presented using the appropriate small-signal transfer functions.The same authors extended their aforementioned work by proposing a modified control structure, which included a rate limiter (for reducing the high charge/discharge rates), a PI controller for the DC-bus voltage control and two SMCs for controlling the currents of the battery and the supercapacitor, respectively (Singh and Lather, 2020a).The results showed a smaller DC-bus voltage overshoot and a faster voltage regulation of the proposed strategy.Ma and Hsieh (2020) studied a battery-supercapacitor hybrid energy storage application for renewables and proposed different control schemes.The system was grid-connected with DC and AC loads, where the inverter was responsible for the DC-bus voltage control (type II compensator) and the inductor current control (P controller).The DC-DC bidirectional storage converters included a single-loop inductor current controller (type II compensator).The authors provided a detailed tuning procedure for the design of the appropriate controllers and verified the effectiveness of their proposed scheme through simulations and experimental implementation.Cabrane et al. (2021) examined a stand-alone PV system with battery-supercapacitor hybrid energy storage and DC load.The control system was based on PI controllers for voltage and current control.Through the DC-bus voltage control, the reference hybrid energy storage current was extracted.After that, a filter was used for the calculation of the reference currents of the battery and supercapacitor.The simulation results showed that the integration of the supercapacitor reduced the consumption of the battery.Also, the authors compared the simulation results of the battery SOC for different filter constants, concluding that the battery SOC consumption decreased for increased time constants.However, the SOC limits of the battery and supercapacitor were not considered in the energy management strategy.Ravada et al. (2021) proposed an isolated multisource converter configuration and control structure for a grid-connected PV/wind system with battery-supercapacitor hybrid storage.All required current and voltage controllers of the proposed converter were chosen to be PI controllers.The authors achieved less complexity in the control stage with a smaller number of components.However, no further stability analysis was done and the PI tuning parameters were not given.
It must be stressed here that all the above studies, which include research in stability analysis, have assumed a unified controller for the design of the bidirectional DC-DC converters, in which the two modes (boost and buck) were controlled in a complementary fashion.Therefore, the design concerned the boost-mode operation of the converter.On the contrary, the following studies made a different control structure for each mode of operation (boost and buck).Song et al. (2011) proposed an algorithm for a grid-connected residential 10kWh battery, considering the daily load profile, the PV generation and the SOC of the battery.The DC-link voltage control was maintained by the inverter, producing a reference inverter output current with the use of a PLL.The current control of the battery bidirectional converter was examined separately for each mode of operation (charging and discharging mode).However, the design of the controllers was not presented, and the PI tuning parameters were not given or explained.Aktas et al. (2017) proposed a grid-connected PV system with hybrid energy storage.The difference of this work is that the storage topology was semi-active, where the supercapacitor was passively connected on the DC-bus, while the battery was connected to the DC-bus through a bidirectional DC-DC converter.Moreover, the control structure regarding the battery bidirectional converter was done according to the mode of operation (boost or buck).During the buck-mode a battery output voltage control and a current control were performed, while for the case of the boost-mode only a battery current control was done, because the DC-bus voltage control was done by the grid inverter.However, no further stability analysis was done and the PI tuning parameters were not given.Simões et al. (2015) analyzed and designed a bidirectional floating interleaved DC-DC converter in a residential PV system with battery storage.They examined the small-signal model separately for the boost-mode and the buck-mode operation.When the system was connected to the grid, the DC-bus voltage control was done by the inverter.When the system was in islanded mode, the DC-bus voltage control was done either by the PV or the battery converter.Depending on the mode of operation, K-factor, PI and PR controllers were examined for current and voltage regulation.Naresh et al. (2021) examined a mathematical model and a stability analysis for a supercapacitor storage system.The authors considered the non-linearities related to the supercapacitor pack and its bidirectional DC-DC converter (i.e., ON-state resistance of switches, parasitic effects).A small-signal analysis was performed considering the non-linearities.PI controllers were chosen for the current control of the inductor current, where the control structure was different for the charging and discharging mode of the supercapacitor converter.A stability analysis showed that there was an improved transient response of the converter designed, by considering the non-idealities for both the charging and discharging modes.Babu et al. (2020) prepared a comprehensive review of different converter configurations and several control strategies related to hybrid energy storage systems.Regarding the control techniques, the authors provided a variety of methods (classical or intelligent), depending on the application that could be employed, along with the features and limitations of each technique.
From the above literature review of the related research, one can clearly conclude that, depending on the application and the system configuration and complexity, there is a plethora of control methods that can be developed.The present paper examines a residential grid-connected PV system with batterysupercapacitor storage and AC loads.The focus of this study is given on the small-signal analysis and the design of the appropriate controllers.
Compared to previous studies, the main contributions of this paper are as follows: • A detailed small-signal analysis is performed for the bidirectional DC-DC converter and the single-phase inverter.Such a detailed small-signal analysis is hard to find in the literature.
• The stability analysis is done for both the boost and the buck modes of operation for the battery and the supercapacitor converters that can result in a more accurate tuning of the controllers.
• The mathematical modeling approach provides flexibility and adjustability to the parameters of the model.Additionally, through the mathematical model a specific behavior of the system is considered, neglecting other insignificant phenomena (i.e., switching ripple signals).
• The averaged models of all converters are examined, considering the system dynamics and ignoring the switching ripple signals.
• Simulation results verify the effective power sharing and the dynamic performance of the proposed model under rapid changes in PV and load power.Also, supercapacitor handles the rapid changes occurring within 0.2 s, hence this relieves the battery stress and extend the battery lifetime.
• Very fast DC-bus voltage regulation with a very small ripple voltage (a maximum of ± 0.625%).
A detailed presentation of the proposed methodology follows.

Proposed system configuration and methodology
In Fig. 1, the architecture of the system under investigation is presented.The PV array has a total power capacity of 3 kW p .Specifically, the PV array is mathematically analyzed based on the equivalent circuit of the one-diode PV cell.The connected PV boost converter is responsible for the voltage step-up and the Maximum Power Point Tracking (MPPT), in which the Perturbation and Observation (P&O) algorithm is used.A detailed analysis and modeling of the PV array, the boost converter and the MPPT control can be found in Argyrou et al. (2017Argyrou et al. ( , 2018b)).
The battery is modeled based on the dual polarization (2 ndorder RC) battery cell circuit, while the supercapacitor model is developed based on the two-branches equivalent circuit of the supercapacitor cell.A detailed mathematical analysis and modeling can be found in Argyrou et al. (2018c).Regarding the battery sizing, a 10 kWh battery pack is chosen to be sufficient for covering the needs of a typical energy efficient household (average electricity consumption of about 11 kWh/day) with increased PV self-consumption and self-sufficiency (Argyrou et al., 2019).Also, it is assumed that the supercapacitor pack must be able to handle a maximum power of about 9 kW for 20 s, with a voltage window of 35-64.8V, hence a 50.6 Wh supercapacitor pack with a total equivalent capacitance of 125 F is considered suitable for our needs.
An active parallel configuration is used for the batterysupercapacitor model for better utilization of the storage technologies and higher efficiencies.The battery and supercapacitor packs are connected to the common 400 V DC-bus through two bidirectional DC-DC converters.This topology allows the battery and supercapacitor modules to have different voltage levels, and their power flow to be controlled separately.
A single-phase DC-AC inverter is designed to convert the DC power from the DC-link into the AC form for grid interconnection.For this study, a single-phase voltage source inverter (VSI) with H-bridge (full-bridge) topology is considered, as shown in Fig. 1.The input voltage of the inverter is the 400 V DC-bus, while the output is connected to the grid through a L-type AC grid-link filter (Samerchur et al., 2011;Ko et al., 2006).Since the system is grid-connected, the inverter is responsible for the DC-bus voltage control.In order to maintain the DC-bus voltage stable near the reference value of 400 V, a voltage controller is used, where a reference magnitude for the grid current, and hence the inverter output current, is obtained.Also, a PLL is used so that the output current injected to the grid be in phase with the grid voltage (unity power factor).
The proposed model is developed and simulated in the MAT-LAB/Simulink software environment, based on mathematical analysis and average modeling.The mathematical modeling approach is selected as it provides flexibility and adjustability to the parameters of the model.In engineering, it is sometimes preferred to model a specific behavior of a system and to neglect other insignificant phenomena.Therefore, though the mathematical modeling the switching ripples are ignored and the averaged model of all converters is examined (PV boost converter, battery and supercapacitor bidirectional converters, grid inverter).However, the system dynamics and the small ripple signals that occur are captured, to ensure model accuracy.According to Xiao (2017), the effect of the high switching frequency of the converters is insignificant on the DC-bus, because the DC-link capacitor mitigates the double line frequency produced.Moreover, one should note that the simulation time of the system with the averaged model is decreased dramatically compared to the switching model, especially for long-term operation with a significant number of converters (Xiao, 2017;Fekkak et al., 2018;Wang et al., 2020;Jiao et al., 2019).Finally, as the switching ripple can be negligible in a well-designed converter (Erickson and Maksimovic, 2007), the switching ripples are ignored and the small-signal variations are modeled, in which the frequency is much smaller than the switching frequency.Therefore, the average modeling combines fast simulation speed, and accurate modeling performance as the system dynamics are considered (Xiao, 2021).
The present paper is organized as follows.Section 2 examines the small-signal analysis of the DC-DC bidirectional converter and the DC-AC inverter.After that, using the small-signal analysis, the transfer functions of the bidirectional converter in boost and buck mode as well as the single-phase VSI are derived.These transfer functions are required for the design of the controllers.In Section 3 the design and stability analysis of the proposed control system is conducted.The stability analysis is done for both the boost and the buck modes of operation for the battery and the supercapacitor converters, resulting in a more accurate tuning on the controllers.Specifically, in Section 3.1 the design of the required current controllers and the stability analysis is performed for the case of the battery and the supercapacitor converters, respectively.Section 3.2 presents the design and stability analysis of the DC-bus voltage control loop, where the reference output current of the inverter is obtained.Then, the results of the simulations are presented in Section 4 and finally the conclusions are given in Section 5.

Small-signal AC analysis
An essential part for the design of the control is the determination of the dynamic behavior of a converter.In other words, how the small variations of the inputs near the steady-state value affect the output of a converter.The goal here is to predict this low-frequency part, which allows us to design the controller of the converter (Erickson and Maksimovic, 2007).
Classical control theory applies only to linear time-invariant (LTI) single-input single-output (SISO) systems, and it is not appropriate for the more demanding dynamic analysis of a nonlinear time-variant system.Therefore, for the latter case, it is necessary to develop a process that allows one to overcome the problems related to time-variation and nonlinearity of the switching process of the converter (Divya and Ajit, 2017).To this end, the necessary steps to be followed are graphically represented in Fig. 2. The resulting small-signal model is a LTI model in which all the standard circuit analysis techniques can be applied.To construct this, the nonlinear time-variant signal is averaged over one switching period, thus assuming that the switching ripples of the state variables are equal to zero as their time variance is removed.After that, the model is linearized by removing all the nonlinearities that incurred by the averaging process.Therefore, a linear time-invariant small signal model is produced, describing the time-domain dynamics at the presence of small-signal excitation.Finally, the time-domain small-signal model is transformed into a frequency-domain (s-domain) small-signal model.This conversion provides the transfer functions of power stage dynamics, which are required for the stability analysis (Choi, 2013).

DC-DC bidirectional converter
The bidirectional DC-DC converter is a combination of boost and buck converters, where the appropriate mode is selected by the PMA.Such a converter is used to charge and discharge the battery and the supercapacitor, where the corresponding duty cycles d 1 and d 2 of the transistors S 1 and S 2 , respectively, are determined by the current controllers (Argyrou et al., 2019;Chao et al., 2013).In the sequel, a detailed small-signal AC analysis is presented for the case of the boost and the buck modes of operation.

Boost-mode operation
The boost-mode is applied for the discharging procedure of the storage (battery or supercapacitor).Fig. 3(a) shows the circuit of the boost-mode operation of the converter, where the direction of the inductor current is from the lower voltage side to the higher voltage side (Joshi and Samanta, 2013;Pany et al., 2011;Zhang et al., 2008).The averaged large signal inductor current, i L , and the DC-bus output voltage, v dc , in a continuous conduction mode (CCM) of operation can be found using the equations below.
where L is the inductance of the converter, C is the capacitance of the converter, v b is the input voltage (i.e., battery voltage) and i dc is the output current of the converter.Each parameter in the equations above must be expanded to include the dynamics produced by the inductors and capacitors of the converter.Thus, the input voltage and the duty cycle (v b (t), d 1 (t)) can be represented by the sum of their quiescent values (V b , D 1 ) and small AC variations in time ( vb (t), These time varying inputs produce perturbations in the dynamic variables.Hence, one can write: where the output current, output voltage and inductor current (i dc (t), v dc (t), i L (t)) are represented by the sum of their quiescent values (I dc , V dc , I L ) and small AC variations in time ( ˆidc (t), vdc (t), ˆiL (t)).In addition, the AC variations are assumed to be relatively small in magnitude compared to the DC quiescent values.
Thus, equations in (1) can be linearized by expanding and separating the steady-state terms and small-signal terms. where Eqs. ( 5)-( 6) consist of (i) the DC terms, which are DC values only, (ii) the 1 st -order AC terms (linear), which contain products of a DC term with an AC term, and (iii) 2 nd -order AC terms (nonlinear), which contain products of two AC terms -time-varying signals -(hence, they are nonlinear in time).One can then neglect the 2 nd -order small AC quantities, as, following assumptions (4), they are much smaller in magnitude than the 1 st -order AC terms.Moreover, the DC terms on the right-hand side are equal to the DC terms on the left-hand side of the equation, by definition in steady-state analysis.Since I L and V dc are constant (DC) terms, their derivatives are zero , and hence the sum of the DC terms on the left-hand side is equal to zero.Therefore, the sum of the DC terms on the right-hand side are also zero.Consequently, the remaining terms are only the linear first order terms.Eqs. ( 7)-( 8) represent the small-signal linearized equations for the inductor current and output voltage variations, respectively.
The next step is to define the state vector x (t), which includes all the state variables, and the input vector û(t), which contains all the independent inputs.Also, the output vector ŷ(t) is defined as a linear combination of the state vector and the input vector.Hence, the state-space averaged model of the boost converter is given by the system of Eqs.(10) below.
The above vectors in state-space equation form are written as: where A, B, C and D are the state equation matrices and are derived from (9).
The next step is the conversion of the time-domain smallsignal model into a frequency-domain (s-domain) small-signal model.Taking Laplace transforms (with zero initial conditions) in Eqs.(11), yields: The last step is to export the small-signal transfer functions of the boost converter.This research is focused on the input current control, for such a case the remaining independent variables are set to zero ( vb (t) = 0, ˆidc (t) = 0), which requires a reduced matrix C = [ ] , leading to the normalized form equation ( 14).

Buck-mode operation
The buck-mode is operated for the charging process of the storage.Fig. 3(b) presents the circuit of the buck-mode converter.In contrast to the boost-mode operation, the inductor current flows from the higher voltage side to the lower voltage side (Rasin and Rahman, 2015).The averaged large signal inductor current, i L , and the output battery voltage, v b , are calculated by Eqs.(15), respectively, and describe the buck-mode operation in a CCM of the converter.
The small-signal analysis for the buck-mode is similar to that of the boost-mode.Each parameter on the equations above must be expanded to include the dynamics produced by the inductors and capacitors of the converter.Thus, the input voltage and the duty cycle (v dc (t), d 2 (t)) can be represented by the sum of their quiescent values (V dc , D 2 ) and small AC variations in time ( vdc (t), d2 (t)).
These time varying inputs produce perturbations in the dynamic variables.Hence, one can write: In addition, the AC variations are assumed to be relatively small in magnitude compared to the DC quiescent values: Thus, equations in (15) can be linearized by expanding and separating the steady-state terms and small-signal terms.
As already explained for the case of the boost-mode operation, the 2 nd -order small AC quantities are neglected (see assumptions (18)).Since I L and V dc are constant (DC) terms, their derivatives are zero , and hence the sum of the DC terms on the right-hand side is also equal to zero.Eqs. ( 21)-( 22) represent the small-signal linearized equations for the inductor current and output voltage variations, respectively.
or, in matrix form, The state vector x (t), input vector û(t) and output vector ŷ(t) are defined by Eqs. ( 24) below.
The above vectors can be written in state-space equation form (see Eq. ( 11)), where matrices A, B, C and D are derived from (23).
As before, the last step is to determine the required smallsignal transfer function of the buck converter using Laplace transforms (see Eq. ( 13)).For the case of the input current control, the remaining independent input is set to zero ( vdc (t) = 0) and the required reduced matrix C = [ ] , leading to the normalized form equation ( 26).

Single-phase voltage source inverter (VSI)
For the production of the AC current, switches operate as pairs of S 1 /S 4 and S 2 /S 3 (see Fig. 1).If any other combination occurs, then the output voltage is zero (Xiao, 2017;Rashid, 2017;Nordin et al., 2014).In order to export the required equations of voltage and current of the inverter model, it is considered that the ONtime of the pair S 1 /S 4 is DT s , while the ON-time of the pair S 2 /S 3 is (1 − D) T s .Therefore, one can obtain the following averaged equations of the inverter over a switching period (T s ): where v ac (t) and i ac (t) are the output voltage and current of the inverter and i dc,inv is the input current of the inverter.The power supplied to the AC grid pulsates at twice the AC grid line frequency.This is reasonable, as the instantaneous AC output power of the inverter, p inv (t), is calculated by Krein et al. (2012): where V rms and I rms are the rms values of the inverter output voltage and current, ω is the grid line frequency and P ac is the average output power of the inverter.
The dynamics of the DC-bus voltage can be expressed by the following Eq.( 30) related to the input power (P dc ) and the output power of the inverter (p inv ) (Ninad and Lopes, 2007): where v g and i g are the amplitudes of the grid voltage and current (large signals), and p g is the instantaneous active power injected into the grid.
In order to examine the dynamic behavior of the inverter, the parameters of the above equation must be expanded to include the produced dynamics.A small-signal model can be obtained for the steady-state condition in terms of the constant value of the input power of the inverter (P dc ) and the constant value of the amplitude of the grid voltage (V g ).Therefore, for the investigation of the impact of the grid current amplitude variation on the average DC-bus voltage, one can neglect P dc and P load .This is done in the framework of a simplified sensitivity analysis, which is sufficient for the study of the impact of the grid current variation on the DC-bus voltage.Thus, the input voltage and the grid current amplitude (v dc (t), i g (t)) can be represented by the sum of their quiescent values (V dc , I g ) and small AC variations in time ( vdc (t), ˆig (t)).
v dc (t) = V dc + vdc (t), i g (t) = I g + ˆig (t)   (31) In addition, the AC variations are assumed to be relatively small in magnitude compared to the DC quiescent values: Thus, Eq. ( 30) can be linearized by expanding and separating the steady-state terms and small-signal terms as follows.
1 st order AC term (linear) As before, the second order small AC quantities are neglected (see assumptions (32)).Moreover, the DC terms on the right-hand side are equal to the DC terms on the left-hand side and equal to zero (derivative of DC term is zero).Consequently, the remaining Applying Laplace transforms (with zero initial conditions) in Eq. ( 34), the required small-signal transfer function of the input voltage by the grid current amplitude is given by Eq. ( 35) below (Ninad and Lopes, 2007;Zakzouk et al., 2017).
The above transfer function has negative static gain, showing that any shift from equilibrium can lead the DC-bus voltage to diverge at a rate that corresponds to the static gain of the smallsignal model (Xiao, 2017).This transfer function is important for the DC-bus voltage control (voltage controller) by the inverter.

Transfer functions and parameters
All the system parameters for the simulation are tabulated in Table 1.Moreover, based on the small-signal AC analysis, the derived transfer functions regarding the current control of the battery and the supercapacitor, and the voltage control on the DC-bus side, are presented in Table 2.These transfer functions are used in Section 3 for the stability analysis and the design of the controllers.

Design of controllers and stability analysis
In this Section, all the controllers are designed to meet the required specifications.The most important properties of the feedback loop is the transient overshoot, the settling time and the steady-state error (Erickson and Maksimovic, 2007).The controller gains are determined by the crossover frequency (ω c ) and the phase margin (PM).The infinite gain is related to zero steady-state error and the crossover frequency is related to the settling time of the compensated system (Simões et al., 2015).The PM is evaluated at the crossover frequency of the open-loop system through the use of Bode plots.An inadequate PM leads to oscillations and overshoot in the system transient response, as well as peaking in the closed-loop transfer functions (Erickson and Maksimovic, 2007).There are several controlling techniques to be used for voltage and current regulation.The most commonly used control method for converters is the PID control due to its easy design for linear systems and industrial applications (Xiao,   2017).Also, PID controllers are widely used in industrial applications, as their reliability and effective performance have been proven (Xiao, 2021).PI controllers are chosen in the current study, we use as the derivative part is not needed.For this study, PI controllers present a satisfactory performance in terms of zero steady-state error, settling time and transient overshoot.This type of controller (PI) is employed in order to increase the gain at low frequencies, so that the output can be better regulated at DC and at frequencies well below the crossover frequency (Erickson and Maksimovic, 2007).The transfer function of a PI compensator in the s-domain is given by the following equation: where K p and K i , are the proportional and integral gains, respectively.
In Section 3.1 the design and the stability analysis of the required current controllers are performed for the case of the battery and the supercapacitor converters, respectively.In addition, the design and stability analysis of the DC-bus voltage control loop, where the reference output current of the inverter is obtained, is performed in Section 3.2.

Battery-supercapacitor hybrid storage system: Design and stability analysis of current controllers
In this sub-Section, the design of the current controllers for the battery and the supercapacitor are examined, respectively, where the duty cycle of each converter can be derived (Serna-Garces et al., 2018;Etxeberria et al., 2011).
The battery and the supercapacitor bidirectional converters contain current controllers that follow the reference currents that arise from the PMA (Fig. 4).The PMA provides power balance to the system and is responsible for the proper utilization of the hybrid storage, where the reference battery current and supercapacitor current are obtained.Specifically, the PMA is responsible for observing the generated PV power, the SOC of the battery and the supercapacitor and the load power, in order to manage the supplied/absorbed power and calculate the reference battery current and supercapacitor current.Briefly, the PMA includes a Low Pass Filter (LPF) with a cut-off frequency of 5 Hz, and a rate limiter to extract an average current for the battery, so that the supercapacitor responds to the fast variations occurring within 0.2 s (Manandhar et al., 2019;Kotra and Mishra, 2017).Additionally, due to the slow dynamics (regarding the operation of battery, controller and converter), a compensator was added to the supercapacitor current calculation to compensate transients that battery may not track instantly.This leads to a faster DC-bus voltage restoration (Manandhar et al., 2019).Also, the battery and the supercapacitor SOC limits are considered in order to avoid deep charge and discharge cycles.
The reference inductor current for the battery converter (i * L,b ) is determined by the PMA, depending on the PV, battery and/or supercapacitor availability.The difference between i * L,b and the actual inductor current (i L,b ) yields the remaining error current, which is passed through a PI controller to generate the appropriate duty cycle (d bo b , d bu b ) for the semiconductors of the battery bidirectional converter.Similarly, the same process is followed for the supercapacitor converter, where the corresponding duty cycle (d bo sc , d bu sc ) for the semiconductors of the supercapacitor bidirectional converter is obtained.Based on the mode of operation (boost or buck), a final decision is made on the proper sign of inductor current.Specifically, it is assumed that during discharging (boost-mode) the battery and supercapacitor currents are positive, while during charging (buck-mode) they are negative.Therefore, the battery and supercapacitor currents, i b and i sc correspond to the input battery and supercapacitor currents (as shown in Fig. 4).
The proposed feedback loop for the control of each bidirectional DC-DC converter in the case of the battery-supercapacitor hybrid storage is presented in Fig. 5. Specifically, Fig. 5(a) corresponds to the supercapacitor current controller loop, while Fig. 5(b) presents the block diagram of the battery current controller.The required transfer functions for the boost and buck mode operation are given in Table 2.It must be noted here that all the feedback sensor gains are assumed to be equal to 1, hence In order to extend the battery lifetime and relieve the battery stress, supercapacitors are suitable for absorbing/releasing the high frequency variations, while the battery will deal with the low frequencies.In other words, the supercapacitor covers the peaks and fluctuations that may occur.The current control of the supercapacitor must be faster than the current control of the battery because the supercapacitor must be faster and track higher frequencies.To this end, the current control loop bandwidth (BW) of the supercapacitor is set to the limit of f sw /6.The battery current control loop BW must be smaller than the BW of the supercapacitor, and therefore its limit is set to f sw /10 (Manandhar et al., 2018;Hajiaghasi et al., 2018).

Boost-mode operation (i) Design of the supercapacitor current controller
The Bode plot of the open-loop transfer function with and without compensation for the supercapacitor current control loop design (boost-mode) is shown in Fig. 6(a).The Bode plot of the uncompensated current control loop (blue line) shows a low gain in the low frequency range, but the loop needs high gain at low frequency.The inverted-zero of the compensator (PI) results to a high gain at low frequencies and reduces the steady-state error of the loop gain.The high-frequency pole cancels the gain of the inverted-zero at high frequencies (Erickson and Maksimovic, 2007;Kotra et al., 2017).In other words, the compensator contains an integral action in its transfer function, providing a high gain in the low frequency range in order to get a perfect tracking of the reference (zero steady-state error).Moreover, it contains high frequency poles to attenuate any produced ripples.
As explained before, to avoid oscillations, the current control loop BW of the supercapacitor must be limited to f sw /6.The switching frequency (f sw ) of the supercapacitor converter is set to 10 kHz.Hence, to ensure the stability of the system, the desirable crossover frequency and PM of the current control loop of the supercapacitor are specified as 10.47 krad/s and 60 • , respectively.The PI controller gains for the supercapacitor current control are set to K p = 0.113 and K i = 685.58.
From the Bode plot of the compensated current control loop (red line) in Fig. 6(a), a negative PM (positive feedback), which may lead to instability, is observed.Hence the loop should not have a positive feedback, near the crossover frequency.In this case, the system has a negative GM and negative PM near 60 rad/s, but because the gain is nowhere near unity (i.e., 0 dB), the system is stable in this region.At about 10 krad/s, the loop gain is unity, and the system has a positive PM (negative feedback), hence the system is again, stable in this region.
(ii) Design of the battery current controller The Bode plot of the open-loop transfer function with and without compensation for the battery current control loop design (boost-mode) is shown in Fig. 6(b).The Bode plot has the same PM and GM characteristics with those of the Bode plot in Fig. 6(a) of the supercapacitor.As explained before, the current control loop BW of the battery must be limited to f sw /10.Hence, to ensure the stability of the system, the desirable crossover frequency and PM of the current control loop of the supercapacitor are specified as 6.28 krad/s and 60 • , respectively.The PI controller gains are set to K p = 0.068 and K i = 246.25.

Buck-mode operation (i) Design of the supercapacitor current controller
The Bode plot of the open-loop transfer function with and without compensation for the supercapacitor current control loop (buck-mode) is presented in Fig. 7(a).As for the case of the boostmode, the desirable crossover frequency and PM of the current control loop are specified as 10.47 krad/s and 60 • , respectively.
The PI controller gains are set to K p = 0.113 and K i = 684.88.

(ii) Design of the battery current controller
The Bode plot of the open-loop transfer function with and without compensation for the battery current control loop (buckmode) is presented in Fig. 7(b).As for the case of the boost-mode, the desirable crossover frequency and PM of the current control loop are specified as 6.28 krad/s and 60 • , respectively.The PI controller gains are set to K p = 0.068 and K i = 246.24.

Single-phase inverter: Design of DC-bus voltage controller and calculation of inverter reference output current
In this sub-Section, the DC-bus voltage control and the grid synchronization, which are presented in the schematic of Fig. 8, are examined.As the PV system is grid-connected, the inverter is responsible for the DC-bus voltage control.In order to maintain the voltage of the DC-bus stable near the reference value of 400 V, a voltage controller is used, where a reference magnitude for the grid current, and hence for the inverter output current, is obtained, as shown in Fig. 9 (Ma and Hsieh, 2020;Song et al., 2011;Zakzouk et al., 2017;Ranaweera et al., 2015).
Regarding the grid synchronization, the task of the inverter is to generate an AC output current in phase with the grid voltage.The PLL circuit provides the reference signal to the inverter, synchronized to the grid frequency (Panda et al., 2016).Then, this signal (sinωt) is multiplied with the reference signal (output of the PI controller), which corresponds to the reference amplitude of the grid current (see Fig. 8).Therefore, a reference AC output current is extracted for the inverter (Vavilapalli et al., 2018;Tummuru et al., 2015).Through the inverter model, a reference input DC current is obtained (Eq.( 28)).
The variation of the DC-link voltage responds to the interaction between the injected current and the extracted current, corresponding to the capacitance of the DC-bus.Therefore, Fig. 1 shows the currents balance on the DC-link, which can be expressed by Eq. ( 37).
The required small-signal transfer function was previously calculated (see Table 2).The PI controller gains, K p and K i , must be tuned and set very accurately with a low crossover frequency to mitigate the double line frequency of 100 Hz on the DC-bus voltage.Therefore, the oscillations in the output current of the inverter are limited (Ninad and Lopes, 2007;Zakzouk et al., 2017).

Simulation results
To verify that the proposed model performs well in short time periods, two scenarios concerning sudden changes in solar irradiance (and hence in the produced PV power) and in the load power, are examined.Therefore, rapid variations in solar irradiance or in the load are assumed, for every second, investigating both events with excess PV power (P pv > P load , hence battery charges) or with deficit PV power (P pv < P load , hence battery discharges).It must be noted here that the studied PMA prioritizes the use of PV and storage, providing increased PV selfconsumption and self-sufficiency of the building.During both scenarios (see Sections 4.1, 4.2), the battery and the supercapacitor remain always within their SOC limits; therefore, zero power exchange is expected between the grid and the PV-storage system.
For clarity, the produced PV power is always positive, the load power is always negative, while the battery power and the supercapacitor power are positive when they supply power and negative when they absorb power.

Step variation in PV generation
For the scenario of step variation in PV generation, the load power remains constant at 1000 W for a period of 5 s.As one can observe from Fig. 11(a), in the beginning the generated PV power is 525 W (for a solar irradiance of 200 W/m 2 ) and the load power is 1000 W. Therefore, the hybrid storage supplies the required remaining power of 475 W to the load, with the battery providing the average power and the supercapacitor handling the rapid changes occurring within 0.2 s.After that, the solar irradiance is increased to 600 W/m 2 (at t = 1 s) and 1000 W/m 2 (at t = 2 s); hence the PV power increases to 1704 W and 2887 W, respectively.During this period, the PV power is larger than the load power, and hence the battery is charging with the remaining excess average power, while the supercapacitor absorbs the high-frequency variations (i.e., the rapid changes occurring within 0.2 s).At t = 3 s, the solar irradiance is decreased to 800 W/m 2 , resulting to 2297 W of produced PV power, which remains larger that the load demand.During this period (t = 3 -4 s), the remaining average power is absorbed by the battery, and the rapid transition is being supplied by the supercapacitor.Similarly, at t = 4 s, the solar irradiance is decreased to 400 W/m 2 , resulting to 1110 W of produced PV power, which is again larger that the load demand.Therefore, the battery absorbs the power difference of 110 W and the supercapacitor handles the high-frequency variations, thus relieving the battery and extending its lifetime.Also, power balance is achieved in all cases.
Fig. 11(b) presents the PV current, the battery current and the supercapacitor current on the DC-link side, where the scenario is verified.Another important parameter is the DC-bus voltage, which must be kept constant at 400 V.In Fig. 12(a), the DC-bus voltage remains stable near 400 V during all different changes occurring in PV generation, exhibiting a maximum ripple voltage (peak-to-peak) of about 1.6 V (or ± 0.2%), which is absolutely acceptable.Moreover, the current controllers in the bidirectional converters of the battery and the supercapacitor provide the corresponding duty cycle for each converter.Also, in Fig. 12(a), despite the several rapid variations occurred on the system, each controller responds extremely fast and provides the required duty cycle for the operation of the bidirectional converter.Specifically, the battery converter operates in boost-mode (battery discharging) during the first second, and in buck-mode (battery charging) during the rest period.As can be seen in the zoomed view of the duty cycle of the battery converter, during each rapid change, the controller acts extremely fast and provides the required duty cycle to the converter.Also, the supercapacitor during the first 0.2 s in each transition, operates either in buck-mode (t = 1 -1.2 s, t = 2 -2.2 s) or boost-mode (t = 3 -3.2s, t = 4 -4.2 s).During the remaining period, the supercapacitor absorbs fluctuations around zero.This way, the dynamic performance of the system is verified.
Finally, Fig. 12(b) shows the currents on the AC side, where the inverter output current, the load current and the grid current are presented.Despite the solar irradiance variations, the output current of the inverter is constant, due to the constant load demand.Also, the current balance is verified during the chosen period of 5 s, as the output current of the inverter supplies the load, and no exchange between the grid and the PV system is observed.

Step variation in load demand
For the scenario of step variation in load demand, the solar irradiance remains constant at 500 W/m 2 for a period of 5 s.As one can observe from Fig. 13(a), in the beginning the generated PV power is 1407 W (for a solar irradiance of 500 W/m 2 ) and the load power is 1500 W. Therefore, the hybrid storage supplies the required remaining power of 93 W to the load, with the battery providing the average power and the supercapacitor handling the rapid changes occurring within 0.2 s.After that, the load power is increased to 2500 W (at t = 1 s) and 3000 W (at t = 2 s), respectively.During this period, the PV power remains lower than the load power, and hence the battery is discharging and supplying the load with the required average power, while the supercapacitor supplies the high-frequency variations.At t = 3 s, the load demand is decreased to 1500 W, which continues to remain larger that the produced PV power.During this period (t = 3 -4 s), the required average power is supplied by the battery, while the rapid transition is being absorbed by the supercapacitor.Finally, at t = 4 s, the load power is decreased to 1000 W, which is smaller than the produced PV power of 1407 W. Therefore, the excess average power is absorbed by the battery, while the rapid transition is being absorbed by the supercapacitor, thus relieving the battery and extending its lifetime.Also, power balance is achieved in all cases.
Fig. 13(b) presents the PV current, the battery current and the supercapacitor current on the DC-link side, where the scenario is verified.Additionally, in Fig. 14(a), the DC-bus voltage remains stable near 400 V during all different changes occurring in load demand, exhibiting a maximum ripple voltage (peak-to-peak) of  about 5 V (or ± 0.625%).Also, in Fig. 14   remaining period, the supercapacitor absorbs fluctuations around zero.This way, the dynamic performance of the system is verified.
Finally, Fig. 14(b) shows the currents on the AC side, where the inverter output current, the load current and the grid current are presented.It is observed that the variation of the inverter output current is in line with the changes in load demand.The current balance is verified during the chosen period of 5 s as the output current of the inverter supplies the load, and no exchange between the grid and the PV system is observed.

Conclusions
In this paper, the design and small-signal analysis for a gridconnected residential PV system with battery-supercapacitor hybrid storage has been studied in detail.Specifically, a detailed small-signal AC analysis was performed for the design of the current controllers for the two bidirectional DC-DC converters.The difference of this work compared to other studies in the literature is that the stability analysis is considered for both boost and buck modes of operation of the converters, resulting in a more accurate tuning of the controllers.In addition, through the voltage control on the DC-bus side, a reference magnitude for the output current of the inverter was obtained.Also, a PLL was used so that the output current injected to the grid be in phase with the grid voltage (unity power factor) and meet the requirements for grid interconnection.The simulation results verified the dynamic performance of the proposed model, through several rapid changes in PV generation and in load power.Also, an extremely fast DC-bus voltage restoration with a very small ripple voltage, is observed.Moreover, the results showed that the supercapacitor can relieve the battery stress and extend the battery lifetime.Concluding, it should be stressed that the proper design and stability analysis of all the required controllers is essential for the proposed system to maintain its stability, regardless any disturbances.
The stability analysis of the proposed design is important for future directions as well.A potential further research would be the investigation of the islanded condition of the system.When a fault occurs to the power network, the inverter must be disconnected from the grid for security reasons.During this mode, all critical loads must keep receiving energy from the PV (in daylight) and/or the storage.Therefore, the system must detect this failure and operate in an islanded mode, where a different control structure exists.

Fig. 1 .
Fig. 1.Architecture of the grid-connected PV system with battery-supercapacitor hybrid storage.

Fig. 3 .
Fig. 3. Circuit of the DC-DC bidirectional converter in (a) boost-mode and (b) buck-mode operation.

Fig. 6 .
Fig. 6.Open-loop Bode plot of the (a) supercapacitor and (b) battery current control loop (boost-mode).(For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.)

Fig. 8 .
Fig. 8. Schematic of the inverter control which consists of the DC-bus voltage control and the PLL for the calculation of the inverter reference output current.

Fig. 9 .
Fig. 9. Block diagram of the DC-bus voltage control loop.
For a crossover frequency of about 40 Hz (or 250 rad/s) and a PM of 65 • , the PI controller gains are set to K p = 2.79 and K i = 324.81.The Bode plot of the open-loop transfer function with and without compensation for the DC-bus voltage control loop design is shown in Fig. 10.

Fig. 10 .
Fig. 10.Open-loop Bode plot of the DC-bus voltage control loop with and without compensation.

Fig. 11 .
Fig. 11.(a) PV power & Load power (average), Battery power, Supercapacitor power and Grid power (average), and (b) PV current, Battery current and supercapacitor current on the DC-link side, for step variation in PV generation.
(a)  it is observed that the battery converter operates in boost-mode (battery discharging) during t = 0 -4 s, and in buck-mode (battery charging) during t = 4 -5 s.As can be seen in the zoomed view of the duty cycle of the battery converter, during each rapid change, the controller acts extremely fast and provides the required duty cycle to the converter.Also, the supercapacitor during the first 0.2 s in each transition, operates either in boost-mode (t = 1 -1.2 s, t = 2 -2.2 s) or buck-mode (t = 3 -3.2s, t = 4 -4.2 s).During the

Fig. 12 .
Fig. 12.(a) DC-bus voltage and duty cycle for the battery and supercapacitor bidirectional converters, and (b) Inverter output current, load current and grid current, for step variation in PV generation.

Fig. 13 .
Fig. 13.(a) PV power & Load power (average), Battery power, Supercapacitor power and Grid power (average), and (b) PV current, Battery current and supercapacitor current on the DC-link side, for step variation in load demand.

Fig. 14 .
Fig. 14.(a) DC-bus voltage and duty cycle for the battery and supercapacitor bidirectional converters, and (b) Inverter output current, load current and grid current, for step variation in load demand.

Table 1
System parameters for the simulation of the proposed model.