Two-stage P2P energy transaction scheduling method based on supply and demand balance and cost optimization
Through the two-stage P2P energy transaction scheduling method, the problems of unbalanced energy distribution and low sharing are solved, better energy distribution and sharing are achieved, the costs of unwinned producers and sellers are reduced, and the autonomy and market adaptability of producers and sellers are enhanced.
Patent Information
- Application Number
- CN202510516167.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-05
AI Technical Summary
In the existing P2P energy transactions, the energy distribution is uneven and the degree of sharing is low. Producers and sellers who have not won the bid cannot effectively participate in the transaction, which affects the rationality and degree of sharing of energy distribution in the community.
The two-stage P2P energy transaction scheduling method is adopted. The first stage determines the winners with the goal of maximizing the balance of energy distribution. The second stage generates the transaction plan and equipment scheduling plan of the unsuccessful producers and sellers with the goal of minimizing equipment and transaction costs to ensure that the unsuccessful producers and sellers can participate in energy sharing.
It has improved the rationality and sharing of energy distribution in community P2P energy transactions, reduced the equipment and transaction costs of unsuccessful producers and sellers, and enhanced the autonomy of producers and sellers and the ability to adapt to market changes.
Smart Images

Figure CN120430561A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet big data and P2P energy trading, and in particular to a two-stage P2P energy trading scheduling method based on supply and demand balance and cost optimization. Background Art
[0002] With the rapid development of renewable energy and the widespread adoption of distributed energy systems, peer-to-peer (P2P) energy trading, as an emerging energy trading model, is gaining increasing attention. P2P energy trading allows producers and sellers to buy and sell energy directly, eliminating the need for traditional energy suppliers or middlemen. This improves energy efficiency and promotes the uptake of renewable energy.
[0003] In the P2P energy trading market, prosumers and sellers can be either energy producers, such as users of distributed energy equipment like solar photovoltaic panels and wind turbines, or energy consumers, such as ordinary residents and commercial buildings. Through the P2P energy trading platform, prosumers and sellers can independently publish energy buying and selling information based on their own energy supply and demand conditions and conduct transactions with other prosumers and sellers.
[0004] Auctions are a common pricing and allocation mechanism used in P2P energy trading. During an auction, energy sellers offer their energy through competitive bidding, while buyers bid based on price and their own needs. However, auctions often overemphasize price, leading to uneven energy distribution. During the bidding process, buyers with high bids are more likely to secure energy, while buyers with lower bids but more urgent energy needs may not be able to secure sufficient energy. Furthermore, some sellers deliberately undercut prices, preventing others from selling their energy. This price-driven allocation approach neglects the rationality of energy distribution and energy utilization. Furthermore, some producers and sellers who are capable of participating in P2P energy trading but do not win bids are unable to do so, impacting the rationality of energy distribution and the degree of energy sharing within community P2P energy trading.
[0005] Therefore, how to design a P2P energy trading scheduling method that can improve the rationality of energy allocation and the degree of energy sharing in community energy trading is a technical problem that needs to be solved urgently. Summary of the Invention
[0006] In view of the above-mentioned deficiencies in the existing technology, the technical problem to be solved by the present invention is: how to provide a two-stage P2P energy trading scheduling method based on supply and demand balance and cost optimization, in which a P2P trading plan that is better than the original bidding plan of the winning producer and seller is generated in the first stage to ensure the rationality of energy allocation and energy utilization of the winning producer and seller; in the second stage, a reasonable P2P trading plan and equipment scheduling plan are generated for producers and sellers who are capable of conducting P2P energy trading but have not won the bid, so that the unsuccessful producers and sellers can participate in energy sharing through a reasonable equipment scheduling plan, thereby improving the rationality of energy allocation and the degree of energy sharing in community P2P energy trading.
[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0008] A two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization includes:
[0009] S1: Divide the energy trading day into several trading sessions;
[0010] S2: Obtain the bidding plans of each producer and seller through the constructed bidding plan model;
[0011] S3: Based on the bidding plans of all prosumers, a first-stage transaction allocation model is constructed with the goal of maximizing energy distribution balance. The first-stage transaction allocation model is solved to determine the winning prosumer participating in the P2P transaction and generate the winning prosumer's P2P transaction plan.
[0012] S4: Calculate the equipment cost of the unsuccessful bidders through the constructed equipment cost model;
[0013] S5: Based on the equipment costs of the unsuccessful prosumers, a second-stage transaction allocation model is constructed with the goal of minimizing equipment costs and transaction costs. The second-stage transaction allocation model is solved to generate the P2P transaction plan and equipment scheduling plan for the unsuccessful prosumers.
[0014] S6: Execute steps S2 to S5 during each trading period on the energy trading day to obtain the P2P trading plan of the winning producer and seller and the P2P trading plan and equipment scheduling plan of the unsuccessful producer and seller, and execute these P2P energy transactions and equipment scheduling in the future.
[0015] Preferably, in step S2, the bidding plan model is expressed as:
[0016]
[0017] Where: NEQ n represents the bidding plan of prosumer n; NE n represents the set of bid transaction volumes of producer and consumer n at each moment; represents the set of purchase bid prices of producer / consumer n corresponding to the bid transaction volume at each moment; represents the set of selling bid prices of producer-consumer n corresponding to the bid transaction volume at each moment;
[0018] in:
[0019] The formula for calculating the bid transaction volume of producer-consumer n in trading period t is expressed as:
[0020]
[0021] If the bid transaction volume of prosumer n in trading period t is greater than 0, it is a buyer;
[0022] If the bid transaction volume of prosumer n in trading period t is less than 0, it is a seller;
[0023] The bidding price constraint formula of prosumer n is expressed as:
[0024]
[0025] Where: represents the total energy demand of prosumer n in trading period t; represents the total energy production of prosumer n in trading period t; Indicates the power consumption of air conditioner; Indicates the charge level of the electric vehicle; represents the base load of prosumer n in trading period t; represents the photovoltaic power generation of prosumer n in trading period t; represents the net energy charged and discharged by prosumer n during trading period t; represents the price at which the utility is sold; Represents the purchase price of the utility.
[0026] Preferably, in step S3, the objective function formula of the first-stage transaction allocation model is expressed as:
[0027]
[0028] Constraints:
[0029]
[0030] Where: represents the purchase bid price of buyer i; represents the winning bid purchase quantity of buyer i; represents the selling bid price of seller j; N represents the winning bid quantity of seller j; B Indicates the number of buyers; N SIndicates the number of sellers; represents the maximum winning bid purchase quantity of buyer i; represents the maximum winning bid quantity sold by seller j.
[0031] Preferably, in step S3, the first-stage transaction allocation model is solved by the following steps:
[0032] S301: Convert the objective function of the first-stage transaction allocation model into Formula 1:
[0033] Formula 1 is expressed as:
[0034]
[0035] S302: Convert the linear programming problem of Formula 1 into a standardized form to obtain Formula 2; solve Formula 2 to obtain the winning purchase quantity and winning sales quantity of each buyer and seller, and determine the winning producer and seller;
[0036] Formula 2 is expressed as:
[0037] minC T *p;
[0038] Constraints:
[0039] A eq *p=b eq ;
[0040] A in *p≤b in ;
[0041] p≥0;
[0042]
[0043] The first N of p S Seller transaction volume From N S +1 to N B Buyer transaction volume
[0044]
[0045] If the winning purchase quantity or winning sales quantity of the buyer or seller is not 0, then the buyer or seller is the winning producer and seller; if the winning purchase quantity or winning sales quantity of the buyer or seller is 0, then the buyer or seller is the unsuccessful producer and seller;
[0046] S303: Convert Formula 1 into the following dual form to obtain Formula 3;
[0047] Formula 3 is expressed as:
[0048]
[0049] Constraints:
[0050]
[0051] Where: and denote the revenue of buyer i and seller j respectively; and denote the winning purchase quantity and winning sales quantity of buyer i and seller j respectively; S denotes the set of sellers; B denotes the set of buyers; represents the winning bid price in trading period t;
[0052] S304: Convert Formula 3 into a standardized form to obtain Formula 4; solve Formula 4 to obtain the winning bid price for trading period t;
[0053] Formula 4 is expressed as:
[0054]
[0055] Constraints:
[0056]
[0057] S305: Match corresponding transaction objects for each winning producer and seller based on the supply and demand balance of energy transactions between the winning producers and sellers, generate a P2P transaction plan for each winning producer and seller in transaction period t, including the winning transaction volume and winning price.
[0058] Preferably, in step S4, the equipment cost model constructed includes:
[0059] 1) Air conditioning equipment cost model
[0060] Incompatibility cost model for air conditioning equipment:
[0061]
[0062] Constraints:
[0063]
[0064] Where: represents the incompatibility cost of air-conditioning equipment of prosumer n; t represents the current period, T represents the total number of trading periods divided into energy trading days; a n coefficients of the air conditioning equipment discomfort cost model representing environmental preferences; Indicates the indoor temperature controlled by the air conditioner; Indicates the lower and upper limits of indoor temperature; Indicates the outdoor temperature; Indicates the power consumption of air conditioner; C n and R n represent the heat capacity and thermal resistance of the HVAC unit respectively; η represents the energy efficiency of air conditioning operation; T ref Indicates the set comfort temperature;
[0065] 2) Energy storage equipment cost model
[0066] Cost model of energy storage equipment:
[0067]
[0068] Constraints:
[0069]
[0070] Where: represents the energy storage equipment cost of prosumer n; They represent the charging and discharging amounts of prosumer n during trading period t, respectively; P represents the given coefficient of the degradation cost per unit energy charge and discharge; essc,Max 、P essd,Max Represent the maximum charging efficiency and discharging efficiency respectively; represents the battery charge state of prosumer n during trading period t; and Indicates charging efficiency and discharging efficiency; SoC min , SoC max Represent the minimum and maximum charge states respectively;
[0071] 3) Electric vehicle charging model
[0072] Inconvenience cost model for electric vehicle charging:
[0073]
[0074] Constraints:
[0075]
[0076] Where: represents the inconvenience cost of electric vehicle charging for prosumer n; represents the charge of the electric vehicle; β n represents the coefficient of the inconvenience cost model for electric vehicle charging; represents the daily energy demand of the tram, where the total daily charge amount of the tram satisfies the daily energy demand of the tram; Indicates the minimum charging vehicle power; Indicates the maximum charging vehicle power;
[0077] 4) Trading volume constraints:
[0078]
[0079] Where: represents the energy purchased by prosumer n during trading period t; represents the energy sold by prosumer n during trading period t; represents energy purchased from the utility; Represents energy purchased from other producers and sellers; represents the energy sold to the utility; Represents energy sold to other producers and sellers; represents the maximum amount of energy sold to the utility; represents the maximum amount of energy purchased from the utility; Indicates the maximum amount of energy purchased from other producers and sellers; It represents the maximum amount of energy sold to other producers and sellers; represents the photovoltaic power generation of prosumer n in trading period t; represents the net energy charged and discharged by prosumer n during trading period t; N represents the base load of prosumer n in trading period t; Others Indicates other producers and sellers except n.
[0080] Preferably, in step S5, the objective function formula of the second-stage transaction allocation model is expressed as:
[0081]
[0082] Constraints:
[0083]
[0084] Where: represents the price at which the utility is sold; represents the purchase price of the utility; d np represents the P2P transaction loss between prosumer n and prosumer p; Indicates the producer and seller who did not win the bid.
[0085] Preferably, in step S5, the second-stage transaction allocation model is solved by the following steps:
[0086] S501: Introduce Lagrange multipliers to transform the objective function of the second-stage transaction allocation model into Formula 5;
[0087] Formula 5 is expressed as:
[0088]
[0089] Constraints:
[0090]
[0091] S502: Solve the dual function by using Formula 5 to obtain Formula 6. Formula 6 is expressed as:
[0092] F * =max λ F(λ);
[0093] Constraints:
[0094]
[0095]
[0096] S503: Decompose Formula 6 into the cost function of each unsuccessful prosumer to obtain Formula 7; solve Formula 7 to obtain the energy purchased or sold by each unsuccessful prosumer during transaction period t, the predicted comprehensive cost, the transaction object, and the corresponding equipment scheduling plan;
[0097] Formula 7 is expressed as:
[0098]
[0099] Constraints:
[0100]
[0101]
[0102] Where: n,t represents the predicted comprehensive cost of the unsuccessful bidder n in transaction period t;
[0103] S504: Using the subgradient method to update the Lagrange multiplier of formula 7;
[0104] The formula is:
[0105]
[0106] Where: k represents the number of iterations; α n Indicates a fixed step size (a positive number);
[0107] S505: Repeat S503 to S504 to perform iterative calculations until convergence, and obtain the energy purchased or sold, predicted comprehensive cost, transaction object and corresponding equipment scheduling plan of each unsuccessful producer and seller in the transaction period t.
[0108] Preferably, in step S506, when the updated Lagrange multiplier satisfies the convergence judgment formula, it indicates that the calculation result converges;
[0109] The convergence judgment formula is expressed as:
[0110] ∣λ n,t (k+1)-λ n,t (k)∣≤ε;
[0111] Where: ε represents the set threshold.
[0112] Preferably, in step S506, the equipment scheduling plan includes air conditioning power consumption Charge capacity Discharge and electric vehicle charging capacity
[0113] Preferably, when all Lagrange multipliers remain unchanged, it indicates that P2P trading has been saturated, and the prosumers are guided to trade unbalanced energy with the utility. The specific steps are as follows:
[0114] S506: When updating the Lagrange multiplier, the change in the Lagrange multiplier V is recorded using the following formula: n (k);
[0115] The formula is:
[0116] V n (k) = λ n (k+1)-λ n (k);
[0117] S507: Change V by Lagrange multiplier n (k) Determine whether energy trading no longer meets the needs of producers and sellers, that is, determine whether all changes in the plans of producers and consumers meet V multiple times. n,t (k)-V n,t (k-1)<ξ: If so, the remaining untradable energy can be directly allocated for trading with the utility.
[0118] Compared with the existing technology, the two-stage P2P energy trading scheduling method based on supply and demand balance and cost optimization in this invention has the following beneficial effects:
[0119] This invention proposes a two-stage P2P energy trading scheduling method. In the first stage, a first-stage transaction allocation model is constructed based on the bid plans submitted by prosumers, aiming to maximize energy allocation balance. The bid plans of all prosumers are comprehensively considered to determine the winning prosumer participating in the P2P transaction. A P2P transaction plan that is superior to the winning prosumer's original bid plan is generated to ensure the rationality of the winning prosumer's energy allocation and energy utilization, thereby improving the rationality of energy allocation in community P2P energy trading. In the second stage, for prosumers capable of engaging in P2P energy trading but unsuccessful in the first stage, their equipment costs are calculated using an equipment cost model. A second-stage transaction allocation model is constructed to minimize equipment and transaction costs. Based on the equipment costs of unsuccessful prosumers, a reasonable P2P transaction plan and equipment scheduling plan are generated. This allows unsuccessful prosumers to minimize equipment usage and transaction costs while meeting their own energy needs. This allows unsuccessful prosumers to participate in energy sharing through a reasonable equipment scheduling plan, thereby improving the degree of energy sharing in community P2P energy trading.
[0120] This invention allows prosumers to independently formulate bidding plans based on their energy trading volumes and bid prices. In the first phase, prosumers calculate their bid plans using a bidding plan model and participate in transaction allocation. This autonomous bidding mechanism ensures prosumers' autonomy in P2P energy trading, enabling them to make decisions based on maximizing their own interests. In the second phase, unsuccessful prosumers can independently schedule equipment operations based on the generated equipment scheduling plan. This flexibility enables prosumers to better adapt to energy market changes and improve their competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0121] In order to make the purpose, technical solutions and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0122] Figure 1 The logical block diagram of the two-stage P2P energy trading scheduling method based on supply and demand balance and cost optimization. DETAILED DESCRIPTION
[0123] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0124] It should be noted that similar reference numerals and letters denote similar items in the following figures. Therefore, once an item is defined in one figure, it does not require further definition or explanation in subsequent figures. In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer" indicate positions or relationships based on the positions or relationships shown in the figures, or the positions or relationships in which the inventive product is typically placed when in use. These terms are intended solely to facilitate the description of the present invention and simplify the description. They do not indicate or imply that the devices or components referred to must have a specific orientation, be constructed, or operate in a specific orientation, and are therefore not to be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third," etc., are used solely to distinguish descriptions and are not to be construed as indicating or implying relative importance. Furthermore, terms such as "horizontal" and "vertical" do not imply that a component is absolutely horizontal or overhanging, but rather may be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but rather may be slightly tilted. In the description of the present invention, it should also be noted that, unless otherwise expressly specified or limited, the terms "disposed," "installed," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0125] The following is a further detailed description through specific implementation methods:
[0126] Example:
[0127] This embodiment discloses a two-stage P2P energy trading scheduling method based on supply-demand balancing and cost optimization. In this method, a community includes an operator, a utility, and multiple prosumers. Operators are the builders and managers of the P2P energy trading platform, responsible for technical support, rule-making, and transaction security. Utilities are traditional energy suppliers (such as power grid companies and power generation companies), who transform into service providers or balancers in P2P transactions. Prosumers are users who both produce (such as installing photovoltaic panels) and consume electricity, achieving energy sharing and profit through P2P transactions.
[0128] like Figure 1 As shown in Figure 2, a two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization includes:
[0129] S1: Divide the energy trading day into several trading sessions;
[0130] In this embodiment, the cycle length of the entire energy trading day is from 8:00 am to 6:00 pm, and the entire energy trading day T = {1, 2, 3, ..., 10} is optimized. For any time period, t∈TN = {1, 2, 3, ..., 10} represents the producers and sellers in the community.
[0131] S2: Obtain the bidding plans of each producer and seller through the constructed bidding plan model;
[0132] S3: Based on the bidding plans of all prosumers, a first-stage transaction allocation model is constructed with the goal of maximizing energy distribution balance. The first-stage transaction allocation model is solved to determine the winning prosumer participating in the P2P transaction and generate the winning prosumer's P2P transaction plan.
[0133] S4: Calculate the equipment cost of the unsuccessful bidders through the constructed equipment cost model;
[0134] S5: Based on the equipment costs of the unsuccessful prosumers, a second-stage transaction allocation model is constructed with the goal of minimizing equipment costs and transaction costs. The second-stage transaction allocation model is solved to generate the P2P transaction plan and equipment scheduling plan for the unsuccessful prosumers.
[0135] S6: Execute steps S2 to S5 during each trading period on the energy trading day to obtain the P2P trading plan of the winning producer and seller and the P2P trading plan and equipment scheduling plan of the unsuccessful producer and seller, and execute these P2P energy transactions and equipment scheduling in the future.
[0136] This invention proposes a two-stage P2P energy trading scheduling method. In the first stage, a first-stage transaction allocation model is constructed based on the bid plans submitted by prosumers, aiming to maximize energy allocation balance. The bid plans of all prosumers are comprehensively considered to determine the winning prosumer participating in the P2P transaction. A P2P transaction plan that is superior to the winning prosumer's original bid plan is generated to ensure the rationality of the winning prosumer's energy allocation and energy utilization, thereby improving the rationality of energy allocation in community P2P energy trading. In the second stage, for prosumers capable of engaging in P2P energy trading but unsuccessful in the first stage, their equipment costs are calculated using an equipment cost model. A second-stage transaction allocation model is constructed to minimize equipment and transaction costs. Based on the equipment costs of unsuccessful prosumers, a reasonable P2P transaction plan and equipment scheduling plan are generated. This allows unsuccessful prosumers to minimize equipment usage and transaction costs while meeting their own energy needs. This allows unsuccessful prosumers to participate in energy sharing through a reasonable equipment scheduling plan, thereby improving the degree of energy sharing in community P2P energy trading.
[0137] This invention allows prosumers to independently formulate bidding plans based on their energy trading volumes and bid prices. In the first phase, prosumers calculate their bid plans using a bidding plan model and participate in transaction allocation. This autonomous bidding mechanism ensures prosumers' autonomy in P2P energy trading, enabling them to make decisions based on maximizing their own interests. In the second phase, unsuccessful prosumers can independently schedule equipment operations based on the generated equipment scheduling plan. This flexibility enables prosumers to better adapt to energy market changes and improve their competitiveness.
[0138] Existing auction strategies typically use price as the primary competitive factor, which can lead to uneven energy distribution and excessive costs. The two-stage P2P energy trading scheduling method of the present invention reduces costs while ensuring reasonable energy distribution by comprehensively considering energy distribution balance and equipment costs. Existing distributed strategies typically require complex calculations and coordination mechanisms, resulting in high computational complexity and potentially limiting user autonomy. The two-stage P2P energy trading scheduling method of the present invention reduces computational complexity while ensuring user autonomy by establishing a concise and effective optimization solution model.
[0139] In order to better introduce the technical solution of the present invention, this embodiment is described through the following parts.
[0140] 1. Equipment Cost Model
[0141] In this embodiment, the constructed equipment cost model includes:
[0142] 1) Air conditioning equipment cost model
[0143] Incompatibility cost model for air conditioning equipment:
[0144]
[0145] Constraints:
[0146]
[0147] Where: represents the incompatibility cost of air-conditioning equipment of prosumer n; t represents the current period, T represents the total number of trading periods divided into energy trading days; a n coefficients of the air conditioning equipment discomfort cost model representing environmental preferences; Indicates the indoor temperature controlled by the air conditioner; Indicates the lower and upper limits of indoor temperature; Indicates the outdoor temperature; represents the energy consumption of heating or cooling operation by prosumer n during trading period t, i.e., the power consumption of air conditioner; C n and R n They represent the heat capacity and thermal resistance of the HVAC (HVAC is the abbreviation of Heating, Ventilation, and Air Conditioning) unit respectively; η represents the energy efficiency of air conditioning operation, such as η cooling is positive and heating is negative; T ref Indicates the set comfort temperature; the indoor temperature controlled by the air conditioner Mainly with the current outdoor temperature and energy consumption for heating or cooling operations And change.
[0148] 2) Energy storage equipment cost model
[0149] Cost model of energy storage equipment:
[0150]
[0151] Constraints:
[0152]
[0153] Where: represents the energy storage equipment cost of prosumer n; They represent the charging and discharging amounts of prosumer n during trading period t, respectively; P represents the given coefficient of the degradation cost per unit energy charge and discharge; essc,Max 、P essd,Max Represent the maximum charging efficiency and discharging efficiency respectively; represents the battery state of charge (SoC) of prosumer n during trading period t; and Indicates charging efficiency and discharging efficiency; SoC min , SoC max Represent the minimum and maximum charge states respectively; Δ(t) represents the charge state of the battery, indicating changes with charging and discharging;
[0154] 3) Electric vehicle charging model
[0155] Inconvenience cost model for electric vehicle charging:
[0156]
[0157] Constraints:
[0158]
[0159] Where: represents the inconvenience cost of electric vehicle charging for prosumer n; represents the charge of the electric vehicle; β n represents the coefficient of the inconvenience cost model for electric vehicle charging; represents the daily energy demand of the tram, where the total daily charge amount of the tram satisfies the daily energy demand of the tram; Indicates the minimum charging vehicle power; Indicates the maximum charging vehicle power; Δt indicates that the charging amount during the entire time period is equal to the required charging amount, where t represents the charging time period;
[0160] 4) Trading volume constraints:
[0161]
[0162] Where: represents the energy purchased by prosumer n during trading period t; represents the energy sold by prosumer n during trading period t; represents energy purchased from the utility; Represents energy purchased from other producers and sellers; represents the energy sold to the utility; Represents energy sold to other producers and sellers; represents the maximum amount of energy sold to the utility; represents the maximum amount of energy purchased from the utility; Indicates the maximum amount of energy purchased from other producers and sellers; It represents the maximum amount of energy sold to other producers and sellers; represents the photovoltaic power generation of prosumer n in trading period t; represents the net energy charged and discharged by prosumer n during trading period t; represents the base load of prosumer n in trading period t.
[0163] 2. Bidding Plan Model
[0164] In this embodiment, the formula of the bidding plan model is expressed as:
[0165]
[0166] Where: NEQ n represents the bidding plan of prosumer n; NE n represents the set of bid transaction volumes (i.e., net energy) of producer / consumer n at each moment; represents the set of purchase bid prices of producer / consumer n corresponding to the bid transaction volume at each moment; represents the set of selling bid prices of producer-consumer n corresponding to the bid transaction volume at each moment;
[0167] It should be noted that the bid price described in this article is based on the comprehensive cost of energy production, with the goal of preventing energy producers and sellers from incurring losses by participating in P2P energy trading. Therefore, the bid price can also be described as the actual comprehensive cost of energy production.
[0168] in:
[0169] The formula for calculating the bid transaction volume of producer-consumer n in trading period t is expressed as:
[0170]
[0171] If the bid transaction volume of prosumer n in trading period t is greater than 0, it is a buyer;
[0172] If the bid transaction volume of prosumer n in trading period t is less than 0, it is a seller;
[0173] The bidding price constraint formula of prosumer n is expressed as:
[0174]
[0175] Where: represents the total energy demand of prosumer n in trading period t; represents the total energy production of prosumer n in trading period t; represents the price at which the utility is sold; Represents the purchase price of the utility.
[0176] After receiving the bidding plans from producers and sellers, the operator will sort the plans of sellers and buyers. The sellers' bidding plans will be sorted from high to low according to the bidding price, and the buyers' will be sorted from low to high. The transaction volume and the predicted comprehensive cost will then be solved through the objective function of maximizing community welfare.
[0177] 3. Phase 1 Transaction Allocation Model
[0178] In this embodiment, the objective function formula of the first-stage transaction allocation model is expressed as:
[0179]
[0180] Constraints:
[0181]
[0182] Where: represents the purchase bid price of buyer i (given); represents the winning bid purchase quantity of buyer i (needs to be calculated); represents the selling bid price of seller j; N represents the winning bid quantity of seller j; B Indicates the number of buyers; N S represents the number of sellers; P i t,B represents the maximum winning bid purchase quantity of buyer i; P j t,S represents the maximum winning bid quantity sold by seller j.
[0183] Specifically, the first-stage transaction allocation model is solved through the following steps:
[0184] S301: Convert the objective function of the first-stage transaction allocation model into Formula 1:
[0185] Formula 1 is expressed as:
[0186]
[0187] S302: Convert the linear programming problem of Formula 1 into a standardized form to obtain Formula 2; solve Formula 2 to obtain the winning purchase quantity and winning sales quantity of each buyer and seller, and determine the winning producer and seller;
[0188] Formula 2 is expressed as:
[0189] minC T *p(32)
[0190] Constraints:
[0191] A eq *p=b eq (33)
[0192] A in *p≤b in (34)
[0193] p≥0 (35)
[0194]
[0195] The first N of p S Seller transaction volume From N S +1 to N B Buyer transaction volume
[0196]
[0197] If the winning purchase quantity or winning sales quantity of the buyer or seller is not 0, then the buyer or seller is the winning producer and seller; if the winning purchase quantity or winning sales quantity of the buyer or seller is 0, then the buyer or seller is the unsuccessful producer and seller;
[0198] S303: Convert Formula 1 into the following dual form to obtain Formula 3;
[0199] Formula 3 is expressed as:
[0200]
[0201] Constraints:
[0202]
[0203] Where: and They represent the revenue of buyer i and seller j respectively; P j t,S and P i t,B denote the winning purchase quantity and winning sales quantity of buyer i and seller j respectively; S denotes the set of sellers; B denotes the set of buyers; represents the winning bid price in trading period t;
[0204] It should be noted that the winning bid price described in this article is based on the comprehensive cost of energy production predicted by the first-stage transaction allocation model. This is intended to prevent energy producers and sellers from incurring losses through participation in P2P energy trading. Therefore, the winning bid price can also be described as the predicted comprehensive cost of energy production.
[0205] S304: Convert Formula 3 into a standardized form to obtain Formula 4; solve Formula 4 to obtain the winning bid price for trading period t;
[0206] Formula 4 is expressed as:
[0207]
[0208] Constraints:
[0209]
[0210] S305: Match corresponding transaction objects for each winning producer and seller based on the supply and demand balance of energy transactions between the winning producers and sellers, generate a P2P transaction plan for each winning producer and seller in transaction period t, including the winning transaction volume and winning price.
[0211] 4. Phase II Transaction Allocation Model
[0212] After the first phase, some prosumers remain unsuccessful bidders and are unable to participate in P2P transactions, which reduces P2P sharing and increases social costs. To address this issue, this paper proposes a multi-constraint coupled dual decomposition distributed optimization algorithm to minimize their equipment costs and obtain a P2P transaction plan.
[0213] In this embodiment, the objective function formula of the second-stage transaction allocation model is expressed as:
[0214]
[0215] In the objective function, the first term represents the cost of purchasing from the utility, the second term is the profit obtained by selling to the utility, the third term is the cost of air conditioning, the fourth term is the cost of energy storage, the fifth term is the cost of charging the tram, and the sixth term is the cost of P2P transaction losses.
[0216] Constraints:
[0217]
[0218]
[0219] Constraint (49) corresponds to the fact that the amount of electricity purchased from producer n by other producers and sellers is equal to the amount of electricity sold by producer n, ensuring the buying and selling balance of producer n.
[0220] Where: represents the price at which the utility is sold; represents the purchase price of the utility; d np Represents the P2P transaction loss between prosumer n and prosumer p.
[0221] Specifically, the second-stage transaction allocation model is solved through the following steps:
[0222] S501: Introduce Lagrange multipliers to transform the objective function of the second-stage transaction allocation model into Formula 5;
[0223] Formula 5 is expressed as:
[0224]
[0225] Constraints: (2), (3), (5)-(8), (10)-(18)
[0226] S502: Since the original function is a convex function and difficult to solve, the dual function is solved by Formula 5 to obtain Formula 6;
[0227] Formula 6 is expressed as:
[0228] F * =max λ F(λ) (51)
[0229] Constraints: (2), (3), (5)-(8), (10)-(18)
[0230] S503: Decompose Formula 6 into the cost function of each unsuccessful prosumer to obtain Formula 7; solve Formula 7 to obtain the energy purchased and sold by each unsuccessful prosumer during the trading period t and the predicted comprehensive cost, i.e., λ n,t ;
[0231] It should be noted that the predicted comprehensive cost is generated through the second-stage transaction allocation model. In actual P2P energy transactions, producers and sellers who did not win the bid can refer to the predicted comprehensive cost to formulate their own transaction prices to avoid losses due to participating in P2P energy transactions.
[0232] Formula 7 is expressed as:
[0233]
[0234] Constraints: (2), (3), (5)-(8), (10)-(18)
[0235] Where: n,t It represents the predicted comprehensive cost of the unsuccessful prosumer n in the transaction period t. That is, other prosumers who want to purchase electricity from prosumer n must trade at this price:
[0236] S504: Using the subgradient method to update the Lagrange multiplier of formula 7;
[0237] The formula is:
[0238]
[0239] Where: k represents the number of iterations; α n Indicates a fixed step size (a positive number);
[0240] S505: Repeat S503 to S504 to perform iterative calculations until convergence, and obtain the energy purchased and sold by each unsuccessful producer and seller during the trading period t and the predicted comprehensive cost;
[0241] When the updated Lagrange multiplier satisfies the convergence judgment formula, it means that the calculation result converges;
[0242] The convergence judgment formula is expressed as:
[0243] ∣λ n,t (k+1)-λ n,t (k)∣≤ε (54)
[0244] Where: ε represents the set threshold.
[0245] λ n,t is the predicted comprehensive cost of producer-seller n. If other producers and consumers want to purchase electricity from n, they must trade at this price. In addition, the public constraint (49) is satisfied by the sub-gradient method, that is, it is implemented through continuous iteration of (54), which is actually equivalent to the clearing process of the interactive platform within the community. When the buying and selling of a producer-seller is unbalanced, his P2P plan needs to be updated. For example, if the amount purchased by other producers and consumers from producer-seller n is greater than the amount sold by producer-seller n, that is, the demand for producer-seller n is greater than the supply, the price of producer-seller n will rise through (51), and vice versa. According to the above steps, the trading plan TX2 of the second stage producer-seller n at this moment can be determined. n,t and equipment scheduling SCP n,t .
[0246] S506: Match the corresponding transaction objects for each unsuccessful bidder based on the supply and demand balance, and generate a P2P transaction plan for each unsuccessful bidder in the transaction period t, including the sales transaction volume, the predicted comprehensive cost and the transaction object, as well as the equipment scheduling plan. The equipment scheduling plan includes the air conditioning power consumption Charge capacity Discharge and electric vehicle charging capacity
[0247] 5. Trading Imbalanced Energy
[0248] When there is a significant imbalance between supply and demand within a community, convergence may not occur. Our analysis suggests that this non-convergence is caused by P2P trading within the community failing to meet the trading needs of prosumers, yet prosumers continue to pursue P2P trading within the community. Therefore, we should assess whether P2P trading within the community fails to meet the trading needs of prosumers. If so, this creates an energy imbalance with the utility.
[0249] In the specific algorithm, determining whether P2P transactions within a community are unable to meet the trading needs of prosumers is equivalent to determining whether the changes in the Lagrange multiplier are stable. Because each Lagrange multiplier reflects the P2P transactions of a single prosumer, all Lagrange multipliers reflect the P2P transactions of the entire community, and the changes in all Lagrange multipliers reflect the changes in P2P transactions within the community. When all Lagrange multipliers remain unchanged after updating the Lagrange multipliers, it indicates that P2P transactions have reached saturation, guiding prosumers to trade unbalanced energy with utilities. The specific steps are as follows:
[0250] S506: When updating the Lagrange multiplier, the change in the Lagrange multiplier V is recorded using the following formula: n (k);
[0251] The formula is:
[0252] V n (k) = λ n (k+1)-λ n (k) (55)
[0253] S507: Change V by Lagrange multiplier n (k) Determine whether energy trading no longer meets the needs of producers and sellers, that is, determine whether all changes in the plans of producers and consumers meet V multiple times. n,t (k)-V n,t (k-1)<ξ: If so, the remaining untradable energy (excess energy) can be directly allocated for trading with the utility.
[0254] In this embodiment, the settings of key parameters are shown in the following table.
[0255]
[0256] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the technical solutions. Those skilled in the art should understand that modifications or equivalent replacements of the technical solutions of the present invention that do not depart from the purpose and scope of the technical solutions of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization, characterized by: include: S1: Divide the energy trading day into several trading sessions; S2: Obtain the bidding plans of each producer and seller through the constructed bidding plan model; S3: Based on the bidding plans of all prosumers, a first-stage transaction allocation model is constructed with the goal of maximizing energy distribution balance. The first-stage transaction allocation model is solved to determine the winning prosumer participating in the P2P transaction and generate the winning prosumer's P2P transaction plan. S4: Calculate the equipment cost of the unsuccessful bidders through the constructed equipment cost model; S5: Based on the equipment costs of the unsuccessful prosumers, a second-stage transaction allocation model is constructed with the goal of minimizing equipment costs and transaction costs. The second-stage transaction allocation model is solved to generate the P2P transaction plan and equipment scheduling plan for the unsuccessful prosumers. S6: Execute steps S2 to S5 during each trading period on the energy trading day to obtain the P2P trading plan of the winning producer and seller and the P2P trading plan and equipment scheduling plan of the unsuccessful producer and seller, and execute these P2P energy transactions and equipment scheduling in the future.
2. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 1 is characterized by: In step S2, the formula of the bidding plan model is expressed as: Where: NEQ n represents the bidding plan of prosumer n; NE n represents the set of bid transaction volumes of producer and consumer n at each moment; represents the set of purchase bid prices of producer / consumer n corresponding to the bid transaction volume at each moment; represents the set of selling bid prices of producer-consumer n corresponding to the bid transaction volume at each moment; in: The formula for calculating the bid transaction volume of producer-consumer n in trading period t is expressed as: If the bid transaction volume of prosumer n in trading period t is greater than 0, it is a buyer; If the bid transaction volume of prosumer n in trading period t is less than 0, it is a seller; The bidding price constraint formula of prosumer n is expressed as: Where: represents the total energy demand of prosumer n in trading period t; represents the total energy production of prosumer n in trading period t; Indicates the power consumption of air conditioner; Indicates the charge level of the electric vehicle; represents the base load of prosumer n in trading period t; represents the photovoltaic power generation of prosumer n in trading period t; represents the net energy charged and discharged by prosumer n during trading period t; represents the price at which the utility is sold; Represents the purchase price of the utility.
3. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 2 is characterized by: In step S3, the objective function formula of the first-stage transaction allocation model is expressed as: Constraints: Where: represents the purchase bid price of buyer i; represents the winning bid purchase quantity of buyer i; represents the selling bid price of seller j; N represents the winning bid quantity of seller j; B Indicates the number of buyers; N S Indicates the number of sellers; represents the maximum winning bid purchase quantity of buyer i; represents the maximum winning bid quantity sold by seller j.
4. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 3 is characterized by: In step S3, the first-stage transaction allocation model is solved by the following steps: S301: Convert the objective function of the first-stage transaction allocation model into Formula 1: Formula 1 is expressed as: S302: Convert the linear programming problem of Formula 1 into a standardized form to obtain Formula 2; solve Formula 2 to obtain the winning purchase quantity and winning sales quantity of each buyer and seller, and determine the winning producer and seller; Formula 2 is expressed as: minC T *p; Constraints: A eq *p=b eq ; A in *p≤b in ; p≥0; The first N of p S Seller transaction volume From N S +1 to N B Buyer transaction volume If the winning purchase quantity or winning sales quantity of the buyer or seller is not 0, then the buyer or seller is the winning producer and seller; if the winning purchase quantity or winning sales quantity of the buyer or seller is 0, then the buyer or seller is the unsuccessful producer and seller; S303: Convert Formula 1 into the following dual form to obtain Formula 3; Formula 3 is expressed as: Constraints: Where: and denote the revenue of buyer i and seller j respectively; and denote the winning purchase quantity and winning sales quantity of buyer i and seller j respectively; S denotes the set of sellers; B denotes the set of buyers; represents the winning bid price in trading period t; S304: Convert Formula 3 into a standardized form to obtain Formula 4; solve Formula 4 to obtain the winning bid price for trading period t; Formula 4 is expressed as: Constraints: S305: Match corresponding transaction objects for each winning producer and seller based on the supply and demand balance of energy transactions between the winning producers and sellers, generate a P2P transaction plan for each winning producer and seller in transaction period t, including the winning transaction volume and winning price.
5. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 1 is characterized in that: In step S4, the equipment cost model constructed includes: 1) Air conditioning equipment cost model Incompatibility cost model for air conditioning equipment: Constraints: Where: represents the incompatibility cost of air-conditioning equipment of prosumer n; t represents the current period, T represents the total number of trading periods divided into energy trading days; a n coefficients of the air conditioning equipment discomfort cost model representing environmental preferences; Indicates the indoor temperature controlled by the air conditioner; Indicates the lower and upper limits of indoor temperature; Indicates the outdoor temperature; Indicates the power consumption of air conditioner; C n and R n represent the heat capacity and thermal resistance of the HVAC unit respectively; η represents the energy efficiency of air conditioning operation; T ref Indicates the set comfort temperature; 2) Energy storage equipment cost model Cost model of energy storage equipment: Constraints: Where: represents the energy storage equipment cost of prosumer n; They represent the charging and discharging amounts of prosumer n during trading period t, respectively; A given coefficient representing the degradation cost per unit energy charge and discharge; essc,Max 、P essd,Max Represent the maximum charging efficiency and discharging efficiency respectively; represents the battery charge state of prosumer n during trading period t; and Indicates charging efficiency and discharging efficiency; SoC min , SoC max Represent the minimum and maximum charge states respectively; 3) Electric vehicle charging model Inconvenience cost model for electric vehicle charging: Constraints: Where: represents the inconvenience cost of electric vehicle charging for prosumer n; represents the charge of the electric vehicle; β n represents the coefficient of the inconvenience cost model for electric vehicle charging; represents the daily energy demand of the tram, where the total daily charge amount of the tram satisfies the daily energy demand of the tram; Indicates the minimum charging vehicle power; Indicates the maximum charging vehicle power; 4) Trading volume constraints: Where: represents the energy purchased by prosumer n during trading period t; represents the energy sold by prosumer n during trading period t; represents energy purchased from the utility; Represents energy purchased from other producers and sellers; represents the energy sold to the utility; Represents energy sold to other producers and sellers; represents the maximum amount of energy sold to the utility; represents the maximum amount of energy purchased from the utility; Indicates the maximum amount of energy purchased from other producers and sellers; It represents the maximum amount of energy sold to other producers and sellers; represents the photovoltaic power generation of prosumer n in trading period t; represents the net energy charged and discharged by prosumer n during trading period t; N represents the base load of prosumer n in trading period t; Others Indicates other producers and sellers except n.
6. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 5 is characterized by: In step S5, the objective function formula of the second-stage transaction allocation model is expressed as: Constraints: Where: represents the price at which the utility is sold; represents the purchase price of the utility; d np represents the P2P transaction loss between prosumer n and prosumer p; Indicates the producer and seller who did not win the bid.
7. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 6 is characterized by: In step S5, the second-stage transaction allocation model is solved by the following steps: S501: Introduce Lagrange multipliers to transform the objective function of the second-stage transaction allocation model into Formula 5; Formula 5 is expressed as: Constraints: S502: Solve the dual function using Formula 5 to obtain Formula 6; Formula 6 is expressed as: F * =max λ F(λ); Constraints: S503: Decompose Formula 6 into the cost function of each unsuccessful prosumer to obtain Formula 7; solve Formula 7 to obtain the energy purchased or sold by each unsuccessful prosumer during transaction period t, the predicted comprehensive cost, the transaction object, and the corresponding equipment scheduling plan; Formula 7 is expressed as: Constraints: Where: n,t represents the predicted comprehensive cost of the unsuccessful bidder n in transaction period t; S504: Using the subgradient method to update the Lagrange multiplier of formula 7; The formula is: Where: k represents the number of iterations; α n Indicates a fixed step size; S505: Repeat S503 to S504 to perform iterative calculations until convergence, and obtain the energy purchased or sold, predicted comprehensive cost, transaction object of each unsuccessful producer and seller in the transaction period t as the P2P transaction plan, and the corresponding equipment scheduling plan.
8. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 7 is characterized by: In step S506, when the updated Lagrange multiplier satisfies the convergence judgment formula, it indicates that the calculation result converges; The convergence judgment formula is expressed as: ∣λ n,t (k+1)-λ n,t (k)∣≤ε; Where: ε represents the set threshold.
9. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 7, characterized in that: In step S506, the equipment scheduling plan includes air conditioning power consumption Charge capacity Discharge and electric vehicle charging capacity 10. The two-stage P2P energy trading scheduling method based on supply-demand balance and cost optimization according to claim 7, characterized in that: When all Lagrange multipliers remain unchanged, it indicates that P2P trading has been saturated, guiding prosumers to trade unbalanced energy with utilities. The specific steps are as follows: S506: When updating the Lagrange multiplier, the change in the Lagrange multiplier V is recorded using the following formula: n (k); The formula is: V n (k)=λ n (k+1)-λ n (k); S507: Change V by Lagrange multiplier n (k) Determine whether energy trading no longer meets the needs of producers and sellers, that is, determine whether all changes in the plans of producers and consumers meet V multiple times. n,t (k)-V n,t (k-1)<ξ: If so, the remaining untradable energy can be directly allocated for trading with the utility.