Medium- and Long-Term Trading Strategies for Large Electricity Retailers in China’s Electricity Market

: In the rapid promotion of China’s electricity spot market, a large number of electricity retailers and large consumers participate in power trading, of which medium- and long-term power trading accounts for a large proportion. In the electricity spot market, the previous medium- and long-term transactions need to be closely combined with the current spot market transaction settlement rules. This paper analyzes the trading strategy of large retailers in the power market. In order to effectively reduce the total electricity cost, it is necessary to optimize the medium- and long-term transactions based on three aspects: electricity quantity and benchmark price decisions of medium-and long-term contracts, the daily electricity decomposition method in the day-ahead (DA) market, and the daily load curve decomposition strategy. According to load history characteristics that are extracted by the X12 method, daily electricity is decomposed from the medium- and long-term electricity quantity in the DA market. This paper introduces three methods of decomposing the daily load curve and proves that the particle swarm algorithm is the best method for effectively minimizing the cost in the DA market. Through analyzing the total electricity cost change pattern, we prove that the basic component of decision making is the relative relationship between the electricity price of medium- and long-term contracts and the equivalent kWh price of medium- and long-term electricity in the DA market, which is determined by the decomposition daily curve method. If the equivalent kilowatt-hour price obtained by the decomposition method in the DA market is greater than the electricity price of medium- and long-term contracts, the larger the electrical energy of medium- and long-term contracts, the lower the costs. Based on the above principles, electricity retailers can carry out planning for medium- and long-term transactions, as well as the decomposition and declaration of the daily electricity quantities and daily load curves.


Introduction
Under the guidance of low-carbon, environmentally friendly, energy-saving, and emission-reduction policies, China has widely promoted electric vehicles. Additionally, the urban public transport system has also proposed the development of electric buses. In the last two years, the number of electric buses in Beijing has increased quickly. In order to cooperate with electric buses' operations, a large number of dedicated bus charging stations have been built [1]. As an electricity consumer, the charging station operator (CSO) is responsible for operating the bus charging stations. At present, CSOs have to settle the extremely high electricity bills according to the peak-to-valley electricity price of industrial and commercial energy consumers. Since the State Council of China issued "(Several Opinions on Step Deepening Electricity System Reform (2015) No. 9)" in 2015, China's Section 2 describes the operating costs and load characteristics of the Beijing CSO. Section 3 introduces the development of China's power market and the trading and settlement rules of China's current power market. Section 4 analyzes the main factors that affect the electricity costs in the MALT market based on transaction rules. Based on historical data, Section 5 obtains a typical daily load curve, which is a declaration load curve in the dayahead (DA) market and an important factor of the decomposition daily load curve. Section 6 obtains the characteristics of the daily electricity distribution through X12 and proposes a daily energy decomposition method of MALT electricity. Section 7 introduces the particle swarm optimization algorithm of the decomposition method of the daily load curve. In section 8, we provide a case study based on the Beijing CSO and analyze different impact factors on electricity costs. Section 9 summarizes the research conclusions.

Research Background of Electric Bus Charging Stations in Beijing
Charging station operators have to settle their electricity fee in accordance with the local urban price policy. Beijing's industrial and commercial energy consumers are subject to local peak-to-valley electricity prices, the tariff curve of which is shown in Figure 1. The annual electricity consumption and electricity costs of Beijing CSO are shown in Table 1. It can be seen that electricity costs are extremely high.   Figure 2 shows the monthly electric energy consumption data since 2019. It can be seen that the energy consumption in 2019 increased rapidly, and the energy consumption at the end of the year was much greater than that at the beginning of the year. Due to COVID-19, the energy consumption at the beginning of 2020 decreased significantly compared with that at the end of 2019 and returned to normal after May 2020. Considering the rapid growth in the number of charging stations, this number increased from 82 at the ¥/kWh   Figure 2 shows the monthly electric energy consumption data since 2019. It can be seen that the energy consumption in 2019 increased rapidly, and the energy consumption at the end of the year was much greater than that at the beginning of the year. Due to COVID-19, the energy consumption at the beginning of 2020 decreased significantly compared with that at the end of 2019 and returned to normal after May 2020. Considering the rapid growth in the number of charging stations, this number increased from 82 at the beginning of 2019 to 165 in 2021. The total electric bus load was relatively stable, excluding the influential factor of charging station growth. Load fluctuations were mainly affected by seasonal temperature factors. Heating energy consumption was the highest in winter. The load fluctuation trend is shown in Figure 3. It is expected that the annual power of 2021 will be much larger than the data of 2019 and 2020, so the pressure to reduce the electricity costs is extremely high.
beginning of 2019 to 165 in 2021. The total electric bus load was relatively stable, excluding the influential factor of charging station growth. Load fluctuations were mainly affected by seasonal temperature factors. Heating energy consumption was the highest in winter. The load fluctuation trend is shown in Figure 3. It is expected that the annual power of 2021 will be much larger than the data of 2019 and 2020, so the pressure to reduce the electricity costs is extremely high.  beginning of 2019 to 165 in 2021. The total electric bus load was relatively stable, excluding the influential factor of charging station growth. Load fluctuations were mainly affected by seasonal temperature factors. Heating energy consumption was the highest in winter. The load fluctuation trend is shown in Figure 3. It is expected that the annual power of 2021 will be much larger than the data of 2019 and 2020, so the pressure to reduce the electricity costs is extremely high.  Based on the demand of Beijing charging station operators and combined with electricity market transactions policy in China, this paper's research into optimization trading strategies aims to reduce its electricity costs.

Development of China's Electricity Market
In 2015, the Chinese government issued a policy document that requires qualifying regions to gradually establish a market-oriented power and electricity balance mechanism dominated by MALT transactions and supplemented by spot transactions. At this time, the key to China's electricity market implementation was standardizing the MALT electricity transactions. At the beginning of 2017, China's government clarified the trading rules for MALT markets. In 2019, some pilot areas represented by Guangdong Province carried out a short-term spot market trial operation. In November 2021, the sixth spot market trial operation in Guangdong was carried out for two months. According to the notice issued by China's government, in principle, the first batch of pilot areas will carry out long-term continuous trial operation of the spot market in 2022. Additionally, all electricity users participating in MALT transactions should participate in spot transactions.
Different time scales in MALT transactions include annual and above transactions, monthly transactions, and intra-month transactions. The transaction organization mode can be classified as bilateral negotiation, centralized bidding, and listing [3]. The transaction content includes contract electricity, contract electricity price, the decomposition of electricity in the day-ahead market, etc. Spot market transactions include three parts: the DA market, the real-time (RT) market, and deviation assessment.
Due to the long time period of MALT transactions, there is a huge deviation between the transaction electricity and RT power consumption. The original deviation assessment of MALT transactions cannot constrain the actual power supply and demand balance [6]. By introducing spot market transactions, the allocation optimization of power resources can ensure the real-time balance of power and trade fairness.

China's Former Electricity Market Trading Regulations
In the MALT transactions, the electricity retailers need to complete the annual MALT transaction decision and decompose the annual contract electric quantity into months, as shown in strategy 1 and strategy 2 in Figure 4. In the monthly transactions, the electricity retailers purchase electricity to supplement the insufficient part of the monthly decomposition electricity. The deviation assessment penalty shall be paid according to the deviation between the total monthly electricity purchased and the actual electricity consumed.  In this paper, annual transactions and monthly transactions are combined in the MALT market, in which electricity retailers need to complete the transaction decisions of electricity quantity and electricity prices at the beginning of year.  In this paper, annual transactions and monthly transactions are combined in the MALT market, in which electricity retailers need to complete the transaction decisions of electricity quantity and electricity prices at the beginning of year.

China's Electric Power Spot Market Trading Rules
Under the reform of the new power system, MALT trading is the main part, and spot market trading is supplemented. Figure 5 shows the current trading procedures in China. In the DA market, the electricity retailers need to reasonably decompose the MALT electricity into daily electricity and the daily decomposition curve based on load characteristics, which is different from the decomposition of monthly electricity in Section 3.2. According to the trading rules analysis, electricity retailers need to complete the following three transaction decisions. Firstly, the electricity retailer completes the MALT transactions at the beginning of the year, of which the decision-making variables include contract electricity Y Q and contract electricity prices Y P , as shown in strategy 1 in Figure   5. Secondly, in order to realize the effective connection between the MALT and the spot market, the electricity retailers should reasonably decompose the MALT electricity purchases to the decomposition contract electricity _ y day Q of each trading day, as shown in strategy 2 in Figure 5. Thirdly, the trading center will announce the DA market price tion, as shown in strategy 3 in Figure 5. The above transaction decisions need to be declared before the start of the day-ahead market. According to this transaction rule, the single-day electricity fee of the MALT market long C is shown in Equation (1).  According to the trading rules analysis, electricity retailers need to complete the following three transaction decisions. Firstly, the electricity retailer completes the MALT transactions at the beginning of the year, of which the decision-making variables include contract electricity Q Y and contract electricity prices P Y , as shown in strategy 1 in Figure 5. Secondly, in order to realize the effective connection between the MALT and the spot market, the electricity retailers should reasonably decompose the MALT electricity purchases to the decomposition contract electricity Q y_day of each trading day, as shown in strategy 2 in Figure 5. Thirdly, the trading center will announce the DA market price P DA,t before the start of the DA market. The electricity retailer needs to report the day-ahead load declaration curve Q DA,t and the daily load curve Q y_day,t based on Q y_day decomposition, as shown in strategy 3 in Figure 5. The above transaction decisions need to be declared before the start of the day-ahead market.
According to this transaction rule, the single-day electricity fee of the MALT market C long is shown in Equation (1). P Y,t is the MALT electricity price of each time step. Q y_day is daily electricity of MALT contract electricity decomposition. Q y_day,t is the daily load curve based on Q y_day decomposition. P DA,t is the DA market price.
The electricity cost in the DA market C DA is shown in Equation (2). Q DA,t is the DA load declaration curve.
The electricity cost in the RT market C RT is shown in Equation (3). Q RT,t is the actual load curve. P RT,t is the real-time electricity price.
Additionally, the deviation assessment E allocation is shown in Equation (4), which include two parts. The first part C allocation1 is shown in Equation (5). When Q DA,t is greater than Q RT,t , the deviation exceeds the deviation assessment range λ 0 , and when P RT,t is higher than P DA,t , the deviation assessment penalty needs to be paid. The second part C allocation2 is shown in Equation (6). When Q DA,t is less than Q RT,t , the deviation exceeds the deviation assessment range λ 0 , and when P RT,t is lower than P DA,t , the deviation assessment penalty needs to be paid.
Additionally, λ 0 is set to ±5%, which is the deviation assessment range. K P is set to 2, which is the deviation assessment coefficient.

Factors Affecting Medium-and Long-Term Transaction Costs in the Spot Market
In the former electricity market, the influential factors of the electricity purchase cost are the annual MALT electricity quantity and the electricity price elasticity coefficient of the annual MALT electricity price. The monthly electricity decomposition is completed based on the proportion of monthly electricity consumption. Supplementary monthly electricity transactions depend on the short-term forecast of monthly electricity.
In the spot market, through calculation Equation (8), there are three factors affecting the electricity costs E day_sum , namely, the MALT power purchase price P Y , the DA market price P DA,t , the decomposition daily electricity Q y_day , and the daily load curve Q y_day,t . listing transactions are affected by human factors and game strategies. This article ignores these factors and only considers the benchmark electricity prices of different power sources and the relative relationship between MALT electricity prices P Y and contract electricity Q y . The influential factors of MALT transactions are shown in Table 2. The relative relationship between P DA,t and P Y,t Different types of power generation units have different on-grid power prices. Figure 6 shows the nine power prices of different power generation types, among which the power prices of coal power, wind power, and photovoltaic power generation fluctuate within a certain range. Based on this situation, the electricity retailers can select the appropriate trading partner in the MALT transactions according to the energy amount and corresponding electricity price. The researchers studied the relationship between the electricity price elasticity coefficient and social economic development in Refs. [22,23]. The researchers studied the effects on residential load power consumption due to electricity price changes at different times in Refs. [24][25][26]. The demand elasticity coefficient of electricity price represents the relationship between energy demands and electricity price, as shown in Formula 10. Q is electricity. P is the electricity price. Q Δ is the electricity fluctuation, and P Δ is the electricity price fluctuation.
dQ P Q P Δ The researchers studied the relationship between the electricity price elasticity coefficient and social economic development in Refs. [22,23]. The researchers studied the effects on residential load power consumption due to electricity price changes at different times in Refs. [24][25][26]. The demand elasticity coefficient of electricity price represents the Energies 2022, 15, 3342 9 of 30 relationship between energy demands and electricity price, as shown in Equation (10). Q is electricity. P is the electricity price. ∆Q is the electricity fluctuation, and ∆P is the electricity price fluctuation.
Based on the principle of market equilibrium, in annual MALT transactions, the electricity price elasticity coefficients of power generation units and electricity retailer units are negative. Additionally, the increase in contract electricity will lead to a decrease in contract electricity prices [26,27]. The change trend of the electricity price is shown in Figure 7, in which P basic is the benchmark electricity price, Q basic is the corresponding minimum electricity purchase, ∆Q is the increase in electricity purchases, and ∆P is the decrease in the electricity price.

Influence of the Decomposition of the Daily Load Curve on Electricity Costs in the Day-Ahead Market
According to the spot market trading rules, in the DA market, electricity retailers need to declare on behalf of users. Additionally, the electricity retailers need to de- , as strategy 2 and strategy 3 shown in Table 2.
The decomposition strategy includes two methods. The first is decomposing the daily electricity according to the average or the ratio of the peak-to-valley price curve in 24 h. The second is independently proposed by electricity retailers and takes effect after confirmation by both parties to the transaction, which is the research object in this paper.
As shown in the second term in Equation (8), DA C is the electricity cost of the DA market, which can be equivalent to Equation (11).
fluctuates randomly. It is assumed that the predicted , DA t P is shown in Figure 8.
depends on the load characteristics of users, which are uncontrollable. However, is controllable. According to the change trend of , DA t P , it increases the distribution proportion of the power curve at a high electricity price and reduces the distribution proportion of the power curve at a low electricity price, as shown in Figure 9. The optimized decomposition method increases , DA C will be reduced accordingly, and the total electricity cost will

Influence of the Decomposition of the Daily Load Curve on Electricity Costs in the Day-Ahead Market
According to the spot market trading rules, in the DA market, electricity retailers need to declare Q DA,t on behalf of users. Additionally, the electricity retailers need to decompose Q Y into Q y_day and further decompose Q y_day into Q y_day,t , as strategy 2 and strategy 3 shown in Table 2.
The decomposition strategy includes two methods. The first is decomposing the daily electricity according to the average or the ratio of the peak-to-valley price curve in 24 h. The second is independently proposed by electricity retailers and takes effect after confirmation by both parties to the transaction, which is the research object in this paper.
As shown in the second term in Equation (8), C DA is the electricity cost of the DA market, which can be equivalent to Equation (11). P DA,t fluctuates randomly. It is assumed that the predicted P DA,t is shown in Figure 8. Q DA,t depends on the load characteristics of users, which are uncontrollable. However, Q y_day,t is controllable. According to the change trend of P DA,t , it increases the distribution proportion of the power curve at a high electricity price and reduces the distribution proportion of the power curve at a low electricity price, as shown in Figure 9. The optimized decomposition method increases P DA_kWh_day which is the equivalent kWh cost (EKC) of Q y_day . Therefore, based on the increase in P DA_kWh_day , C DA will be reduced accordingly, and the total electricity cost will also be reduced.   ,

Influence of the Electricity Quantity Difference and Electricity Price Difference on the Power Purchase Cost
The electricity difference between The second is that which is necessary to sell excess electric-

Influence of the Electricity Quantity Difference and Electricity Price Difference on the Power Purchase Cost
The electricity difference between The second is that which is necessary to sell excess electric-

Influence of the Electricity Quantity Difference and Electricity Price Difference on the Power Purchase Cost
The electricity difference between Q y_day,t and Q DA,t , as shown in the second term of Equation (8), determines the day-ahead market transactions. Thus, there are two situations when making decisions regarding MALT purchases. The first is that Q y_day,t is less than Q DA,t , which is necessary to purchase supplementary electricity in the DA market. The second is that Q y_day,t is greater than Q DA,t , which is necessary to sell excess electricity in the DA market. The price difference between P Y,t and C DA determines the economy of purchase decision. Analysis of the influential factors of the daily load decomposition curve is shown in Table 2. As P Y and P Y,t are locked in the transaction at the beginning of the year, the randomness fluctuation of P DA,t will cause electricity cost changes. Electricity retailers need to optimize Q y_day,t according to P DA,t released by the power trading center 24 h in advance. The following four situations will occur. When P Y,t > P DA,t and Q y_day,t < Q DA,t , electricity retailers buy electricity at high prices in the MALT market and replenish the electricity gap at low prices in the DA market. When P Y,t < P DA,t and Q y_day,t < Q DA,t , electricity retailers buy electricity at low prices in the MALT market and replenish electricity at high prices in the DA market. When P Y,t > P DA,t and Q y_day,t > Q DA,t , the electricity retailers buy surplus electricity at a high price in the MALT market and need to sell it at a low price in the DA market, resulting in a loss. When P Y,t < P DA,t , and Q y_day,t > Q DA,t , power retailers buy surplus electricity at a low price in the MALT market and need to sell it at a high price in the DA market, resulting in arbitrage income.
Due to the fluctuation of P DA,t , any of the above situations may occur randomly in the DA market.

Method of Decomposition of Medium-and Long-Term Contract Electricity
According to the analysis of Sections 2 and 3, the electricity decomposition of MALT contracts is an important link between MALT transactions and the spot market. In the former electricity market, electricity retailers allocated annual MALT electricity according to the empirical data of the monthly electricity proportion of the load. In the spot market, electricity retailers need to obtain Q y_day according to the distribution law of annual daily electricity quantity, as shown in No. 3 of Table 2.
The author investigate the electricity decomposition of the generator side in Ref. [11]. The goal of the decomposition of MALT electricity is completing the contract electricity. In [8], the MALT electric quantity is allocated to daily electricity quantity with the goal of reducing the load rate deviation of each generator unit. There are few studies on electricity decomposition on the consumption side. The MALT electricity decomposition of electricity retailers should be based on the proportion of daily power consumption. By searching and investigating load forecasting methods, this paper proposes a method of extracting load characteristics from load forecasting to carry out daily power decomposition.
Through research into MALT load forecasting, we can analyze the relationship between demand development and various factors and establish a mathematical model. Related research methods include regression analysis, the differential autoregressive moving average method, artificial intelligence, and the X12-ARIMA seasonal decomposition method [28][29][30][31]. In [32], the authors used the X12 seasonal adjustment method to decompose the change trend of electricity data. The X12 seasonal adjustment method can effectively decompose the trend component series, the seasonal periodic component series, and the random component series in time series data. There are two types of X12 decomposition models: the addition model and the multiplication model. The additive model is suitable for models with relatively stable seasonal cycles and the multiplicative model is suitable for models with obvious changes in the seasonal cycles.
Since the total electricity consumption of the charging station is relatively stable, the MALT electricity transaction is not equal to the annual electricity consumption. Thus, the electricity decomposition can ignore the random fluctuation of actual electricity consumption. It decomposes MALT contract electricity based on daily electricity characteristics through the historical electricity consumption data analysis. As shown in Equation (12), bus charging station operations are suitable for the multiplication model, affected by factors such as different seasons, working days, and holidays. Q day represents the historical daily electricity data; Q T is the trend component sequence; Q C is the seasonal cycle component sequence; and Q I is the random component sequence.
According to Equation (12), the decomposition of Q year is based on the trend component series Q T and periodic component series Q C of daily electricity consumed. The random component Q I is ignored. The calculation formula of Q y_day decomposition is shown in Equation (13).

Generation Method of the Declared Load Curve Based on Historical Data in the DA Market
According to the spot market trading rules, electricity retailers need to declare Q DA,t based on the characteristics of the daily load curve. According to the analysis in the Section 3, Q DA,t will affect the decomposition of daily electricity, as shown in No. 4 of Table 2. An accurate Q DA,t value can effectively avoid the deviation assessment in the RT market.
Therefore, it is very important for electricity retailers to analyze and understand the daily load characteristics of their agent users. Based on a large number of historical load curves, this section adopts the principal component analysis (PCA) method to remove random interference factors and obtains representative load curves and scene probabilities through clustering.

Disturbance Data Processing
The first step is to exclude the influence of random components and extract load curve features from historical data. This section adopts principal component analysis (PCA) [33][34][35], which can separate the commonness and difference from data vectors and retain the main information of the data.
N is the number of samples of historical data. The data number of each sample of the load is p. The variable X N×p is the matrix of samples of historical data, as shown in Equation (14). The principal component Y is obtained through the orthogonal transformation matrix U p×p , as shown in Equation (15). The variance λ j of Y represents the dispersion degree of the sample points on the principal component of j. β j is the corresponding contribution rate, as shown in Equation (16). Y main is the principal component with a 95% contribution rate. In Equation (17), X main represents the load data that remove the disturbance and retain the main variation.

Typical Scenarios for Load Declaration Curves
Aiming at the periodicity and uncertainty of the load, the representative time series scenes are extracted form historical data, which can reflect the load characteristics [36,37]. The annual load of a charging station varies with the season, changes on weekdays, weekends, and holidays due to operational demand differences, and fluctuates over the day due to peak and valley demands, as shown in Figure 10.

Typical Scenarios for Load Declaration Curves
Aiming at the periodicity and uncertainty of the load, the representative time series scenes are extracted form historical data, which can reflect the load characteristics [36,37]. The annual load of a charging station varies with the season, changes on weekdays, weekends, and holidays due to operational demand differences, and fluctuates over the day due to peak and valley demands, as shown in Figure 10. Through the scene reduction method, small scene sets are obtained from sequential scenes with a large amount of original data. These can represent the characteristics of the original scene to the greatest extent [38]. Clustering algorithms are widely used in scene reduction. In this paper, the k-means clustering method is used to classify the original scene [39].
The original time series scene S contains N historical data main X . k scene sets are classified, 1 2 , , k S S S  , through the k-means clustering method, in which i S represents all scenes belonging to category i. In Equation (18), these data are the load data belonging to the scene. The average of i S is the typical load curve of this scenario, as shown in Equation (19). The corresponding scenario probability is shown in Equation (20). Through the scene reduction method, small scene sets are obtained from sequential scenes with a large amount of original data. These can represent the characteristics of the original scene to the greatest extent [38]. Clustering algorithms are widely used in scene reduction. In this paper, the k-means clustering method is used to classify the original scene [39].
The original time series scene S contains N historical data X main . k scene sets are classified, S 1 , S 2 , · · · S k , through the k-means clustering method, in which S i represents all scenes belonging to category i. In Equation (18), these data are the load data belonging to the scene. The average of S i is the typical load curve of this scenario, as shown in Equation (19). The corresponding scenario probability is shown in Equation (20).
P 1 , · · · P i , · · · P k represent the typical scene load curve of the charging station, which are equivalent to Q DA,t . pro 1 , · · · pro i , · · · pro k represent the corresponding scene probability.

Load Curve Decomposition Method
In the DA market, the electricity retailers decompose Q y_day obtained in Section 5 to obtain Q y_day,t based on Q DA,t obtained in Section 6, as shown in strategy 3 in Table 2.
According to the fluctuation curve of the P DA,t , this section adopts the particle swarm optimization (PSO) method to reasonably decompose Q y_day into Q y_day,t , which will be reported to the trading center before the DA market transaction starting. This method can effectively reduce the electricity cost in the DA market.

Optimization Objective of Load Curve Decomposition
At present, there are few studies on the decomposition of the daily load curve on the electricity consumption side. Referring to the research on the power generation side's power decomposition in the literature [7,9,10,40], the aim of the decomposition of the daily load curve is to reduce the difference in the load rate of the power generation side units with the constraint of the randomness of new energy and the natural conditions of cascade hydropower.
Since this paper seeks to reduce the electricity cost of electricity retailers, the optimization objective function provides the minimization of electricity cost in the DA market, as shown in Equation (21), which complete the decomposition of the daily load curve Q y_day,t .
Based on different typical scenarios mentioned in Section 6.2, Equation (22) is the combined objective function formula of Equation (21). P i,t is the typical load curve in scenario i. pro i is the probability of the occurrence of this scenario. Q y_day,t is the optimization target. P DA,t is announced by the trading center, as a known quantity.

Constraints
Electricity retailers are different from power generation enterprises. Their main constraint conditions include the total consumption constraint, the maximum power constraint, and the electricity cost constraint. 24 ∑ t=1 Q y_day,t · ∆t = Q y_day (23) ∆t is the time step of settlement in the DA market. The integral Q y_day,t with respect to ∆t is equal to Q y_day .
The load curve power Q y_day,t should be less than the declaration load P i,t and Q y_day at any time.
C DA is the optimized electricity cost obtained by the decomposition method of the particle swarm in the DA market. C DA_MEAN is the electricity cost of the DA market obtained by the decomposition method of the average distribution in 24 h. C DA_PEAK is the electricity cost of the DA market obtained by the decomposition method of the distribution ratio based on the peak-to-valley price. C DA should be less than C DA_MEAN and C DA_PEAK .

Solution Algorithm
This paper refers to research into dispatching power distribution in power generation plants to select an optimization algorithm. The research into electricity dispatching of power distribution focuses on the fairness of power distribution of multiple generators, the completion of contract power, and the utilization balance of generators. These problems are mostly solved by quadratic programming or the particle swarm algorithm [12,13]. This paper studies the decomposition of the daily electricity of electricity retailers; considering the number of price data in the spot market, it uses the particle swarm algorithm to decompose the load curve, which represents the optimized particles. Optimization of the electricity cost is achieved in the DA market according to the flowchart in Figure 11. Energies 2022, 15 Meet requirements of global optimal position or not Figure 11. Algorithm flow chart. Figure 11. Algorithm flow chart.

Contract Electricity Price for Medium-and Long-Term Transactions
According to historical data, the energy consumption of the built bus charging stations is stable. The power consumption of the CSO depends on the annual development of urban public transportation. In 2021, the annual electricity consumption of electric bus charging station operators was about 250 million kWh in Beijing.
In this paper, we assume the deviation of annual purchased electricity consumption to be ±40%. Thus, Q Y is between 150 million kWh and 350 million kWh. Taking into account the price changes of different types of power sources, this study assumes that the benchmark electricity price P basic is as follows.
The minimum electricity quantity Q basic in the medium-and long-term contract is 150 million kWh. The increase step of electricity quantity ∆Q is 50 million kWh. The corresponding electricity price step ∆P is −5%. Thus, the corresponding P Y values are shown in Table 3.

Decomposition Method of Medium-and Long-Term Contract Electricity for the Load of Bus Charging Station Operators
According to the historical electricity data P data of Beijing electric bus charging station operators, the electricity consumption varies with the seasons. The highest electricity consumption is in winter. Additionally, it fluctuates periodically at a frequency of seven days, as shown in Figure 12.  The trend component and periodic component are extracted from daily electricity data P data according to the X12 method. X12 T is the ratio of the trend component in daily electricity to the annual electricity, and X12 S is the ratio of the periodic component to the trend component in daily electricity, as shown in Figure 13. According to the MALT contract electricity Q Y given in Section 8.1, the decomposition of Q Y is shown in Figure 13, which can be expressed as Q y_day = Q Y · X12 T · X12 S .  Figure 13. According to the MALT contract electricity Y Q given in Section 8.1, the decomposition of Y Q is shown in Figure   13, which can be expressed as is as shown in Figure 14.
In Figure 14a, it shows 84 daily electricity types, and in Figure 14b, it shows the occurrence numbers of each decomposed daily electricity types. When Q Y is 250 million kWh, Q y_day is as shown in Figure 14. In Figure 14a, it shows 84 daily electricity types, and in Figure 14b, it shows the occurrence numbers of each decomposed daily electricity types.

Generation of the Load Curve Declaration of the Bus Charging Station in the DA Market
At present, the deviation assessment of Guangdong power market is 5%. According to the PCA method in Section 6.1, represents the first four principal components extracted from the annual daily power data data P , and the influence of random disturbance signals within 5% is excluded, as shown in Figure 15. This retains the main characteristics of load data data P .

Generation of the Load Curve Declaration of the Bus Charging Station in the DA Market
At present, the deviation assessment of Guangdong power market is 5%. According to the PCA method in Section 6.1, P data_PCA represents the first four principal components extracted from the annual daily power data P data , and the influence of random disturbance signals within 5% is excluded, as shown in Figure 15. This retains the main characteristics of load data P data .

Generation of the Load Curve Declaration of the Bus Charging Station in the DA Market
At present, the deviation assessment of Guangdong power market is 5%. According to the PCA method in Section 6.1, represents the first four principal components extracted from the annual daily power data data P , and the influence of random disturbance signals within 5% is excluded, as shown in Figure 15. This retains the main characteristics of load data data P . This process obtains 38 groups of typical load scenarios and the corresponding scenario probabilities through clustering 365 daily load data points by k-means clustering. The typical load scenarios are used as the daily declaration load in the DA market. This process obtains 38 groups of typical load scenarios and the corresponding scenario probabilities through clustering 365 daily load data points by k-means clustering. The typical load scenarios are used as the daily declaration load in the DA market.

Analysis of Electricity Costs in Medium-and Long-Term Transactions
The influential factors of MALT electricity charges are the benchmark electricity price and electricity price elasticity coefficient. According to Q Y in Section 7.1, the corresponding electricity cost of the MALT transaction is shown in Figure 16. The electricity cost increases with the increase in the quantity of purchased electricity. When the increase in the electricity quantity leads to a decrease in the electricity contract step price, the cost of electricity will decrease.

Analysis of Electricity Costs in Medium-and Long-Term Transactions
The influential factors of MALT electricity charges are the benchmark electricity price and electricity price elasticity coefficient. According to Y Q in Section 7.1, the corresponding electricity cost of the MALT transaction is shown in Figure 16. The electricity cost increases with the increase in the quantity of purchased electricity. When the increase in the electricity quantity leads to a decrease in the electricity contract step price, the cost of electricity will decrease.   Figure 17, in which Figure 17a is the trial operation price curve of Guangdong

Analysis of the Electricity Cost in the DA Market
In this paper, the prediction error of the daily declared load is ignored. According to the analysis in Section 3.2, the influential factors of C DA are P DA,t and Q y_day,t . P DA,t is shown in Figure 17, in which Figure 17a is the trial operation price curve of Guangdong Province. In order to analyze the impact of different price ranges, the price in Figure 17b is 1.5 times that in Figure 17a. The price in Figure 17c is 2.5 times that in Figure 17a. And the average kilowatt-hour price of three different price is shown in Table 4.  In Figure 18, DA C based on the 24-h average decomposition is shown.
is obtained through X12 decomposition method, as shown in Figure 14. Based on different DA prices, each DA electricity cost will change. However, when _ y day Q is less than the actual electricity consumption, it is necessary to supplement electricity in the DA market. Additionally, DA C is positive. When _ y day Q is greater than the actual electricity consumption, the excess electricity needs to be sold in the DA market. Additionally, DA C is negative.
Therefore, the overall DA C decreases with the increase in

Price1
Price2 Price3 Average kilowatt-hour DA price 0.261 0.391 0.651 Influence of the DA Electricity Price on the DA Electricity Cost In Figure 18, C DA based on the 24-h average decomposition is shown. Q y_day is obtained through X12 decomposition method, as shown in Figure 14. Based on different DA prices, each DA electricity cost will change. However, when Q y_day is less than the actual electricity consumption, it is necessary to supplement electricity in the DA market. Additionally, C DA is positive. When Q y_day is greater than the actual electricity consumption, the excess electricity needs to be sold in the DA market. Additionally, C DA is negative. Therefore, the overall C DA decreases with the increase in Q y_day , and the downward trend remains unchanged.

Impact of the Decomposition Strategy on the Day-Ahead Electricity Cost
There are three electricity decomposition strategies: the decomposition strategy of the average distribution in 24 h, the decomposition strategy of the peak-to-valley price proportion distribution, and the decomposition strategy of the particle swarm method.
The variable dimension of PSO is 24 based on the time step in the DA market. The swarm sizes is 300, and the number of iterations is 3000. The convergence criterion is specified in Section 7.2, which can obtain the minimum of all iteration results below C DA_PEAK and C DA_MEAN . The software code was debugged by MATLAB 2019. The hardware used was a Dell workstation. The consumption used in the decomposition of the average distribution was 2.632837 s. The consumption used in the decomposition of the proportion distribution was 2.681714 s. The consumption used in the decomposition of PSO was 319.725981 s.
tionally, DA C is positive. When _ y day Q is greater than the actual electricity consum the excess electricity needs to be sold in the DA market. Additionally, DA C is neg Therefore, the overall DA C decreases with the increase in _ y day Q , and the down trend remains unchanged.  In Figure 19, the decomposition results with the three decomposition strategies are shown. The purpose of decomposition optimization is to increase the cost proportion of Q y_day,t in the DA market, which is subtracted in Equation (11). Therefore, the higher the equivalent kWh cost (EKC) of Q y_day,t , the lower C DA is. In Table 5, the EKC of three different decomposition methods is given. Additionally, it can be seen that the EKC of PSO is the highest. There are three electricity decomposition strategies: the decomposition strategy of the average distribution in 24 h, the decomposition strategy of the peak-to-valley price proportion distribution, and the decomposition strategy of the particle swarm method.
The variable dimension of PSO is 24 based on the time step in the DA market. The swarm sizes is 300, and the number of iterations is 3000. The convergence criterion is specified in Section 7.2.3, which can obtain the minimum of all iteration results below In Figure 19, the decomposition results with the three decomposition strategies are shown. The purpose of decomposition optimization is to increase the cost proportion of in the DA market, which is subtracted in Equation (11). Therefore, the higher the equivalent kWh cost (EKC) of _ , y day t Q , the lower DA C is. In Table 5, the EKC of three different decomposition methods is given. Additionally, it can be seen that the EKC of PSO is the highest. Figure 19. Three decomposition strategies of the load curve in the DA market.   In Figure 20, when Q Y is 250 million kWh, the corresponding electricity costs C DA_means , C DA_peak and C DA_pso based on Price1 are shown, in which C DA_means of all decomposed daily electricity types is the highest and C DA_pso of all decomposed daily electricity types is the lowest. Based on Price2 and Price3, C DA_pso is the lowest cost. Therefore, the decomposition strategy of PSO can obtain the lowest C DA under random P DA,t with any decomposed daily electricity. In Figure 20, when Y Q is 250 million kWh, the corresponding electricity costs

Electricity Cost and Deviation Assessment Cost in the RT Market
The main influential factor of RT C is the deviation between

Electricity Cost and Deviation Assessment Cost in the RT Market
The main influential factor of C RT is the deviation between Q RT,t and Q DA,t . Based on the method described in Sections 6.1 and 8.3, the typical scene's load based on PCA is Q DA,t . C RT is calculated based on the load history data P data and P 1 ∼ P K of a typical load scenario. C RT_PCA is calculated based on a typical load P data_PCA with PCA and P 1 ∼ P K of a typical load scenario. As shown in Figure 21, C RT and C RT_PCA are basically consistent. Thus, the main features of the original data P data are effectively retained in a typical load X main of principal component extraction. This paper mainly analyzes the impact of the transaction strategy. Thus, the calculation uses historical data and ignores the impact of load forecast errors. According to the 5% deviation assessment range and two times the deviation assessment coefficient specified by the Guangdong power market, the annual deviation assessment was calculated according to three spot prices in Figure 16, as shown in Table 6. This paper mainly analyzes the impact of the transaction strategy. Thus, the calculation uses historical data and ignores the impact of load forecast errors. According to the 5% deviation assessment range and two times the deviation assessment coefficient specified by the Guangdong power market, the annual deviation assessment was calculated according to three spot prices in Figure 16, as shown in Table 6. Table 6. Annual deviation assessment with three spot prices.

Analysis of the Influential Factors of the Transaction Strategy on Electricity Costs
Influence of Medium-and Long-Term Electricity Quantity on Electricity Costs According to historical data analysis, the annual electricity consumption of Beijing's electric bus charging station system is 264.5 million kWh. Additionally, the annual electricity cost is RMB 264.9 million according to the peak and valley electricity price in Beijing. If the operator participates in the electricity market transaction, the MALT transaction electricity cost can be greatly reduced.
It is assumed that the , DA t P of the whole year is similar to the trial price in which the EKC range of the average distribution decomposition is less than 0.3/kWh. The change in the total electricity cost corresponding to the change in Y Q is shown in Figure 22. As shown in Table 3, if the medium-and long-term benchmark electricity price is higher than RMB 0.4/kWh, Y P is always higher than EKC with the increase in Y Q , which leads to an increase in the total electricity cost. If the medium-and long-term benchmark electricity price is lower than RMB 0.4 /kWh, Y P may be lower than EKC with the increase in Y Q , which leads to a decrease in the total electricity cost.  According to historical data analysis, the annual electricity consumption of Beijing's electric bus charging station system is 264.5 million kWh. Additionally, the annual electricity cost is RMB 264.9 million according to the peak and valley electricity price in Beijing. If the operator participates in the electricity market transaction, the MALT transaction electricity cost can be greatly reduced.
It is assumed that the P DA,t of the whole year is similar to the trial price in which the EKC range of the average distribution decomposition is less than 0.3/kWh. The change in the total electricity cost corresponding to the change in Q Y is shown in Figure 22. As shown in Table 3, if the medium-and long-term benchmark electricity price is higher than RMB 0.4/kWh, P Y is always higher than EKC with the increase in Q Y , which leads to an increase in the total electricity cost. If the medium-and long-term benchmark electricity price is lower than RMB 0.4/kWh, P Y may be lower than EKC with the increase in Q Y , which leads to a decrease in the total electricity cost.

Influence of the DA Electricity Price on Electricity Costs in the Spot Market
Taking the benchmark price of RMB 0.5/kWh as an example, based on the three electricity prices type in Figure 16, the annual electricity costs corresponding to the three decomposition strategies are calculated, as shown in Figure 23. Based on Price1, which is the lowest DA price, the total electricity cost will increase with an increase in Q Y , as shown in Figure 23a. Based on Price3, which is the highest DA price, the total electricity cost will decrease with an increase in Q Y , as shown in Figure 23c. Based on Price2, the change trend of the total electricity cost varies according to different stages of Q Y and P Y , as shown in Figure 23b.

Influence of the DA Electricity Price on Electricity Costs in the Spot Market
Taking the benchmark price of RMB 0.5 /kWh as an example, based on the three electricity prices type in Figure 16, the annual electricity costs corresponding to the three decomposition strategies are calculated, as shown in Figure 23. Based on Price1, which is the lowest DA price, the total electricity cost will increase with an increase in Y Q , as shown in Figure 23(a). Based on Price3, which is the highest DA price, the total electricity cost will decrease with an increase in Y Q , as shown in Figure 23(c). Based on Price2, the change trend of the total electricity cost varies according to different stages of Y Q and Y P , as shown in Figure 23(b). Figure 23. The influence on the total electricity cost with different medium-and long-term electricity quantities based on three spot market electricity prices.

Influence of the DA Electricity Price on Electricity Costs in the Spot Market
Taking the benchmark price of RMB 0.5 /kWh as an example, based on the three electricity prices type in Figure 16, the annual electricity costs corresponding to the three decomposition strategies are calculated, as shown in Figure 23. Based on Price1, which is the lowest DA price, the total electricity cost will increase with an increase in Y Q , as shown in Figure 23(a). Based on Price3, which is the highest DA price, the total electricity cost will decrease with an increase in Y Q , as shown in Figure 23(c). Based on Price2, the change trend of the total electricity cost varies according to different stages of Y Q and Y P , as shown in Figure 23(b). Figure 23. The influence on the total electricity cost with different medium-and long-term electricity quantities based on three spot market electricity prices. Figure 23. The influence on the total electricity cost with different medium-and long-term electricity quantities based on three spot market electricity prices.
In Figure 23, the difference in three price types is due to the difference between P DA_kWh_day and P Y . Q Y does not affect the P DA_kWh_day of different decomposition methods, but the increase in Q Y leads to a decrease in P Y . The relationship between the P DA_kWh_day of the PSO decomposition based on Price2 and P Y is shown in Figure 24. When this P DA_kWh_day is greater than P Y , Q Y is higher, and the total cost is lower. When this P DA_kWh_day is lower than P Y , Q Y is higher, and the total cost is higher.
ods, but the increase in Y Q leads to a decrease in Y P . The relationship between the _ _ DA kWh day P of the PSO decomposition based on Price2 and Y P is shown in Figure 24. When this _ _ DA kWh day P is greater than Y P , Y Q is higher, and the total cost is lower. When this _ _ DA kWh day P is lower than Y P , Y Q is higher, and the total cost is higher.

Influence of Generation Unit Selection on the Total Electricity Cost
Due to the volatility and randomness of the electricity price in the spot market, this paper presents different EKCs of PSO decomposition corresponding to three DA price curves type, as shown in Figure 25. According to the benchmark price of the power generation unit introduced in Section 4.1, the benchmark price of photovoltaic power generation is RMB 0.25 /kWh. Additionally, the benchmark price of coal-fired power is RMB 0.5 /kWh.

Influence of Generation Unit Selection on the Total Electricity Cost
Due to the volatility and randomness of the electricity price in the spot market, this paper presents different EKCs of PSO decomposition corresponding to three DA price curves type, as shown in Figure 25. According to the benchmark price of the power generation unit introduced in Section 4.1, the benchmark price of photovoltaic power generation is RMB 0.25/kWh. Additionally, the benchmark price of coal-fired power is RMB 0.5/kWh. As shown in Figure 25, if the bus charge station operator signs a medium-or longterm contract with a photovoltaic power station, the EKC is higher than Y P . The greater the Y Q , the lower the cost. If the bus charge station operator signs a medium-or longterm contract with a coal-fired power plant and the DA price range is similar to Price2, As shown in Figure 25, if the bus charge station operator signs a medium-or long-term contract with a photovoltaic power station, the EKC is higher than P Y . The greater the Q Y , the lower the cost. If the bus charge station operator signs a medium-or long-term contract with a coal-fired power plant and the DA price range is similar to Price2, when Q Y is less than 260 million kWh, the EKC is lower than P Y . Thus, the total electricity cost will be reduced by reducing Q Y .

Comprehensive Influence of Various Factors on the Total Electricity Cost
MALT trading decisions involve many factors. In Section 8.4, we analyze the influential factors of the total electricity cost from the selection of the MALT benchmark electricity price, the selection of MALT contract electricity quantities, DA market electricity price change, and different decomposition strategies.
Electricity retailers need to forecast the fluctuation range of the DA price in the spot market when selecting medium-and long procurement power sources and determining contract quantities, as shown in Figure 26. If the DA price range is similar to Price3, it is indicated that the DA price in the spot market will be high, and the benchmark price of each power source is relatively low in MALT transactions. The larger the Q Y , the lower the total electricity cost. If the DA price range is similar to Price1 and Price2, in the range where P Y is lower than the EKC of PSO decomposition, an increase in Q Y can reduce the cost. In the range where P Y is higher than the EKC of PSO decomposition, a reduction in Q Y is beneficial to reducing the electricity cost. According to the comparison of the three decomposition strategies, it can be clearly concluded that the PSO decomposition method can effectively reduce the cost of electricity. As shown in Figure 27, the EKC of PSO decomposition is higher than the other two decomposition methods, which can reduce the electricity cost in the DA market. Thus, the PSO decomposition method is the optimal option for electricity retailers. According to the comparison of the three decomposition strategies, it can be clearly concluded that the PSO decomposition method can effectively reduce the cost of electricity. As shown in Figure 27, the EKC of PSO decomposition is higher than the other two decomposition methods, which can reduce the electricity cost in the DA market. Thus, the PSO decomposition method is the optimal option for electricity retailers.

Conclusions
Based on the analysis of the rules of China's power spot market, in order to guide electricity retailers to participate in the electricity market, which combines the mediumand long-term market and the spot market, this article investigates transaction decisionmaking strategies for the three influential factors, which are the medium-and long-term electricity quantity and the medium-and long-term contract price, the decomposition strategy of daily electricity，and the decomposition strategy of the daily load curve. In order to obtain the lowest electricity price in medium-and long-term transactions, it is necessary to determine the electricity quantity and benchmark price, considering the influence of the price elasticity coefficient. The X12 method can effectively extract the annual electricity fluctuation characteristics. The decomposition strategy of daily electricity based on X12 is the most reasonable method that combines the medium-and long-term market and the spot market. In the decomposition strategy of the daily load curve, this article introduces three decomposition methods, among which the particle swarm optimization method is the best way to increase the equivalent per kilowatt-hour cost in the DA market. Through the analysis of all impact factors, it can be seen that the three decision-making strategies comprehensively affect the relative relationship between the electricity price of medium-and long-term contracts and the equivalent per kilowatt-hours price in the DA market. Electricity retailers should choose the purchase object based on the range of equivalent per kilowatt-hours price in the DA market. If the price range of equivalent per kilowatt-hours of the whole year is higher than the electricity price of medium-and long-term contracts, retailers should increase the electricity quantity of medium-and long-term contracts.
Through the above research, taking Beijing's electric bus charging station operator as the studied case, CSOs decomposed daily electricity based on the X12 method, obtained the declaration of the load curve based on PCA and typical scenarios, and completed de- Figure 27. The relationship between the EKC of the three decomposition strategies and the mediumand long-term electricity prices.

Conclusions
Based on the analysis of the rules of China's power spot market, in order to guide electricity retailers to participate in the electricity market, which combines the mediumand long-term market and the spot market, this article investigates transaction decisionmaking strategies for the three influential factors, which are the medium-and long-term electricity quantity and the medium-and long-term contract price, the decomposition strategy of daily electricity, and the decomposition strategy of the daily load curve. In order to obtain the lowest electricity price in medium-and long-term transactions, it is necessary to determine the electricity quantity and benchmark price, considering the influence of the price elasticity coefficient. The X12 method can effectively extract the annual electricity fluctuation characteristics. The decomposition strategy of daily electricity based on X12 is the most reasonable method that combines the medium-and long-term market and the spot market. In the decomposition strategy of the daily load curve, this article introduces three decomposition methods, among which the particle swarm optimization method is the best way to increase the equivalent per kilowatt-hour cost in the DA market. Through the analysis of all impact factors, it can be seen that the three decision-making strategies comprehensively affect the relative relationship between the electricity price of mediumand long-term contracts and the equivalent per kilowatt-hours price in the DA market. Electricity retailers should choose the purchase object based on the range of equivalent per kilowatt-hours price in the DA market. If the price range of equivalent per kilowatt-hours of the whole year is higher than the electricity price of medium-and long-term contracts, retailers should increase the electricity quantity of medium-and long-term contracts.
Through the above research, taking Beijing's electric bus charging station operator as the studied case, CSOs decomposed daily electricity based on the X12 method, obtained the declaration of the load curve based on PCA and typical scenarios, and completed decision making on the electricity quantity and power type of medium-and long-term transactions based on the equivalent price per kilowatt-hours through the PSO method. The case analysis proves that the complete strategy steps in the paper can help electricity retailers to achieve a lower electricity cost.  Daily energy that is decomposed from medium-and long-term contract Q y_day,t electricity in day-ahead market P Y Load curve that is decomposed from Q y_day in the day-ahead market P Y,t Contract price of medium-and long-term market transactions Q DA,t Medium-and long-term electricity price of each time step of P Y Q RT,t Day-ahead market declaration load P DA,t Real-time load P RT,t Real-time market electricity price λ 0 Deviation assessment range K P Deviation assessment coefficient C long Daily electricity fee for medium-and long-term transactions C long_year Annual purchase cost of medium-and long-term transactions C DA Electricity fee in the day-ahead market C RT Electricity fee in the real-time market based on real load data C RT_PCA Electricity fee in the real-time market based on load data through PCA E allocation Deviation assessment cost E day_sum Load data that remove the disturbance and retain the main variation S i Scenes belonging to category i, which contains historical data X main P i Typical scene load curve of scenes S i pro i Scene probability of scenes S i P i,t Typical load curve of each time step of P i C DA_MEAN Electricity cost of the DA market based on the decomposition method of the average distribution in 24 h C DA_PEAK Electricity cost of the DA market based on the decomposition method of the distribution ratio based on the peak-to-valley price.

C DA_pso
Electricity cost of the DA market based on the decomposition method of the decomposition strategy of the particle swarm method P DA_kWh_day Equivalent per kilowatt-hour cost in the DA market X12 T Ratio of the trend component in daily electricity to the annual electricity X12 S Ratio of the periodic component to the trend component in daily electricity ∆t Time step of the daily settlement day