### System Configuration Optimization
#### 2.3.2 Configuration Optimization Objective Function  
The planning layer aims to minimize the total annual cost of the system's lifecycle, which includes the initial investment cost \(C_{\text{inv}}\), annual operating cost \(C_{\text{ope}}\), and annual maintenance cost throughout the entire lifecycle \(C_{\text{mai}}\). \(C_{\text{inv}}\) entails the purchase cost \(C_{\text{buy}}\)  
Figure 9: The solution process and information exchange of the planning and operating dual-layer model. installation cost \(C_{\text{ins}}\), construction cost \(C_{\text{con}}\), and other expenses related to photovoltaic and energy storage equipment \(C_{\text{oth}}\). \(C_{\text{ope}}\) consists of the annual operating cost of photovoltaic power generation \(C_{\text{ope,pv}}\) and the annual operating cost of system energy storage charging and discharging \(C_{\text{ope,b}}\). After solving the operating layer model, the results return to the planning layer model. The objective function of the planning layer \(F\) can be expressed as:  
\[F=\min C_{\text{total}}=\min\bigl{(}C_{\text{inv}}+C_{\text{ope}}+C_{\text{mai }}\bigr{)} \tag{1}\]  
\[C_{\text{inv}}=C_{\text{buy}}+C_{\text{ins}}+C_{\text{con}}+C_{\text{oth}}=E_{ \text{pv}}c_{\text{pv}}\alpha_{k}+E_{\text{e}}c_{\text{e}}\alpha_{k} \tag{2}\]  
\[\alpha_{k}=\frac{r(1+r)^{\epsilon_{k}}}{(1+r)^{\epsilon_{k}}-1} \tag{3}\]  
\[C_{\text{ope}}=C_{\text{ope,pv}}+C_{\text{ope,b}}+C_{\text{dr}}=P_{\text{pv}} \beta_{\text{pv}}+P_{\text{b}}\beta_{\text{e}}+(P_{\text{dr}}-P_{\text{dr}0}) \beta_{\text{dr}} \tag{4}\]  
\[C_{\text{mail}}=\delta C_{\text{inv}} \tag{5}\]  
where \(C_{\text{total}}\) is the equivalent annual cost of the entire lifecycle of the system (CNY); \(E_{\text{pv}}\), \(E_{\text{e}}\) represents the capacity of photovoltaic and energy storage configuration (kW); \(c_{\text{pv}}\), \(c_{\text{e}}\) indicates cost per unit capacity (purchase cost, installation cost, construction cost, and other expenses) for photovoltaic and energy storage (CNY/kW); \(k\) with the device in the system represents photovoltaic or energy storage; \(\alpha_{k}\) represents the annual conversion factor for the total lifecycle cost; \(r\) denotes the discount rate; \(\epsilon\) indicates work years for the equipment (year); \(P_{\text{pv}}\) denotes the photovoltaic power generation (kW); \(P_{\text{b}}\) indicates the energy storage charging and discharging power (kW); \(P_{\text{dr}0}\), \(P_{\text{dr}}\) are, respectively, the load demand before and after demand response (kW); \(\beta_{\text{pv}}\) is the operating cost per unit power of photovoltaic (CNY/kW); \(\beta_{\text{e}}\) is the operating cost per unit power of energy storage (CNY/kW); \(\beta_{\text{dr}}\) indicates the unit power demand response cost (CNY/kW); \(\delta\) is the annual conversion coefficient for the entire lifecycle cost. The operating layer aims for economic efficiency by minimizing electricity costs, reducing carbon emissions, and optimizing reliability with low interaction power. To address the varying dimensions of multiple objectives, this work normalizes the objective functions and applies a weighted optimization method. The economic objective function \(f_{1}\) expression is:  
\[f_{1}=\min\frac{\sum\limits_{t=1}^{T}P_{\text{grid\_buy}}(t)c_{\text{buy}}(t )}{\sum\limits_{t=1}^{T}P_{\text{load}}(t)c_{\text{buy},t}(t)} \tag{6}\]  
where \(P_{\text{grid\_buy}}(t)\) is the power purchased by the system from the power grid at time \(t\) (kW); \(P_{\text{load}}(t)\) represents the system load power at time \(t\) (kW); \(c_{\text{buy}}(t)\) represents the electricity price purchased by the system from the grid at time \(t\) (CNY/kW); \(T\) denotes the calculation cycle.