## 4 Optimization of Multi-Scenario Parameters Based on PSO
### Multi-Scenario Variable Parameter Optimization  
The optimization parameters are implemented by the PSO method. When selecting the optimization parameters, the optimal parameter setting scheme for the annual operation can be obtained by evaluating the comprehensive optimization function. In the process of analyzing the actual demonstration system operating conditions, it was found that the requirements for operating strategies under different weather and load conditions are quite different. The use of uniform parameters throughout the year is not applicable to all scenarios, and may compromise the optimal setting scheme for the whole year. This paper proposes a scenario-based parameter design method. According to the photovoltaic power generation and load characteristics of rural communities in western China, we can summarize four operating scenarios as heating season sunny, heating season cloudy, non-heating season sunny, and non-heating season cloudy. Then, we are able to solve the optimal operating parameters in different scenarios. During the operation, different operating parameters are adopted according to the different scenarios. **Scene 1: Sunny day during the non-heating season**  
In the non-heating season, the power load is relatively small, and the maximum power of the load is about 55 kW. In sunny conditions, the photovoltaic power generation effect is good, and the maximum power exceeds 100 kW. The ESS is charged at noon when the photovoltaic effect is strong and discharged at night when the load is large. The charging rule is basically one charge and discharge cycle per day. Due to the large photovoltaic power generation, the maximum power of the PCC point power sent to the utility during the day is up to 50 kW, and the load power at night is close to 60 kW. Waveforms of Scene 1 is shown in Figure 8.  
The optimal individual fitness value is the lowest value of the comprehensive cost. The total number of iterations is 20. Because the power of photovoltaic power generation is high, its cost value is negative, which means that it can obtain online revenue through photovoltaic power generation. The total comprehensive income obtained in three days is about 232.8 yuan. The simulation waveform is shown in Figure 9.  
Figure 8: Waveforms of Scene 1: (**a**) PV and storage; (**b**) load and point of common connection (PCC). It can be seen from Figure 9 that the parameter optimization results are SOCpro = 36.5 and SOCmin = 36.4. This means that in the non-heating season, when the photovoltaic power generation is sufficient on sunny days, there is no need to consider the pre-charging of energy storage batteries in advance. Because there is a large amount of photovoltaic power generation on sunny days, the operating strategy will choose to recharge the ESS when photovoltaic power exceeds the load. Figure 10 shows the simulated waveforms of the SOC curve and the energy storage curve. The implementation effect of the energy storage control strategy is roughly charging during the day and discharging at night. During daytime the ESS can be fully charged, and discharged when the electricity price is high at night; on average, there is one charge and discharge cycle per day. **Scene 2: Cloudy day during the non-heating season**  
As can be seen in Figure 11, the light intensity is relatively small on cloudy days, and the photovoltaic power generation is low. The maximum power is only about 20 KW. The maximum load power is about 55 KW. Figure 10: SOC and storage waveforms of Scene 1. Figure 9: PSO curves of Scene 1: (**a**) comprehensive cost; (**b**) SOCpro and SOCmin. The power of the PCC points is all above 0, because the photovoltaic power is small and can be fully self-used, and there is no \"remaining power\" to sell. Because photovoltaic power generation is always small, it is occasionally necessary to take electricity from the utility to charge the ESS, so the power consumption at the PCC point is often greater than the load power, and the maximum value exceeds 100 kW.