Research on Modeling of Microgrid Based on Data Testing and Parameter Identiﬁcation

: The model parameter identiﬁcation based on real operation data is a means to accurately determine the simulation parameters of the microgrid, but the real operation data cannot guarantee the exact agreement with the required data for parameter identiﬁcation, which has become an important restriction factor in the accurate simulation and analysis of the dynamics of the microgrid. This paper provides a method of modeling of microgrid based on data testing and parameter identiﬁcation. In this paper, the method of parameter trajectory sensitivity is ﬁrst introduced. Then, the data testing scheme for parameter identiﬁcation is presented, and the parameter identiﬁcation ﬂow chart is given. Thirdly, a microgrid demonstration system in China is taken as an example, the important parameters of the distributed photovoltaic, direct-drive wind turbine and energy storage unit in the system are obtained by data testing and parameter identiﬁcation, and in the end, the accuracy of the model is veriﬁed through the comparison of the simulation data and the test data of the microgrid during grid-connection/island switching process. The obtained microgrid model provides a base model for the analysis of the overall characteristics, such as the transient stability, as well as power quality of the microgrid.


Introduction
A microgrid with multiple distributed renewable power sources is conducive to increasing the application of renewable energy power generation, reducing energy consumption, and improving the reliability and flexibility of power systems, thus, is developing rapidly worldwide. At present, there are more than 400 microgrid demonstration projects planned, under construction or put into operation worldwide.
Digital modeling and simulation is one of the main methods of microgrid research, which provides a necessary tool and strong technical support for the study of microgrid operation mechanisms, protection control and other issues. Models developed by manufacturers of wind turbines, photovoltaic (PV) units, and energy storage units can reproduce the behavior of distributed power sources accurately and in detail. However, this level of detail is not suitable for the stability study of large power systems. This is because the use of these models requires a lot of input data, and due to the large number of state variables in the models, the time and complexity of simulations are greatly increased. Therefore, the standards committees in China and abroad have issued general dynamic models for renewable power sources such as wind turbines, PV, energy storage, etc. On one hand, the general models can of the system and the easier it is to identify [20]. Trajectory sensitivity (relative value) is defined as the following formula: y(t,θ 1 ,...,θ i +∆θ i ,...,θ m )−y(t,θ 1 ,...,θ i ,...,θ m ) y(t,θ 1 ,...,θ i ,...,θ m ) ∆θ i θ i0 (1) where S θ i is the trajectory sensitivity of the i-th parameter θ i , and θ i0 is the given value of the parameter θ i ; y is one of the observed quantities. m is the number of parameters to be identified. Research shows that if the observed quantity is sensitive to the parameters, that is, the corresponding trajectory sensitivity is relatively large, the parameters can be easily identified according to the observed quantities. On the contrary, if the parameter has little influence on all the observed quantities, then the parameter is not easy to identify. In order to quantitatively compare the sensitivity of each parameter, the average value of the absolute values of each point of the track sensitivity can be calculated according to the following formula: where k is the total number of points of trajectory sensitivity.

Sensitivity Analysis
For the PV, direct-drive wind turbine and energy storage unit in the microgrid discussed in this paper, the converter is the core component. So it is a key technology for distributed generation unit modeling to establish a reasonable model of the converter and its controller and to obtain its parameters accurately.
In this paper, based on the general models discussed in Section 1, and according to the analysis of transient characteristics of microgrids, models of the PV, direct-drive wind turbine and energy storage unit control system are established, respectively.
First, for the PV unit, the output of the photovoltaic cell is simulated by an equivalent DC source, and PV has both an MPPT operating mode and a constant power mode. The control structure of the PV unit is shown in Figure 1. The parameters that need identification include the maximum and minimum of power change rate when the PV unit works in MPPT mode and PI (Proportion Integration) parameters of active and reactive power control links. This is because in MPPT mode, a sudden change in the active power output may damage the converter, and a slow change may be harmful to the recovery of the system. The PI control parameters of active and reactive power control links directly affect the dynamic characteristics of PV unit. The parameters to be identified are shown in the red dashed box in Figure 1.  For the trajectory sensitivity analysis, a grid-connected PV system model is built on MATLAB/Simulink platform. The active power P and reactive power Q at the outlet of the PV unit are selected as the observation measurements, sensitivity analysis is done to Kp, Tp, Kq and Tq, all of which are parameters of the PI controllers of the PV unit in Figure 1 and need identification.
In Figure 1 (1) Trajectory sensitivity when power reference value changes.
The reference values of the active power and reactive power of the converter are changed according to Figure 2a,b respectively. The trajectory sensitivity of the parameters to be identified is shown in Figure 3a  For the trajectory sensitivity analysis, a grid-connected PV system model is built on MATLAB/Simulink platform. The active power P and reactive power Q at the outlet of the PV unit are selected as the observation measurements, sensitivity analysis is done to K p , T p , K q and T q , all of which are parameters of the PI controllers of the PV unit in Figure 1 and need identification.
In Figure 1, is the general form of PI controller, where, K p represents the ration coefficient, T p represents the integral time constants. However, in the simulation model constructed in MATLAB, the form of PI control is K p (1 + K ip s ), where K ip is used to describe the integral link, and the relationship between K ip and T p is: K ip = K p /T p . Similarly, the relationship between K iq and T q is: K iq = K q /T q . Due to the MATLAB platform, the trajectory sensitivity analysis given in Figures 3 and 5 adopts K ip and K iq instead of T p and T q .
(1) Trajectory sensitivity when power reference value changes.
The reference values of the active power and reactive power of the converter are changed according to Figure 2a,b respectively. The trajectory sensitivity of the parameters to be identified is shown in Figure 3a,b.  For the trajectory sensitivity analysis, a grid-connected PV system model is built on MATLAB/Simulink platform. The active power P and reactive power Q at the outlet of the PV unit are selected as the observation measurements, sensitivity analysis is done to Kp, Tp, Kq and Tq, all of which are parameters of the PI controllers of the PV unit in Figure 1 and need identification.
In Figure 1 (1) Trajectory sensitivity when power reference value changes.
The reference values of the active power and reactive power of the converter are changed according to Figure 2a,b respectively. The trajectory sensitivity of the parameters to be identified is shown in Figure 3a    (2) Trajectory sensitivity in the case of short-circuit fault.
At the point of common coupling (PCC), a three-phase short-circuit fault occurs at t = 0 s, and the voltage drops to 0.8 p.u. At t = 0.15 s, the fault is cleared, and the system gradually resumes normal operation. The voltage (U) at PCC is shown in Figure 4. The trajectory sensitivity of the parameters to be identified is shown in Figure 5a   (2) Trajectory sensitivity in the case of short-circuit fault.
At the point of common coupling (PCC), a three-phase short-circuit fault occurs at t = 0 s, and the voltage drops to 0.8 p.u. At t = 0.15 s, the fault is cleared, and the system gradually resumes normal operation. The voltage (U) at PCC is shown in Figure 4. The trajectory sensitivity of the parameters to be identified is shown in Figure 5a,b. (2) Trajectory sensitivity in the case of short-circuit fault.
At the point of common coupling (PCC), a three-phase short-circuit fault occurs at t = 0 s, and the voltage drops to 0.8 p.u. At t = 0.15 s, the fault is cleared, and the system gradually resumes normal operation. The voltage (U) at PCC is shown in Figure 4. The trajectory sensitivity of the parameters to be identified is shown in Figure 5a     The sensitivity analysis results show that, under the conditions of both reference value change and the short-circuit fault, active power is more sensitive to the parameters K p and T p , and reactive power is more sensitive to the parameters K q and T q . Therefore, with an appropriate data testing scheme, the dynamic data of the output power of the distributed generation unit under different working conditions can be collected to identify the required parameters.
(3) Sensitivity of upper and lower limits of power change rate.
The acquisition of the upper and lower limits of the power change rate does not require sensitivity analysis, but only needs to set the power change reference value in the actual test process and calculate the power change rate according to the test data.
(4) Sensitivity analysis of direct-drive wind turbine.
For direct-drive wind turbine, the machine-side variables and the grid-side variables are decoupled by the DC link. Only the PI control parameters of DC voltage and reactive power control link of the grid side converter directly affect its dynamic characteristics. Therefore, the machine-side part is replaced by an equivalent DC source, and the control structure is shown in Figure 6. The parameters that need identification include PI parameters of the DC voltage control link and the reactive power control link. The parameters to be identified are shown in the red dashed box in Figure 6. The sensitivity analysis results show that, under the conditions of both reference value change and the short-circuit fault, active power is more sensitive to the parameters Kp and Tp, and reactive power is more sensitive to the parameters Kq and Tq. Therefore, with an appropriate data testing scheme, the dynamic data of the output power of the distributed generation unit under different working conditions can be collected to identify the required parameters.
(3) Sensitivity of upper and lower limits of power change rate.
The acquisition of the upper and lower limits of the power change rate does not require sensitivity analysis, but only needs to set the power change reference value in the actual test process and calculate the power change rate according to the test data.
(4) Sensitivity analysis of direct-drive wind turbine.
For direct-drive wind turbine, the machine-side variables and the grid-side variables are decoupled by the DC link. Only the PI control parameters of DC voltage and reactive power control link of the grid side converter directly affect its dynamic characteristics. Therefore, the machine-side part is replaced by an equivalent DC source, and the control structure is shown in Figure 6. The parameters that need identification include PI parameters of the DC voltage control link and the reactive power control link. The parameters to be identified are shown in the red dashed box in Figure 6. Adopting the sensitivity analysis method used in the PV unit, the sensitivity analysis is undertaken for the direct-drive wind turbine. The results show that the DC voltage of the direct-drive wind turbine is more sensitive to the parameters Kp and Tp, and the reactive power is more sensitive to the parameters Kq and Tq.
(5) Sensitivity analysis of energy storage unit. Adopting the sensitivity analysis method used in the PV unit, the sensitivity analysis is undertaken for the direct-drive wind turbine. The results show that the DC voltage of the direct-drive wind turbine is more sensitive to the parameters K p and T p , and the reactive power is more sensitive to the parameters K q and T q .
(5) Sensitivity analysis of energy storage unit.
For the energy storage unit, the output of the energy storage battery is also simulated by an equivalent DC source, of which the control structure is shown in Figure 7. In the grid-connected mode of a microgrid, the energy storage unit works in power control mode, and normally the Q command is 0. Therefore, the parameters that need identification include the upper and lower limits of the active power control slope and the PI control parameters of the active and reactive power control links. The parameters to be identified are shown in the red dashed box in Figure 7. Adopting the sensitivity analysis method used in the PV unit, the sensitivity analysis is undertaken for the energy storage unit. The result show that the active power of the energy storage unit is more sensitive to the parameters Kp and Tp, and the reactive power is more sensitive to the parameters Kq and Tq.

Test Scheme
The sensitivity analysis gives the correlation between system parameters and system external characteristics and helps to determine the observation measurements for parameter identification. According to the sensitivity analysis in the previous section, the test scheme was designed, as shown in Table 1.

Parameter Identification Steps Based on Particle Swarm Optimization Algorithm
Considering the nonlinearity of the system to be identified, the time cost and the accuracy of the algorithm [21-23], the particle swarm optimization algorithm is adopted for parameter identification. The flow chart is shown in Figure 8. Adopting the sensitivity analysis method used in the PV unit, the sensitivity analysis is undertaken for the energy storage unit. The result show that the active power of the energy storage unit is more sensitive to the parameters K p and T p , and the reactive power is more sensitive to the parameters K q and T q .

Test Scheme
The sensitivity analysis gives the correlation between system parameters and system external characteristics and helps to determine the observation measurements for parameter identification. According to the sensitivity analysis in the previous section, the test scheme was designed, as shown in Table 1.

Parameter Identification Steps Based on Particle Swarm Optimization Algorithm
Considering the nonlinearity of the system to be identified, the time cost and the accuracy of the algorithm [21][22][23], the particle swarm optimization algorithm is adopted for parameter identification. The flow chart is shown in Figure 8.

Error Indicator
According to the China Recommended Standard GB/T 32892-2016 "photovoltaic power generation system model and parameter testing procedures", the maximum deviation between the simulation data and the test data during the steady-state interval is adopted to assess the accuracy of the model. The expression is as follows: where is the standard value of the electrical quantity in the simulation data; is the standard value of the electrical quantity in the test data; and are the first and last serial numbers of the test data in the error calculation interval.

Basic Information and Selection of Test Points
The modeling and test work are carried out on the wind/PV/storage microgrid demonstration system established by the Electric Power Research Institute of State Grid Jiangsu Electric power corporation. The system is a microgrid infrastructure platform which includes a distributed

Error Indicator
According to the China Recommended Standard GB/T 32892-2016 "photovoltaic power generation system model and parameter testing procedures", the maximum deviation between the simulation data and the test data during the steady-state interval is adopted to assess the accuracy of the model. The expression is as follows: where X S is the standard value of the electrical quantity in the simulation data; X M is the standard value of the electrical quantity in the test data; K M Start and K M End are the first and last serial numbers of the test data in the error calculation interval.

Basic Information and Selection of Test Points
The modeling and test work are carried out on the wind/PV/storage microgrid demonstration system established by the Electric Power Research Institute of State Grid Jiangsu Electric power corporation. The system is a microgrid infrastructure platform which includes a distributed wind/PV/storage unit, i.e., one 30 kW horizontal axis direct-drive wind turbine, one 5 kW rotor wing direct-drive wind turbine, one 5 kW H airfoil direct-drive wind turbine, one 30 kW fixed polycrystalline PV unit and one 75 kWh lithium battery energy storage unit. The detailed parameters of the microgrid example system are shown in Appendix A.
The wind turbines, PV power unit and energy storage unit of the microgrid are connected in parallel to a 0.4 kV bus, which connects to a 10 kV distribution network for power exchange with the main grid.
The test points are selected according to the sensitivity and test scheme determined in Table 1. The test basis is as follows: GB/T 32826-2016 "photovoltaic power generation system modeling guide", GB/T 32892-2016 "photovoltaic power generation system model and parameter test regulation", and GB/T 34133-2017 "energy storage converter test technical regulation".
The test points of the microgrid in the example are shown in Figure 9. The test equipment connection points are shown in red. A total of four test points are used to test the voltage and current of the PV unit, wind turbines, energy storage unit as well as the grid-connection terminal respectively. The test points are selected according to the sensitivity and test scheme determined in Table 1. The test basis is as follows: GB/T 32826-2016 "photovoltaic power generation system modeling guide", GB/T 32892-2016 "photovoltaic power generation system model and parameter test regulation", and GB/T 34133-2017 "energy storage converter test technical regulation".
The test points of the microgrid in the example are shown in Figure 9. The test equipment connection points are shown in red. A total of four test points are used to test the voltage and current of the PV unit, wind turbines, energy storage unit as well as the grid-connection terminal respectively.

Parameter Identification Result
Using the method described in Section 2, the parameters of the microgrid demonstration system are identified, and the results are shown in Table 2.

Parameter Identification Result
Using the method described in Section 2, the parameters of the microgrid demonstration system are identified, and the results are shown in Table 2.

Validity Analysis of the Microgrid Model
The microgrid has two modes: Grid-connected mode and island mode. In the normal operation of the main power grid, the microgrid works in the grid-connected mode. If a fault occurs in the main power grid, the relay protection device of the power system acts, and the connection between the microgrid and the main power grid is disconnected. The microgrid enters the island operating state. During the microgrid grid-connection/island switching process, frequency and voltage fluctuations of the distribution network and the microgrid may occur.
In order to verify the accuracy of the overall model of the microgrid, the grid-connection/island switching tests and simulation analysis were carried out. The test data and the simulation data were compared to verify the validity of the parameter identification results. The test cases and test points are shown in Table 3. Table 3. Grid-connection/island switching test of the microgrid.

Test Cases Test Points
Control from grid-connected mode to island mode AC side of PV and energy storage unit; PCC Control from island mode to grid-connected mode AC side of PV and energy storage; PCC PCC refers to point of common coupling.
Case 1: Normally, the microgrid works in grid-connected mode, the power supplied by the PV unit is 20 kW, energy storage unit supplies 50 kW. Then, at t = 10 s, the microgrid is switched to island mode from grid-connected mode. The comparison of the simulation results and the test data are shown in Figure 10. The errors are shown in Table 4, the fulfillment of the results is obtained according to GB/T 32892-2016 "photovoltaic power generation system model and parameter test regulation". The data includes: The voltage, active power and reactive power at PCC, the active power supplied by the energy storage unit and the PV unit respectively.

Validity Analysis of the Microgrid Model
The microgrid has two modes: Grid-connected mode and island mode. In the normal operation of the main power grid, the microgrid works in the grid-connected mode. If a fault occurs in the main power grid, the relay protection device of the power system acts, and the connection between the microgrid and the main power grid is disconnected. The microgrid enters the island operating state. During the microgrid grid-connection/island switching process, frequency and voltage fluctuations of the distribution network and the microgrid may occur.
In order to verify the accuracy of the overall model of the microgrid, the grid-connection/island switching tests and simulation analysis were carried out. The test data and the simulation data were compared to verify the validity of the parameter identification results. The test cases and test points are shown in Table 3. Table 3. Grid-connection/island switching test of the microgrid.

Test Cases
Test Points Control from grid-connected mode to island mode AC side of PV and energy storage unit; PCC Control from island mode to grid-connected mode AC side of PV and energy storage; PCC PCC refers to point of common coupling.
Case 1: Normally, the microgrid works in grid-connected mode, the power supplied by the PV unit is 20 kW, energy storage unit supplies 50 kW. Then, at t = 10 s, the microgrid is switched to island mode from grid-connected mode. The comparison of the simulation results and the test data are shown in Figure 10. The errors are shown in Table 4, the fulfillment of the results is obtained according to GB/T 32892-2016 "photovoltaic power generation system model and parameter test regulation". The data includes: The voltage, active power and reactive power at PCC, the active power supplied by the energy storage unit and the PV unit respectively.   Case 2: Normally, the microgrid works in island mode, the frequency and voltage are controlled by the energy storage unit. The frequency is 50 Hz. The power supplied by the PV unit is 20 kW, and the load is 32 kW. Then, at t = 2.2 s, the microgrid is switched to grid-connected mode from island mode. The comparison of the simulation results and the test data are shown in Figure 11. The errors are shown in Table 5.  Case 2: Normally, the microgrid works in island mode, the frequency and voltage are controlled by the energy storage unit. The frequency is 50 Hz. The power supplied by the PV unit is 20 kW, and the load is 32 kW. Then, at t = 2.2 s, the microgrid is switched to grid-connected mode from island mode. The comparison of the simulation results and the test data are shown in Figure 11. The errors are shown in Table 5.

Summary
According to the simulation results, the frequency and voltage are within normal limits during the transient process of grid-connection/island switching. In addition, the simulation model meets the grid guide in terms of error indicators, which provides a reasonable model for the analysis of the overall operating characteristics of the microgrid, and thus help guarantee the stable operation of the microgrid and its practical application in China.

Conclusions
In view of the influence of manufacturers, models, and other factors on the accuracy of parameters in microgrid modeling, this paper proposes an accurate modeling method for microgrids, which provides a model basis for the analysis of the overall characteristics of a microgrid and may help popularize the application of microgrids. The conclusions obtained in this paper and issues that require further study include: (1) The key to accurate modeling of microgrids is that the actual data used for parameter identification are consistent with the actual system operating conditions. Based on the results of the parameter sensitivity analysis, the paper designed a data test scheme to ensure the validity of the data used in the parameter identification. (2) Taking the microgrid demonstration system in China as an example, the important parameters of the PV, wind turbine, and energy storage unit in the system were obtained, and the accuracy of the model was verified through the comparison of the simulation data and the test data during the grid-connection/island switching process. Therefore, it can be concluded that the modeling method proposed in this paper is effective. (3) The general model of renewable power generation units were adopted in the paper.
When studying the special control structure of the microgrid, the corresponding test scheme and algorithm need to be further improved. (4) In the microgrid control system, the current parameter identification focuses on the parameters in power and frequency control. Future studies should pay more attention to the increasing demand of low voltage ride through controls of the microgrid. (5) The workload of parameter identification based on test data is large. When the number of microgrids increases, the workload increases exponentially. It is necessary to develop specialized and commercial software to improve the efficiency of microgrid parameter identification and modeling.
Author Contributions: This paper was a collaborative effort between the authors. The authors contributed collectively to the collation and review of literatures.
Appendix A