A method for energy trading in battery swap stations based on smart contracts and multi-party secure computing

By combining smart contracts and multi-party secure computation, the issues of renewable energy volatility and data privacy in the energy management of battery swapping stations have been resolved, achieving efficient, secure, and transparent energy management and promoting cooperation and trust among battery swapping stations.

CN118735520BActive Publication Date: 2025-10-28THE CHINESE UNIV OF HONG KONG (SHENZHEN)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410738625.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2025-10-28
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

Existing battery swapping station energy management systems struggle to achieve accurate energy forecasting and balancing when faced with the volatility and uncertainty of renewable energy sources. Furthermore, centralized management systems suffer from data security and privacy breaches, limiting the system's reliability and scalability.

Method used

By combining smart contracts and multi-party secure computation, and leveraging the decentralized and immutable characteristics of blockchain technology, a method for energy trading at battery swapping stations was designed to ensure the transparency and fairness of transactions. Furthermore, multi-party secure computation technology was used to calculate transaction amounts while protecting data privacy.

Benefits of technology

It enables energy complementarity and optimization between battery swapping stations, improves the efficiency and security of energy trading, protects the privacy of operational data, reduces reliance on centralized management, and ensures the fairness and privacy of the trading process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118735520B_ABST
    Figure CN118735520B_ABST
Patent Text Reader

Abstract

This invention discloses an energy trading method for battery swapping stations based on smart contracts and multi-party secure computation. The method comprises: S1, a decision-making model and solution method for a single battery swapping station; S2, designing an energy trading model for the battery swapping station based on the decision-making model of the single station, designing a distributed algorithm for solving the energy trading problem, and implementing the corresponding smart contract; and S3, designing the solution algorithm based on smart contracts and multi-party secure computation. This invention employs the above-mentioned energy trading method for battery swapping stations based on smart contracts and multi-party secure computation, ensuring both trading efficiency and privacy protection of battery swapping station operational data. It not only ensures the transparency and fairness of the trading process but also effectively protects the operational privacy of the battery swapping stations, enabling transactions and payment settlements to be completed without directly sharing sensitive information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of battery swapping station technology, and in particular to a battery swapping station energy trading method based on smart contracts and multi-party secure computation. Background Technology

[0002] With the increasing popularity of electric vehicles as a green mode of transportation, battery swapping stations have become a key infrastructure supporting the sustainable use of electric vehicles. These stations not only provide fast battery swapping services but also reduce reliance on traditional fossil fuels, promoting energy efficiency and environmental friendliness. However, with the increasing number of electric vehicles, battery swapping stations face numerous challenges, particularly in energy management and supply. Battery swapping stations that combine renewable energy sources such as wind and solar power are receiving particular attention because they help further reduce the carbon footprint of electric vehicles. While battery swapping stations that incorporate renewable energy offer an opportunity to transition to more sustainable energy consumption, this also brings new challenges.

[0003] First, the volatility and uncertainty of renewable energy bring complexity to the energy management of battery swapping stations, making accurate forecasting and balancing of energy supply and demand a challenge. Second, as battery swapping station networks expand, how to effectively conduct energy trading to achieve energy complementarity and optimize costs has become an urgent problem to be solved. Furthermore, ensuring the security and privacy protection of operational data at battery swapping stations during energy trading is crucial for fostering trust and cooperation among stations. Existing technologies have significant shortcomings in addressing these challenges. Centralized energy management and trading systems are prone to data security and privacy breaches, limiting system reliability and scalability.

[0004] The existing energy trading framework fails to fully leverage the synergistic advantages among battery swapping stations, resulting in the underutilization of renewable energy potential. Furthermore, the means to address the volatility and uncertainty of renewable energy remain limited, making it difficult to guarantee the stability and efficiency of battery swapping stations in providing high-quality swapping services in the face of renewable energy fluctuations.

[0005] Therefore, a new solution is urgently needed to improve the efficiency of energy management in battery swapping stations, ensure the stability of energy supply, and protect the privacy of operational data. This invention proposes an energy trading method for battery swapping stations that combines smart contracts and multi-party secure computation. This method aims to optimize energy trading and management between battery swapping stations. Through the collaborative work of smart contracts and multi-party secure computation, it achieves independent and efficient energy trading between stations while ensuring the privacy of the trading process and the operational data of the stations. This method consists of two main stages: First, each battery swapping station independently makes energy trading decisions based on its own energy demand and supply situation; second, the energy transaction is completed under the guidance of the smart contract. Leveraging the decentralized nature and data immutability of blockchain technology, this invention reduces reliance on centralized management, improves the security and fairness of energy trading, and effectively protects the operational privacy of battery swapping stations. Furthermore, by employing multi-party secure computation technology, the privacy and security of data for all parties involved in the transaction are ensured without directly sharing sensitive information, while accurately calculating the amount each battery swapping station needs to pay, thus guaranteeing the security and efficiency of the transaction. This invention can promote energy complementarity between battery swapping stations, optimize the utilization of renewable energy, and provide an effective new solution for achieving green and efficient energy management. Summary of the Invention

[0006] To address the aforementioned issues, this invention provides an energy trading method for battery swapping stations based on smart contracts and multi-party secure computation. First, the method combines smart contracts and multi-party secure computation: applying these technologies to energy trading and management between battery swapping stations ensures both transaction efficiency and privacy protection of station operational data. Second, deep integration with blockchain technology: leveraging the decentralized and immutable nature of blockchain technology ensures transparency and fairness in the transaction process while effectively protecting the operational privacy of battery swapping stations and reducing reliance on centralized management. Third, application of advanced multi-party secure computation technology: utilizing this technology, the amount payable by each party is calculated while protecting the privacy of each station's operational data, enabling transactions and payment settlements to be completed without directly sharing sensitive information.

[0007] To achieve the above objectives, this invention provides a method for energy trading at battery swapping stations based on smart contracts and multi-party secure computation, comprising the following steps:

[0008] S1. Decision-making model and solution method for a single battery swapping station;

[0009] S2. Design an energy trading model for a battery swapping station based on the decision-making model and solution method of a single battery swapping station, design a distributed algorithm for solving energy trading, and implement the corresponding smart contract.

[0010] S3. Design of a solution algorithm based on smart contracts and secure multi-party computation.

[0011] In step S1: The decision model and solution method for a single battery swapping station include the charging and discharging management of the battery swapping station, the power management of the battery swapping station, the power schedule optimization problem of the battery swapping station, and the transformation of the convex optimization problem. The charging and discharging management of the battery swapping station includes the battery set, the charging and discharging decision variables of the battery swapping station, the battery allocation decision variables of the battery swapping station, the battery power constraint, the battery swapping dynamic process, entering the battery swapping station, leaving the battery swapping station, the revenue of the battery swapping station, the discharge loss and the electric vehicle compensation.

[0012] Battery assembly: for battery swapping stations Define the set of batteries at time t for battery swapping station i. In battery swapping station n, each battery Described by a vector: in This represents the time it takes for battery j to arrive at battery swapping station n. This represents the time it takes for battery j to leave the battery swapping station n.

[0013] Battery swapping station charging and discharging decision variables: Battery swapping station n needs to determine the amount of charge each battery j receives at each time t. With discharge quantity Then the charging decision variables for battery swapping station n are a set. The discharge decision variables are a set While battery j is at battery swapping station n, the amount of charging and discharging at each time t cannot exceed the upper limit of charging and discharging:

[0014]

[0015] Furthermore, battery j cannot be charged and discharged simultaneously at each time t, thus resulting in the following non-convex constraint:

[0016]

[0017] Battery allocation decision variables for battery swapping stations: At each time t, battery swapping station n needs to decide how to allocate batteries to electric vehicles arriving for swapping. The set of electric vehicles arriving at battery swapping station n is used for... To indicate, for each battery The battery swapping station n decides whether to swap battery j for electric vehicle i, i.e.

[0018]

[0019] in If battery j is swapped to electric vehicle i, then battery j is not swapped to electric vehicle i; otherwise, battery j is not swapped to electric vehicle i. The battery allocation decision variables for battery swapping station n are a set:

[0020]

[0021] Battery capacity constraint: Define the battery charging and discharging efficiency as η∈(0,1), therefore, the capacity increase of battery j by charging is... The amount of electricity reduced by discharging is The formula for the change in charge of battery j is:

[0022]

[0023] And the charge level of battery j at any given moment should be within the battery's capacity range:

[0024]

[0025] Battery swapping dynamic process: The dynamic battery swapping process means that the battery needs to go through the process of entering the charging station and leaving the charging station.

[0026] Entering a battery swapping station: When an electric vehicle arrives at battery swapping station n for a battery swap, station n will receive the electric vehicle's battery and use it... Let represent the number of batteries received by battery swapping station n at time t. satisfy:

[0027]

[0028] In the model, the battery begins charging and discharging operations the moment it arrives at the battery swapping station n. Therefore, the battery arrival time is defined as...

[0029]

[0030] The battery charge at the battery swapping station n is determined by the battery charge of electric vehicle i. The decision

[0031]

[0032] Leaving a battery swapping station: When a battery is swapped to an electric vehicle, it is defined as leaving the swapping station. For swapping station n, the set of batteries leaving the swapping station is:

[0033]

[0034] Define the battery's off-time:

[0035]

[0036] The dynamic change process of the battery pack is as follows:

[0037]

[0038] Battery swapping station revenue: The revenue of battery swapping station n during the battery swapping process includes three parts: battery swapping fees, discharge losses, and compensation for electric vehicles. The battery swapping fee for battery swapping station n is the product of the battery swapping price P and the total number of battery swaps.

[0039]

[0040] Discharge loss: During the discharge of battery j At that time, losses will occur, specifically in the form of...

[0041]

[0042] Where a1, a2>0 are loss coefficients;

[0043] Electric vehicle compensation: Since the capacity of the swapped-out batteries may vary, the swapping station n will compensate for batteries that are not fully charged. A fully charged battery is defined as E. max The battery's charge level when it was replaced was... The compensation for electric vehicles will take the following form:

[0044]

[0045] Where a3 and a4>0 are compensation coefficients.

[0046] Preferably, in step S1, the power management of the battery swapping station includes the interaction between new energy sources and the power grid.

[0047] Preferably, in step S1, the revenue definition of the battery swapping station in the power schedule optimization problem includes charging and discharging revenue, battery compensation, and net costs of trading electricity with the grid.

[0048]

[0049] Preferably, in step S1, a greedy battery allocation strategy is defined in the transformation of the convex optimization problem.

[0050] Preferably, in step S2, the trading model is subject to three constraints: market clearing constraint, post-trade energy balance constraint, and incentive constraint.

[0051] Market clearing constraint: The market clearing constraint ensures that the energy transactions and payment amounts between swapping stations are balanced. Specifically, between any swapping station n and l, the amount of electricity purchased by n is equal to the amount of electricity sold by l.

[0052]

[0053] And the total amount paid by all battery swapping stations offsets each other:

[0054]

[0055] Energy balance constraints after the transaction: During the power management and transaction process of the battery swapping station, it is necessary to ensure the balance of power, that is, the balance between the demand and the amount of electricity received by all batteries;

[0056]

[0057] Incentive and constraint: When battery swapping station n participates in energy trading, its income should be higher than that when it does not participate in trading.

[0058] Preferably, in step S3, the Remix integrated development environment is used to deploy the smart contract.

[0059] This invention offers the following advantages: First, it designs a model compression method tailored to the adaptive characteristics of unsupervised domains. Second, it employs a battery swapping station energy trading method combining smart contracts and secure multi-party computation (SMPC): applying smart contracts and SMPC to energy trading and management between battery swapping stations ensures both trading efficiency and privacy protection of station operational data. Third, it deeply integrates blockchain technology: leveraging the decentralized and immutable nature of blockchain, it not only ensures transparency and fairness in the trading process but also effectively protects the operational privacy of battery swapping stations, reducing reliance on centralized management. Fourth, it utilizes advanced secure multi-party computation technology: by protecting the privacy of each battery swapping station's operational data, it calculates the amount each party needs to pay, enabling transactions and payment settlements to be completed without directly sharing sensitive information.

[0060] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0061] Figure 1 This is an overall flowchart of an energy trading method for battery swapping stations based on smart contracts and multi-party secure computation according to the present invention.

[0062] Figure 2 This is a schematic diagram of a smart contract for an energy trading method for battery swapping stations based on smart contracts and multi-party secure computation, according to the present invention.

[0063] Figure 3 This is a schematic diagram of a smart contract for a battery swapping station energy trading method based on smart contracts and multi-party secure computation according to the present invention. Detailed Implementation

[0064] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0065] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.

[0066] Example 1

[0067] like Figure 1-2 As shown, this invention provides a method for energy trading in battery swapping stations based on smart contracts and multi-party secure computation, comprising the following steps:

[0068] S1. Decision model and solution method for a single battery swapping station;

[0069] The decision-making model and solution method for a single battery swapping station include charging and discharging management, power management, power schedule optimization, and transformation of convex optimization problems.

[0070] Charging and discharging management of battery swapping stations:

[0071] Battery assembly:

[0072] There are T time points, and the set of all time points is:

[0073] There are N battery swapping stations, corresponding to the set of N.

[0074] For battery swapping stations We define the set of batteries j at battery swapping station n at time t as the set.

[0075] In battery swapping station n, each battery Described by a vector:

[0076] in, This represents the time it takes for battery j to arrive at battery swapping station n. This represents the time it takes for battery j to leave the battery swapping station n.

[0077] Battery swapping station charging and discharging decision variables:

[0078] The battery swapping station n needs to determine the amount of charge each battery j receives at each time t. With discharge quantity Then the charging decision variables for battery swapping station n are a set. The discharge decision variables are a set

[0079] While battery j is at battery swapping station n, the amount of charging and discharging at each time t cannot exceed the upper limit of charging and discharging:

[0080]

[0081] Furthermore, battery j cannot be charged and discharged simultaneously at each time t, thus resulting in the following non-convex constraint:

[0082]

[0083] Battery allocation decision variables for battery swapping stations:

[0084] At each time t, battery swapping station n needs to decide how to allocate batteries to the electric vehicles arriving for swapping. The set of electric vehicles arriving at battery swapping station n is used for... To express.

[0085] Specifically, for each battery Battery swapping station n decides whether to swap battery j for electric vehicle i.

[0086] Right now

[0087]

[0088] in, This means that battery j is swapped to electric vehicle i, and vice versa. The battery allocation decision variables for battery swapping station n are a set. Battery allocation needs to meet the following two constraints:

[0089] Battery allocation exclusivity: Each battery can only be allocated to no more than one electric vehicle.

[0090]

[0091] Battery swapping service guarantees that every arriving electric vehicle will be assigned a battery.

[0092]

[0093] Battery power constraints:

[0094] Let the efficiency of battery charging and discharging be η∈(0,1). Therefore, the amount of charge increased by battery j during charging is... The amount of electricity reduced by discharging is The formula for the change in charge of battery j is:

[0095]

[0096] And the charge level of battery j at any given moment should be within the battery's capacity range:

[0097]

[0098] Battery swapping dynamic process:

[0099] The dynamic battery swapping process means that the battery needs to go through the process of entering and leaving the charging station.

[0100] Entering a battery swapping station: When an electric vehicle arrives at battery swapping station n for a battery swap, station n will receive the electric vehicle's battery, which we will then use... Let represent the number of batteries received by battery swapping station n at time t. satisfy:

[0101]

[0102] In the model, the battery begins charging and discharging operations the moment it arrives at the battery swapping station n. Therefore, we define the battery arrival time as...

[0103]

[0104] The battery charge at the battery swapping station n is determined by the battery charge of electric vehicle i. The decision;

[0105]

[0106] Leaving a battery swapping station: When a battery is swapped to an electric vehicle, it is defined as leaving the swapping station. For swapping stations n, the set of batteries leaving the swapping station is:

[0107]

[0108] Therefore, the battery departure time is defined as follows:

[0109]

[0110] The dynamic change process of the battery pack is as follows:

[0111]

[0112] Battery swapping station revenue: The revenue of battery swapping station n during the battery swapping process includes three parts: battery swapping fees, discharge losses, and compensation for electric vehicles. The battery swapping fee at battery swapping station n is the product of the battery swapping price P and the total number of battery swaps.

[0113]

[0114] Discharge loss:

[0115] Discharging battery j At this time, losses will occur. The specific forms of loss are as follows:

[0116]

[0117] Where a1, a2>0 are loss coefficients.

[0118] Electric vehicle compensation:

[0119] Since the swapped-out batteries may have different capacities, the swapping station n will compensate for batteries that are not fully charged. We define a fully charged battery as E. maxThe battery's charge level when it was replaced was... The compensation for electric vehicles will take the following form:

[0120]

[0121] Where a3 and a4 > 0 are compensation coefficients.

[0122] Power management of battery swapping stations:

[0123] The energy for battery swapping stations comes from both new energy sources and the power grid.

[0124] New energy: Each battery swapping station n is equipped with either solar power or wind power. The power generation of the new energy source at time t is... and It is a random variable and is not controlled by the battery swapping station n.

[0125] Solar power generation: We use alpha n ≥0 represents the solar power capacity of battery swapping station n. The unit represents the amount of solar power generated per unit of installed capacity, and It is a random variable. Therefore, the solar power generation is:

[0126]

[0127] Wind power generation: We use β n ≥0 represents the wind power installed capacity of battery swapping station n, using The unit represents the installed capacity of wind power generation, and It is a random variable. Therefore, the wind power generation is:

[0128]

[0129] Then the total renewable energy generation of each battery swapping station n is the sum of solar power generation and wind power generation:

[0130]

[0131] Grid interaction: Each battery swapping station n needs to decide how much electricity it will purchase from the grid at each time t. and the amount of electricity sold The electricity purchased and sold must satisfy the following non-negativity constraint:

[0132]

[0133] Furthermore, during the power management process of a battery swapping station, it is necessary to ensure power balance, that is, to balance the demand and the amount of electricity received by all batteries.

[0134]

[0135] Define the electricity purchase decision variables for battery swapping station n as a set. Electricity sales decision variables are a set At each time t, the electricity price is defined as The electricity price for selling electricity is defined as follows: The net cost of electricity exchange between the battery swapping station n and the power grid is:

[0136]

[0137] The problem of power schedule optimization for battery swapping stations:

[0138] Battery swapping stations need to optimize their power schedules to maximize their profits.

[0139] The revenue definition of a battery swapping station n includes charging and discharging revenue, battery compensation, and net costs of trading electricity with the grid.

[0140]

[0141] The optimized power schedule for battery swapping station n is then:

[0142]

[0143] Due to the battery allocation decision variable z n Problem (25) is an integer programming problem, which is difficult to solve directly. Furthermore, the existence of the non-convex constraint (3) further increases the difficulty of solving problem (25). Therefore, we need to transform this problem into a convex optimization problem for solution.

[0144] Transformation of convex optimization problem:

[0145] To solve the problem (25), we define a greedy battery allocation strategy and remove constraint (3), thereby simplifying the problem:

[0146] Greedy battery allocation strategy: We consider allocating the batteries with the largest capacity to electric vehicles coming for battery swapping, with the specific strategy as follows:

[0147] Maximizing battery capacity: For each battery j, we calculate its maximum capacity, i.e., the capacity from the time of arrival. Initially, charge at the maximum charging speed until the battery reaches its maximum capacity. The specific formula is as follows:

[0148]

[0149] High-capacity battery selection: We select a high-capacity battery collection. This includes batteries with the largest capacity. The number of batteries selected is equal to the number of arriving electric vehicles, ensuring that these batteries meet the battery swapping needs of the electric vehicles.

[0150]

[0151] Power Constraint: We need to ensure that the selected battery can reach its maximum power level. This constraint is expressed as:

[0152]

[0153] Battery allocation: We allocate high-capacity batteries sequentially to electric vehicles that arrive at battery swapping stations. We represent the set of high-capacity batteries and the set of electric vehicles as follows:

[0154]

[0155] The battery allocation decision variables then satisfy the following constraints:

[0156]

[0157] Furthermore, we remove the non-convex constraint (3), thus obtaining the optimization problem as follows:

[0158]

[0159] Furthermore, we have proven the following theorem: Problem (25) and Problem (32) have the same optimal solution.

[0160] Therefore, we can obtain the optimal solution of the original problem (18) by solving the convex optimization problem (19).

[0161] S2. Design an energy trading model for a battery swapping station based on the decision-making model of a single battery swapping station, design a distributed algorithm for solving energy trading, and implement the corresponding smart contract.

[0162] Energy trading model for battery swapping stations:

[0163] We consider trading energy between battery swapping stations to maximize the total revenue of all battery swapping stations.

[0164] Trading variable: At time t, each battery swapping station n trades energy with battery swapping station l, and the energy trading volume is represented by... Indicates. When This represents a battery swapping station n purchasing energy from station l, and conversely, selling energy. Therefore, the set of energy trading variables for station n is: After the energy transaction, the amount paid by the battery swapping station n to the system is represented by π. n This means that when π n >0 represents the amount paid by the battery swapping station n to the system.

[0165] Trading constraints: Trading models are subject to three constraints: market clearing constraints, post-trade energy balance constraints, and incentive constraints.

[0166] Market clearing constraint: The market clearing constraint ensures that energy transactions and payment amounts between battery swapping stations are balanced. Specifically, between any battery swapping station n and l, the electricity purchased by n is equal to the electricity sold by l.

[0167]

[0168] And the total amount paid by all battery swapping stations offsets each other:

[0169]

[0170] Post-transaction energy balance constraints: During the power management and trading process of battery swapping stations, it is necessary to ensure power balance, that is, to balance the demand and the amount of electricity received by all batteries.

[0171]

[0172] Incentive and constraint: When battery swapping station n participates in energy trading, its revenue should be higher than its revenue when it does not participate. We define the revenue of battery swapping station n after participating in energy trading as:

[0173] V n (x n ,y n ,z n ,b n ,q n ,β n ,π n )=U n (x n ,y n ,z n ,b n ,q n )-π n (36)

[0174] Therefore, incentive constraints can be defined as:

[0175]

[0176] in, The following relationship must be satisfied:

[0177]

[0178] Transaction mechanism design: The goal of the transaction mechanism is to maximize the total revenue of all battery swapping stations.

[0179]

[0180] in The problem of designing a trading mechanism can then be modeled as follows:

[0181]

[0182] S3. Solution algorithm design based on smart contracts and multi-party secure computation:

[0183] Design an algorithm based on smart contracts and multi-party secure computation to solve the problem (39), thereby maximizing the total revenue of all battery swapping stations while protecting privacy.

[0184] Calculating energy trading volume β based on smart contracts: We define auxiliary variables:

[0185] The auxiliary variable transforms the original market clearing constraint (20) into the following two constraints:

[0186]

[0187] Furthermore, we introduce dual variables. And the penalty variable ρ>0.

[0188] An iterative distributed algorithm is proposed to solve for the energy trading volume β. In each iteration, given auxiliary and dual variables, each battery swapping station first solves its own trading problem, and then submits its solution to the algorithm. The algorithm then optimizes the auxiliary and dual variables uniformly. The process of the k-th iteration is as follows:

[0189] Solving the transaction problem of battery swapping stations: The algorithm provides auxiliary variables from the previous iteration. And the dual variable λ(k-1), then for each battery swapping station i, the following problem is solved:

[0190]

[0191] After solving problem (42), the battery swapping station i submits the result β of its own transaction variable. n (k) is given to the algorithm.

[0192] The algorithm updates the auxiliary and dual variables according to the following formula:

[0193]

[0194] Algorithm 1 outlines the solution for energy trading volume β based on smart contracts.

[0195] Algorithm 1: Solving the energy trading volume β based on smart contracts

[0196] 1: Solution initialization: Initialize the number of iterations k = 0, the fault tolerance ∈ = 0.01, the penalty term ρ = 1, and initialize the auxiliary variables. And dual variable λ(0)=0

[0197] 2: repeat

[0198] 3: Iteration count update: k = k + 1.

[0199] 4: for all n battery swapping stations:

[0200] 5: Let the battery swapping station n solve problem (31) and then use the result β n (k) Submit to this algorithm

[0201] 6: end for

[0202] 7: Update according to formulas (32) and (33) and dual variable λ(k)

[0203] 8: until the termination condition is met:

[0204] 9: Termination iteration number k * =k.

[0205] The result of running Algorithm 1 is expressed as follows

[0206]

[0207] Payment Amount π Calculation Based on Multi-Party Secure Computation: We propose Algorithm 2 to calculate the payment amount for battery swapping stations. During the execution of Algorithm 2, a multi-party secure computation algorithm 3 is employed to ensure that the privacy information of battery swapping stations is not leaked.

[0208] Algorithm 2 outlines the solution for the payment amount π:

[0209] Algorithm 2: Solving the payment amount π based on multi-party secure computation

[0210] 1: Calculate the amount of revenue reduction for each battery swapping station (n) during the energy trading process. With the increase

[0211]

[0212] 2: Calculate the total revenue reduction ψ of all battery swapping stations using a multi-party security calculation algorithm. dec (k * ) and the increase ψ inc (k * ):

[0213]

[0214] 3: for all n battery swapping stations:

[0215] 4: Payment amount π for battery swapping station n n (k * )for:

[0216]

[0217] 5: end for

[0218] Define p as a large prime number (typically 160 bits). Algorithm 3 outlines a multi-party secure computation algorithm:

[0219] Algorithm 3: Secure Multi-Party Computation Algorithm

[0220] 1: Input: (All battery swapping stations are known) (ψ n (Only the number of battery swapping stations n is known)

[0221] Output:

[0222] 2: for all n battery swapping stations:

[0223] 3: The number of battery swapping stations n generates N integers, represented as follows: Where π n,1 =ψ n The remaining integers are random integers. These integers are used as the polynomial h. n The coefficients of (ξ), the polynomial h n The degree of (ξ) is N-1, and its formula is:

[0224] h n (ξ)=(π n,1 +π n,2 ξ+π n,3 ξ 2 +...+π n,N ξ N-1 )mod p. (50)

[0225] 4: Calculate the number of swapping stations (n) and the number of swapping stations (l) ψ. n,l The calculation method is ψ n,l =h n (l).

[0226] 5: Battery swapping station n sends the data of battery swapping station l via a point-to-point communication channel. n,l To ensure that other battery swapping stations are unaware of ψ n,l .

[0227] 6: end for

[0228] 7: for all n battery swapping stations:

[0229] 8: The battery swapping station n sums all the shares it receives and the shares it holds:

[0230]

[0231] 9: end for

[0232] 10: Calculate ψ for all battery swapping stations n The sum:

[0233]

[0234] Smart contract design:

[0235] Based on the proposed algorithm, a blockchain-based smart contract was designed. We used the Remix integrated development environment (IDE) to deploy the smart contract, a platform widely used for Ethereum development. Figure 3 As shown, our smart contract user interface on the Remix platform aims to simplify the process of solving problem P1 for battery swapping stations. In each iteration k of solving P1, each battery swapping station submits its energy trading decision through the "energyTradingDecision" function, such as... Figure 3 As shown in the figure. Next, the smart contract updates the auxiliary and dual variables. Each swapping station can use the "getAuxiliaryVariables" and "getDualVariables" functions to obtain the updated values ​​of these variables, respectively. After iteration k is completed, each swapping station can verify whether the iteration has converged by accessing the "isIterationComplete" function. This structured process enables the smart contract to effectively help swapping stations solve problem P1 without leaking the station's privacy information. After solving P1, the swapping station can use the "SMPCsubmission" function to run a multi-party secure computation algorithm to solve for the payment amount.

[0236] Therefore, the present invention adopts the above-mentioned energy trading method for battery swapping stations based on smart contracts and multi-party secure computation, and designs a model compression method for the characteristics of unsupervised domain adaptation. First, the energy trading method for battery swapping stations combining smart contracts and multi-party secure computation: the combination of smart contracts and multi-party secure computation is applied to the energy trading and management process between battery swapping stations, ensuring the efficiency of the transaction and the privacy protection of the operation data of the battery swapping stations.

[0237] Second, the deep integration of blockchain technology: Through the decentralized and tamper-proof characteristics of blockchain technology, not only is the transparency and fairness of the transaction process ensured, but the operational privacy of the battery swapping station is also effectively protected, reducing the reliance on centralized management.

[0238] Third, the application of advanced multi-party secure computation technology: By utilizing multi-party secure computation technology, the amount to be paid by each party can be calculated while protecting the privacy of the operational data of each battery swapping station, thus enabling transactions and payment settlements to be completed without directly sharing sensitive information.

[0239] To make the objectives, technical solutions, and advantages disclosed in the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the present invention and are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments in this application without creative effort are within the scope of protection of this application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.

[0240] It should be noted that the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0241] Similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

Claims

1. A method for energy trading in battery swapping stations based on smart contracts and multi-party secure computation, characterized in that, Includes the following steps: S1. Decision-making model and solution method for a single battery swapping station; S2. Design an energy trading model for a battery swapping station based on the decision-making model and solution method of a single battery swapping station, design a distributed algorithm for solving energy trading, and implement the corresponding smart contract. In step S2, the trading model is subject to three constraints: market clearing constraint, post-trade energy balance constraint, and incentive constraint. Market clearing constraints: Market clearing constraints ensure that energy transactions and payment amounts are balanced between battery swapping stations. Specifically, any battery swapping station... and between, The purchased electricity amount equals Electricity sold: ; Let n be the amount of electricity purchased by swap station n from swap station l at time t. Let L be the amount of electricity sold by battery swapping station l to battery swapping station n at time t. And the total amount paid by all battery swapping stations offsets each other: ; This is the amount paid by battery swapping station n; Post-trade energy balance constraints: at battery swapping stations In the process of power management and trading, it is necessary to ensure the balance of power, that is, the balance between the demand and the amount of electricity received by all batteries. ; For the battery swapping station n in The amount of electricity required at all times; Let n be the total electricity generated by the battery swapping station n at time t using its own renewable energy generation. For the battery swapping station n in t Electricity purchased from the power grid at all times; For the battery swapping station n in The amount of electricity sold to the power grid at all times; Incentives and constraints: When the battery swapping station His returns after participating in energy trading were higher than his returns when he did not participate in trading. S3. Design of a solution algorithm based on smart contracts and secure multi-party computation; In step S1: The decision model and solution method for a single battery swapping station include the charging and discharging management of the battery swapping station, the power management of the battery swapping station, the power schedule optimization problem of the battery swapping station, and the transformation of the convex optimization problem. The charging and discharging management of the battery swapping station includes the battery set, the charging and discharging decision variables of the battery swapping station, the battery allocation decision variables of the battery swapping station, the battery power constraint, the battery swapping dynamic process, entering the battery swapping station, leaving the battery swapping station, the revenue of the battery swapping station, the discharge loss and the electric vehicle compensation. Battery assembly: for battery swapping stations , defined in At any time, battery swapping station The battery is a collection At the battery swapping station In, each battery Described by a vector: ,in Represents battery Arrival at the battery swapping station Time, Represents battery Leaving the battery swapping station time; Battery swapping station charging and discharging decision variables: battery swapping station It is necessary to decide on each battery At every moment Charging amount With discharge quantity Then the battery swapping station The charging decision variables are a set The discharge decision variables are a set. When the battery At the battery swapping station During the period, at every moment The amount of charge / discharge must not exceed the upper limit of charge / discharge: ; ; Furthermore, the battery At every moment Simultaneous charging and discharging are not allowed, therefore the following non-convex constraint applies: ; Battery allocation decision variables for battery swapping stations: at each time point Battery swapping station It is necessary to decide how to allocate batteries to electric vehicles arriving at the battery swapping station. electric vehicle collection To indicate, for each battery Battery swapping station Decide whether to use the battery Replace with electric vehicle ,Right now ; in Represents battery Replace with electric vehicle Conversely, the battery Not replaced with electric vehicle Battery swapping station The battery allocation decision variables are a set: ; Battery capacity constraint: The efficiency of battery charging and discharging is defined as... Therefore, batteries The increased capacity due to charging is The amount of electricity reduced by discharging is Then the battery The formula for the change in electricity is: ; And the battery at every moment The charge level should be within the battery's capacity range: ; Battery swapping dynamic process: The dynamic battery swapping process means that the battery needs to go through the process of entering the charging station and leaving the charging station. Entering the battery swapping station: When the electric vehicle arrives at the battery swapping station Battery swapping, battery swapping station It will receive the battery from the electric vehicle and use it. Representative battery swapping station exist The battery that receives the signal at all times, satisfy: ; In the model, when the battery arrives at the battery swapping station At the next moment, the battery begins charging and discharging; therefore, the battery's arrival time is defined as... ; ; Arrival at the battery swapping station The battery power is provided by the electric vehicle Battery life The decision ; Leaving the battery swapping station: When a battery is swapped to an electric vehicle, it is defined as leaving the battery swapping station. The set of batteries leaving the battery swapping station is as follows: ; Define the battery's off-time: ; The dynamic change process of the battery pack is as follows: ; Battery swapping station revenue: Battery swapping station The revenue generated from providing battery swapping services includes three parts: battery swapping fees, discharge losses, and compensation for electric vehicles. (Battery swapping stations...) Battery swapping fee is the battery swapping price. The product of the total number of battery swaps: ; Discharge loss: during battery operation Discharge At that time, losses will occur, specifically in the form of... ; in , This is the loss coefficient; Electric vehicle compensation: Because the capacity of the swapped-out batteries may vary, battery swapping stations... It will compensate for batteries that are not fully charged when they are replaced, and a fully charged battery is defined as... The battery's charge level when it was replaced was... The compensation for electric vehicles will then take the following form: ; in , This is the compensation coefficient.

2. The energy trading method for battery swapping stations based on smart contracts and multi-party secure computation as described in claim 1, characterized in that, In step S1, the power management of the battery swapping station includes the interaction between new energy sources and the power grid.

3. The energy trading method for battery swapping stations based on smart contracts and multi-party secure computation as described in claim 1, characterized in that, In step S1, the revenue definition of the battery swapping station in the power schedule optimization problem includes charging and discharging revenue, battery compensation, and net cost of buying and selling electricity with the grid. ; For the revenue of battery swapping station n; The set of decision variables for purchasing electricity for battery swapping stations; For the set of variables for electricity sales decisions; The net cost of electricity exchange between the battery swapping station n and the power grid.

4. The energy trading method for battery swapping stations based on smart contracts and multi-party secure computation as described in claim 1, characterized in that, In step S1, a greedy battery allocation strategy is defined in the transformation of the convex optimization problem.

5. The energy trading method for battery swapping stations based on smart contracts and multi-party secure computation as described in claim 1, characterized in that, In step S3, the Remix integrated development environment is used to deploy the smart contract.

Citation Information

Patent Citations

  • Charging and discharging and battery swap optimization method of battery swap station, storage medium and terminal equipment

    CN117829881A