DC-Microgrid System Design, Control, and Analysis

Recently direct current (DC) microgrids have drawn more consideration because of the expanding use of direct current (DC) energy sources, energy storages, and loads in power systems. Design and analysis of a standalone solar photovoltaic (PV) system with DC microgrid has been proposed to supply power for both DC and alternating current (AC) loads. The proposed system comprises of a solar PV system with boost DC/DC converter, Incremental conductance (IncCond) maximum power point tracking (MPPT), bi-directional DC/DC converter (BDC), DC-AC inverter and batteries. The proposed bi-directional DC/DC converter (BDC) lessens the component losses and upsurges the efficiency of the complete system after many trials for its components’ selection. Additionally, the IncCond MPPT is replaced by Perturb & Observe (P&O) MPPT, and a particle swarm optimization (PSO) one. The three proposed techniques’ comparison shows the ranking of the best choice in terms of the achieved maximum power and fast—dynamic response. Furthermore, a stability analysis of the DC microgrid system is investigated with a boost converter and a bidirectional DC-DC converter with the Lyapunov function for the system has been proposed. The complete system is designed and executed in a MATLAB/SIMULINK environment and validated utilizing an OPAL real-time simulator.


Introduction
A microgrid is a small-scale grid system that can work freely or in conjunction with the region's principal electrical grid. Today, the microgrid is picking up a considerable measure of desirability since new renewable energy sources that occasionally work better nearer to the point of cause, are instead connected to the main electrical grid. The best illustration is a photovoltaic system [1][2][3]. Nowadays, more houses and structures are associated with the small neighborhood solar energy grid frameworks that may serve only one property. Besides, as solar innovation descends in cost and turns out to be more viable, a few features can really get advantageous by a smaller economy of scale-straightforward solar cells put in accessible territories can take in free regular daylight and be changed it over to electrical energy to run a specific arrangement of machines or warming and cooling frameworks. The microgrid alludes to a small-scale power grid that can keenly succeed in managing energy exchange between the interconnected loads and the distributed generation sources, for example, photovoltaics (PVs) [4]. Microgrids can be proposed as backup power generation or to support the principle electrical grid amid times of substantial demand. Frequently, microgrids include different energy sources as a method for consolidating sustainable power. Different purposes incorporate lessening costs and upgrading reliability. There are two fundamental sorts of microgrid; direct current (DC) microgrid and alternating current (AC) microgrid. Figure 1 demonstrates a schematic perspective of the DC microgrid system. This framework uses a DC bus as its primary support and allocates Recently, renewable energy sources have gained a lot of attraction because of high energy demand, changes in natural strategies, and the scattered populace around the world. The concern of the environmental changes is driving in significant variations in power generation and utilization designs. Different nations have set the objective of reducing 20% of greenhouse gas by 2020. These natural concerns have pulled in broad consideration to move towards more earth benevolent energy sources, for example, a photovoltaics (PV) system, wind turbines, and fuel cells. However, these energy sources are directly dependent on the environment, for example, in PV systems, there are changes in the radiation of sunlight and temperature. The power produced from these sources fluctuates, which effects inversely to the main power grid. The ideal approach to shield this issue is to move towards a more astute confined framework such as a microgrid (MG). A microgrid can work in an islanded mode when there are blackouts for supplying power to local loads. A microgrid can likewise function as backup power when there is a lack of supply from the main grid. Point of common coupling (PCC) makes the connection between the microgrid and the main grid. Additionally, both the PV systems and the fuel cells produce direct current (DC) whereas the infrastructure of the exciting power generation system is based on alternating current (AC). While integrating these renewable energy systems with the present structure, this DC voltage must be changed to AC, utilizing converters which include additional transformation steps that lead to upsurge power losses, thus diminishing general framework proficiency [5,6]. In fact, there are countless DC loads, for example, PCs, servers, mobiles, TVs and so on that require another step to convert this AC power to DC, bringing on additional losses. Different modeling techniques for a photovoltaic cell utilizing Matlab/Simulink/Simscape are proposed [7]. However, maximizing the power point via efficient tracking technique is still one of the important research points to be addressed [8][9][10], associated with efficient various DC microgrids control [11][12][13][14][15]. The real issue with the current solar energy MPPT technology is that the productivity of the PV system is still low and does not work at its best effectiveness relating to the nonlinear varieties [16,17]. DC microgrid has the ability of conversion losses reduction on the demand side [18]. The upcoming microgrid will be a crucial part of the distribution power system to accessible assimilate different types of distributed generation sources [19]. In addition, the growing load such as consumer electronics, power storage, and solar modules are essentially DC in nature, more DC microgrids and hybrid ones will likewise act in the distribution power system [20,21]. However, the evolving concept of DC microgrid needs Recently, renewable energy sources have gained a lot of attraction because of high energy demand, changes in natural strategies, and the scattered populace around the world. The concern of the environmental changes is driving in significant variations in power generation and utilization designs. Different nations have set the objective of reducing 20% of greenhouse gas by 2020. These natural concerns have pulled in broad consideration to move towards more earth benevolent energy sources, for example, a photovoltaics (PV) system, wind turbines, and fuel cells. However, these energy sources are directly dependent on the environment, for example, in PV systems, there are changes in the radiation of sunlight and temperature. The power produced from these sources fluctuates, which effects inversely to the main power grid. The ideal approach to shield this issue is to move towards a more astute confined framework such as a microgrid (MG). A microgrid can work in an islanded mode when there are blackouts for supplying power to local loads. A microgrid can likewise function as backup power when there is a lack of supply from the main grid. Point of common coupling (PCC) makes the connection between the microgrid and the main grid. Additionally, both the PV systems and the fuel cells produce direct current (DC) whereas the infrastructure of the exciting power generation system is based on alternating current (AC). While integrating these renewable energy systems with the present structure, this DC voltage must be changed to AC, utilizing converters which include additional transformation steps that lead to upsurge power losses, thus diminishing general framework proficiency [5,6]. In fact, there are countless DC loads, for example, PCs, servers, mobiles, TVs and so on that require another step to convert this AC power to DC, bringing on additional losses. Different modeling techniques for a photovoltaic cell utilizing Matlab/Simulink/Simscape are proposed [7]. However, maximizing the power point via efficient tracking technique is still one of the important research points to be addressed [8][9][10], associated with efficient various DC microgrids control [11][12][13][14][15]. The real issue with the current solar energy MPPT technology is that the productivity of the PV system is still low and does not work at its best effectiveness relating to the nonlinear varieties [16,17]. DC microgrid has the ability of conversion losses reduction on the demand side [18]. The upcoming microgrid will be a crucial part of the distribution power system to accessible assimilate different types of distributed generation sources [19]. In addition, the growing load such as consumer electronics, power storage, and solar modules are essentially DC in nature, more DC microgrids and hybrid ones will likewise act in the distribution power system [20,21]. However, the evolving concept of DC microgrid needs more investigation on power flow analysis. One of the proposed methods is to model the DG (Distributed-Generation) sources and components as droop buses. In a DC microgrid, the load allocation mechanism is accomplished by droop control by feeding back the output current via a virtual resistance to the voltage loop. The optimization of demand response at the residential side and DC microgrid in the process phase is adopted as well. One of the approaches to enhance the system efficiency is to coordinate the storage devices and/ or the loads [22][23][24].
PV systems cannot be demonstrated as a steady DC source since its output power relies upon the load current, temperature, and insolation. For the most part, maximum power point tracking (MPPT) is received to track the maximum power point in the PV framework. The productivity of MPPT relies upon both the MPPT control algorithm and the MPPT circuit. The MPPT control algorithm is generally connected in the DC-DC converter that is regularly utilized as the MPPT circuit. From the seventies, a remarkable number of MPPT control strategies have been proposed starting with basic (for example, voltage and current input based MPPT) to more enhanced power based MPPT (for instance, the P&O procedure and the incremental conductance strategy) methods. As of late intelligent based plans have been presented.
The maximum power point tracking (MPPT) is a vital part for the photovoltaic (PV) system to always get the maximum extracted power from the system. However, it is not an easy task because of the extensive variations in exterior effects and the nonlinear association of the electrical characteristics of the PV panels. Up to now, there are different MPPT methods based on control approaches engaged and climate circumstances. These various methods could be classified between online, offline, and intelligent techniques such as incremental conductance (IncCond), perturb and observe (P&O), neural networks (NN), fuzzy logic (FL), and constant voltage (CV). Some of these techniques like P&O, have a drawback that the fluctuations generation nearby the MPP (Maximum-Power_Point), slow tracking speed, and loss of a substantial quantity of energy in the control unit. The IncCond technique has been established to overwhelmed P&O issues for better efficiency and faster response. However, the recent research into MPPT methods are proposing the dynamic behavior's enhancement over the traditional techniques [25][26][27]. Modern models for PV modules based on neural networks is implemented with performance enhancement utilizing a genetic algorithm (GA) [28][29][30]. Various duty cycles values for DC-DC converter have been estimated using NN, [31] for MPPT, then utilized in a stand-alone PV system with its converter and inverter modeling [32,33]. MPPT algorithm with photovoltaic array emulator using DC/DC converters has been investigated [34]. PV panels' position adjustment has been adopted to reduce line losses [35]. The P&O and IncCond methods have been used for MPPT under dynamic weather conditions [36]. P&O technique combined with particle swarm optimization (PSO) for MPPT is implemented [37,38] and also IncCond technique utilized PSO for a standalone PV system to enhance its dynamic performance [39]. A modern approach for MPPT modeling validation is to use the real-time simulator or the hardware-in-the-loop (HIL) apparatus as shown in references [40,41]. A novel MPPT algorithm on PSO for PV systems is implemented and validated by the OPAL-real-time simulator by one of the authors [42].
The objective of this paper is to investigate, model, and design a complete standalone solar PV system with DC microgrid. The system is designed to feed a fixed DC load of 1 kW and fixed AC load of 8 kW, 500 kVAR load which can be assumed as a small area that can be powered from this standalone DC microgrid without depending on the main grid connections. To enhance the PV array efficiency, a PSO (Particle-Swarm-Optimization) MPPT (Maximum-Power-Point-Tracking) technique has been utilized to track the maximum power from a PV panel for a nano-grid system incomparable with the IncCond and P&O technique. The simulated system is validated by OPAL real-time simulator (HIL, Hardware-In-the-Loop). The final step is to analyze the stability of the DC microgrid system with the Lyapunov function identification.

Photovoltaic DC Microgrid System
This proposed system consists of a PV system with incremental conductance MPPT, a DC-DC boost converter, bi-directional DC-DC converter and control circuits, DC-AC inverter and controller and a battery bank. The proposed converter decreases the component losses and upsurges the performance of the complete system with better dynamic response and maximum power by utilizing particle swarm optimization. A simple diagram of the complete system is shown in Figure 2, and this proposed system has been designed and implemented in MatLab/Simulink. Perturb and observe, incremental conductance, and particle swarm optimization MPPT approaches are compared to show the validity of the proposed PSO over the other two techniques. The OPAL real-time simulator is used to validate the PV Simulink environment with the previous comparison. and a battery bank. The proposed converter decreases the component losses and upsurges the performance of the complete system with better dynamic response and maximum power by utilizing particle swarm optimization. A simple diagram of the complete system is shown in Figure 2, and this proposed system has been designed and implemented in MatLab/Simulink. Perturb and observe, incremental conductance, and particle swarm optimization MPPT approaches are compared to show the validity of the proposed PSO over the other two techniques. The OPAL real-time simulator is used to validate the PV Simulink environment with the previous comparison.  Sunlight has been converted to DC power by the solar cells. The photovoltaic cell produces electricity from the sun. At the point when PV panels are visible to daylight, it changes the sunlight or solar energy into electrical energy. The PV array is a mixture of parallel and series photovoltaic cells. This cluster builds up the power from the sunlight/solar energy in a straightforward manner, and it changes when the temperature and irradiances changes.
In Figure 3, a block diagram of a PV system has been shown. PV systems consist of an MPPT algorithm for tracking the maximum power from PV panels, DC-DC converter (boost converter) to boost the voltage of PV to rated voltage, finally, through the inverter, it connects with the loads. Sunlight has been converted to DC power by the solar cells. The photovoltaic cell produces electricity from the sun. At the point when PV panels are visible to daylight, it changes the sunlight or solar energy into electrical energy. The PV array is a mixture of parallel and series photovoltaic cells. This cluster builds up the power from the sunlight/solar energy in a straightforward manner, and it changes when the temperature and irradiances changes.
In Figure 3, a block diagram of a PV system has been shown. PV systems consist of an MPPT algorithm for tracking the maximum power from PV panels, DC-DC converter (boost converter) to boost the voltage of PV to rated voltage, finally, through the inverter, it connects with the loads. and a battery bank. The proposed converter decreases the component losses and upsurges the performance of the complete system with better dynamic response and maximum power by utilizing particle swarm optimization. A simple diagram of the complete system is shown in Figure 2, and this proposed system has been designed and implemented in MatLab/Simulink. Perturb and observe, incremental conductance, and particle swarm optimization MPPT approaches are compared to show the validity of the proposed PSO over the other two techniques. The OPAL real-time simulator is used to validate the PV Simulink environment with the previous comparison.  Sunlight has been converted to DC power by the solar cells. The photovoltaic cell produces electricity from the sun. At the point when PV panels are visible to daylight, it changes the sunlight or solar energy into electrical energy. The PV array is a mixture of parallel and series photovoltaic cells. This cluster builds up the power from the sunlight/solar energy in a straightforward manner, and it changes when the temperature and irradiances changes.
In Figure 3, a block diagram of a PV system has been shown. PV systems consist of an MPPT algorithm for tracking the maximum power from PV panels, DC-DC converter (boost converter) to boost the voltage of PV to rated voltage, finally, through the inverter, it connects with the loads.

Simulink Representation of the Complete PV System and the Proposed MPPT Techniques
The complete system is shown in Figure 4. It compromises the PI controller for buck/ boost DC-DC converter, battery storage, inverter with its controller, PV model with its MPPT, bidirectional converter, AC and DC loads. The IncCond MPPT is replaced one time by P&O to see the advantage of the first approach, and then replaced by the PSO one for better dynamic performance as shown in the comparison figure with the aid of the HIL. The details of each element along with the proposed techniques are explained in this section in the form of flowcharts.

Simulink Representation of the Complete PV System and the Proposed MPPT Techniques
The complete system is shown in Figure 4. It compromises the PI controller for buck/ boost DC-DC converter, battery storage, inverter with its controller, PV model with its MPPT, bidirectional converter, AC and DC loads. The IncCond MPPT is replaced one time by P&O to see the advantage of the first approach, and then replaced by the PSO one for better dynamic performance as shown in the comparison figure with the aid of the HIL. The details of each element along with the proposed techniques are explained in this section in the form of flowcharts.

Modeling of the Solar PV System
A solar PV array can be modeled in three diverse ways by utilizing MatLab/Simulink. One of the techniques is by modeling the part that utilizes numerical expressions. The following technique is to utilize the library block of Simpower frameworks, where a PV array can be modeled by gathering PV modules as indicated by the required power output. The third strategy is the utilization of the solar cell block from the slim electronics library. The distinction between this technique and the first is that in this strategy the solar cell block contains the numerical expression [7]. In our model, we have considered the solar array block from the Simpower systems library which was established by NREL, USA. The PV array block in the Simpower frameworks is a five-parameter model which utilizes a current source driven by the sunlight in parallel with a diode, a shunt resistor, and a series resistor are linked at the output as shown in Figure 5.

Modeling of the Solar PV System
A solar PV array can be modeled in three diverse ways by utilizing MatLab/Simulink. One of the techniques is by modeling the part that utilizes numerical expressions. The following technique is to utilize the library block of Simpower frameworks, where a PV array can be modeled by gathering PV modules as indicated by the required power output. The third strategy is the utilization of the solar cell block from the slim electronics library. The distinction between this technique and the first is that in this strategy the solar cell block contains the numerical expression [7]. In our model, we have considered the solar array block from the Simpower systems library which was established by NREL, USA. The PV array block in the Simpower frameworks is a five-parameter model which utilizes a current source driven by the sunlight in parallel with a diode, a shunt resistor, and a series resistor are linked at the output as shown in Figure 5.  3. Simulink Representation of the Complete PV System and the Proposed MPPT Techniques The complete system is shown in Figure 4. It compromises the PI controller for buck/ boost DC-DC converter, battery storage, inverter with its controller, PV model with its MPPT, bidirectional converter, AC and DC loads. The IncCond MPPT is replaced one time by P&O to see the advantage of the first approach, and then replaced by the PSO one for better dynamic performance as shown in the comparison figure with the aid of the HIL. The details of each element along with the proposed techniques are explained in this section in the form of flowcharts.

Modeling of the Solar PV System
A solar PV array can be modeled in three diverse ways by utilizing MatLab/Simulink. One of the techniques is by modeling the part that utilizes numerical expressions. The following technique is to utilize the library block of Simpower frameworks, where a PV array can be modeled by gathering PV modules as indicated by the required power output. The third strategy is the utilization of the solar cell block from the slim electronics library. The distinction between this technique and the first is that in this strategy the solar cell block contains the numerical expression [7]. In our model, we have considered the solar array block from the Simpower systems library which was established by NREL, USA. The PV array block in the Simpower frameworks is a five-parameter model which utilizes a current source driven by the sunlight in parallel with a diode, a shunt resistor, and a series resistor are linked at the output as shown in Figure 5.  The diode I-V Characteristics I d is where K B = Boltzmann's contact; q = electron charge; I d = diode current (A); V d = diode voltage (V); I 0 = diode saturation current (A); T = Cell temperature (K); n i = Diode ideality factor; and N cell = Number of cells connected in series.

Modeling and Simulation of the Boost Converter
A boost converter has been made utilizing a capacitor, an inductor, a diode, and a switch that appears in Figure 6. The operating system of a boost converter can be clarified in two modes. The main component of the boost converter is the switching transistor. It turns some portion of a circuit on and off rapidly. Normally the speed of the switching can be more than 1000 times each second.

Modeling and Simulation of the Boost Converter
A boost converter has been made utilizing a capacitor, an inductor, a diode, and a switch that appears in Figure 6. The operating system of a boost converter can be clarified in two modes. The main component of the boost converter is the switching transistor. It turns some portion of a circuit on and off rapidly. Normally the speed of the switching can be more than 1000 times each second.

Incremental Conductance MPPT
The photovoltaic output voltage is fundamentally a component of atmospheric factors, for example, temperature and insolation. Incremental Conductance was planned considering a perception of P-V characteristic curve. This algorithm was produced to defeat some downside of the Perturb and Observe (P&O) algorithm ( Figure 7). The impediment of the perturb and observe technique to track the peak power under the quick fluctuating climatic condition is overcome by the IC (Incremental-Conductance) technique. The IC algorithm is the most ordinarily utilized technique since its outcomes can be figured rapidly, and its control is effortlessly executed. The IC can verify that the MPPT has come to the MPP and quit perturbing the working point.

Incremental Conductance MPPT
The photovoltaic output voltage is fundamentally a component of atmospheric factors, for example, temperature and insolation. Incremental Conductance was planned considering a perception of P-V characteristic curve. This algorithm was produced to defeat some downside of the Perturb and Observe (P&O) algorithm ( Figure 7). The impediment of the perturb and observe technique to track the peak power under the quick fluctuating climatic condition is overcome by the IC (Incremental-Conductance) technique. The IC algorithm is the most ordinarily utilized technique since its outcomes can be figured rapidly, and its control is effortlessly executed. The IC can verify that the MPPT has come to the MPP and quit perturbing the working point.

Modeling and Simulation of the Boost Converter
A boost converter has been made utilizing a capacitor, an inductor, a diode, and a switch that appears in Figure 6. The operating system of a boost converter can be clarified in two modes. The main component of the boost converter is the switching transistor. It turns some portion of a circuit on and off rapidly. Normally the speed of the switching can be more than 1000 times each second.

Incremental Conductance MPPT
The photovoltaic output voltage is fundamentally a component of atmospheric factors, for example, temperature and insolation. Incremental Conductance was planned considering a perception of P-V characteristic curve. This algorithm was produced to defeat some downside of the Perturb and Observe (P&O) algorithm ( Figure 7). The impediment of the perturb and observe technique to track the peak power under the quick fluctuating climatic condition is overcome by the IC (Incremental-Conductance) technique. The IC algorithm is the most ordinarily utilized technique since its outcomes can be figured rapidly, and its control is effortlessly executed. The IC can verify that the MPPT has come to the MPP and quit perturbing the working point. The MPP can be computed by utilizing the connection between dI/dV and −I/V. When dI/dV is negative, MPPT lies on the right side of the recent position, and when positive the MPPT is on the left side [9].
In the event that MPP lies on the right side, dI/dV < −I/V and after that the PV voltage has to be reduced to come to the MPP, and when MPP is on the left side, the PV voltage has to be increased to reach the MPP. This algorithm has benefits over P&O in that it can decide when the MPPT has come to the MPP, whereas P&O oscillates around the MPP. Additionally, IC can track quickly increasing and decreasing irradiance conditions with higher precision than P&O [10]. IC techniques can be utilized for finding the MPP, enhance the PV proficiency, lessen power loss, as well as the system cost. The IC algorithm is shown in the Figure 8. The MPP can be computed by utilizing the connection between dI/dV and −I/V. When dI/dV is negative, MPPT lies on the right side of the recent position, and when positive the MPPT is on the left side [9].
In the event that MPP lies on the right side, dI/dV < −I/V and after that the PV voltage has to be reduced to come to the MPP, and when MPP is on the left side, the PV voltage has to be increased to reach the MPP. This algorithm has benefits over P&O in that it can decide when the MPPT has come to the MPP, whereas P&O oscillates around the MPP. Additionally, IC can track quickly increasing and decreasing irradiance conditions with higher precision than P&O [10]. IC techniques can be utilized for finding the MPP, enhance the PV proficiency, lessen power loss, as well as the system cost. The IC algorithm is shown in the Figure 8.

Perturb and Observe Algorithm
This technique is created on an investigation of the association between the PV component output power and its output voltage, indicating that once the output current of the PV module increases, the PV unit current perturbation will persevere within the same course in the direction of the MPP. This can be attained through overturning the perturbation course. This method flowchart is demonstrated in Figure 9 [43].

Perturb and Observe Algorithm
This technique is created on an investigation of the association between the PV component output power and its output voltage, indicating that once the output current of the PV module increases, the PV unit current perturbation will persevere within the same course in the direction of the MPP. This can be attained through overturning the perturbation course. This method flowchart is demonstrated in Figure 9 [43]. The PV module output voltage is attuned by a PI controller working the PV module at its MPP under standard test conditions. The duty ratio of the DC-DC converter is perturbed to extract the maximum output power from the PV module.

Practical Swarm Optimisation for MPPT
The proposed PSO-based MPPT algorithm's flowchart is demonstrated in Figure 10, with the main blocks of this algorithm being outlined as follows [42,44]:  Step 1. (Parameter Selection): As far as the planned MPPT algorithm is concerned, the converter's duty cycle is described as the particle position; the derived output power being considered to operate as the fitness vale assessment function; with each particle's initial 99 velocity and position being initialized at random and in a consistent distribution within the search space.  Step 2. (Fitness Evaluation): The fitness value of particle i, is calculated subsequent to the controller issuing the duty cycle directive, symbolizing the location of particle i. If the convergence criterion is met, the process will terminate; otherwise, rerun Steps 2 through to 7.  Step 7: (Re-initialization): By considering the PSO technique, the convergence technique is either to establish the most favorable solution, or attain the maximum number of iterations. However, the fitness value in PV systems does not remain constant, since it varies respective of the applied load as well as the atmospheric conditions. For that reason, there is the need to reinitialize PSO while a search recommenced for a novel method of identifying the novel MPP upon having the output of the PV module varied.
If step. 3 is false then k = −1 and continue to Step 5.
Step. 5: Calculate ((n + 1) = (n) +  · K Step. 6: Go to Step. 1 until reaching the maximum power value. The PV module output voltage is attuned by a PI controller working the PV module at its MPP under standard test conditions. The duty ratio of the DC-DC converter is perturbed to extract the maximum output power from the PV module.

Practical Swarm Optimisation for MPPT
The proposed PSO-based MPPT algorithm's flowchart is demonstrated in Figure 10, with the main blocks of this algorithm being outlined as follows [42,44]:

•
Step 1. (Parameter Selection): As far as the planned MPPT algorithm is concerned, the converter's duty cycle is described as the particle position; the derived output power being considered to operate as the fitness vale assessment function; with each particle's initial 99 velocity and position being initialized at random and in a consistent distribution within the search space.

•
Step 2. (Fitness Evaluation): The fitness value of particle i, is calculated subsequent to the controller issuing the duty cycle directive, symbolizing the location of particle i. Step 6. (Convergence Determination): The converge criterion are located either to the optimal solution or reach the maximum number of iterations. If the convergence criterion is met, the process will terminate; otherwise, rerun Steps 2 through to 7.

•
Step 7: (Re-initialization): By considering the PSO technique, the convergence technique is either to establish the most favorable solution, or attain the maximum number of iterations. However, the fitness value in PV systems does not remain constant, since it varies respective of the applied load as well as the atmospheric conditions. For that reason, there is the need to reinitialize PSO while a search recommenced for a novel method of identifying the novel MPP upon having the output of the PV module varied.  Figure 11 is the Simulink representation of the PV system with the DC-DC boost converter and the IC MPPT. The IC MPPT are replaced with the P&O and the PSO for comparison purposes. The system is designed to feed a DC load of 1kW and fixed AC load of 8 kW, 500 kVAR load as a small area that can be powered from the proposed standalone DC microgrid without depending on the main grid connections.

Modeling of Bidirectional Buck-boost Converter
The DC-DC buck and boost converters don't have bidirectional power stream capacity ( Figure  12). This limitation is due to the existence of diodes in the structure that stop opposite current flow [11]. Generally, a unidirectional DC-DC converter could be transformed into a bidirectional converter by supplanting the diodes with a governable switch in its construction.
Step 1. Parameter Selection: The converter's duty cycle is described as the particle position; the derived output power being considered to operate as the fitness vale assessment function.
Step 2. The fitness value of particle i, is calculated subsequent to the controller issuing the duty cycle directive, symbolizing the location of particle i.
Step 3. Update Individual and Global Best Data: pbest, i and gbest positions and values are revised.
Step 4. Update Individual and Global Best Data, gbest (global best fitness values) and pbest (individual best positions), of each particle.
Step 5. Update Velocity and Position of Each Particle.
Step 6. If the convergence criterion is met, the process will terminate; otherwise, rerun Steps 2 through to 7.
Step 7: (Re-initialization); reinitialize PSO.  Figure 11 is the Simulink representation of the PV system with the DC-DC boost converter and the IC MPPT. The IC MPPT are replaced with the P&O and the PSO for comparison purposes. The system is designed to feed a DC load of 1kW and fixed AC load of 8 kW, 500 kVAR load as a small area that can be powered from the proposed standalone DC microgrid without depending on the main grid connections.  Figure 11 is the Simulink representation of the PV system with the DC-DC boost converter and the IC MPPT. The IC MPPT are replaced with the P&O and the PSO for comparison purposes. The system is designed to feed a DC load of 1kW and fixed AC load of 8 kW, 500 kVAR load as a small area that can be powered from the proposed standalone DC microgrid without depending on the main grid connections.

Modeling of Bidirectional Buck-boost Converter
The DC-DC buck and boost converters don't have bidirectional power stream capacity ( Figure  12). This limitation is due to the existence of diodes in the structure that stop opposite current flow [11]. Generally, a unidirectional DC-DC converter could be transformed into a bidirectional converter by supplanting the diodes with a governable switch in its construction.
Step 1. Parameter Selection: The converter's duty cycle is described as the particle position; the derived output power being considered to operate as the fitness vale assessment function.
Step 2. The fitness value of particle i, is calculated subsequent to the controller issuing the duty cycle directive, symbolizing the location of particle i.
Step 3. Update Individual and Global Best Data: pbest, i and gbest positions and values are revised.
Step 4. Update Individual and Global Best Data, gbest (global best fitness values) and pbest (individual best positions), of each particle.
Step 5. Update Velocity and Position of Each Particle.
Step 6. If the convergence criterion is met, the process will terminate; otherwise, rerun Steps 2 through to 7.

Modeling of Bidirectional Buck-boost Converter
The DC-DC buck and boost converters don't have bidirectional power stream capacity ( Figure 12). This limitation is due to the existence of diodes in the structure that stop opposite current flow [11]. Generally, a unidirectional DC-DC converter could be transformed into a bidirectional converter by supplanting the diodes with a governable switch in its construction. Electronics 2018, 7, x FOR PEER REVIEW 10 of 27 Figure 12. Simulink representation of bidirectional buck-boost converter.
Selection of inductor and capacitor: The overall converter operation depends on the design of the inductor. The primary concern is the size and weight of a powerful inductor, to the point that is may be the single heaviest part in the whole converter. To decrease the inductor weight and size, it is necessary to take a small inductance value [12]. The least inductance value expected to guarantee the converter works in continuous conduction mode (CCM) is recognized as critical inductance (LCR) value. For the buck and boost converter, the critical inductance value is reliant on the steady-state duty cycle (D), switching period (TS) and load resistance (RL). The critical inductance for the boost converter is: The critical inductance for the buck mode converter is: Additionally, the input capacitor, as well as output capacitor magnitude can be found from the capacitors ripple voltage, where output ripple voltage is ∆Vo, inductor ripple current is ∆IL.

Bidirectional Buck-Boost Converter Controller
The DC voltage is controlled by changing the duty cycle in the bi-directional converter working in CCM mode. This controller keeps up a steady voltage at yield side for both boost and buck operation. The duty cycle of both switches creates by the controller. Two nested loops with the PI controller form this controller. Output voltage and inductor current are feedback signals to the PI controller ( Figure 13). Selection of inductor and capacitor: The overall converter operation depends on the design of the inductor. The primary concern is the size and weight of a powerful inductor, to the point that is may be the single heaviest part in the whole converter. To decrease the inductor weight and size, it is necessary to take a small inductance value [12]. The least inductance value expected to guarantee the converter works in continuous conduction mode (CCM) is recognized as critical inductance (LCR) value. For the buck and boost converter, the critical inductance value is reliant on the steady-state duty cycle (D), switching period (T S ) and load resistance (R L ). The critical inductance for the boost converter is: The critical inductance for the buck mode converter is: Additionally, the input capacitor, as well as output capacitor magnitude can be found from the capacitors ripple voltage, where output ripple voltage is ∆V o , inductor ripple current is ∆I L .

Bidirectional Buck-Boost Converter Controller
The DC voltage is controlled by changing the duty cycle in the bi-directional converter working in CCM mode. This controller keeps up a steady voltage at yield side for both boost and buck operation. The duty cycle of both switches creates by the controller. Two nested loops with the PI controller form this controller. Output voltage and inductor current are feedback signals to the PI controller ( Figure 13). Electronics 2018, 7, x FOR PEER REVIEW 11 of 27 Figure 13. Bidirectional buck-boost converter controller in Simulink.

Modeling of the Inverter and Inverter Controller
An inverter consists of analog circuitry, a MOSFET driven incorporated circuit and a low-pass filter. The control circuit is involved in three fundamental blocks, the reference voltage, sine wave generator, and carrier wave generator (carrier waves can be either saw-tooth signals or triangular). At the point when these blocks are executed with comparators and other small simple circuitry, they control the PWM (Pulse-Width-Modulation) signals. The PWM signals are fed to the MOSFET drivers that perform level interpretation to drive four MOSFETs in an H-Bridge design. From here the signal is sent through a low-pass LC filter with the goal that the yield conveys a pure sine wave. Figure 14 shows the inverter controller design to control the SPWM (Sinusoidal-Pulse-Width-Modulation) signal. Figure 15 demonstrates the signals that are passed into a comparator to achieve the PWM waveform. Figure 16 shows the generated PWM signal. Producing a sine wave adjusted on zero volts needs a negative and positive voltage across the load, for the negative and positive parts of the wave, correspondingly. This can only be accomplished from a source using four MOSFET switches organized in an H-Bridge setup. An H-Bridge converter is a switching design made out of four switches in a plan that looks like an H. By controlling distinctive switches in the bridge, a positive, negative, or zero potential voltage can be put over a load. To get a pure sine wave, the signal has been sent through a low pass filter.

Modeling of the Inverter and Inverter Controller
An inverter consists of analog circuitry, a MOSFET driven incorporated circuit and a low-pass filter. The control circuit is involved in three fundamental blocks, the reference voltage, sine wave generator, and carrier wave generator (carrier waves can be either saw-tooth signals or triangular). At the point when these blocks are executed with comparators and other small simple circuitry, they control the PWM (Pulse-Width-Modulation) signals. The PWM signals are fed to the MOSFET drivers that perform level interpretation to drive four MOSFETs in an H-Bridge design. From here the signal is sent through a low-pass LC filter with the goal that the yield conveys a pure sine wave. Figure 14 shows the inverter controller design to control the SPWM (Sinusoidal-Pulse-Width -Modulation) signal. Figure 15 demonstrates the signals that are passed into a comparator to achieve the PWM waveform. Figure 16 shows the generated PWM signal. Producing a sine wave adjusted on zero volts needs a negative and positive voltage across the load, for the negative and positive parts of the wave, correspondingly. This can only be accomplished from a source using four MOSFET switches organized in an H-Bridge setup. An H-Bridge converter is a switching design made out of four switches in a plan that looks like an H. By controlling distinctive switches in the bridge, a positive, negative, or zero potential voltage can be put over a load. To get a pure sine wave, the signal has been sent through a low pass filter.

Modeling of the Inverter and Inverter Controller
An inverter consists of analog circuitry, a MOSFET driven incorporated circuit and a low-pass filter. The control circuit is involved in three fundamental blocks, the reference voltage, sine wave generator, and carrier wave generator (carrier waves can be either saw-tooth signals or triangular). At the point when these blocks are executed with comparators and other small simple circuitry, they control the PWM (Pulse-Width-Modulation) signals. The PWM signals are fed to the MOSFET drivers that perform level interpretation to drive four MOSFETs in an H-Bridge design. From here the signal is sent through a low-pass LC filter with the goal that the yield conveys a pure sine wave. Figure 14 shows the inverter controller design to control the SPWM (Sinusoidal-Pulse-Width-Modulation) signal. Figure 15 demonstrates the signals that are passed into a comparator to achieve the PWM waveform. Figure 16 shows the generated PWM signal. Producing a sine wave adjusted on zero volts needs a negative and positive voltage across the load, for the negative and positive parts of the wave, correspondingly. This can only be accomplished from a source using four MOSFET switches organized in an H-Bridge setup. An H-Bridge converter is a switching design made out of four switches in a plan that looks like an H. By controlling distinctive switches in the bridge, a positive, negative, or zero potential voltage can be put over a load. To get a pure sine wave, the signal has been sent through a low pass filter.   In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.    In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.   In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.  In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.    In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.

Modeling of the Battery
The battery terminal voltage V b and state of charge (SOC) are two significant parameters for the suggestion of the battery status [13]. The battery model is given in MATLAB/Simulink. The parameters of the nickel metal hydride compose battery model are given as in Table 2.

Input Irradiance Variation Effect
The PV array is provided with the temperature and irradiation data using a signal builder block in the Simulink. A PV array of 20 kW, IC MPPT has been used to track the highest power from the PV array, and a boost converter has been used to boost the voltage of the PV panel to its DC grid voltage of 340 V. A bidirectional buck-boost converter has been implied to control the battery charging and discharge. A fixed DC load of 1 kW and fixed AC load of 8 kW, 500 kVAR load, have been fed from this system. As this system is producing DC voltage, a DC to AC inverter is implied to power the AC loads of this system. Figure 18 shows the input irradiance for the system, and we consider an ambient temperature of 25 • C for this simulation. In this figure, different irradiance levels are proposed with respect to the time as happens in real life. Then, different MPPT techniques are investigated with the aid of real-time simulator to check the fast-dynamic response. In Figure 17, the design of the inverter has been shown, and the parameters used in the inverter are given in Table 1.

Modeling of the Battery
The battery terminal voltage Vb and state of charge (SOC) are two significant parameters for the suggestion of the battery status [13]. The battery model is given in MATLAB/Simulink. The parameters of the nickel metal hydride compose battery model are given as in Table 2.

Input Irradiance Variation Effect
The PV array is provided with the temperature and irradiation data using a signal builder block in the Simulink. A PV array of 20 kW, IC MPPT has been used to track the highest power from the PV array, and a boost converter has been used to boost the voltage of the PV panel to its DC grid voltage of 340 V. A bidirectional buck-boost converter has been implied to control the battery charging and discharge. A fixed DC load of 1 kW and fixed AC load of 8 kW, 500 kVAR load, have been fed from this system. As this system is producing DC voltage, a DC to AC inverter is implied to power the AC loads of this system. Figure 18 shows the input irradiance for the system, and we consider an ambient temperature of 25°C for this simulation. In this figure, different irradiance levels are proposed with respect to the time as happens in real life. Then, different MPPT techniques are investigated with the aid of real-time simulator to check the fast-dynamic response. In Figure 19 the power produced by the solar PV panel are variable in terms of time depending on the solar irradiation. When the irradiance is 1000 W/m 2 , the PV gives the highest power similar to  In Figure 19 the power produced by the solar PV panel are variable in terms of time depending on the solar irradiation. When the irradiance is 1000 W/m 2 , the PV gives the highest power similar to its rating at almost 20 kW. While decreasing the irradiance, the power output of the PV also decreases with time. As described above, in this system the DC grid voltage of 340 V has been used. DC grid voltage and power supplied to DC load obtained in simulation as shown in Figure 20. As the PV array cannot produce less than the grid voltage, the DC-DC boost converter boosts the PV array voltage to 340 V. From the figure, we can see that DC grid voltage is around 340 V and the power supplied to the DC load is around 1000 W though there are fluctuations when the irradiance suddenly drops down or goes up for both the DC grid voltage and power provided to the DC load.
Electronics 2018, 7, x FOR PEER REVIEW 14 of 27 its rating at almost 20 kW. While decreasing the irradiance, the power output of the PV also decreases with time. As described above, in this system the DC grid voltage of 340 V has been used. DC grid voltage and power supplied to DC load obtained in simulation as shown in Figure 20. As the PV array cannot produce less than the grid voltage, the DC-DC boost converter boosts the PV array voltage to 340 V. From the figure, we can see that DC grid voltage is around 340 V and the power supplied to the DC load is around 1000 W though there are fluctuations when the irradiance suddenly drops down or goes up for both the DC grid voltage and power provided to the DC load. Figure 19. PV output power. Figure 19. PV output power.
Electronics 2018, 7, x FOR PEER REVIEW 14 of 27 its rating at almost 20 kW. While decreasing the irradiance, the power output of the PV also decreases with time. As described above, in this system the DC grid voltage of 340 V has been used. DC grid voltage and power supplied to DC load obtained in simulation as shown in Figure 20. As the PV array cannot produce less than the grid voltage, the DC-DC boost converter boosts the PV array voltage to 340 V. From the figure, we can see that DC grid voltage is around 340 V and the power supplied to the DC load is around 1000 W though there are fluctuations when the irradiance suddenly drops down or goes up for both the DC grid voltage and power provided to the DC load. Figure 19. PV output power. The PV system supplies DC power, and to supply the power to the AC loads, a DC-AC inverter is used. Figure 21 shows the AC voltage across the AC load, where there is also the sudden decrease and increase of voltage due to the sudden decline and rise of the irradiance.
One of the main components of the system is the bi-directional buck/boost converter. The common DC link voltage (DC grid) is kept constant by the bi-directional flow of power between the battery and PV system. If the voltage increases above the predefined grid voltage value, i.e. 340 V that means the PV system power is enough to feed the load and charge the battery and therefore, some current is sent to the battery to take the voltage down to 340 V, and in this case the bidirectional converter is operated in buck mode, stepping down the voltage from 340 V to 160 V (Battery Voltage). If the DC grid voltage goes down below 340 V, this means the PV is not producing enough power to feed the load and therefore, some current is sent from the battery to the grid and in this case, the battery discharges and the bidirectional converter is operated in boost mode, i.e., boosting the voltage from 160 to 340 V. Initially, the battery state of charge (SOC) is selected as 50%. With the input irradiance in Figure 18, the battery is in charging mode as the PV system is producing enough power to feed the loads as well as charge the battery, so the battery SOC is increasing at the time, as shown in Figure 22. The bidirectional buck-boost converter is working in buck mode, the DC input voltage 340 V is buck to 160 V by controller pulses.  The PV system supplies DC power, and to supply the power to the AC loads, a DC-AC inverter is used. Figure 21 shows the AC voltage across the AC load, where there is also the sudden decrease and increase of voltage due to the sudden decline and rise of the irradiance.
One of the main components of the system is the bi-directional buck/boost converter. The common DC link voltage (DC grid) is kept constant by the bi-directional flow of power between the battery and PV system. If the voltage increases above the predefined grid voltage value, i.e. 340 V that means the PV system power is enough to feed the load and charge the battery and therefore, some current is sent to the battery to take the voltage down to 340 V, and in this case the bidirectional converter is operated in buck mode, stepping down the voltage from 340 V to 160 V (Battery Voltage). If the DC grid voltage goes down below 340 V, this means the PV is not producing enough power to feed the load and therefore, some current is sent from the battery to the grid and in this case, the battery discharges and the bidirectional converter is operated in boost mode, i.e., boosting the voltage from 160 to 340 V. Initially, the battery state of charge (SOC) is selected as 50%. With the input irradiance in Figure 18, the battery is in charging mode as the PV system is producing enough power to feed the loads as well as charge the battery, so the battery SOC is increasing at the time, as shown in Figure 22. The bidirectional buck-boost converter is working in buck mode, the DC input voltage 340 V is buck to 160 V by controller pulses. The PV system supplies DC power, and to supply the power to the AC loads, a DC-AC inverter is used. Figure 21 shows the AC voltage across the AC load, where there is also the sudden decrease and increase of voltage due to the sudden decline and rise of the irradiance.
One of the main components of the system is the bi-directional buck/boost converter. The common DC link voltage (DC grid) is kept constant by the bi-directional flow of power between the battery and PV system. If the voltage increases above the predefined grid voltage value, i.e. 340 V that means the PV system power is enough to feed the load and charge the battery and therefore, some current is sent to the battery to take the voltage down to 340 V, and in this case the bidirectional converter is operated in buck mode, stepping down the voltage from 340 V to 160 V (Battery Voltage). If the DC grid voltage goes down below 340 V, this means the PV is not producing enough power to feed the load and therefore, some current is sent from the battery to the grid and in this case, the battery discharges and the bidirectional converter is operated in boost mode, i.e., boosting the voltage from 160 to 340 V. Initially, the battery state of charge (SOC) is selected as 50%. With the input irradiance in Figure 18, the battery is in charging mode as the PV system is producing enough power to feed the loads as well as charge the battery, so the battery SOC is increasing at the time, as shown in Figure 22. The bidirectional buck-boost converter is working in buck mode, the DC input voltage 340 V is buck to 160 V by controller pulses.  As the battery is charged and the bidirectional buck-boost converter is in buck mode, the battery current and power is negative, as shown in Figure 23. While giving the input irradiance bellow 700 W/m 2 , the produced power from the PV system is not enough to feed the loads, so the bidirectional converter is working in boost mode to make the battery voltage from 160 V to 340 V, causing the battery to discharge as shown in the Figure 24. When As the battery is charged and the bidirectional buck-boost converter is in buck mode, the battery current and power is negative, as shown in Figure 23. As the battery is charged and the bidirectional buck-boost converter is in buck mode, the battery current and power is negative, as shown in Figure 23. While giving the input irradiance bellow 700 W/m 2 , the produced power from the PV system is not enough to feed the loads, so the bidirectional converter is working in boost mode to make the battery voltage from 160 V to 340 V, causing the battery to discharge as shown in the Figure 24. When While giving the input irradiance bellow 700 W/m 2 , the produced power from the PV system is not enough to feed the loads, so the bidirectional converter is working in boost mode to make the battery voltage from 160 V to 340 V, causing the battery to discharge as shown in the Figure 24. When the input irradiance is more than 700 W/m 2 the battery works in charging mode, as in the 3 and 4 mins the irradiance is around 790 W/m 2 and the battery charges during this period. the input irradiance is more than 700W/m2 the battery works in charging mode, as in the 3 and 4 mins the irradiance is around 790 W/m 2 and the battery charges during this period. Figure 24. Battery discharging mode.
OPAL-RT real-time simulator (Hardware-in the-loop) is a platform set of test application on the basis of modeling and has the ability to conduct hardware within the loop and rapid control prototyping. The type of the user equipment is OP4510 RT-LAB-RCP/HIL, which is located in the authors' research lab [42] and is shown in Figure 25 and it is manufactured by Canadian company with the name OPAL. Hardware-in-the-loop (HIL) simulation is a well-established prototyping approach that aims to reduce design costs of power systems by running comprehensive tests early in the development phase. Real-time simulation refers to a computer model of a physical system that can execute at the same rate as actual "wall clock" time. In other words, the computer model runs at the same rate as the actual physical system. It employs a special technique to integrate a complicated model into multiple subsystems, which will operate simultaneously. The OP4510 is a compact device with 128 fast I/O channels with signal conditioning, additional RS422 channels (or optional low-speed fiber optic channels), high-speed communication ports (SFPs), and is fully integrated with Simulink, Sim-Power-System. The integration of high-end INTEL multi-core processors with powerful Kintex 7 FPGA (Field-Programmable-Gate-Array) provides greater simulation power and sub-microsecond simulation time steps to maximize the accuracy of fast power electronic systems. A programmable FPGA is installed within the target machine and 10 ns is the frequency of the digital I/O channel, pulse resolution. One simulation step can obtain or generate multiple pulse events in the platform of the RT-LAB simulation system. In this way, the IGBT (Insulated-Gate-Bipolar-Transistor) switch in the electric inverter can be provided with highly précised timing. If the events of FPGA can be combined by identifying the unique real-time algorithm and function of RE-EVENTs, then 10μs can be obtained as the simulation step [40][41][42].
The models that are installed by Simulink are to be compacted out of the apex and the OPAL-RT library' parameters such as SM, SS, and SC should be used to name the RT-LAB so that functions of various parts can be ensured. Curve within the simulation system, data communication among the OPAL-RT real-time simulator (Hardware-in the-loop) is a platform set of test application on the basis of modeling and has the ability to conduct hardware within the loop and rapid control prototyping. The type of the user equipment is OP4510 RT-LAB-RCP/HIL, which is located in the authors' research lab [42] and is shown in Figure 25 and it is manufactured by Canadian company with the name OPAL. Hardware-in-the-loop (HIL) simulation is a well-established prototyping approach that aims to reduce design costs of power systems by running comprehensive tests early in the development phase. Real-time simulation refers to a computer model of a physical system that can execute at the same rate as actual "wall clock" time. In other words, the computer model runs at the same rate as the actual physical system. the input irradiance is more than 700W/m2 the battery works in charging mode, as in the 3 and 4 mins the irradiance is around 790 W/m 2 and the battery charges during this period. Figure 24. Battery discharging mode.
OPAL-RT real-time simulator (Hardware-in the-loop) is a platform set of test application on the basis of modeling and has the ability to conduct hardware within the loop and rapid control prototyping. The type of the user equipment is OP4510 RT-LAB-RCP/HIL, which is located in the authors' research lab [42] and is shown in Figure 25 and it is manufactured by Canadian company with the name OPAL. Hardware-in-the-loop (HIL) simulation is a well-established prototyping approach that aims to reduce design costs of power systems by running comprehensive tests early in the development phase. Real-time simulation refers to a computer model of a physical system that can execute at the same rate as actual "wall clock" time. In other words, the computer model runs at the same rate as the actual physical system. It employs a special technique to integrate a complicated model into multiple subsystems, which will operate simultaneously. The OP4510 is a compact device with 128 fast I/O channels with signal conditioning, additional RS422 channels (or optional low-speed fiber optic channels), high-speed communication ports (SFPs), and is fully integrated with Simulink, Sim-Power-System. The integration of high-end INTEL multi-core processors with powerful Kintex 7 FPGA (Field-Programmable-Gate-Array) provides greater simulation power and sub-microsecond simulation time steps to maximize the accuracy of fast power electronic systems. A programmable FPGA is installed within the target machine and 10 ns is the frequency of the digital I/O channel, pulse resolution. One simulation step can obtain or generate multiple pulse events in the platform of the RT-LAB simulation system. In this way, the IGBT (Insulated-Gate-Bipolar-Transistor) switch in the electric inverter can be provided with highly précised timing. If the events of FPGA can be combined by identifying the unique real-time algorithm and function of RE-EVENTs, then 10µs can be obtained as the simulation step [40][41][42].
The models that are installed by Simulink are to be compacted out of the apex and the OPAL-RT library' parameters such as SM, SS, and SC should be used to name the RT-LAB so that functions of various parts can be ensured. Curve within the simulation system, data communication among the It employs a special technique to integrate a complicated model into multiple subsystems, which will operate simultaneously.
The OP4510 is a compact device with 128 fast I/O channels with signal conditioning, additional RS422 channels (or optional low-speed fiber optic channels), high-speed communication ports (SFPs), and is fully integrated with Simulink, Sim-Power-System. The integration of high-end INTEL multi-core processors with powerful Kintex 7 FPGA (Field-Programmable-Gate-Array) provides greater simulation power and sub-microsecond simulation time steps to maximize the accuracy of fast power electronic systems. A programmable FPGA is installed within the target machine and 10 ns is the frequency of the digital I/O channel, pulse resolution. One simulation step can obtain or generate multiple pulse events in the platform of the RT-LAB simulation system. In this way, the IGBT (Insulated-Gate-Bipolar-Transistor) switch in the electric inverter can be provided with highly précised timing. If the events of FPGA can be combined by identifying the unique real-time algorithm and function of RE-EVENTs, then 10µs can be obtained as the simulation step [40][41][42].
The models that are installed by Simulink are to be compacted out of the apex and the OPAL-RT library' parameters such as SM, SS, and SC should be used to name the RT-LAB so that functions of various parts can be ensured. Curve within the simulation system, data communication among the main parameters, and real-time observation are performed by the SC subsystem. Data are gathered and displayed with the help of a fundamental module found in the programs. The SM subsystem takes over the responsibility of network synchronization and real-time observation. The SS subsystem normally belongs to the system models involved in the simulation. The segregated model comprises one SM subsystem, one SC subsystem, and SS subsystem. There are only switch, oscilloscope, and logic selection and no calculating parts in the SC subsystem. The Opcomm synchronous communication module holds a significant part in simulation, and each signal has to reach the subsystem above via undergoing the Opcomm module [40][41][42]. Figure 26 demonstrates testing main program with 10 µs as the simulation step. The SM subsystem has the tenacity of completing the simulation calculation along with the synchronous communication of the MPPT. The improved incremental conductance technique is implemented in the experimentation. The module's vulnerable to the events are replaced by RT-EVENTS (Real-Time events to transform the module from Simulink into real-time) modules. PWM signal is giving accurate output. The digital output module of RT-LAB is the OP5110-5120 Digital Out that has the ability to carry out the output of the PWM signal. The analog input module is the Analog in that, also has the ability to carry out the input of current and voltage of the photovoltaic cell. FPGA has been blended with the synchronous drive module that is the OP5110-5120 Opsync. The SC subsystem has the ability to perform current, system information, voltage, and power of the photovoltaic cell. Due to the same sampling rate of four signals, only one Opcomm module is required.
Electronics 2018, 7, x FOR PEER REVIEW 18 of 27 main parameters, and real-time observation are performed by the SC subsystem. Data are gathered and displayed with the help of a fundamental module found in the programs. The SM subsystem takes over the responsibility of network synchronization and real-time observation. The SS subsystem normally belongs to the system models involved in the simulation. The segregated model comprises one SM subsystem, one SC subsystem, and SS subsystem. There are only switch, oscilloscope, and logic selection and no calculating parts in the SC subsystem. The Opcomm synchronous communication module holds a significant part in simulation, and each signal has to reach the subsystem above via undergoing the Opcomm module [40][41][42]. Figure 26 demonstrates testing main program with 10 μs as the simulation step. The SM subsystem has the tenacity of completing the simulation calculation along with the synchronous communication of the MPPT. The improved incremental conductance technique is implemented in the experimentation. The module's vulnerable to the events are replaced by RT-EVENTS (Real-Time events to transform the module from Simulink into real-time) modules. PWM signal is giving accurate output. The digital output module of RT-LAB is the OP5110-5120 Digital Out that has the ability to carry out the output of the PWM signal. The analog input module is the Analog in that, also has the ability to carry out the input of current and voltage of the photovoltaic cell. FPGA has been blended with the synchronous drive module that is the OP5110-5120 Opsync. The SC subsystem has the ability to perform current, system information, voltage, and power of the photovoltaic cell. Due to the same sampling rate of four signals, only one Opcomm module is required.   The proposed three techniques are compared for validity purposes to show the best dynamic response and best MPP value under different levels of irradiance from Figure 18. Figure 28 shows the highest obtained maximum power is achieved from the particle swarm optimization (PSO) with a good dynamic response too. However, the incremental conductance (IncCond) MPPT is better than perturb and observe (P&O) choice in both fast-dynamic response and MPP value.    The proposed three techniques are compared for validity purposes to show the best dynamic response and best MPP value under different levels of irradiance from Figure 18. Figure 28 shows the highest obtained maximum power is achieved from the particle swarm optimization (PSO) with a good dynamic response too. However, the incremental conductance (IncCond) MPPT is better than perturb and observe (P&O) choice in both fast-dynamic response and MPP value. The proposed three techniques are compared for validity purposes to show the best dynamic response and best MPP value under different levels of irradiance from Figure 18. Figure 28 shows the highest obtained maximum power is achieved from the particle swarm optimization (PSO) with a good dynamic response too. However, the incremental conductance (IncCond) MPPT is better than perturb and observe (P&O) choice in both fast-dynamic response and MPP value.

Stability Analysis Investigation
It is very important to perform the steady-state and transient stability analysis on both the AC and DC microgrid to ensure good quality and constant power supply. The DC microgrid has faster stability incomparable with the AC microgrid after the fault clearance without any effect when it is connected to a weak grid. The microgrid and the traditional power system stability have the same basic concepts. However, because of the presence of the high-level-penetration of DG sources with their associated converters, the microgrid stability glitches are originated or heavily affected by the converters' dynamics and control. There are different techniques to examine and predict the stability of microgrids to provide systematic tools for microgrid controllers design. A mixture of a small-signal and time-domain simulation is usually used for inclusive stability analysis.
Stability analysis of the microgrid has significant effect with the increase of intermittent renewable energy sources penetration. The proposed stability analysis investigation is using a logic of global/semi-global stability [45][46][47], rather than using prevailing small-signal-analysis methods.

Stability Analysis Investigation
It is very important to perform the steady-state and transient stability analysis on both the AC and DC microgrid to ensure good quality and constant power supply. The DC microgrid has faster stability incomparable with the AC microgrid after the fault clearance without any effect when it is connected to a weak grid. The microgrid and the traditional power system stability have the same basic concepts. However, because of the presence of the high-level-penetration of DG sources with their associated converters, the microgrid stability glitches are originated or heavily affected by the converters' dynamics and control. There are different techniques to examine and predict the stability of microgrids to provide systematic tools for microgrid controllers design. A mixture of a small-signal and time-domain simulation is usually used for inclusive stability analysis.
Stability analysis of the microgrid has significant effect with the increase of intermittent renewable energy sources penetration. The proposed stability analysis investigation is using a logic of global/semi-global stability [45][46][47], rather than using prevailing small-signal-analysis methods.

Stability Analysis Investigation
It is very important to perform the steady-state and transient stability analysis on both the AC and DC microgrid to ensure good quality and constant power supply. The DC microgrid has faster stability incomparable with the AC microgrid after the fault clearance without any effect when it is connected to a weak grid. The microgrid and the traditional power system stability have the same basic concepts. However, because of the presence of the high-level-penetration of DG sources with their associated converters, the microgrid stability glitches are originated or heavily affected by the converters' dynamics and control. There are different techniques to examine and predict the stability of microgrids to provide systematic tools for microgrid controllers design. A mixture of a small-signal and time-domain simulation is usually used for inclusive stability analysis.
Stability analysis of the microgrid has significant effect with the increase of intermittent renewable energy sources penetration. The proposed stability analysis investigation is using a logic of global/semi-global stability [45][46][47], rather than using prevailing small-signal-analysis methods. The present tactics to stability analysis are mainly based on time-domain, energy function, and Lyapunov-function. This work shapes a simple stability analysis way based on the polynomial-Lyapunov-function, which is calculated algorithmically utilizing the sum-of-squares optimization to maximize the region of attraction (ROA) of an equilibrium solution. This process rules out the essential for previous information of the formula of the Lyapunov or energy function. Because of the mentioned reasons and the essential effect of the power electronics converters with their controllers on the system stability, this part proposes simple investigation for the DC-DC boost controller and bidirectional DC-DC buck-boost converter with their controllers. The DC microgrid almost doesn't have harmonic effects, and skin effect or Ferranti effect. Because of its advantages, it may be the perfect candidate for the future power systems over the AC microgrid [7,48,49].
Another widespread analytic method for grid-connected inverters is the impedance-based stability principle. Many control techniques are proposed to improve the microgrid stability such as novel frequency regulation by using the kinetic energy from the loads or load-voltage-sensitivity and adaptively controlling converters [50][51][52][53][54]. The general microgrid stability as same as the normal power system stability definition in reference [55], which is: "The ability of an electric power system, for a given initial operating condition, to regain a state of operating equilibrium after being subjected to a physical disturbance, with most system variables bounded so that practically the entire system remains intact." The frequency stability is "the ability of a power system to maintain steady frequency following a severe system upset resulting in a significant imbalance between generation and load. [55]" And the voltage stability refers to "the ability of a power system to maintain the steady voltage at all buses in the system after being subjected to a disturbance from a given initial operating condition. [55]" "Similar to the bulk power system, the microgrid frequency stability largely depends on the real power demand-supply balance and the reactive power balance is critical for microgrid voltage stability [49]". The instability of the power converter controllers can affect microgrid loss synchronism and cause prohibited complete system voltage profiles. A sustained low voltage condition can outcome due to inadequate microgrid abilities to loose regulate system voltage after the contingencies [56,57].
The polynomial Lyapunov function for stability analysis of a DC-nanogrid is investigated. The proposed method depends on semi-definite optimization with identifying the region of attraction (ROA) of the equilibrium point without the aid of time domain choice for solution [45][46][47] with power electronics converters. The dynamic modeling of the DG source is formulated and converts into state-space equations. The equilibrium solutions for all states and used Taylor series are identified. The Lyapunov function V(x) is calculated to satisfy the Lyapunov conditions in a domain Ω around the equilibrium solution (located at x = 0, where x is the state variables vector) given as follows: . V(x) = ∇V(x) · F(x) ≤ 0 f or ∀x (8) .
x = F(x); (x) : The functions of the system differential equations (9) V(x) < γ, ∀x ∈ ROA After that, we determine the Lyapunov function (LF) and assess system state x stability by checking the condition V(x) < γ. Then, we determine feasibility of the sum of squares (SOS) for optimization in order to identify a Lyapunov polynomial function and identify the ROA estimate of the equilibrium.
Illustration of system stability using Lyapunov function (Equations (7)-(10)) for best estimation of ROA is presented. The optimization technique will help find best LF with the widest estimate of ROA. A set inclusion problem is formulated to make V(x) satisfying the Lyapunov conditions in the widest possible domain, as shown in the following:

•
Set A: Set of the states x within an arbitrary "radius" β (in other word, satisfying the inequality p(x) < β, where p(x) has an arbitrary shape) • Set B: Set of the states x for which an arbitrary γ is an upper bound of the Lyapunov function V(x); • Set C: Set of the states x for which .
where "A is the Jacobian of F(x). Once A has been determined, if all of its eigenvalues are found to have negative real parts, then there exists a positive-definite matrix P (where Q must be positive definite) that satisfies the following condition" The corresponding LF is determined using: Step 2: "In this step, V(x) is held fixed while γ and s 2 (x) are determined using Equations (15) and (17), using the bisection method to iteratively determine the biggest value of γ ;" Step 3: "In this step, V(x) is held fixed while both β and s 1 (x) are determined using Equation (16). However, Equation (10) is bilinear in β and s 1 (x), bisection is used to obtain s 1 (x) while keeping β fixed" Step 4: "In this step β, γ, s 1 (x), and s 2 (x) are held fixed while V(x) is determined using Equations (14) through (17) and normalized with respect to γ to avoid numerical problem"; Step 5a: "If the value of β converges, the iteration process is stopped; otherwise, the process flow restarts at step 2"; Step 5b: "Determine the variation in the shaping function following" To carry out the previous portion of the work, we use software SOSTOOLS 2.05, SeDuMi 1.3, and Multipoly 2.00.
For the stability analysis of the proposed system in previous section the two controllers, DC-DC boost controller and bidirectional DC-DC buck-boost converter are considered ( Figure 30). We consider two controls in the model. The control signals are duty cycles of the converters. S1 controls the power output of the PV; S2 controls the DC bus voltage. Utilizing Kirchhoff's laws, the dynamic model of the system can be composed as： with the constraints: x1 > 0, x4 > 0 Moving the equilibrium points of the system to the origin and the system without control which is s = 0 is globally asymptotically stable [17]. We consider two controls in the model. The control signals are duty cycles of the converters. S1 controls the power output of the PV; S2 controls the DC bus voltage. Utilizing Kirchhoff's laws, the dynamic model of the system can be composed as: with the constraints: v 2 > 0, i 1 > 0. Let x T = [x 1 , x 2 , x 3 , x 4 ] = [i 1 , v 1 , i 2 , v 2 ] and the system can be rewritten as state space model: . . . .
with the constraints: x 1 > 0, x 4 > 0 Moving the equilibrium points of the system to the origin and the system without control which is s = 0 is globally asymptotically stable [17].
with the Lyapunov function: .
x 4 Considering only the boost converter and replacing the values of parameters with s 1 as zero we get; . .

Conclusions
In this paper, important aspects of the solar renewable energy source have been explored. The possibilities of the DC microgrid system and its viability have been investigated. A complete design and analysis have been proposed to effectively enhance the power conversion efficiency of a standalone solar PV system with DC microgrid. A PV array of 20 kW, IC MPPT, a boost converter, and a bidirectional buck-boost converter have been implied to control the battery charging and discharging. The proposed converter decreases the component losses and upsurges the performance of the complete system by peer selection of its components. Additionally, PSO and P&O MPPT techniques are proposed incomparable with the IncCond one. Particle Swarm Optimization (PSO) one is the best in terms of fast-dynamic responses with the fast change of irradiance with better maximum power point (MPP). The IncCond one gives very good results close to the PSO and better than the P&O. A fixed DC load of 1kW and fixed AC load of 8kW, 500kVAR load, have been fed from this system. Later, a stability analysis of the DC microgrid for the boost controller and bidirectional buck-boost controller have figured out the space state equations and Lyapunov function using sum-of-squares optimization. The proposed complete system lessens the component losses and upsurges the efficiency of the complete system in terms of enhancing the dynamic response, minimizing harmonics' loss, and getting more