Design and Dynamic Modelling of PV-Battery Hybrid Systems for Custom Electromagnetic Transient Simulation

: Battery energy storage systems (BESS) can alleviate the unstable e ﬀ ects of intermittent renewable energy systems, such as solar and wind power systems. In addition, a BESS can level the load of the existing utility grid. The penetration rate of this type of system is expected to increase in the future power grid, i.e., the microgrid. In this paper, a modeling technique is proposed that allows users to customize the photovoltaic (PV) battery hybrid systems. A dynamic power system computer-aided design / electromagnetic transients including DC system (PSCAD / EMTDC) model of a PV battery hybrid system is presented in this paper. Dynamic modeling of PV arrays, BESS, maximum power point tracking (MPPT) algorithms, and bidirectional converters are provided as well. The PV model, battery model, and MPPT control model are designed using a user-deﬁned model (UDM) for custom electromagnetic transient simulation. A control method for stabilizing the output of the PV battery hybrid system is proposed. Finally, a PSCAD / EMTDC simulation is conducted to verify the e ﬀ ectiveness of the operating algorithm.


Introduction
A photovoltaic (PV) generation system is a type of technology that uses solar cells to convert solar energy into electrical energy. Due to its abundant resources, easy exploitation, cleanliness, and renewable properties, PV generation is developing more and more rapidly as a renewable energy source. When the PV generation systems are interconnected to a distribution system, the existing passive grid is changed to an active grid. In an active grid, electrical energy can flow in both directions, so the demand side can also contribute to electricity generation [1,2]. This can achieve substantial technical and economic benefits for both utility companies and customers. Loss reduction, voltage improvement, and frequency control are a few examples of accomplishing this goal. The technical impact of PV systems can be assessed through power system studies such as steady-state or dynamic analysis [3]. Steady states are basic investigations that can evaluate the flow of power and fault currents when PV is interconnected to the system. These studies are important for determining a reasonable location for and the generation capacity of a solar power plant [4,5]. Further, dynamic studies are needed to evaluate the overall grid continuity and to design powerful control systems [6][7][8].
However, the disadvantage of PV generation is that it occurs intermittently depending on the weather conditions. Therefore, energy storage elements are needed to obtain stable and reliable output from the PV generation system and to improve the steady-state and dynamic behavior of power generation systems [9]. A battery energy storage system (BESS) can be integrated into a PV generation model. The PV and battery model is developed using UDM from PSCAD. The output characteristics of the PV and battery are expressed mathematically and programmed using Fortran code.

PV Array Modeling
The basic operating principle of a PV array is the photoelectric effect of a semiconductor PN junction. The physical phenomenon of the PV module can be represented by an equivalent electrical circuit, as shown in Figure 1. The load current is expressed by Equation (1) [26]. The current source can be obtained by solar radiation quantity and temperature. where, : Solar radiation quantity : Temperature (℃) The characteristics of the PV module are non-linear and each curve only has one maximum power point. In addition, the output current of the PV module is mainly affected by the irradiation variation, while the output voltage of the PV module is mainly affected by the temperature variation. However, because the variable range of output power at different temperatures is small, irradiation variation is a major factor in the output power of the PV array.
PSCAD/EMTDC is an industry-standard simulation tool for studying the transient behavior of electrical devices and networks. The graphical user interface allows users to graphically organize  The current source can be obtained by solar radiation quantity and temperature.
where, S: Solar radiation quantity T: Temperature ( • C) The characteristics of the PV module are non-linear and each curve only has one maximum power point. In addition, the output current of the PV module is mainly affected by the irradiation variation, Electronics 2020, 9, 1651 4 of 25 while the output voltage of the PV module is mainly affected by the temperature variation. However, because the variable range of output power at different temperatures is small, irradiation variation is a major factor in the output power of the PV array.
PSCAD/EMTDC is an industry-standard simulation tool for studying the transient behavior of electrical devices and networks. The graphical user interface allows users to graphically organize circuits and run simulations. It also allows users to analyze results and manage data in a fully integrated graphical environment [25].
The user-friendly interface allows the user to enter the required parameters of the component. User-defined components can be created using the component wizard as a function of PSCAD. Figure 2 shows the components of the PV array model created using the component wizard. circuits and run simulations. It also allows users to analyze results and manage data in a fully integrated graphical environment [25]. The user-friendly interface allows the user to enter the required parameters of the component. User-defined components can be created using the component wizard as a function of PSCAD. Figure  2 shows the components of the PV array model created using the component wizard.   The key essential parameters used for PV array are shown in Figure 4 along with the data used in this paper.   circuits and run simulations. It also allows users to analyze results and manage data in a fully integrated graphical environment [25]. The user-friendly interface allows the user to enter the required parameters of the component. User-defined components can be created using the component wizard as a function of PSCAD. Figure  2 shows the components of the PV array model created using the component wizard.   The key essential parameters used for PV array are shown in Figure 4 along with the data used in this paper. The key essential parameters used for PV array are shown in Figure 4 along with the data used in this paper. The main function is represented using the Fortran language in UDM with reference to PSCAD, as shown in Figures 5 and 6. Figure 5 shows the Fortran code employed to determine the terminal voltage of the PV array using the 'VDC', an internal function of PSCAD. As shown in Figure 6, the magnitude of the output current is determined by using the characteristic variable and constant variable of the PV array model. In this part, the model of the PV module can be determined by reflecting the characteristics of PV module. If the user wants to change The main function is represented using the Fortran language in UDM with reference to PSCAD, as shown in Figures 5 and 6. Figure 5 shows the Fortran code employed to determine the terminal voltage of the PV array using the 'VDC', an internal function of PSCAD.  As shown in Figure 6, the magnitude of the output current is determined by using the characteristic variable and constant variable of the PV array model. In this part, the model of the PV module can be determined by reflecting the characteristics of PV module. If the user wants to change the characteristics of the PV module, the user can modify this part to reflect the desired characteristics of the PV module.
In addition, Figure 6 shows the Fortran code employed to determine the terminal current of the PV array using the 'CCIN', an internal function of PSCAD.
Electronics 2020, 9, x FOR PEER REVIEW 6 of 25 the characteristics of the PV module, the user can modify this part to reflect the desired characteristics of the PV module. In addition, Figure 6 shows the Fortran code employed to determine the terminal current of the PV array using the 'CCIN', an internal function of PSCAD.    Figure 8 shows the output characteristics of the PV array as a function of insolation from the test circuit. The simulation results are found to be identical to the actual output characteristics of the PV array output.  the characteristics of the PV module, the user can modify this part to reflect the desired characteristics of the PV module. In addition, Figure 6 shows the Fortran code employed to determine the terminal current of the PV array using the 'CCIN', an internal function of PSCAD.       Figure 9 shows the typical discharge characteristics of a nickel-metal hydride (Ni-MH) battery cell. The conventional discharge model is similar to the Shepherd model, but it can accurately represent the voltage dynamics when the current variation and the open-circuit voltage (OCV) are considered as functions of the state of charge (SOC) [13]. To better represent OCV behavior, terms related to polarization voltage are added. In addition, the term related to polarization resistance has been slightly modified. The obtained battery voltage is given by [27]:   Figure 9 shows the typical discharge characteristics of a nickel-metal hydride (Ni-MH) battery cell.  Figure 9 shows the typical discharge characteristics of a nickel-metal hydride (Ni-MH) battery cell. The conventional discharge model is similar to the Shepherd model, but it can accurately represent the voltage dynamics when the current variation and the open-circuit voltage (OCV) are considered as functions of the state of charge (SOC) [13]. To better represent OCV behavior, terms related to polarization voltage are added. In addition, the term related to polarization resistance has been slightly modified. The obtained battery voltage is given by [27]:  The conventional discharge model is similar to the Shepherd model, but it can accurately represent the voltage dynamics when the current variation and the open-circuit voltage (OCV) are considered as functions of the state of charge (SOC) [13]. To better represent OCV behavior, terms related to polarization voltage are added. In addition, the term related to polarization resistance has been slightly modified. The obtained battery voltage is given by [27]:

Battery Modeling
where, The exponential area of Equation (3) is valid for Ni-MH batteries. Hysteresis occurs between charging and discharging regardless of the SOC of the battery: this only occurs in the exponential domain. This phenomenon can be represented by a nonlinear dynamic system [27]: where, B: Exponential zone time constant inverse (Ah The exponential voltage depends on the charge or discharge mode. A complete discharge model system is shown in Figure 10. The exponential area of Equation (3) is valid for Ni-MH batteries. Hysteresis occurs between charging and discharging regardless of the SOC of the battery: this only occurs in the exponential domain. This phenomenon can be represented by a nonlinear dynamic system [27]: where, : Exponential zone amplitude (V) ( ): Charge and discharge mode The exponential voltage depends on the charge or discharge mode. A complete discharge model system is shown in Figure 10. The battery charge characteristics of the existing model are as follows. The charging behavior, particularly the end of charge (EOC) characteristics, differs and depends on the type of battery. The Ni-MH type has special action in EOC. When the battery reaches the full charge voltage, the voltage slowly decreases with the current amplitude. This is very important for modeling because the battery charger monitors the charge stop value. This behavior is expressed by modifying the charge polarization resistance. When the battery is fully charged ( = 0), the voltage begins to drop. At this point, the charger continues to overcharge the battery ( < 0) and the voltage decreases. This phenomenon can be manifested by reducing the polarization resistance when the battery is overcharged using the absolute value of the charge ( ): The battery model can accurately represent the behavior of the battery using well-determined parameters. An important feature of the battery model is the extraction of parameters from the manufacturer's discharge curve. Figure 11 shows the real discharge characteristics of a 1.2 V 100 Ah Ni-MH battery cell (GMH 100) [28]. The real discharge curve shows the discharge test data from the actual manufacturer. The discharge curve shows the voltage characteristics during discharging with a constant current of 20 A (0.2 C rate). The battery charge characteristics of the existing model are as follows. The charging behavior, particularly the end of charge (EOC) characteristics, differs and depends on the type of battery. The Ni-MH type has special action in EOC. When the battery reaches the full charge voltage, the voltage slowly decreases with the current amplitude. This is very important for modeling because the battery charger monitors the charge stop value. This behavior is expressed by modifying the charge polarization resistance. When the battery is fully charged (I s = 0), the voltage begins to drop. At this point, the charger continues to overcharge the battery (I s < 0) and the voltage decreases. This phenomenon can be manifested by reducing the polarization resistance when the battery is overcharged using the absolute value of the charge (I s ): The battery model can accurately represent the behavior of the battery using well-determined parameters. An important feature of the battery model is the extraction of parameters from the manufacturer's discharge curve. Figure 11 shows the real discharge characteristics of a 1.2 V 100 Ah Ni-MH battery cell (GMH 100) [28]. The real discharge curve shows the discharge test data from the actual manufacturer. The discharge curve shows the voltage characteristics during discharging with a constant current of 20 A (0.2 C rate). The parameters are extracted from 0.2 C data using the curve fitting function of MATLAB, and they are listed in Table 1 [29]. Figure 12 shows a comparison of the original data and the extracted parameter data [30].  However, the obtained parameters did not fit the other discharge curves (1, 2, and 5 C curves). Analyzing the results of the obtained parameters showed that the curve shape was similar, but the yintercept was different. The parameters ( , ) related to the y-intercept were recalculated. These two parameters were calculated using the relationship between current and y-intercept as shown in Equation (6). The parameters are extracted from 0.2 C data using the curve fitting function of MATLAB, and they are listed in Table 1 [29]. Figure 12 shows a comparison of the original data and the extracted parameter data [30].  The parameters are extracted from 0.2 C data using the curve fitting function of MATLAB, and they are listed in Table 1 [29]. Figure 12 shows a comparison of the original data and the extracted parameter data [30].  However, the obtained parameters did not fit the other discharge curves (1, 2, and 5 C curves). Analyzing the results of the obtained parameters showed that the curve shape was similar, but the yintercept was different. The parameters ( , ) related to the y-intercept were recalculated. These two parameters were calculated using the relationship between current and y-intercept as shown in Equation (6)  However, the obtained parameters did not fit the other discharge curves (1, 2, and 5 C curves). Analyzing the results of the obtained parameters showed that the curve shape was similar, but the y-intercept was different. The parameters (E 0 , R) related to the y-intercept were recalculated. These two parameters were calculated using the relationship between current and y-intercept as shown in Equation (6).
The two parameters are again derived using the curve fitting of MATLAB, with the results presented in Table 2 and Figure 13. The two parameters are again derived using the curve fitting of MATLAB, with the results presented in Table 2 and Figure 13.        Figure 14 shows the components of a battery model created using the component wizard.
Electronics 2020, 9, x FOR PEER REVIEW 10 of 25 The two parameters are again derived using the curve fitting of MATLAB, with the results presented in Table 2 and Figure 13.       The obtained parameters from curve fitting are entered as the required parameters, as shown in Figure 16. As shown in Figure 17, the battery model is implemented using the Fortran language in UDM of PSCAD. The user can then visualize the discharge curve with the obtained parameters and compare them with the manufacturer's discharge curve. In Figure 17, the initial state of the battery model is defined. The magnitude of the output voltage is determined using the characteristic variable of the battery model. In this part, the model of the Ni-MH battery can be determined by reflecting the characteristics of the battery. If the user wants to change the characteristics of the battery, the user can modify this part to reflect the desired characteristics of the battery. The obtained parameters from curve fitting are entered as the required parameters, as shown in Figure 16. The obtained parameters from curve fitting are entered as the required parameters, as shown in Figure 16. As shown in Figure 17, the battery model is implemented using the Fortran language in UDM of PSCAD. The user can then visualize the discharge curve with the obtained parameters and compare them with the manufacturer's discharge curve. In Figure 17, the initial state of the battery model is defined. The magnitude of the output voltage is determined using the characteristic variable of the battery model. In this part, the model of the Ni-MH battery can be determined by reflecting the characteristics of the battery. If the user wants to change the characteristics of the battery, the user can modify this part to reflect the desired characteristics of the battery. As shown in Figure 17, the battery model is implemented using the Fortran language in UDM of PSCAD. The user can then visualize the discharge curve with the obtained parameters and compare them with the manufacturer's discharge curve. In Figure 17, the initial state of the battery model is defined. The magnitude of the output voltage is determined using the characteristic variable of the battery model. In this part, the model of the Ni-MH battery can be determined by reflecting the characteristics of the battery. If the user wants to change the characteristics of the battery, the user can modify this part to reflect the desired characteristics of the battery. The profile of the experimental data is compared to that of the model data. The experimental data are the actual battery discharge data measured by the manufacturer through the Ni-MH battery discharge experiment. Regardless of the discharge current, the results indicate that the obtained parameters can correctly represent the Ni-MH battery model. Therefore, it can be seen that the battery model is almost the same as the actual model characteristics.

PV Battery Hybrid Systems
The control method of the converter and inverter is developed using UDM from PSCAD. The converter control technique applied the MPPT technique to maximize the output of the PV system. The inverter control technology is applied to control the output of the PV battery hybrid system. It is developed so that the user can easily modify the control technique of the converter and inverter. Therefore, it is possible to check the performance by applying various techniques and can be used for new technique development. Figure 22 shows the configuration of a PV battery hybrid system. The PV array and the battery are each connected to a common DC bus through a DC/DC converter. Then, they are interconnected to the AC grid through a common DC/AC inverter. BESS can balance between PV generation and load demands through charging and discharging. The PV system is intended to maximize PV generation output. The BESS is used to control the DC link voltage. The inverter aims to control the system output. The PV system, BESS, and inverter each have independent control objects, and the whole system works safely through the control of each of its parts.

PV Generation System
When the PV source is interconnected to the grid, it is necessary to convert the DC power into AC power using electronics. Further, to improve the efficiency of the PV power generation system, it

PV Battery Hybrid Systems
The control method of the converter and inverter is developed using UDM from PSCAD. The converter control technique applied the MPPT technique to maximize the output of the PV system. The inverter control technology is applied to control the output of the PV battery hybrid system. It is developed so that the user can easily modify the control technique of the converter and inverter. Therefore, it is possible to check the performance by applying various techniques and can be used for new technique development. Figure 22 shows the configuration of a PV battery hybrid system. The PV array and the battery are each connected to a common DC bus through a DC/DC converter. Then, they are interconnected to the AC grid through a common DC/AC inverter. BESS can balance between PV generation and load demands through charging and discharging. The PV system is intended to maximize PV generation output. The BESS is used to control the DC link voltage. The inverter aims to control the system output. The PV system, BESS, and inverter each have independent control objects, and the whole system works safely through the control of each of its parts.

PV Battery Hybrid Systems
The control method of the converter and inverter is developed using UDM from PSCAD. The converter control technique applied the MPPT technique to maximize the output of the PV system. The inverter control technology is applied to control the output of the PV battery hybrid system. It is developed so that the user can easily modify the control technique of the converter and inverter. Therefore, it is possible to check the performance by applying various techniques and can be used for new technique development. Figure 22 shows the configuration of a PV battery hybrid system. The PV array and the battery are each connected to a common DC bus through a DC/DC converter. Then, they are interconnected to the AC grid through a common DC/AC inverter. BESS can balance between PV generation and load demands through charging and discharging. The PV system is intended to maximize PV generation output. The BESS is used to control the DC link voltage. The inverter aims to control the system output. The PV system, BESS, and inverter each have independent control objects, and the whole system works safely through the control of each of its parts.

PV Generation System
When the PV source is interconnected to the grid, it is necessary to convert the DC power into AC power using electronics. Further, to improve the efficiency of the PV power generation system, it

PV Generation System
When the PV source is interconnected to the grid, it is necessary to convert the DC power into AC power using electronics. Further, to improve the efficiency of the PV power generation system, it is also necessary to control the PV array to generate maximum power in a specific environment. For the PV system, maximum power point tracking (MPPT) is realized by controlling the DC/DC converter.
MPPT aims to operate the PV generation at the maximum power point using a control algorithm. Many MPPT algorithms can be used, including the constant voltage tracking method, perturbation and observation (P&O) method, INC-CON method, and variable step size method. Of these methods, the P&O method is selected because it does not require more reliable measurements than the other methods.
The P&O algorithm works by continuously measuring the terminal voltage and current of the PV array, then adding a small disturbance to constantly disturb the voltage, and observing the change in output power to determine the next control signal. If the power increases, the fluctuation continues in the same direction in the next step: otherwise, the fluctuation direction is reversed as shown in Figure 23. For the P&O algorithm, large perturbations can be used to quickly track the maximum power point, but the resulting accuracy is low. Conversely, using small perturbations increase the accuracy of the algorithm, but it takes a long time to track the maximum power point. In the characteristic curve of the PV generation, the power increment and the voltage increment have the following relationship [31]: At the left of MPP : dP dV > 0 (7) At the right of MPP : dP dV < 0 (8) At the MPP : dP dV = 0 (9) Electronics 2020, 9, x FOR PEER REVIEW 15 of 25 is also necessary to control the PV array to generate maximum power in a specific environment. For the PV system, maximum power point tracking (MPPT) is realized by controlling the DC/DC converter. MPPT aims to operate the PV generation at the maximum power point using a control algorithm. Many MPPT algorithms can be used, including the constant voltage tracking method, perturbation and observation (P&O) method, INC-CON method, and variable step size method. Of these methods, the P&O method is selected because it does not require more reliable measurements than the other methods.
The P&O algorithm works by continuously measuring the terminal voltage and current of the PV array, then adding a small disturbance to constantly disturb the voltage, and observing the change in output power to determine the next control signal. If the power increases, the fluctuation continues in the same direction in the next step: otherwise, the fluctuation direction is reversed as shown in Figure 23. For the P&O algorithm, large perturbations can be used to quickly track the maximum power point, but the resulting accuracy is low. Conversely, using small perturbations increase the accuracy of the algorithm, but it takes a long time to track the maximum power point. In the characteristic curve of the PV generation, the power increment and the voltage increment have the following relationship [31]: At the left of MPP: > 0 At the right of MPP: At the MPP: = 0 (9) As shown in Figure 24, the MPPT algorithm is implemented in the Fortran language in the UDM of PSCAD. In this part, the MPPT algorithm code is shown while excluding the initialization part and the variable definition part. If this part is modified with the other algorithm, it is possible to verify the other algorithm. As shown in Figure 24, the MPPT algorithm is implemented in the Fortran language in the UDM of PSCAD. In this part, the MPPT algorithm code is shown while excluding the initialization part and the variable definition part. If this part is modified with the other algorithm, it is possible to verify the other algorithm. For PV generation systems, a buck chopper circuit is used as a DC/DC converter. Due to the high output voltage of the PV cell series, a buck circuit can be used to convert a high voltage PV array. Capacitors are commonly connected between the PV array and the buck circuit, and these are used to reduce high-frequency harmonics. Figure 25 shows the configuration of the buck circuit and its control system. The duty cycle D can be adjusted to control the PV generation to operate it at its maximum power point. Control schemes include PI control. Figure 26 shows the DC/DC converter control scheme in PSCAD. For PV generation systems, a buck chopper circuit is used as a DC/DC converter. Due to the high output voltage of the PV cell series, a buck circuit can be used to convert a high voltage PV array. Capacitors are commonly connected between the PV array and the buck circuit, and these are used to reduce high-frequency harmonics. Figure 25 shows the configuration of the buck circuit and its control system. For PV generation systems, a buck chopper circuit is used as a DC/DC converter. Due to the high output voltage of the PV cell series, a buck circuit can be used to convert a high voltage PV array. Capacitors are commonly connected between the PV array and the buck circuit, and these are used to reduce high-frequency harmonics. Figure 25 shows the configuration of the buck circuit and its control system. The duty cycle D can be adjusted to control the PV generation to operate it at its maximum power point. Control schemes include PI control. Figure 26 shows the DC/DC converter control scheme in PSCAD. The duty cycle D can be adjusted to control the PV generation to operate it at its maximum power point. Control schemes include PI control. Figure 26 shows the DC/DC converter control scheme in PSCAD.

Battery Energy Storage System
The BESS consists of a battery, a bidirectional DC/DC converter, and a control system. The system can work in two directions. The battery can be charged to store additional energy, and it can also release energy into the grid. In this paper, the BESS is connected to the DC bus through a bidirectional DC/DC converter in PSCAD, as shown in Figure 27. The battery acts as a power source to meet the load demands that cannot be fully met by the PV system, particularly during solar fluctuations. The battery is designed to complement the PV system output.

Battery Energy Storage System
The BESS consists of a battery, a bidirectional DC/DC converter, and a control system. The system can work in two directions. The battery can be charged to store additional energy, and it can also release energy into the grid. In this paper, the BESS is connected to the DC bus through a bidirectional DC/DC converter in PSCAD, as shown in Figure 27. The battery acts as a power source to meet the load demands that cannot be fully met by the PV system, particularly during solar fluctuations. The battery is designed to complement the PV system output.

Battery Energy Storage System
The BESS consists of a battery, a bidirectional DC/DC converter, and a control system. The system can work in two directions. The battery can be charged to store additional energy, and it can also release energy into the grid. In this paper, the BESS is connected to the DC bus through a bidirectional DC/DC converter in PSCAD, as shown in Figure 27. The battery acts as a power source to meet the load demands that cannot be fully met by the PV system, particularly during solar fluctuations. The battery is designed to complement the PV system output.  The main purpose of the battery converter is to control the DC link voltage. As shown in Figure 28, the factors that determine the reference value (P BAT,ref ) for this controller are the DC link voltage (E Cap ), grid power (P SYS,ref ), and PV power (P PV ).
Electronics 2020, 9, x FOR PEER REVIEW 18 of 25 The main purpose of the battery converter is to control the DC link voltage. As shown in Figure  28, the factors that determine the reference value (  The mode of operation for the BESS is determined by the calculated reference ( , ). Charge mode: If the reference value ( , ) is negative, switch D1 is activated and the converter acts as a boost circuit. Figure 29 shows how to control the charge mode of a bidirectional converter. Discharge mode: When the reference value ( , ) is positive, switch D2 is activated and the converter operates as a buck circuit. Figure 30 shows the discharge mode of a bidirectional converter. The charge and discharge control scheme is modeled by PSCAD in Figure 31. The main purpose of the battery converter is to control the DC link voltage. As shown in Figure  28, the factors that determine the reference value (  The mode of operation for the BESS is determined by the calculated reference ( , ). Charge mode: If the reference value ( , ) is negative, switch D1 is activated and the converter acts as a boost circuit. Figure 29 shows how to control the charge mode of a bidirectional converter. Discharge mode: When the reference value ( , ) is positive, switch D2 is activated and the converter operates as a buck circuit. Figure 30 shows the discharge mode of a bidirectional converter. The charge and discharge control scheme is modeled by PSCAD in Figure 31. Discharge mode: When the reference value (P BAT,ref ) is positive, switch D2 is activated and the converter operates as a buck circuit. Figure 30 shows the discharge mode of a bidirectional converter.
Electronics 2020, 9, x FOR PEER REVIEW 18 of 25 The main purpose of the battery converter is to control the DC link voltage. As shown in Figure  28, the factors that determine the reference value (   Discharge mode: When the reference value ( , ) is positive, switch D2 is activated and the converter operates as a buck circuit. Figure 30 shows the discharge mode of a bidirectional converter. The charge and discharge control scheme is modeled by PSCAD in Figure 31. The charge and discharge control scheme is modeled by PSCAD in Figure 31.

Control of Grid-Connected Inverter
The PV array and the battery are connected to the AC grid via a common DC/AC inverter. The purpose of the inverter is to control the system output power regardless of the output of the PV generation. A vector control scheme with a reference frame along the grid voltage vector position is used to independently control the active and reactive power flowing between the grid and the inverter. The converter is regulated by a direct axis current used to regulate the actual power (system output power) and a quadrature axis current used to regulate the reactive power. Figure 32 shows a control diagram of the inverter.

Control of Grid-Connected Inverter
The PV array and the battery are connected to the AC grid via a common DC/AC inverter. The purpose of the inverter is to control the system output power regardless of the output of the PV generation. A vector control scheme with a reference frame along the grid voltage vector position is used to independently control the active and reactive power flowing between the grid and the inverter. The converter is regulated by a direct axis current used to regulate the actual power (system output power) and a quadrature axis current used to regulate the reactive power. Figure 32 shows a control diagram of the inverter.

Control of Grid-Connected Inverter
The PV array and the battery are connected to the AC grid via a common DC/AC inverter. The purpose of the inverter is to control the system output power regardless of the output of the PV generation. A vector control scheme with a reference frame along the grid voltage vector position is used to independently control the active and reactive power flowing between the grid and the inverter. The converter is regulated by a direct axis current used to regulate the actual power (system output power) and a quadrature axis current used to regulate the reactive power. Figure 32 shows a control diagram of the inverter.  The controller of the inverter is modeled using the UDM of PSCAD. A portion of the Fortran code is shown in Figure 33. The program is configured to determine the output voltage and the current using the internal function of PSCAD. The required parameters for the inverter are entered as shown in Figure 34.
Electronics 2020, 9, x FOR PEER REVIEW 20 of 25 current using the internal function of PSCAD. The required parameters for the inverter are entered as shown in Figure 34.    Electronics 2020, 9, x FOR PEER REVIEW 20 of 25 current using the internal function of PSCAD. The required parameters for the inverter are entered as shown in Figure 34.

Case Studies
In this paper, the PV battery hybrid system is simulated in various situations to evaluate the system performance. Figure 36 shows a PV battery hybrid system modeled by PSCAD. The simulation settings are shown in Table 3.

Case Studies
In this paper, the PV battery hybrid system is simulated in various situations to evaluate the system performance. Figure 36 shows a PV battery hybrid system modeled by PSCAD. The simulation settings are shown in Table 3.    In case 1, the power output to the grid is fixed. Figure 37 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery state (charge = 0, discharge = 1). The system output of the inverter is maintained in a stable manner because the battery compensates for the fluctuation of the PV generation power. When the PV power exceeds the inverter power reference, the battery operates in charge mode; otherwise, it operates in discharge mode.
Electronics 2020, 9, x FOR PEER REVIEW 23 of 25 In case 1, the power output to the grid is fixed. Figure 37 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery state (charge = 0, discharge = 1). The system output of the inverter is maintained in a stable manner because the battery compensates for the fluctuation of the PV generation power. When the PV power exceeds the inverter power reference, the battery operates in charge mode; otherwise, it operates in discharge mode. In case 2, the system output reference changes every 10 s. Figure 38 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery status. Hybrid systems have been proven to work well with various system output references. This example demonstrates that hybrid systems can contribute to grid power control under various conditions. Through case 1 and case 2 simulations, it is confirmed that the control of the converter and inverter is being performed stably. The converter of the PV array is controlled to maximize the output of the PV array, and the converter of battery controls the charging and discharging of the battery. Through this control, it is confirmed that the inverter controls the system output stably. In case 2, the system output reference changes every 10 s. Figure 38 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery status. Hybrid systems have been proven to work well with various system output references. This example demonstrates that hybrid systems can contribute to grid power control under various conditions. Electronics 2020, 9, x FOR PEER REVIEW 23 of 25 In case 1, the power output to the grid is fixed. Figure 37 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery state (charge = 0, discharge = 1). The system output of the inverter is maintained in a stable manner because the battery compensates for the fluctuation of the PV generation power. When the PV power exceeds the inverter power reference, the battery operates in charge mode; otherwise, it operates in discharge mode. In case 2, the system output reference changes every 10 s. Figure 38 shows the system output, PV generation power, battery charge and discharge power, battery SOC, and battery status. Hybrid systems have been proven to work well with various system output references. This example demonstrates that hybrid systems can contribute to grid power control under various conditions. Through case 1 and case 2 simulations, it is confirmed that the control of the converter and inverter is being performed stably. The converter of the PV array is controlled to maximize the output of the PV array, and the converter of battery controls the charging and discharging of the battery. Through this control, it is confirmed that the inverter controls the system output stably. Through case 1 and case 2 simulations, it is confirmed that the control of the converter and inverter is being performed stably. The converter of the PV array is controlled to maximize the output of the PV array, and the converter of battery controls the charging and discharging of the battery. Through this control, it is confirmed that the inverter controls the system output stably.

Conclusions
In this paper, a simulation model of a PV battery hybrid system is developed by PSCAD/EMTDC. Each system component is modeled and simulated using PSCAD customization. The modeling schemes of PV models, battery models, and power conversion systems have been described in detail. The PV model is made into a model that can receive the characteristics of a photovoltaic cell and determine the output of the photovoltaic cell. The battery model is developed to reflect the discharge characteristics of the battery, and the parameters are extracted from the experimental data of the battery discharge. Using the DC/DC converter, PV generation uses the MPPT algorithm and BESS uses the charge and discharge algorithm. The results confirm that the entire system can be stabilized through charging and discharging.
The proposed PV battery hybrid system allows the user to change or modify the properties of the PV or the battery. This means that new PV or battery characteristics can be easily applied. In addition, the user can modify the Fortran code to immediately apply the converter and inverter algorithm. This allows users to develop system operating algorithms and simulate various cases without the need for a lot of modification.
In this paper, a development technique of the PV battery hybrid system model is proposed. When the development model is applied to an actual system, it is difficult to modify or improve. Therefore, an optimal model can be developed using the proposed technique. In addition, various case analysis can be performed before applying the development model to the actual system.

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