## 4 Optimization of Multi-Scenario Parameters Based on PSO
### Multi-Scenario Variable Parameter Optimization
Figure 12 is the optimization curve of SOCpro and SOCmin. The optimization results are SOCpro = 100 and SOCmin = 30.2. The final comprehensive cost result was 1562 yuan. In the scenario where the photovoltaic power generation is very small on cloudy days, attention needs to be paid to charging the ESS in advance. If the ESS is not charged in advance, the photovoltaic power generation is small, so there is no excess electricity to charge the ESS, which will cause the ESS to stay at a low level for a long time and thereby affect the life of the batteries. At the same time, when the electricity price of the utility is high and power needs to be provided for the load, the ESS capacity is insignificant and cannot meet the requirements. Figure 13 shows the simulated waveforms of the ESS SOC and charge/discharge power. It can be seen that the ESS is charged during the period when the electricity price is low, and the ESS can be discharged during the two periods when the electricity price is high to provide support for the load electricity consumption. Figure 11: Waveforms of Scene 2: (**a**) PV and storage; (**b**) load and PCC. Figure 12: PSO curves of Scene 2: (**a**) comprehensive cost; (**b**) SOCpro and SOCmin. **Scene 3: sunny day during the heating season**  
In sunny days during the heating season, both the load electricity consumption and photovoltaic power generation are relatively large. The peak power value of photovoltaic power generation during the day reached more than 100 kW, and the peak value of load power consumption at night also reached more than 100 kW. As can be seen from the power curve of PCC in Figure 14, the span of the micro-grid and utility exchange power is relatively large (much power is generated at day and more is used at night). The maximum power consumption at night reached more than 100 kW, and photovoltaic power generation was sufficient during the day, so the power returned to the grid also reached nearly 50 kW. The total amount of power fluctuations is still relatively large. The large power difference between day and night is a characteristic of sunny days in the heating season. As can be seen in Figure 15, the optimization results of the parameter settings are SOCpro = 75.15 and SOCmin = 58.47. If only from the perspective of electricity cost, SOCpro and SOCmin should be set to 30. However, because the algorithm adds consideration of battery life loss, placing it at a lower SOC level has a certain impact on battery life loss. So, through optimization, we found a better solution in this scenario, namely, discharge the electricity when the electricity price is high and the load is heavy, and when the electricity price is relatively low at night, add a certain amount of power to the battery to reduce the influence of lower SOC level on the battery. Charging the battery to 75.15 with the lower electricity price of the grid can keep the battery at a better SOC level while leaving some margin to absorb the photovoltaic power generation the next day. In this way, the optimal result of the comprehensive evaluation cost, considering the loss of the energy storage battery and the power cost, can be obtained as 1459.5 yuan. Figure 14: Waveforms of Scene 3: (**a**) PV and storage; (**b**) load and PCC. Figure 13: SOC and storage waveforms of Scene 2. The SOC and ESS charge and discharge power waveforms are shown in Figure 16. The SOC of the ESS stays around 75 for a period, which is the consequence of charging part of the ESS at night. **Scene 4: cloudy day during the heating season**  
The demand for the heating season load is relatively large, the minimum value of the load is also above 50 kW, and the maximum value is close to 80 kW. At the same time, the weather is cloudy, photovoltaic power generation is relatively small, and the maximum power generation is only a little more than 30 kW. Waveforms of Scene 4 is shown in Figure 9.0 Large load demand and insufficient renewable energy supply is the characteristic of this scenario. Figure 18 shows the simulation curves of PSO optimization.