A Bi-Level Optimization and Scheduling Strategy for Charging Stations Considering Battery Degradation

: This paper proposes a bi-level optimization scheduling strategy for integrated photovoltaic (PV) and energy storage systems (ESS) to meet electric vehicle (EV) charging demands while reducing charging costs. First, a battery degradation cost model is developed in order to convert the long-term costs into short-term costs for real-time operation. The upper layer of ESS and power grid operation strategies are obtained by minimizing costs associated with battery degradation and distribution grid costs. The lower layer considers the PV uncertainty and the error caused by the upper layer operation strategy


Introduction
In recent years, the effect of fossil fuel consumption and climate change have received widespread attention.Consequently, renewable energy development and energy efficiency enhancement has gained global prominence [1,2].In the automotive industry, EVs have been recognized as having a crucial role in reducing carbon emissions as well as promoting the adoption of renewable energy sources [3,4].Sales of EVs increased 75% during the beginning of 2022 compared to the corresponding period in the previous year [5].However, with the widespread popularity of EVs and charging stations, although they can bring environmental benefits, the associated increase in charging demand will significantly add to the peak load of daily electricity consumption, presenting new safety and economic challenges to the power system.Inconsistent penetration rates may have various impacts on the operation of distribution systems, such as voltage distortion, supply-demand balance and line overload, among others [6][7][8].It is critical to address these issues by developing a reasonable charging station model and optimizing the charging and discharging strategies for EVs [9,10].
Directly connecting PV power generation to the grid can result in grid instability, due to its intermittency [11].Research indicates that the construction of a PV-storage charging station can enhance energy usage efficiency, reduce carbon emissions, and reduce the cost of power generation [12,13].Ref. [14] established a comprehensive benefit-cost analysis model for a PV-storage charging station, formulated an energy management strategy dependent on real-time electricity prices, and quantitatively evaluated the comprehensive benefits of the station.Ref. [15] proposed an integrated model for charging and swapping stations for EVs and presented a microgrid optimization and scheduling model that minimizes daily operational costs by considering user behavior characteristics.Ref. [16] established a model of a charging station that plans and schedules based on patterns of vehicle arrival with consideration of the intermittent PV power generation and the construction cost, operating cost, maintenance cost, and user satisfaction cost of the system.The above references mainly formulate charging and discharging strategies for ESS based on the economic efficiency of charging stations, while ignoring the impact of these strategies on the battery degradation.
Battery degradation [17] refers to the irreversible physical and chemical processes that occur inside an energy storage battery during charging and discharging cycles, leading to a sustained decrease in capacity.Implementing a reasonable battery schedule strategy can mitigate battery degradation, enhance battery life, and ultimately reduce the costs of ESS [18].Ref. [19] studied the aging principles and life prediction of batteries, established a battery degradation model, and conducted a quantitative analysis.Ref. [20] simulated the relationship between charging speed and energy storage and studied orderly charging to improve battery aging.The results showed that reasonable EV scheduling can delay battery aging.Ref. [21] combined distributed energy and grid energy considering the cost of battery degradation and the randomness of distributed energy, and optimized scheduling to minimize system operation costs, proving the effectiveness of the strategy.In fact, the life span of batteries is significantly linked to ESS operation strategies, and failing to consider ESS's charging and discharging strategies could seriously affect the battery's service life.
Currently, many researchers have conducted thorough exploratory research to address the problems associated with charging EVs.Heuristic algorithms have been shown to perform well in solving the problems associated with mixed-integer nonlinear programming [22,23].Ref. [24] proposed an improved multi-objective particle swarm optimization (MOPSO) algorithm and examined the effects of optimization objectives and control strategies on the controlled charging of EVs within distribution areas by taking the IEEE 33 bus system as a case study.The optimization outcomes demonstrated both the model and algorithm's effectiveness and feasibility.Ref. [25] established an EV charging load simulation model with demand response policies aimed at reducing power costs and pollution emissions.The study used the MOPSO algorithm to solve the optimization problems encountered in the model.Ref. [26] proposed an optimization model for a PV, ESS, EV charging station, with the aim of reducing power costs and used a multi-agent PSO algorithm to determine the configuration of its capacity and optimal energy management strategy.Although the above algorithms have improved the accuracy of solutions to varying degrees, they all have the drawback of having an excessive number of parameters and being prone to local optima.The SQP algorithm has robust local convergence and is commonly used to solve multi-objective mixed-integer nonlinear programming problems [27].
In summary, most of the existing research focuses on reducing economic operating costs while only a few studies have tackled the challenge of fully utilizing EVs and renewable energy.However, in these studies, the objective function is overly simplified.The main contribution of this paper, in comparison with prior research on economic scheduling methods for EV charging stations, can be summarized as follows: A bi-level optimized scheduling strategy for an integrated PV-ESS charging station considering battery degradation is proposed when considering the uncertainty of PV power generation.Long-term costs are converted into short-term costs related to real-time operations, which not only reduces power grid fluctuations but also improves the service life of ESS.The upper model minimizes the running cost of the charging station as the optimization goal, and the lower model eliminates power fluctuations caused by photovoltaic errors as the optimization goal, taking into account system constraints, and realizing the economic and stable operation of the charging station.Second, the paper proposes a global optimization algorithm that uses a blend of PSO and SQP to eliminate nonlinear optimization problems in the bi-level optimization model.Optimization scheduling, based on the obtained solutions, is subsequently implemented.The proposal's feasibility and effectiveness are assessed in simulations, evaluating the practicality of the proposed bi-level optimization scheduling strategy and algorithm.
This section presents a detailed analysis of the study conducted.Section 2 presents the framework of the PV-ESS charging station, the mathematical models for battery life, and cost degradation.Section 3 proposes a bi-level optimization scheduling model for PV-storage charging stations.In Section 4, a PSO-SQP hybrid optimization algorithm is proposed.Section 5 discusses the influence of optimization scheduling in different cases.Finally, Section 6 summarizes the main achievements of this research.

Framework of PV-ESS Charging Station
In recent years, the EV industry has made significant strides, particularly in constructing charging infrastructure, including distributed power sources, public charging stations, and ESS [28].Figure 1 illustrates the framework of an intelligent EV charging station, which uses a combination of PV, ESS, the power grid, and traditional charging station infrastructure.Firstly, when an EV is connected to the charging plug, the charging station will upload the relevant vehicle's information to the control center.Secondly, the control center will collect and utilize multiple sources of information to solve the optimization problem.Finally, the control center will carry out policy-based scheduling using the optimized solution and will operate the charging station, ESS, and the relay switches that are connected to the charging station to perform real-time scheduling.

Battery Life Degradation Model
Establishing a battery life decay model is helpful for accurately calculating the aging cost of batteries and analyzing their remaining lifespans [29].The empirical model of battery life decay describes the basic law of battery decay using a large amount of data, establishes the correspondence between battery capacity and other parameters, and has the advantages of simplicity, effectiveness, and strong adaptability, making it suitable for research on battery life prediction [30].As the depth of discharge (DOD) and the number of cycles are the main determining factors of ESS life, this paper considers their effects on battery life and establishes a battery life decay model and a degradation cost model.By optimizing the aging cost of batteries in the objective function, this study obtains the charging and discharging strategies of the ESS under different scheduling strategies and analyzes the degree of battery life decay for each strategy.
The cycle life of LiFePO4 batteries at different DODs is shown in Figure 2 [31].After fitting the relationship, between DOD and cycle-life N ctf using polynomial regression, the mathematical expression is shown in Equation (1).
Energies 2023, 16, x FOR PEER REVIEW 4 of 17 advantages of simplicity, effectiveness, and strong adaptability, making it suitable for research on battery life prediction [30].As the depth of discharge (DOD) and the number of cycles are the main determining factors of ESS life, this paper considers their effects on battery life and establishes a battery life decay model and a degradation cost model.By optimizing the aging cost of batteries in the objective function, this study obtains the charging and discharging strategies of the ESS under different scheduling strategies and analyzes the degree of battery life decay for each strategy.
The cycle life of LiFePO4 batteries at different DODs is shown in Figure 2 [31].After fitting the relationship, between DOD and cycle-life Nctf using polynomial regression, the mathematical expression is shown in Equation (1).
where λ1, λ2, λ3, and λ4 are fitted parameters.The model to calculate battery life degradation for the ESS is given as: 1 , where α is the state of health (SOH) loss rate of the battery in one dispatch perio; n is the equivalent charge-discharge cycle number during one scheduling period that is extracted by RCA [32]; the cycle life of the battery corresponding to the i-th cycle, represented by Nctf,i, is determined by fitting the relationship between the DOD and the number of cycles; R is the lifespan of the ESS, measured in years.

Battery Degradation Cost Model of ESS
The charging and discharging cycles presented in Figure 2 were conducted under constant DOD conditions.However, estimating the cost of battery degradation based on historical data during real-time operations is prone to errors.This paper makes the assumption that previous charging and discharging patterns have no bearing on how each charging and discharging cycle affects the battery's lifespan.The model for battery degradation cost used in this research represents the reduction of both the capacity and longevity of the battery [33].The model to calculate battery life degradation for the ESS is given as: where α is the state of health (SOH) loss rate of the battery in one dispatch perio; n is the equivalent charge-discharge cycle number during one scheduling period that is extracted by RCA [32]; the cycle life of the battery corresponding to the i-th cycle, represented by N ctf,i , is determined by fitting the relationship between the DOD and the number of cycles; R is the lifespan of the ESS, measured in years.

Battery Degradation Cost Model of ESS
The charging and discharging cycles presented in Figure 2 were conducted under constant DOD conditions.However, estimating the cost of battery degradation based on historical data during real-time operations is prone to errors.This paper makes the assumption that previous charging and discharging patterns have no bearing on how each charging and discharging cycle affects the battery's lifespan.The model for battery degradation cost used in this research represents the reduction of both the capacity and longevity of the battery [33].

Battery Degradation Cost Model of V2G
According to the flexible charging and discharging characteristics of vehicle-to-grid (V2G), V2G users sign charging and discharging agreements to obtain the charging and discharging scheduling rights of users to transfer the grid load and storage peaking pressure.The battery life degradation cost model under V2G is expressed as follows: where DOD EV (∆t) is the EV discharge depth at ∆t interval; P EV (t) is the EV charge and discharge power at moment t; C EV.R is the EV battery replacement cost; η EV.C , η EV.D are the EV charge and discharge efficiency; E EV.B (t) is the participating V2G program battery capacity at moment t; E EV.rated is the EV battery-rated capacity.

Bi-Level Optimal Scheduling Model
The paper proposes a bi-level optimization model that is illustrated in Figure 3.The optimization scope lengths for the upper and lower levels are represented by T u and T l , respectively.The upper-level model formulates a mixed-integer nonlinear optimization model with a time interval of ∆t u = 1 h.It aims to minimize the operational cost of the charging station by considering various factors such as predicted PV and load power, battery degradation cost, and distribution network cost.The optimization scheduling is executed hourly, with a scheduling period of 24 h.The optimal control variables, {P ESS (t u ) and P Grid (t u ) } T u t u =1 , are calculated and transmitted to the lower-level model.The lower-level model adopts a quadratic optimization model with a time interval of ∆t l = 15 min and a scheduling period of 1 h and aims to minimize the fluctuations of the grid's power caused by the PV power error.The input vector {P PV (t l ), P ESS (t l ), P Grid (t l ) } T l t l =1 is utilized to correct the PV power error by using V2G technology while keeping the original scheduling plan unchanged.The updated data are then fed back to the upper-level model to minimize the grid's power fluctuations.

Upper-Level Optimization Scheduling Model
The upper-level goal is to minimize the overall operating cost of the charging station by optimizing the decision variable P ESS (t u ), P Grid (t u ) t u=1 T u .The specific objective function can be expressed as where C ESS (t u ) represents battery degradation cost at moment t u ; P Grid (t u ) represents the power flow from the distribution grid to the charging station when positive or from the charging station to the distribution grid when negative at moment t u ; T p (t u ) is the electricity price at t u .

Lower-Level Optimization Scheduling Model
The lower-level scheduling scheme integrates the optimization outcomes from the upper-level model and considers decision variables P PV (t l ), P ESS (t l ), P Grid (t l ) t l =1 T l to reduce the impact of uncertainties caused by PV energy generation.The objective function of the lower-level optimization can be expressed as where

Upper-Level Optimization Scheduling Model
The upper-level goal is to minimize the overall operating cost of the charging station by optimizing the decision variable {P ESS (t u ), P Grid (t u ) } T u t u =1 .The specific objective function can be expressed as where C ESS (t u ) represents battery degradation cost at moment t u ; P Grid (t u ) represents the power flow from the distribution grid to the charging station when positive or from the charging station to the distribution grid when negative at moment t u ; T p (t u ) is the electricity price at t u .

Lower-Level Optimization Scheduling Model
The lower-level scheduling scheme integrates the optimization outcomes from the upper-level model and considers decision variables {P PV (t l ), P ESS (t l ), P Grid (t l ) } T l t l =1 to reduce the impact of uncertainties caused by PV energy generation.The objective function of the lower-level optimization can be expressed as where σ ESS , σ G , σ EV are the weight coefficients of the ESS cost, distribution network cost and V2G cost, respectively.The penalty cost function is expressed in terms of C ESS , C Grid which correspond to a deviation from the variables that are provided in the upper level.These are then incorporated into the objective function.The penalty cost function is formulated as where P upper ESS (t u ), P upper Grid (t u ) are the transmission power in the upper level of the ESS and the distribution grid.P lower ESS (t l ), P lower Grid (t l ) are the transmission power in the lower level of the ESS and the distribution grid, respectively.

Constraints
To meet the economic and safety requirements of the power grid side, as well as the needs of users for EV charging, it is essential to consider multiple constraints simultaneously as the following: where P max EV.C and P max EV.D are the maximum charge and discharge power of EV respectively; SOC EV (t) is the remaining EV battery capacity at moment t; SOC exp is the expected SOC declared by EV users.

Bi-Level Optimal Scheduling Strategy
The pseudo-code for the scheduling process of the proposed strategy in the paper is shown in Algorithm 1, and the specific steps are as follows: (i) Collect relevant information for EV charging and upload information about PV power generation, ESS, and distribution grid electricity prices at the station.
(ii) Solve the upper-level optimization model by utilizing the algorithm mentioned in this paper to determine the optimal values of the upper-level decision variables.
(iii) Apply the optimized upper-level values as a reference for the lower level, consider the PV power generation error, and obtain the optimized values of the lower-level decision variables, then perform scheduling at each time step in the lower level.
(iv) Check if it is time for scheduling.If not, the status values of each component after scheduling are returned to the upper-level data.
(v) The scheduling process is completed.

PSO-SQP Hybrid Optimization Algorithm
This paper combines heuristic algorithms with linear programming knowledge to solve the issue of nonlinear terms in the bi-level model.Traditional PSO algorithms have the advantages of fast global search speed, high efficiency, and simplicity, but they often get trapped in local optima for non-convex models.The SQP algorithm with its powerful boundary search capability is often used to solve nonlinear programming problems, but its performance often depends on the initial values chosen.Hence, this paper uses the PSO algorithm's global search capabilities and the SQP algorithm's powerful boundary search capabilities to formulate a PSO-SQP algorithm for solving the proposed model.

PSO Algorithm
Drs. Eberhart and Kennedy's design of a intelligence algorithm that drew inspiration from bird hunting behavior gave rise to the PSO algorithm.It is utilized in diverse research fields to solve a wide range of optimization problems.PSO designates the population as a swarm, with each particle representing a potential solution to the optimization problem at hand.To arrive at the ideal solution, the particles move around the solution space, and all of the particles' interactions with one another affect their movements.Each particle's velocity and position vectors are updated via Formulas ( 21) and ( 22), respectively.
where ω is the weight coefficient, c 1 , and c 2 are acceleration coefficients; r 1 , r 2 are random numbers distributed in an interval of [0, 1]; pb t i and gb t i denote the individual optimal solution and the whole population optimal solution at the t-th iteration, respectively.[34] first proposed the SQP algorithm, which is very effective in addressing nonlinear optimization issues.It is essential to use an appropriate method for choosing the initial point location when using the algorithm because it has a significant impact on the accuracy and computational efficiency of the SQP approach.The fundamental principle underlying the SQP algorithm is to decompose the original nonlinear optimization problem into a sequence of sub-problems.Each of these sub-problems optimizes the quadratic programming for the target function to linearize the constraints.The solution to each problem can then be obtained using a sequential approach.

R.B. Wilson
where ∇ f (X k ) and ∇g (X k ) are the gradients of the objective function; constraints at X k , d T is the T-th iteration descent direction matrix; H k is the Hessian matrix of the Lagrangian function variables for the k-th iteration.

PSO-SQP Hybrid Optimization Algorithm Flow
The proposed model in this paper employs the PSO-SQP hybrid algorithm for optimization.The PSO-SQP algorithm initially entails using the PSO algorithm for iterative optimization.When the optimal solution changes less than a specified value, the present final solution may be utilized as the SQP algorithm's initial value to compensate for its lacking global search ability.The initial value is then input into the SQP algorithm to perform a fine-grained search on the original optimization problem.This compensates for the weakness of PSO's local search.The results are then re-entered into the PSO algorithm and the global optimal parameter values of the optimization problem are continuously sought through iterative computation.The specific flowchart displaying the steps of this algorithm is shown in Figure 4. Substituting X as the initial value into SQP obtains f(X SQP ) and its variable X SQP Substitute X SQP into the PSO algorithm to calculate the result f(X') The input value is calculated with PSO to obtain the optimal value f(X) and its variable

Algorithm Parameter Setting
A simulation analysis was conducted on a particular distribution network in the area to validate the practicality and effectiveness of the proposed strategy.The PSO-SQP algorithm is used to solve the proposed model for an orderly charging and discharging schedule.Table 1 displays the parameters of the optimization model [34], whereas Table 2 presents the electricity price data that were chosen from the general industrial and commercial time-of-use electricity prices in the Hangzhou region.The predicted PV power and error range is shown in Figure 5. Step 1. Initialize the algorithm parameters.
Step 2. The PSO algorithm is utilized to optimize the objective function based on the initial parameters.If the difference between the best solutions in two consecutive iterations is smaller than a specific value, it is considered that PSO has reached a local optimum.Then, the current optimal value f (X) and its variables X = [P ESS (t), P EV (t), P Grid (t) ] are obtained.
Step 3. Use X as the initial value for the SQP algorithm, the optimal value f (X SQP ) and the optimized variable X SQP = [P ESS t), P EV t), P Grid (t) ] are obtained through calculation.
Step 4. The optimized variable X SQP obtained from the SQP algorithm is passed back into the PSO algorithm to calculate the optimal value f (X ).
Step 5. Compare the optimized final values obtained from both algorithms, f (X) and f (X ), and choose the minimum value as the optimal solution.
Step 6.If the stopping condition is satisfied, output the optimal solution and terminate the program.Otherwise, update the current particle velocity and position, and return to step 2.

Algorithm Parameter Setting
A simulation analysis was conducted on a particular distribution network in the area to validate the practicality and effectiveness of the proposed strategy.The PSO-SQP algorithm is used to solve the proposed model for an orderly charging and discharging schedule.Table 1 displays the parameters of the optimization model [34], whereas Table 2 presents the electricity price data that were chosen from the general industrial and commercial time-of-use electricity prices in the Hangzhou region.The predicted PV power and error range is shown in Figure 5.

Analysis of Simulation Results
To validate the practicality of the proposed strategy, several application scenarios were established.These included scenarios with errors between forecasted and actual PV output, varying penetration rates of EVs, the application of V2G technology, and scenarios

Analysis of Simulation Results
To validate the practicality of the proposed strategy, several application scenarios were established.These included scenarios with errors between forecasted and actual PV output, varying penetration rates of EVs, the application of V2G technology, and scenarios showcasing battery degradation.The validity of the algorithm was demonstrated through a comparative analysis of these scenarios.
Case 1: There is a 5% error between the predicted and actual PV output.The charging station is furnished with PV, ESS, and EVs for V2G operations, with 40 EVs charging daily.
Cases 2-4: From Case 2 to Case 4, the error between the predicted and actual PV output is increased by 10% in order from the previous one, and all other configurations are the same in Case 1.
Cases 5-7: From Case 5 to Case 7, the number of EVs participating in charging increases by 10 over the former in that order, and all other configurations are the same as in Case 1.
Case 8: EVs do not participate in V2G operations, with all other configurations identical to Case 1.
Case 9: With all other configurations being identical to Case 1, the degradation of battery has no impact on economic dispatch.
The battery degradation cost, V2G cost, distribution network cost, total cost, and ESS lifetime in different cases in each dispatch cycle are shown in Figure 6.showcasing battery degradation.The validity of the algorithm was demonstrated through a comparative analysis of these scenarios.Case 1: There is a 5% error between the predicted and actual PV output.The charging station is furnished with PV, ESS, and EVs for V2G operations, with 40 EVs charging daily.
Cases 2-4: From Case 2 to Case 4, the error between the predicted and actual PV output is increased by 10% in order from the previous one, and all other configurations are the same as in Case 1.
Cases 5-7: From Case 5 to Case 7, the number of EVs participating in charging increases by 10 over the former in that order, and all other configurations are the same as in Case 1.
Case 8: EVs do not participate in V2G operations, with all other configurations identical to Case 1.
Case 9: With all other configurations being identical to Case 1, the degradation of battery has no impact on economic dispatch.
The battery degradation cost, V2G cost, distribution network cost, total cost, and ESS lifetime in different cases in each dispatch cycle are shown in Figure 6.In Figure 6, Cases 1 to 4 indicate that the greater the deviation between the predicted and actual PV output, the higher the costs incurred by the PV-storage charging station, and the shorter the ESS's lifetime caused by increased output deviation.
This study proposes a lower-level optimization model aimed at mitigating the impacts of PV error.The optimization results obtained from four different prediction error cases are verified and analyzed, as demonstrated in Figure 7a.To mitigate fluctuations caused by PV errors, the ESS discharges between 7:00-11:00, charging again between 12:00-18:00 to ensure sufficient power release during peak electricity consumption and reduce operational pressure on the regional load.As prediction error increases, the ESS needs to expend a significant amount of energy to smooth out the power fluctuations caused by PV errors, leading to a rapid change in SOC.During the peak electricity consumption period from 19:00 to 22:00, the ESS mainly discharges to reduce power consumption costs.From 23:00 to the next day at 6:00, when the PV power output is zero, the dispatching strategy charges the ESS to the required level during the low electricity price period.In Figure 6, Cases 1 to 4 indicate that the greater the deviation between the predicted and actual PV output, the higher the costs incurred by the PV-storage charging station, and the shorter the ESS's lifetime caused by increased output deviation.
This study proposes a lower-level optimization model aimed at mitigating the impacts of PV error.The optimization results obtained from four different prediction error cases are verified and analyzed, as demonstrated in Figure 7a.To mitigate fluctuations caused by PV errors, the ESS discharges between 7:00-11:00, charging again between 12:00-18:00 to ensure sufficient power release during peak electricity consumption and reduce operational pressure on the regional load.As prediction error increases, the ESS needs to expend a significant amount of energy to smooth out the power fluctuations caused by PV errors, leading to a rapid change in SOC.During the peak electricity consumption period from 19:00 to 22:00, the ESS mainly discharges to reduce power consumption costs.From 23:00 to the next day at 6:00, when the PV power output is zero, the dispatching strategy charges the ESS to the required level during the low electricity price period.
charges first to meet the load demand.From 13:00 to 18:00, PV and the distribution net work supply power to the ESS to ensure that there is sufficient power release during the peak electricity consumption period, thus reducing the peak-valley difference.Other times, when the PV input is zero, electricity procurement costs from the grid, as well as the degradation costs of charging and discharging batteries in the ESS, are considered Therefore, during these times, the primary source of power supply will be purchased from the grid to guarantee the electricity demand of the charging station.To verify and analyze the effect of EV charging station load penetration on schedul ing, this study simulated the cases of 40, 30, 20, and 10 EVs charging at the station, corre sponding to Case 1 and Cases 5-7 in Figure 6.As shown in Figure 8a, the DOD and the number of charge and discharge cycles of the ESS decrease as the EV penetration rate increases.This study's scheduling strategy prioritizes using the distribution network to supply power to loads when the PV and storage output is insufficient to meet the EV charging demand, based on real-time electricity prices.This approach reduces the number of charge and discharge cycles required for the ESS.This indicates that the proposed scheduling strategy can significantly reduce the DOD or the number of cycles of the ESS and the scheduling effect becomes more significant as the EV penetration rate increases Figure 8b displays that as EV penetration increases, they are predominantly focused on utilizing V2G technology during the peak electricity pricing from 19:00 to 21:00 for eco nomic benefits.As shown in Figure 7b, as the prediction error increases, the power supply fluctuation of the distribution network from 8:00 to 12:00 is not significant because the ESS discharges first to meet the load demand.From 13:00 to 18:00, PV and the distribution network supply power to the ESS to ensure that there is sufficient power release during the peak electricity consumption period, thus reducing the peak-valley difference.Other times, when the PV input is zero, electricity procurement costs from the grid, as well as the degradation costs of charging and discharging batteries in the ESS, are considered.Therefore, during these times, the primary source of power supply will be purchased from the grid to guarantee the electricity demand of the charging station.
To verify and analyze the effect of EV charging station load penetration on scheduling, this study simulated the cases of 40, 30, 20, and 10 EVs charging at the station, corresponding to Case 1 and Cases 5-7 in Figure 6.As shown in Figure 8a, the DOD and the number of charge and discharge cycles of the ESS decrease as the EV penetration rate increases.This study's scheduling strategy prioritizes using the distribution network to supply power to loads when the PV and storage output is insufficient to meet the EV charging demand, based on real-time electricity prices.This approach reduces the number of charge and discharge cycles required for the ESS.This indicates that the proposed scheduling strategy can significantly reduce the DOD or the number of cycles of the ESS, and the scheduling effect becomes more significant as the EV penetration rate increases.Figure 8b displays that as EV penetration increases, they are predominantly focused on utilizing V2G technology during the peak electricity pricing from 19:00 to 21:00 for economic benefits.This paper compares Case 1, Case 8, and Figure 9a in Figure 6 and shows that the V2G participation in the economic dispatch of smart charging stations occurs during periods of high electricity prices.This reduces the required cost of the distribution network and alleviates the peak shaving pressure of the ESS.Similarly, the comparison of Case 1, Case 9, and Figure 9b in Figure 6 illustrates that the ESS suppresses excessive charge and This paper compares Case 1, Case 8, and Figure 9a in Figure 6 and shows that the V2G participation in the economic dispatch of smart charging stations occurs during periods of high electricity prices.This reduces the required cost of the distribution network and alleviates the peak shaving pressure of the ESS.Similarly, the comparison of Case 1, Case 9, and Figure 9b in Figure 6 illustrates that the ESS suppresses excessive charge and discharge based on dispatch requirements that consider battery degradation, reducing the depth and frequency of cycles.The economic dispatch that takes battery degradation into account can extend the service life of the ESS by 630 days.This paper compares Case 1, Case 8, and Figure 9a in Figure 6 and shows that t V2G participation in the economic dispatch of smart charging stations occurs during p riods of high electricity prices.This reduces the required cost of the distribution netwo and alleviates the peak shaving pressure of the ESS.Similarly, the comparison of Case Case 9, and Figure 9b in Figure 6 illustrates that the ESS suppresses excessive charge a discharge based on dispatch requirements that consider battery degradation, reducing t depth and frequency of cycles.The economic dispatch that takes battery degradation in account can extend the service life of the ESS by 630 days.

Algorithm Effect Comparison
This study's objective was to evaluate the effectiveness of the proposed PSO-SQP gorithm in solving the bi-level economic dispatch model by comparing it with the PS MOPSO, and SPSO algorithms in Case 1. Table 3 demonstrates that the PSO-SQP alg rithm's outcomes outperform those of the other three algorithms and provide relative optimal solutions.This verifies the superiority of the proposed PSO-SQP hybrid algorith in solving the bi-level economic dispatch problem.

Algorithm Effect Comparison
This study's objective was to evaluate the effectiveness of the proposed PSO-SQP algorithm in solving the bi-level economic dispatch model by comparing it with the PSO, MOPSO, and SPSO algorithms in Case 1. Table 3 demonstrates that the PSO-SQP algorithm's outcomes outperform those of the other three algorithms and provide relatively optimal solutions.This verifies the superiority of the proposed PSO-SQP hybrid algorithm in solving the bi-level economic dispatch problem.

Conclusions
This study proposes a bi-level optimization model for an intelligent charging station integrating the PV system, ESS, and the distribution network.The proposed model is solved utilizing the PSO-SQP hybrid algorithm, and the specific methodology entails the following steps: (i) The upper level of the proposed model formulates the scheduling strategy based on the input PV and load data to minimize the system's comprehensive cost, while the lowerlevel signs a V2G agreement with the user based on the upper level's output strategy and actual PV data to eliminate the grid fluctuations caused by PV errors, achieving economic and stable operation of the charging station.
(ii) This research proposes two models for the degradation cost and lifetime attenuation of the ESS, respectively.By optimizing the ESS's operation strategy by minimizing the

Figure 1 .
Figure 1.The framework of PV-ESS charging station.

Figure 2 .
Figure 2. The relationship between cycle-life and DOD.

Figure 2 .
Figure 2. The relationship between cycle-life and DOD.
X)-f n (X)≤ Ɛ Determine whether the PSO algorithm has obtained a local optimal value

Figure 4 .
Figure 4. Flow chart of algorithm solution.

Figure 4 .
Figure 4. Flow chart of algorithm solution.

Figure 5 .
Figure 5.The predicted PV power and errors range.

Figure 5 .
Figure 5.The predicted PV power and errors range.

Figure 6 .
Figure 6.Various costs and ESS lifetimes in different Cases.

Figure 6 .
Figure 6.Various costs and ESS lifetimes in different Cases.

Figure 7 .
Figure 7. Results of operation with different PV errors.(a) SOC curves with different errors; (b power curve of distribution network under different errors.

Figure 7 .
Figure 7. Results of operation with different PV errors.(a) SOC curves with different errors; (b) power curve of distribution network under different errors.

Figure 8 .
Figure 8. Results of operation with different numbers of EVs.(a) SOC curves for different numbers of EVs; (b) power curve of distribution network with different numbers of EVs.

Figure 8 .
Figure 8. Results of operation with different numbers of EVs.(a) SOC curves for different numbers of EVs; (b) power curve of distribution network with different numbers of EVs.

Figure 8 .
Figure 8. Results of operation with different numbers of EVs.(a) SOC curves for different numb of EVs; (b) power curve of distribution network with different numbers of EVs.

Figure 9 .
Figure 9. Results of SOC curve for different scenarios.(a) Change in SOC curve with and witho V2G involvement;(b) SOC curve changing with and without considering battery degradation.

Figure 9 .
Figure 9. Results of SOC curve for different scenarios.(a) Change in SOC curve with and without V2G involvement;(b) SOC curve changing with and without considering battery degradation.
DOD ESS (∆t) is the ESS discharge depth at ∆t interval; P ESS (t) is the ESS charge and discharge power at moment t; N ctf (∆t) is the storage cycle life of the DOD ESS (∆t); C ESS.R is the ESS replacement cost; η ESS.C , η ESS.D are the ESS charge and discharge efficiency; E B (t) is the battery capacity at moment t; E B.rated is the battery-rated capacity.
Grid ' which correspond to a deviation from the variables that are provided in the upper level.These are then incorporated into the objective function.The penalty cost function is formulated as σ ESS , σ G , σ EV are the weight coefficients of the ESS cost, distribution network cost and V2G cost, respectively.The penalty cost function is expressed in terms of C ESS ' ,C Energy balance constraint of the system P EV (t)η EV + P ESS (t)η ESS = P PV (t) + P Grid (t) are the maximum charge and discharge power of the ESS; SOC ESS (t) is the remaining battery capacity of the ESS at moment t; DOD max is the maxi- mum discharge of depth.(iii) EV charging and discharging constraints P max EV.D η EV.D ≤ P EV.D ≤ 0 ≤ P EV.C ≤ P max EV.C η EV.
C (18) SOC EV (t + 1) = SOC EV (t) + P EV.C (t)η EV.C ∆t E EV.B (t) − P EV.D (t)∆t η EV.D E EV.B (t)(19) P EV (t u ), P PV (t u ), SOC ESS (t u ), SOC EV (t u ), T p (t u ) Objective function: f 1 in upper-level Output: {P ESS (t u ), P Grid (t u )} → lower-level as set points for t l = 1 to T l , do Input: P ESS (t u ), P Grid (t u ), P PV (t l ), SOC ESS (t l ), SOC EV (t l ) Objective function: f 2 in lower-level Output: {P ESS (t l ), P EV (t l ), P Grid (t l )} t u +t l → upper-level as set points end for

Table 1 .
Parameters of the optimization model.

Table 1 .
Parameters of the optimization model.

Table 3 .
Comparison of solution results of different algorithms.