Barrier Function Based Adaptive Sliding Mode Controller for a Hybrid AC/DC Microgrid Involving Multiple Renewables

Conventional electricity generation methods are under the major revolution, and microgrids established on renewable energy sources are playing a vital role in this power generation transformation. This study proposes a hybrid AC/DC microgrid with a barrier function-based adaptive sliding mode controller, in which 8 kW wind energy system and 4.5 kW photovoltaic energy system perform as the hybrid RESs, and 33 Ah of battery works as the energy storage system. Barrier function-based adaptive sliding mode controller ensures the convergence of the system’s output variable independent of the knowledge of the upper bound of the disturbances. Firstly, global mathematical modeling of the suggested system is ensured. Then, the control laws are defined, providing the DC bus voltage regulation during islanding mode and AC/DC link bus voltage regulation during the grid-connected mode. The proposed barrier function-based adaptive sliding mode controller technique is analyzed through 20 s simulations on MATLAB/Simulink, which validates the controller’s robustness and effectiveness. Furthermore, a comparison of the proposed controller is made with the proportional integral derivative controller, Lyapunov controller, and sliding mode controller. In the end, hardware-in-loop tests are performed using C2000 Delfino MCU F28379D LaunchPad, showing the proposed structure’s real-time performance.


Introduction
During the past few years, the generation of electricity through conventional energy sources is raising major environmental concerns because of the greenhouse effect and other pollutants [1]. Various methods have been introduced to combat environmental pollution and climate change. One of the significant ways is to implement a renewable energy sources (RESs)-based microgrid, due to its high efficiency and simplicity, and that it has played a vital role in clean energy generation [2,3]. Moreover, increasing consumption of RESs in microgrid development has significant concerns about power balance and stable frequency due to the unpredictable environmental effects on RESs. Therefore, they are not preferred to be implemented alone; hence, the energy storage system's (ESS) integration is preferred [3,4].
Renewable sources, either photovoltaic (PV) or wind, are used in distribution generation (DG) systems in microgrids mostly. However, a combination of PV and wind is proposed in [5,6], which increases energy flow towards the utility grid and enhances the occurs for linear controllers to mitigate the fast transients, e.g., sudden cut-off at generation end, the quick change in load, etc.
Some non-linear control methods for hybrid AC/DC microgrids are presented in [18,28,37]. In [18], the proposed hybrid AC/DC microgrid offers integral terminal sliding mode control for the machine side and grid side for on-grid and off-grid mode. The stable voltage at the AC and DC bus is achieved under different weather conditions but due to the presence of hybrid RES and hybrid ESS, the intricacy of the system increases. Ref. [18] offers an integral back-stepping based non-linear control which ensures the regulation of the DC bus. However, the proposed model only operates in islanding mode. Moreover, two control techniques are integrated which causes involvedness. Ref. [38] presents a hybrid AC/DC microgrid directly connected with the grid without considering any ESS in the system. A non-linear sliding mode controller has been proposed in [21,39] to achieve DC bus voltage regulation, but the controller has limitations as it shows chattering and less profound to external disturbances. A recent study, Ref. [40], provides a double integral sliding mode controller to address the chattering and external disturbances issues. However, this study only considers the DC microgrid with a hybrid energy storage system and ensures energy management and tight DC bus voltage regulation. In [41], an adaptive Lyapunov redesign approach is suggested for power converters associated with renewable sources and hybrid energy storage systems considering the model uncertainties in the system. It guarantees the DC voltage regulation and energy management in the system but does not consider any DC-AC inverter in the system. In [42], Lyapunov-based non-linear control for RESs has been proposed where it provides the secondary support to AC subgrid during the on-grid mode by ensuring frequency, voltage, and power system stabilization.
Keeping in view all the problems mentioned above, it is evident that hybrid AC/DC microgrid having different distributed generators, energy storage elements, and AC/DC loads are always challenging work. The unpredicted behavior of RESs under changing weather conditions drastically affects the stability of the grid [18]. Moreover, the constant power loads (CPL) at the DC side of the grid degrades the performance of the system [42]. Furthermore, when two modes of the MG are offered in the model then switching between the islanding and grid-connected mode will fluctuate the DC and AC bus which can be devastating for the power system. Hence, a more accurate, adaptive, and efficient control law is compulsory for the stability of the microgrid under capricious generation, loads demand, and operating conditions. Therefore, this work proposes a barrier function-based adaptive sliding mode (BFASMC) controller for hybrid renewable energy sources based AC/DC microgrid with an energy storage system. Simple SMC and Lyapunov controllers are not preferred because the hit and trial method is used to tune their parameters which may cause chattering and fluctuations in its operation and shows high transient values during initial and varying conditions which are not admissible in the MG system. Double integral SMC eliminates the chattering issue but still shows high transients, and during the switching between the modes of the MG, there may occur huge oscillations at the DC and AC bus. The integral back-stepping controller becomes very complex due to the virtual controller's introduction, and there may come computational restrictions for multiple DGs. Therefore, a barrier function-based adaptive SMC is proposed which offers simple structure, chattering free operation, adaptive nature, enhanced robustness to different disturbances, the inessential limit of upper-bound uncertainties, and better performance than exiting controllers and, also, this technique is not implemented on such models before. The adaptive behavior of the controller will cause fewer transients during the mode switching of the MG. Figure 1 reveals the proposed hybrid AC/DC microgrid model. It carries a wind energy system (WES), PV panels stack, energy storage system (battery), a common AC/DC bus, and AC/DC loads. The wind energy unit is comprised of a wind turbine attached with PMSG, and its output is forwarded to the bridge rectifier, and then a DC-DC boost converter connects the system with a DC-link bus. The PV stack connects with the DC-link bus via a non-inverting buck-boost converter. Additionally, the battery as an energy storage unit connects with the DC bus via a buck-boost converter. The control unit is divided into two parts.

1.
Low-Level Control: It ensures the regulation of input and output current flow from power converters referred to their reference signals produced by the high-level controller; 2.
High-Level Control: It ensures the AC/DC microgrid's stability by monitoring the state of charge (SoC).
In this research work, common AC and DC bus voltage regulation under load varying conditions, external disturbances or uncertainties, and impulsiveness of RES are studied. Furthermore, the practical performance of the controller's efficiency is validated using realtime hardware-in-loop analysis. This study offers the following significant contributions:

1.
Multiple control laws to ensure the stability of the DC bus and AC bus under the load varying conditions, external disturbances, and impulsiveness of RESs; 2.
Global modeling of the system and implementation of BFASMC controller; 3.
Real-time hardware-in-loop (HIL) analysis, which, validates the efficiency for the practical implementation of the controller. This manuscript is organized in the following sections as AC/DC microgrid with mathematical modeling and global modeling is presented in Section 3. Section 3.2 introduces the BFASMC and designs the control strategies. Section 4 presents the experimental and simulation-based results, and finally, the manuscript is concluded in Section 5.

Modeling of Wind Energy Generation Unit
The proposed wind energy system (WES) model consists of a wind generation unit, including a permanent magnet synchronous generator (PMSG) connected with a wind turbine. Furthermore, the generation unit is combined with a boost converter for the current flow in one direction only, as shown in Figure 2. The wind generator operation will be controlled through a high-level controller that offers maximum power point tracking (MPPT) operation of WES. The WES converts the kinetic energy into mechanical energy. Furthermore, it is converted into electrical energy. The mechanical power generated by the PMSG can be expressed as [43].
where, ρ ( kg m 3 ), R, C p and V is the air density, turbine radius, power coefficient of the turbine, and wind speed, respectively. The pitch angle of the blade (β) and the power coefficient of the turbine are the functions of the tip speed ratio. The practical value of C p ranges from 0.4 to 0.45, but theoretically, the maximum value can be 0.59 [43]. λ generally, can be illustrated as: It is observed that optimal torque control (OTC) is considered to be a practical approach to achieve MPPT due to its accuracy and simplicity [43]. Furthermore, OTC alters the torque produced in PMSG, approaching the turbine's maximum torque reference at a specified wind speed. If the rotor is at an optimum tip speed ratio, then it has a maximum power coefficient. Therefore, λ and C p can be replaced with λ opt and C p−max and Equation (3) can be represented as: Since P m−opt = ω m T m−opt , so Equation (4) can be rewritten as: Equation (5) can be used to generate the reference torque, and reference current can also be determined by the following equation.
where V d represents the rectifier's DC output voltages. The rotational speed of the generator or turbine is controlled by a DC-DC boost converter (applied as apparent load) operated in continuous conduction mode. Components of the boost converter are comprised of an inductor L w , series resistance R w , output capacitor C w , diode D 1 , and IGBT switch S 1 . The following differential equation describes the state-space model of the converter.
where average state variables µ 1 , V dc and i w shows the values of the control signal, output voltage and wind current, respectively.

Modeling of PV System
PV system with a non-inverting buck-boost converter is used in the model. High-level control directs the operation of the PV in MPPT mode. The regression plane method is used for MPPT, which operates on temperature and irradiance data at a definite point to create a reference signal V pv−re f [44]. V pv−re f can be calculated for any value of temperature and irradiance using the following equation: The internal circuitry of the DC-DC converter can be found in Figure 3. It comprises of an inductor L pv , IGBT switches S 2 , S 2 , two diodes D 1 , D 2 , the input capacitor C pv , and an output capacitor C dc . The converter is assumed to be in continuous conduction mode. There exist two modes of operation for the converter, when both the switches are ON and when both the switches are OFF. When S 2 and S 2 are ON, the load will be disconnected as diode D 1 is reverse biased. When S 2 and S 2 are OFF, the load is connected to L pv through diode D 2 . The buck-boost converter associated with the PV system can be expressed as the average state model by following differential equations.
where µ 2 , V pv , i L , and V dc are the values of the control signal, PV input voltages, current of the PV system, and output voltage V dc of the PV system.  Figure 4 represents the circuit diagram of the battery connected with the DC-link bus via a DC-DC buck-boost converter. The circuit of the buck-boost converter is comprised of an inductor L bat , the filter capacitor C dc , and two IGBT switches, S 3 and S 4 . Both the switches are controlled through PWM applied at their gate terminals. The buck-boost converter is connected with the battery because it can operate for charging and discharging mode depending upon the load demand and state of charge (SoC). When S 3 is ON and S 4 is OFF, the converter will be in boost mode, and discharging (I batre f > 0) happens to provide the required energy to the DC link bus. When S 4 is ON and S 3 is OFF, then buck (i batre f < 0) operation will occur, and the battery will be charging. Mathematical expression for buck-boost operation can be represented as: In Equation (13), i batre f is the reference value of the battery current, generated according to the power demand and SoC controlled through the high-level controller. For the discharging mode of the battery, the converter can be demonstrated through the following equation:

Modeling of Energy Storage System (ESS)
where i bat and i bat are converter and battery current, respectively, and V dc and V bat are DC-link bus and battery voltages. For the charging mode of the battery, the converter can be determined by the following equations: A virtual control represents the simplification of the system by the following equation: where, µ 34 is a virtual control law for battery system. By using Equation (18), buck-boost converter model for the battery can be simplified by the following two equations:

Modeling of AC Sub-Grid
AC Sub-grid configuration is shown in Figure 5. Utility grid and AC loads are supplied through the voltage source inverter (VSI). The currents and voltages of the voltage source inverter are as follows: V d , V q , I d , and I q are the output voltages and currents of the dq axis; I gd , I gq , V gd , and V gq are the utility grid dq axis currents and voltages, respectively. Operating frequency and voltages for the AC loads and utility grid are the same throughout the grid-connected operation. Parks and Clark's dq transformation is used for VSI mathematical modeling and can be expressed by the following equations [45]: where variable expressions of C f , R f , and L f are the capacitance, equivalent resistance and inductance of the filter, respectively. R g and L g are the equivalent resistance of the inductor, respectively. Output voltages of VSI have angular frequency denoted by ω o .

Global Modeling (Islanded Mode)
The proposed DC sub-grid system's global model comprises hybrid renewable sources, wind and PV systems, and battery as an energy storage unit, DC loads. The global model, as described in Sections 2.1-2.3 can be expressed as follows.
where x 1 , x 2 , and x 4 represents the current values of inductors L w , L pv and L bat , respectively; Voltage of capacitor C dc and C PV are expressed by x 5 and x 3 .

Global Modeling (Grid-Connected Mode)
The proposed AC sub-grid system's global model comprises hybrid renewable sources, wind and PV systems, main grid, and AC loads. The global model, as described in Sections 2.1, 2.2, and 2.4 can be expressed as follows: where, x 6 , x 7 , x 8 , and x 9 are the currents and voltages values of dq axis; x 10 and x 11 shows the values of utility grid dq axis currents, respectively; w o is the angular frequency during the grid-connected mode of microgrid. In the next section, the controller's design is discussed to control the AC and DC bus voltages during the islanded mode and gridconnected mode.

Barrier Function for Sliding Mode Controller
Let us suppose that first order system dynamics are given as: where system's disturbance is d(t) with known value, i.e., |d(t)| ≤ d m , where d m is a finite positive integer. Control input of the system's state can be denoted as u(t) ∈ R. By assuming that the bounds of disturbances acting on the system are unknown. A first-order sliding mode controller is required to stabilize the system, and is given as: However, there are two major concerns regarding the first-order sliding mode controller, firstly chattering and secondly gain selection of optimum control. Thus, higher-order SMC is considered an efficient approach to resolve the chattering, and adaptive SMC to mitigate the gain section of optimum control. Additionally, barrier function-based adaptive SMC can be used to tackle both the issues mentioned above. It is evident from Equation (43) that control law is a function of the system's state, and it varies with time. There are two different approaches assumed to define the barrier functions in this paper [46].

1.
Positive definite barrier functions (PBFs): Let assume some fixed ε > 0, which leads to a continuous even function . So PBF will be:

2.
Positive semi-definite barrier functions (PSBFs): Following equation defines the PSBF as: The defined function in Equations (44) and (45) provides adaptive gains based on PBF and PSBF. Therefore, when ε → 0 then K → 0. If state lies in the vicinity of origin, i.e., |x| ε < 1 , then K ≈ |x| ε , that certifies the convergence of state x to zero. Moreover, proof refers to the claim can be identified in [46].

Control of Islanding Mode of DC Sub-Grid
In Section 2.5, the global model during the islanding mode of DC sub-grid is presented. It is clear that VSI side will not be utilized during this mode, and hybrid renewable energy sources and battery provides the necessary power to the loads. Islanded mode of the microgrid is activated when the switch S L is OFF as shown in the Figure 6. The following equation can express the tracking errors to make sure the stable operation of the DC sub-grid as: where I wre f , V pvre f , I batre f , and V dcre f are the reference values of wind current, PV current, battery current, and the reference voltage of common DC bus, respectively. Assuming the time derivative in Equation (46) will give the following expressions: where ϑ 1 , ϑ 2 , ϑ 3 and ϑ 4 are the untilled bounds and uncertain dynamics and the deftness of the controller tends to remove these parameters adaptively. From Equations (47)-(49), the control laws can be derived as: For the error convergence towards zero, barrier functions forė 1 ,ė 2 ,ė 3 andė 4 are illustrated below considering the Equation (43) as: where K 1 , K 2 , K 3 and K 4 are the adaptive gains, whose values can be determined by using the Equations (44) and (45) as: where i = 1, 2, 3, 4, andF to be a positive arbitrary number. Hence, Equations (51)-(53) can be rewritten to express the controllers for DC sub-grid as:

Control during Grid-Connected Mode of AC Sub-Grid
In Section 2.4, the global model during the grid-connected mode of AC sub-grid is presented. VSI side is utilized during this mode and hybrid renewable energy sources contribute with the main grid to provide the necessary power to the utility grid. The battery will be kept in idle mode due to the availability of the grid. The following equation can express the tracking errors to make sure the stable operation of the AC sub-grid as: where I dre f and I qre f are the reference values of VSI dq axis currents. Errors for wind and PV systems are already defined. The grid-connected mode of the microgrid is activated when switch S L is ON as shown in Figure 6. Assuming the time derivative in Equation (62) will give the following expressions: where ϑ 4 , ϑ 5 and ϑ 6 are the unknown bounds and uncertain dynamics and the accuracy of the controller tends to remove these parameters adaptively. From Equations (64) and (65), the control laws can be derived as: For the error convergence towards zero, barrier functions forė 5 andė 6 are illustrated below considering the Equation (43) as: where K 5 and K 6 are the adaptive gains, whose values can be determined by using. Equations (44) and (45) as: where β = 5, 6, andF is a positive arbitrary number. Control laws for WES and PV system will remain the same as given in Equations (59) and (60). Hence, control laws for AC-grid side can be expressed by the following equations as: The active power reference generation during the grid-connected mode can be determined by solving the Equation (63).
where c 2 is a constant having a positive value to ensure the convergence of the error e 4 towards zero. Equation (63) ensures the stability of DC and AC bus voltages by regulating the flow of active power between AC and DC sides of the microgrid.

Results and Discussion
To check the proposed system's performance, MATLAB/Simulink tool is used to simulate the AC/DC hybrid microgrid system. Moreover, two modes of operation were studied (Islanded and grid-connected mode), under which the centralized barrier functionbased adaptive sliding mode controller's performance is analyzed. In both the AC/DC microgrid modes, the primary aim is to stabilize the AC/DC bus voltages. The general configuration of the non-linear adaptive control technique illustrating the design procedure and structure during the entire operation of the micro-grid is given in Figure 7. Where energy sources (wind, PV, and battery) are attached with the power converters. RESs are firstly attached with the MPPT blocks before connecting with the power converters. Powers of the RESs are fed to the energy management block to ensure the power balance in the microgrid by the appropriate use of ESS during the islanding mode. Moreover, during the grid-connected mode, ESS will be in idle mode and the VSI side will be used to ensure the flow of power between the grid and RESs as per the load demands. The centralized barrier function adaptive SMC block generates all the control laws during grid-connected and islanding mode. Table 1 shows the irradiance and temperature change due to the weather conditions, heat, fog, and dust on the panels and generated MPPT voltages for the PV stacks in the system. The designed parameters used in the microgrid are listed in Tables 2-4. Moreover, Table 5 shows the comparison results of the proposed controller as compared to the other non-linear techniques. Simulations are performed for 19 s only. The profile of the wind speed for the considered model is shown in Figure 8a and the DC load power profile is given in Figure 8b. The references are generated by the high-level controller, assuming that they will ensure energy balance during the operation of the microgrid. However, these references are not designed separately.

Islanding Mode
Under the Islanding mode of microgrid, the steady-state and dynamic response of MG is analyzed. The output power of wind turbine, PV system, battery, and stable voltages at the DC bus is illustrated in Figure 9a,b under their allocated reference values, respectively. The hybrid microgrid converts into an isolated system during the islanding mode and there are two possible scenarios to be kept in mind to ensure the power balance. Firstly, under low irradiance and wind speed with heavily attached load with the system, ESS will contribute a good portion of the power to ensure the DC bus regulation. Secondly, with high irradiance and wind speed with low power load attached with the system, both PV and wind generate sufficient power to ensure the power balance at the DC bus and excess power charges the ESS.
The battery tracks reference generated at the high-level controller side to ensure the power balance and keep the stable voltage at the DC bus in islanding mode. Moreover, wind power and PV power also track their respective reference MPPT values during islanding mode, ensuring the regulated DC bus voltages. The zoomed-in views are attached, confirming the steady-state error under transient conditions. At t = 0-0.5 s, generation at WES is zero, power generated by the PV system is 3 kW and load demand is 3 kW. PV provides the required power to the load. At t = 0.5-1 s, generation at WES increases from 0 to 2 kW, however, PV generation is the 3 kW, and load power is 3 kW. Hence, both the PV and WES contribute to providing the necessary power to the load and the remaining power is utilized to charge the battery, as shown in Figure 10. During t = 6-11 s, WES generation changes from 5 kW to 1.5 kW, and PV generation changes from 4.3 kW to 3.8 kW. Load power required during this period ranges from 14 kW to 10 kW. Hence, the battery discharges to ensure the DC bus regulation by providing the additional power. Hence, it must be noticed that RESs and ESS both provide the required power during the islanded mode making sure that not all the dependency is made on one resource only; moreover, RESs charge the battery under low load power during the islanded mode.  One of the main objectives achieved in this research work can be seen in Figure 9b, which depicts the regulation of DC bus under varying load conditions and shows the effectiveness of the applied controller. It can be seen that the DC bus successfully tracks the reference voltage. A comparison of the proposed BFASMC has been ensured in Figure 10, which shows the efficiency, improved steady-state (SS) error, and lesser settling time as compared to the proportional integral derivative (PID) controller, sliding mode controller, and Lyapunov controller. The proposed BFASMC achieves SS in just t = 0.003 s with 0.1% overshoot and 0.03s settling time, however, SMC takes t = 0.051 s with 0.6 s settling time and 4.7% overshoot with continuous chattering, PID takes t = 0.5 s with 15% overshoot and 0.6 s settling time, and Lyapunov takes t = 0.02 s with 2.1% overshoot and 0.2% steady-state error, which can be observed in zoomed-in windows. Spikes in DC bus voltage regulations are due to the variation in the load, PID and Lyapunov controllers take more SS response time, low transient response, and more settling time. Moreover, SMC exhibits a huge amount of chattering throughout the operation of the microgrid, which is not suitable from the DC bus regulation point of view. However, BFASMC performs better during the islanded mode of microgrid as compared to other controllers.

Grid-Connected Mode
In grid-connected mode, performance is checked on the basis of a specified framework to ensure DC and AC bus voltage regulation. Reference generated in the Equation (73) shows the flow of the active power between the DC and AC sides as per the load requirements throughout the grid-connected mode. If the generated power by PV and wind is less than the demand then, power flows towards the DC side from the utility grid and, if the generated power is greater than the demand, then excessive power is delivered to the utility grid. Figure 11 shows the power injected by the WES and PV system to the microgrid. The operation of the hybrid RESs is in maximum power point tracking mode during the entire grid operation. Due to the availability of the grid power in the system, ESS is kept in the idle mode under the grid-connected operation. The generation of the wind and PV is depending on the weather conditions. Figure 8a shows the wind speed profile. It can be observed that wind speed varies due to weather conditions. The rotor speed of the wind turbine is controlled by the optimal torque control (OTC) method to extract the MPPT from the WES. Figure 11 shows the MPPT power generation of the RESs during the grid-connected mode. During the grid-connected mode, AC voltage at the voltage source inverter (VSI) side will be automatically balanced due to the connection with the main grid. The objective will be to stabilize the DC bus voltage. PV and WES are operated in MPPT and the load profile is given in Figure 9. At t = 6-8 s, the load current changes from 7 kW to 14 kW, and hybrid RESs cannot provide all the power due to generation constraint, therefore, active power will flow from the AC side to the DC side to ensure the power balance at DC bus. During t = 12-14 s, load power is 3 kW, and it can be noticed that WES and PV are generating more power than the required load power; therefore, power from the DC side to the AC side will flow to ensure the stable voltage at the DC bus.
The voltage regulation at the DC link bus during the grid-connected mode can be seen in Figure 12. Comparison of proposed BFASMC during the grid-connected mode is done with PID, Lyapunov, and sliding mode controller techniques. It can be clearly identified from Figure 13 that BFASMC, as compared to other controller techniques, tracks the reference 1000 V accurately with 0.001 s settling time, 0.1% overshoot, and zero steady-state response. Spikes can be seen at the load changing periods, but they are under acceptable range and during BFASMC the recovery time is very minimal, which validates the effectiveness of the proposed technique. The sliding mode controller tracks the reference voltages with 0.003 s settling time, 0.05% steady-state error, and high chattering throughout the considered period, which is not acceptable for the smooth and uninterruptable operation of the microgrid. The Lyapunov controller has minimum chattering but it has high 0.2 s settling time and 0.29% overshoot during the varying load conditions. The stabilized frequency during the grid-connected mode can be seen in Figure 14. Grid current and voltages during the grid-connected mode are shown in Figures 15 and 16, respectively. In addition, the comparison of the designed VSI controllers is performed to validate the performance of BFASMC for VSI side. Lyapunov and SMC controller are compared with the proposed BFASMC and simulation results can be seen in Figures 17 and 18. Table 5 shows the difference between the PID, SMC. Lyapunov and BFASMC in terms of settling time, rise time, percent overshoot, and steady-state error percentage.

Hardware in the Loop Analysis
To enhance the validity of the proposed controller, hardware in the loop (C-HIL) analysis evaluates the real-time performance of the BFASMC controller before its practical implementation and HIL setup is shown in Figure 19. To generate the control signals, this hardware in loop analysis uses C2000 Delfino MCU F28379D LaunchPad with dualcore central processing units (CPUs) with an operating frequency of 200 MHZ, and the interface is provided with MATLAB/Simulink using Delfino T1C2000 support through embedded coder. The average small-signal model of hybrid renewable energy sources (PV and WES), including energy storage system (battery), power converters, and grid, is modeled on MATLAB and machine coding is done on MCU F28379D Launchpad-1. Moreover, control laws of BFASMC are implemented on Launchpad-2 with a 10 kHz switching frequency. The general-purpose input/output (GPIO) ports at Launchpad-1 based on the machined model have connected with the pulse width modulation (PWM) output ports at Launchpad-2. Both the launchpads establish a close loop of 12-bit builtin digital to analog converter (DAC) and an analog to digital converter (ADC). C-HIL experiment is facilitated by using the power of the wind energy system to supply the constant load power. For C-HIL experiments, islanding and grid-connected mode are considered and compared with simulation results. Figure 20 shows the islanded mode of the grid with experimental results of DC bus voltage regulation and comparison can be observed with BFASMC simulations. There can be observed some spikes at t = 32 s, 34 s, 36 s, 38 s. 40 s, 42 s, 44 s, 46 s, and 48 s, due to DC load current variation under islanded mode. However, the controller shows a fast convergence to stabilize the DC bus. Moreover, a comparison of the closed-loop HIL results with the MATLAB/Simulink results depicts the satisfactory performance of the controller. In Figure 21, HIL BFASMC DC bus regulation comparison is presented with HIL-SMC during the islanded mode. It can be observed clearly that SMC has more chattering and overshoot than the BFASMC which shows the effectiveness of the proposed BFASMC controller.    Figure 22 represents close-loop HIL regulation of the DC bus during the grid-connected mode. The experimental result shows some fluctuation in voltages from 699.8 V to 700.3 V, which is under the acceptable range. Moreover, a comparison of simulation and experimental results validate the adequate performance of the BFASMC controller. In Figure 23, HIL BFASMC DC bus voltage regulation comparison is presented with HIL-SMC during the grid-connected mode. Results show that SMC has a large overshoot and does not track the voltage accurately, where BFASMC has less overshoot and regulates the DC bus more precisely.

Conclusions and Future Work
This manuscript provides a barrier function-based adaptive sliding mode controller approach for a hybrid AC/DC microgrid considering the islanded and grid-connected operations. MATLAB/Simulink evaluates the performance of the proposed technique under different cases and results reveal the better performance than PID, SMC, and Lyapunov. The main performance objective of the proposed approach to ensure the stability of AC and DC sub-grids during the grid-connected and islanded mode has been accomplished successfully and efficiently. Finally, the hardware-in-loop execution of the proposed structure further validates the real-time performance of the controller. Results under different experiments indicate the stable operation of the DC bus during the varying output from the RESs and OFF/ON grid modes. Future work may involve the real microgrid framework in the laboratory, where, proposed controller technique can be tested through various real-time experimental assessments.