Distributed energy point-to-point transaction optimization method and system
By identifying user energy roles and generating transaction intention information based on a time-series energy state database, and combining linear programming and blockchain technology to optimize distributed energy peer-to-peer transactions, the problem of insufficient flexibility in existing transaction mechanisms is solved, achieving efficient and transparent transaction matching and maximizing user benefits.
Patent Information
- Application Number
- CN202511664027.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-10
AI Technical Summary
The existing distributed energy peer-to-peer trading method adopts a single trading mechanism, which is difficult to cover the optimized scheduling needs under complex supply and demand matching, resulting in low transaction matching efficiency and low flexibility.
Based on the time-series energy state database, the energy role of the target user is identified, transaction intention information is generated, and the target matching scheme is solved by linear programming. The objective function of supply and demand balance constraint, price range constraint and user profit maximization is constructed. On-chain transaction confirmation and bill generation are carried out by blockchain transaction data structure and smart contract.
It improves transaction efficiency, enhances transaction flexibility and transparency, maximizes individual user benefits and improves system economic efficiency, and solves the problem of insufficient flexibility in existing transaction mechanisms.
Smart Images

Figure CN121504607A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed energy peer-to-peer transaction optimization technology, specifically to a distributed energy peer-to-peer transaction optimization method and a distributed energy peer-to-peer transaction optimization system. Background Technology
[0002] In related technologies, most distributed energy peer-to-peer trading methods adopt a single trading mechanism as the core, such as bilateral bidding, listing or unified clearing, which is difficult to cover the optimized scheduling needs under complex supply and demand matching, limits the efficiency of transaction matching, and has low flexibility. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides an optimized method for distributed energy peer-to-peer transactions. Based on the time-series energy state database, the method identifies the energy role of the target user within a target time period and generates transaction intention information based on the role identification results, thereby improving transaction efficiency and enhancing flexibility and transparency.
[0004] The technical solution adopted in this invention is as follows: A method for optimizing distributed energy peer-to-peer transactions includes the following steps: acquiring dynamic energy data of participating users in various time periods, and constructing a time-series energy state database based on the dynamic energy data; identifying the energy role of the target user in the target time period based on the time-series energy state database; generating transaction intention information based on the time-series energy state database and the energy role identification results; constructing supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the transaction intention information; solving the target matching scheme through linear programming based on the supply and demand balance constraints, the price range constraints, and the objective function; standardizing the target matching scheme to generate a matching result database; constructing a blockchain transaction data structure based on the matching result database and economic benefit indicators, and calling smart contracts to perform on-chain transaction confirmation, bill generation, and anomaly rollback.
[0005] In one embodiment of the present invention, the dynamic energy data includes: household load power, distributed photovoltaic power generation data, energy storage device status data, and energy interaction data of electric vehicles.
[0006] In one embodiment of the present invention, the energy storage device status data includes energy storage charging amount and energy storage discharging amount, and the energy interaction data of the electric vehicle includes the charging amount and discharging amount of the electric vehicle. Constructing a time-series energy state database based on the dynamic energy data includes: calculating a first state of charge (SOC) of the energy storage device based on the energy storage charging amount and the energy storage discharging amount; calculating a second SOC of the electric vehicle based on the charging amount and discharging amount of the electric vehicle; and constructing the time-series energy state database based on the household load power, the distributed photovoltaic power generation data, the energy storage device status data, the energy interaction data of the electric vehicle, the first SOC, and the second SOC within each time period.
[0007] In one embodiment of the present invention, identifying the energy role of the target user within a target time period based on the time-series energy state database includes: extracting the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within the target time period from the time-series energy state database; calculating the target user's net energy index within the target time period based on the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within the target time period; and identifying the target user's energy role within the target time period based on the net energy index; wherein, if the net energy index is greater than 0, the target user is identified as an energy seller within the target time period; if the net energy index is less than 0, the target user is identified as an energy demander within the target time period.
[0008] In one embodiment of the present invention, generating transaction intention information based on the time-series energy state database and the energy role identification result includes: obtaining the initial transaction intention of the target user within the target time period based on the time-series energy state database and the energy role identification result; standardizing and storing the initial transaction intention in the database after performing a balance verification to generate the transaction intention information.
[0009] In one embodiment of the present invention, the supply and demand balance constraint is constructed using the following formula: , in, This represents the maximum sellable electricity for user i within the set of energy seller roles during time period c. This represents the maximum purchasable electricity for user j within the set of energy demanders during time period c. This represents the group of energy sellers. This represents the set of energy demanders; The price range constraint is constructed using the following formula: , in, This represents the transaction price of electricity for user j in the user set representing the demand side during time period c. This indicates setting a ceiling on the electricity purchase price for the power grid. This represents the upper bound of electricity prices indicating market structure. This represents the transaction price of electricity for user i in the energy seller role set during time period c. This indicates the reference electricity price for the power grid; The objective function is constructed using the following formula: , in, This indicates the energy seller role identifier for user i during time period c. This indicates the energy demander role of user i during time period c.
[0010] A distributed energy peer-to-peer trading optimization system includes: an acquisition module for acquiring dynamic energy data of participating users in various time periods and constructing a time-series energy state database based on the dynamic energy data; an identification module for identifying the energy role of the target user in a target time period based on the time-series energy state database; a first generation module for generating trading intention information based on the time-series energy state database and the energy role identification results; a first construction module for constructing supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the trading intention information; a solution module for solving a target matching scheme using linear programming based on the supply and demand balance constraints, the price range constraints, and the objective function; a second generation module for standardizing the target matching scheme to generate a matching result database; and a second construction module for constructing a blockchain transaction data structure based on the matching result database and economic benefit indicators, and calling smart contracts for on-chain transaction confirmation and bill generation.
[0011] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described distributed energy peer-to-peer trading optimization method.
[0012] A non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned distributed energy peer-to-peer trading optimization method.
[0013] The beneficial effects of this invention are: This invention identifies the energy role of the target user within a target time period based on the time-series energy state database, and generates transaction intention information based on the role identification results, thereby improving transaction efficiency and enhancing flexibility and transparency. Attached Figure Description
[0014] Figure 1 This is a flowchart of the distributed energy peer-to-peer transaction optimization method according to an embodiment of the present invention; Figure 2 This is an architecture diagram of a distributed energy peer-to-peer trading system according to a specific embodiment of the present invention; Figure 3 This is a block diagram of a distributed energy peer-to-peer trading optimization system according to an embodiment of the present invention. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] Figure 1 This is an embodiment of the distributed energy peer-to-peer transaction optimization method of the present invention.
[0017] like Figure 1 As shown, the distributed energy peer-to-peer trading optimization method of this embodiment may include the following steps: S1 acquires dynamic energy data for energy trading participants in various time periods and constructs a time-series energy status database based on the dynamic energy data.
[0018] Specifically, firstly, the platform's energy trading participants (i.e., energy trading users) and their activity time periods (i.e., the corresponding time periods) can be established. Specifically, the user set can be set as follows: , in, This represents the set of users participating in energy trading. Indicates user The index. Time periods can be divided using a fixed granularity, for example, a 15-minute cycle, with the corresponding set of time periods as follows:
[0019] in, Represents a set of time periods. Indicates time period The index.
[0020] Based on the two sets mentioned above, define a composite index mapping. As the primary key of the database structure, it uniquely identifies the energy state of each user within a specific time period. The output includes the index model. And the initial table structure of the energy state database built based on this model.
[0021] Secondly, regarding the collection of various dynamic energy data, these dynamic energy data may include: household load power, distributed photovoltaic power generation data, energy storage device status data, and energy interaction data of electric vehicles.
[0022] Specifically, for all users connected to the platform, household load power and distributed photovoltaic power generation data are collected at predefined time granularities. The following data is obtained through the home energy management system interface: , in, Indicates user In time period household load power, Indicates user In time period The distributed photovoltaic power generation data is collected. All raw data is processed by anomaly detection (including but not limited to removing obvious outliers) and smoothing before being written into the database to form a standardized set of load and power generation data records.
[0023] For user groups equipped with energy storage devices ( It is necessary to collect energy storage device status data, which includes energy storage charging amount and energy storage discharging amount. The following data should be accessed in real time through the energy storage device management interface:
[0024] in, Indicates user In time period Energy storage charging capacity (in kWh). Indicates user In time period The energy storage and discharge capacity (in kWh).
[0025] For user sets that include electric vehicles ( During the permitted effective charging and discharging period ( This involves collecting energy interaction data from electric vehicles. This data includes the charging and discharging amounts of the electric vehicles. Using the battery management system interface, the following variables are obtained: , in, Indicates user electric vehicles during the time period The charging capacity (in kWh). Indicates user electric vehicles during the time period Discharge amount (in kWh) In one embodiment of the present invention, constructing a time-series energy state database based on dynamic energy data may include: S11, calculate the first state of charge of the energy storage device based on the energy storage charging amount and energy storage discharging amount.
[0026] Specifically, the first state of charge of an energy storage device can be calculated using the following formula: , in, Indicates user The corresponding energy storage devices during the time period The first state of charge, Indicates user In time period Energy seller role identification, Indicates user In time period The energy demander role identifier, specifically, if the user In time period If the role is that of an energy seller, then , If the user In time period As an energy demander, , If the user In time period If it is neither an energy demander nor an energy seller, then , , Indicates user The corresponding charging efficiency parameters of energy storage devices, Indicates user The corresponding discharge efficiency parameters of the energy storage device.
[0027] It should be noted that, to ensure the physical feasibility of the data, verification can be implemented through the following constraints: , in, Indicates user The corresponding maximum charging capacity of the energy storage device Indicates user The corresponding maximum discharge capacity of the energy storage device Indicates user The corresponding minimum state of charge allowed for energy storage devices, Indicates user The highest state of charge allowed for the corresponding energy storage device.
[0028] S12, calculate the second state of charge of the electric vehicle based on the amount of charging and discharging of the electric vehicle.
[0029] Specifically, the second state of charge of an electric vehicle can be calculated using the following formula: , in, Indicates user The corresponding electric vehicles in the time period The second state of charge, Indicates user The corresponding battery charging efficiency of electric vehicles Indicates user The corresponding battery discharge efficiency of electric vehicles.
[0030] It should be noted that the state variables must satisfy the following physical constraints: , in, Indicates user The corresponding maximum charging capacity for electric vehicles. Indicates user The corresponding maximum discharge capacity of electric vehicles, Indicates user The corresponding minimum tolerance value for the state of charge of electric vehicles. Indicates user The maximum tolerance value for the corresponding state of charge of electric vehicles.
[0031] S13. Construct a time-series energy state database based on household load power, distributed photovoltaic power generation data, energy storage device status data, electric vehicle energy interaction data, first state of charge, and second state of charge for each time period.
[0032] Specifically, to achieve standardized integration of multi-source data, a unified user energy state description structure needs to be constructed. This structure is based on the user... With time period The composite index is the primary key and is expressed in the following vector form: , The structure is written into the energy status database table, along with a corresponding data source identifier and digest hash value, to ensure data traceability and consistency. Each record contains energy behavior and status information of multiple devices used by the user during that time period, forming a complete record.
[0033] S2 identifies the energy role of the target user within the target time period based on the time-series energy state database.
[0034] In one embodiment of the present invention, identifying the energy role of a target user within a target time period based on a time-series energy state database includes the following steps: S21, extract household load power, distributed photovoltaic power generation data, energy storage device status data, and energy interaction data of electric vehicles for the target user within the target time period from the time-series energy state database.
[0035] S22, calculate the net energy index of the target user within the target time period based on the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within the target time period.
[0036] Specifically, the net energy index of the target user during the target time period can be calculated using the following formula: , in, Indicates user In time period Net energy index.
[0037] S23, Identify the energy role of the target user within the target time period based on the net energy index; if the net energy index is greater than 0, the target user is identified as an energy seller within the target time period; if the net energy index is less than 0, the target user is identified as an energy demander within the target time period.
[0038] Specifically, roles are assigned based on net energy metrics, expressed by the following formula: , , in, Indicates user In time period Energy seller role identification, Indicates user In time period The energy demander role is identified. Specifically, if the net energy index is greater than 0, the user is identified. In time period As the energy seller, at this time , If the net energy index is less than 0, then identify the user. In time period As an energy demander, at this time , If the net energy index equals 0, then identify the user. In time period Neither an energy demander nor an energy seller, at this time , .
[0039] S3 generates transaction intention information based on the time-series energy state database and the energy role recognition results.
[0040] In one embodiment of the present invention, generating transaction intention information based on a time-series energy state database and combined with energy role identification results includes the following steps: S31, obtain the target user's initial transaction intention within the target time period based on the time-series energy state database and energy role identification results.
[0041] Specifically, for the target users of the energy seller role, users In time period The net surplus electricity available for sale on the market can be expressed by the following formula: , in, Indicates user In time period Net surplus electricity available for sale on the market.
[0042] For the target users in the energy demander role, users In time period The actual electricity shortage can be expressed by the following formula: , in, Indicates user In time period The actual electricity shortage.
[0043] It is understandable that the set of energy seller roles A and the set of energy demander roles B that satisfy the verification and conditions can be represented by the following formula: .
[0044] Set A contains all items within the time period Users with a net surplus of electricity available for sale in the market, set B includes all users within the time period Users with a positive actual electricity demand shortfall. Based on the identified energy roles of each user, their initial intended electricity volume for trading in the distributed energy peer-to-peer trading market can be further determined.
[0045] Specifically, for any user If within a time period If an energy seller belongs to set A, then its intended electricity sales volume can be expressed by the following formula: , in, Indicates user In time period The intended electricity sales volume (i.e., the electricity volume planned to be sold to the market). If within the time period If a user belongs to energy demander role set B, their intended electricity purchase volume can be expressed by the following formula: , in, Indicates user In time period The intended electricity volume (i.e., the electricity volume that is desired to be purchased from the market).
[0046] In other words, the initial transaction intention may include the set of intended electricity sales volume of all energy seller users. And the collection of intended electricity purchases from all energy demanders. This serves as input data for subsequent market matching.
[0047] S32, after balancing and verifying the initial transaction intentions, standardize and store them in the database to generate transaction intention information.
[0048] Specifically, to ensure the feasibility of transactions and the balance of system load in the distributed energy peer-to-peer trading market, it is necessary to verify the supply and demand balance of the total transaction intentions within any given time period. Specifically, the time period can be generated using the following formula. Internal transaction balance deviation: , in, Indicates time The net value of intended transactions reflects whether market supply and demand are balanced. This indicates that there is a power surplus or shortage in the current time period, and this information will be used to trigger the subsequent matching adjustment mechanism.
[0049] To achieve data decoupling and interface unification between modules, it is necessary to structure and archive user transaction intention information and manage it uniformly in a database. In this process, a standardized transaction intention data table should be constructed, with each record including: a user identifier. Time period Energy role variables (Among them, when the user) hour, ;when hour, ), corresponding or (Determined based on user role), Transaction balance deviation It also includes metadata fields such as timestamps, data source identifiers, and hash verification codes.
[0050] S4, based on transaction intention information, constructs supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits.
[0051] In one embodiment of the present invention, the supply and demand balance constraint is constructed using the following formula: , in, This represents the maximum sellable electricity for user i within the set of energy seller roles during time period c. This represents the maximum purchasable electricity for user j within the set of energy demanders during time period c. This represents the group of energy sellers. This represents the set of energy demanders.
[0052] Supply and demand balance constraints, as one of the basic physical constraints in linear optimization models, are used to ensure the overall consistency of supply and demand in electricity trading.
[0053] The price range constraint is constructed using the following formula: , in, This represents the transaction price of electricity for user j in the user set representing the demand side during time period c. This indicates setting a ceiling on the electricity purchase price for the power grid. This represents the upper bound of electricity prices indicating market structure. This represents the transaction price of electricity for user i in the energy seller role set during time period c. This indicates the reference electricity price for the power grid.
[0054] Price range constraints are used to define the acceptable range of prices for matched transactions, avoiding economically infeasible or market-rule-violating pricing.
[0055] The objective function is constructed using the following formula: , in, This indicates the energy seller role identifier for user i during time period c. This indicates that user j is an energy demander during time period c.
[0056] The first term in the objective function represents the additional revenue generated by the seller when the electricity price is lower than the grid's reference price, while the second term represents the cost savings achieved by the demand side when the electricity price is lower than the grid's purchase price. This function drives the system to optimize towards maximizing user benefits, while ensuring the physical feasibility of the transaction and reasonable pricing.
[0057] S5, based on supply and demand balance constraints, price range constraints, and objective function, solves the target matching scheme through linear programming.
[0058] Specifically, based on the established supply and demand balance constraints, price range constraints, and objective function, the optimal matching scheme, i.e., the target matching scheme, is solved using linear programming. In this optimization problem, the maximum trading capacity of users is constrained as follows: , Using a linear solver (such as Gurobi), all constraints and the objective function are loaded to solve for the optimal transaction volume and price sequence. The output (i.e., the target matching scheme) includes the optimal transaction volume and corresponding transaction price for each user under their respective roles.
[0059] S6 standardizes the target matching scheme to generate a matching result database.
[0060] Specifically, the target matching scheme is standardized to meet the requirements of database storage and blockchain access formats. To ensure data integrity and traceability, all records are appended with their generation time and source identifier, and a hash digest is calculated for each record. Finally, the data is written to the matching result database in a standardized format for use by the settlement system and blockchain.
[0061] S7 constructs a blockchain transaction data structure based on the matching result database and economic benefit indicators, and calls smart contracts to confirm on-chain transactions and generate invoices.
[0062] Specifically, based on the transaction data between the distributed energy peer-to-peer trading market and the grid side, the economic benefits of user i during time period c are quantified.
[0063] Specifically, for the energy seller role, user i's total electricity sales revenue during time period c is... It can be divided into two parts: the revenue obtained from selling electricity through the distributed energy peer-to-peer trading market and the compensation obtained from selling electricity to the grid, which can be calculated using the following formula: , in, This represents the total electricity sales revenue of user i during time period c. This indicates that user i sold electricity in the m-th distributed energy peer-to-peer transaction during time period c. This represents the transaction price of user i in the m-th distributed energy peer-to-peer transaction within time period c. This represents the amount of electricity sold by user i to the power grid during time period c. This indicates the reference electricity price for the power grid.
[0064] The net income of user i in the distributed energy peer-to-peer trading market during time period c can be calculated by excluding the electricity sold to the grid. , in, This represents the net income of user i in the distributed energy peer-to-peer trading market during time period c.
[0065] For the energy demander role, user j's total electricity purchase cost during time period c The expenditure, including electricity purchased through the distributed energy peer-to-peer trading market and electricity purchased from the grid, can be calculated using the following formula: , in, This represents the total electricity purchase cost for user j during time period c. This represents the amount of electricity purchased by user j in the m-th distributed energy peer-to-peer transaction during time period c. This represents the transaction price of user j in the m-th distributed energy peer-to-peer transaction within time period c. This represents the amount of electricity that user j purchased from the power grid during time period c. This indicates the upper limit of the electricity purchase price for the power grid.
[0066] In summary, the savings for energy demanders are... This can be the difference between the cost of purchasing all electricity from the grid and the actual total expenditure, i.e. .
[0067] In the above calculation process, the user's role identifier during that time period must be taken into account. and This is used to identify whether a user is an energy demander or an energy seller in the transaction, and the final output includes the net revenue of each user in the distributed energy peer-to-peer trading market for each time period c. or savings Grid-side interactive power ( and ) and the total amount and It is used to generate billing data.
[0068] Furthermore, information such as each user's transaction role within time period c, the electricity volume and price of distributed energy peer-to-peer transactions, the electricity volume exchanged with the grid, the settlement amount, and economic benefits are encapsulated into structured information units. The constructed data object includes the following fields: user's unique address (blockchain identifier), time period index c, transaction role (seller or buyer), and the electricity volume and price of distributed energy peer-to-peer transactions. Electricity on the grid side ( , ), settlement amount and net income ( ) or savings ( The data includes a data source identifier, an integrity verification hash (e.g., generated based on the SHA256 algorithm), and a currently generated timestamp. All constructed data objects are output in JSON format and submitted as transaction data to be signed in subsequent steps.
[0069] In one embodiment of the present invention, before data is uploaded to the blockchain, secure encapsulation and on-chain broadcasting of the data are completed through cryptographic signing and smart contract calls. The signing operation employs an elliptic curve cryptography algorithm (such as secp256k1), using the user's private key to perform cryptographic signing of the structured transaction data. Subsequently, a blockchain transaction payload is constructed, with parameters including the smart contract method name, the structured data ontology, and the signature value. The signed data packet is encapsulated using a Web3 API and broadcast to the blockchain network. After broadcasting, the transaction is verified and confirmed by on-chain nodes according to a consensus mechanism (such as PoH). After confirmation, information such as the hash value of the successful transaction, the current block number, and the transaction index position are recorded as credentials for subsequent traceability queries.
[0070] In one embodiment of the present invention, it is possible to verify whether a transaction has been successfully recorded on the blockchain and generate a standardized billing document for reference by users and the platform. Specifically, the transaction hash value can be used first by calling the Web3 interface. Query the on-chain receipt result. If the transaction status is successful (i.e., status=true), record the block height and write time of the transaction. Next, assemble the bill details based on the original settlement data and user identifier. Fields include: user address, time period c, transaction role, transaction volume and price, and settlement amount (…). or Net income or savings The data includes electricity consumption and pricing data between the power grid and the blockchain, transaction hash values, and block numbers. The final bill is output in PDF or CSV format, supporting both platform display and local user download. Complete settlement records are written to the ledger database in a structured format for synchronous querying by blockchain explorers.
[0071] It should be noted that, to improve system stability and data consistency, this step defines a handling mechanism for failed transaction data uploads. If a failure is detected (such as insufficient transaction gas, signature verification failure, contract call anomalies, etc.), a failure log will be immediately recorded and an alarm module will be triggered. The system will perform re-signing and resubmission operations on the failed transaction, with a maximum number of retries set to [number to be filled in]. The recommended value is 3. If multiple attempts fail to complete the on-chain transaction, it should be written to the failed transaction database for subsequent manual intervention by the platform administrator. All failure records must include the following information: unique user identifier, transaction data content, reason for failure and error code, timestamp, and system log number. The hash value of successfully retried transactions must be updated synchronously and included in the settlement ledger logical consistency verification process.
[0072] In a specific embodiment of the present invention, the architecture diagram of the distributed energy peer-to-peer trading system of the present invention can be as follows: Figure 2As shown, the distributed energy peer-to-peer trading optimization method based on this invention is implemented and verified in the system. For the Ethereum platform, the Remix IDE environment is used for smart contract development, Ganache CLI version 6.12.2 is used for virtual machine testing, and the web3.py library is used to connect the smart contract, user interface, and blockchain database. For the Solana platform, the Rust programming language is used to write smart contracts, and SOL's SDK and Web3.js library are used for development and deployment. The distributed energy peer-to-peer trading system architecture integrates multiple functional modules such as energy data acquisition, transaction matching, and blockchain settlement to achieve efficient trading and optimized scheduling of distributed energy. The system is based on a user set, including ordinary users, a subset of users equipped with energy storage devices, and a subset of users with electric vehicles. Within a preset 15-minute time period, the system acquires multi-dimensional energy data such as user load, photovoltaic power generation, energy storage devices, and electric vehicle charging and discharging through the energy data acquisition module, generating a unified energy state structure. Based on the collected energy data, the system identifies the user's energy role at different time periods and generates initial trading intentions. The transaction matching and pricing module utilizes a linear optimization algorithm to find the optimal transaction matching scheme under the constraints of supply and demand balance and price range, maximizing user economic benefits. The optimization results are stored in the matching result database and simultaneously transmitted to the settlement module. The settlement module calculates user revenue or savings based on the traded electricity volume and price, constructs the data into a blockchain transaction structure, and saves it on the blockchain via smart contracts. The entire process employs a historical proof-of-fact consensus mechanism to ensure transaction transparency and immutability. The system includes anomaly handling and rollback mechanisms to ensure timely response and recording of failed transactions. The grid-side interaction system provides market price constraints and backup power support; all transaction and status data are standardized and stored in the database system.
[0073] Therefore, this invention, based on the construction of a unified energy state database, standardizes the collection and modeling of multi-source energy data (load, electric vehicles, energy storage, photovoltaics, etc.) to identify the energy role of users in each time period. This enables a refined characterization of user energy behavior and dynamic role identification in complex multi-source distributed energy systems, solving the problem of difficulty in real-time and effective identification of user supply and demand status in existing technologies. It provides high-quality structured input for subsequent transaction matching, significantly improving the real-time performance and flexibility of system scheduling. Furthermore, based on a supply and demand balance and price range constraint model, this invention optimizes the matching and pricing of transaction intentions between buyers and sellers through linear programming, achieving efficient energy matching among multiple users and roles. This solves the problem that traditional methods, which rely on a single transaction mechanism, cannot adequately address diverse demand responses. This model ensures power balance and economic rationality while maximizing individual user benefits as an optimization objective, thereby improving overall economic efficiency. Furthermore, based on a third-generation blockchain architecture, this invention uses smart contracts to automatically settle and record transaction orders on-chain. It generates traceable bills by combining user identity address, transaction electricity and price, net profit or savings, etc., constructing an end-to-end trusted transaction closed-loop system. This effectively solves the problems of cumbersome settlement processes, severe data silos, and weak privacy protection mechanisms in existing technologies. The use of structured transaction data signature and consensus verification mechanisms ensures the immutability and transparency of transaction data, improving system security and regulatory feasibility. In addition, during the settlement phase, this invention separates the calculation of distributed energy peer-to-peer transactions and grid interaction, clearly defining the sources of user profits and savings. By combining the grid reference price and the user's actual transaction price, it accurately quantifies economic benefits, solving the problem of incomplete transaction economic analysis in existing technologies. This provides users with clear, transparent, and verifiable billing support, further enhancing users' enthusiasm for participating in distributed energy transactions.
[0074] In summary, the distributed energy peer-to-peer transaction optimization method according to embodiments of the present invention acquires dynamic energy data corresponding to participating users in energy transactions within various time periods, constructs a time-series energy state database based on the dynamic energy data, identifies the energy roles of target users within a target time period based on the time-series energy state database, generates transaction intention information based on the time-series energy state database and the energy role identification results, and constructs supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the transaction intention information. Based on the supply and demand balance constraints, price range constraints, and objective function, a target matching scheme is solved using linear programming, and the target matching scheme is standardized to generate a matching result database. A blockchain transaction data structure is constructed based on the matching result database and economic benefit indicators, and a smart contract is invoked to perform on-chain transaction confirmation and bill generation. Therefore, by identifying the energy roles of target users within a target time period based on the time-series energy state database and generating transaction intention information based on the role identification results, transaction efficiency is improved, and flexibility and transparency are enhanced.
[0075] Corresponding to the distributed energy peer-to-peer transaction optimization method in the above embodiments, the present invention also proposes a distributed energy peer-to-peer transaction optimization system.
[0076] like Figure 3 As shown, the distributed energy peer-to-peer trading optimization system of this embodiment may include: an acquisition module 100, an identification module 200, a first generation module 300, a first construction module 400, a solution module 500, a second generation module 600, and a second construction module 700.
[0077] The system comprises the following modules: an acquisition module 100, which acquires dynamic energy data of participating users in energy transactions over various time periods and constructs a time-series energy state database based on the dynamic energy data; an identification module 200, which identifies the energy role of target users within a target time period based on the time-series energy state database; a first generation module 300, which generates transaction intention information based on the time-series energy state database and the energy role identification results; a first construction module 400, which constructs supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the transaction intention information; a solution module 500, which solves the target matching scheme using linear programming based on the supply and demand balance constraints, price range constraints, and the objective function; a second generation module 600, which standardizes the target matching scheme to generate a matching result database; and a second construction module 700, which constructs a blockchain transaction data structure based on the matching result database and economic benefit indicators, and calls smart contracts to perform on-chain transaction confirmation and bill generation.
[0078] In one embodiment of the present invention, dynamic energy data includes: household load power, distributed photovoltaic power generation data, energy storage device status data, and energy interaction data of electric vehicles.
[0079] In one embodiment of the present invention, the energy storage device status data includes energy storage charging amount and energy storage discharging amount, and the electric vehicle energy interaction data includes electric vehicle charging amount and electric vehicle discharging amount. The acquisition module 100 is specifically used to: calculate the first state of charge of the energy storage device based on the energy storage charging amount and energy storage discharging amount; calculate the second state of charge of the electric vehicle based on the electric vehicle charging amount and electric vehicle discharging amount; and construct a time-series energy state database based on household load power, distributed photovoltaic power generation data, energy storage device status data, electric vehicle energy interaction data, first state of charge, and second state of charge in each time period.
[0080] In one embodiment of the present invention, the identification module 200 is specifically used to: extract the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within a target time period from a time-series energy state database; calculate the target user's net energy index within the target time period based on the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within the target time period; and identify the target user's energy role within the target time period based on the net energy index; wherein, if the net energy index is greater than 0, the target user is identified as an energy seller within the target time period; if the net energy index is less than 0, the target user is identified as an energy demander within the target time period.
[0081] In one embodiment of the present invention, the first generation module 300 is specifically used to: obtain the initial transaction intention of the target user within the target time period based on the time-series energy state database and the energy role recognition result; and standardize and store the initial transaction intention in the database after performing a balance verification to generate transaction intention information.
[0082] In one embodiment of the present invention, the first generation module 300 is specifically used to: construct a supply and demand balance constraint using the following formula: , in, This represents the maximum sellable electricity for user i within the set of energy seller roles during time period c. This represents the maximum purchasable electricity for user j within the set of energy demanders during time period c. This represents the group of energy sellers. This represents the set of energy demanders; The price range constraint is constructed using the following formula: , in, This represents the transaction price of electricity for user j in the user set representing the demand side during time period c. This indicates setting a ceiling on the electricity purchase price for the power grid. This represents the upper bound of electricity prices indicating market structure. This represents the transaction price of electricity for user i in the energy seller role set during time period c. This indicates the reference electricity price for the power grid; The objective function is constructed using the following formula: , in, This indicates the energy seller role identifier for user i during time period c. This indicates that user j is an energy demander during time period c.
[0083] It should be noted that for details not disclosed in the distributed energy peer-to-peer transaction optimization system of this embodiment of the invention, please refer to the details disclosed in the above-described distributed energy peer-to-peer transaction optimization method, which will not be elaborated here.
[0084] According to an embodiment of the distributed energy peer-to-peer trading optimization system of the present invention, the system acquires dynamic energy data of participating users in energy transactions within various time periods through an acquisition module, constructs a time-series energy state database based on the dynamic energy data, identifies the energy roles of target users within a target time period based on the time-series energy state database, generates transaction intention information based on the time-series energy state database and the energy role identification results through a first generation module, constructs supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the transaction intention information through a first construction module, solves the target matching scheme through linear programming based on the supply and demand balance constraints, price range constraints, and objective function through a solution module, standardizes the target matching scheme to generate a matching result database through a second generation module, constructs a blockchain transaction data structure based on the matching result database and economic benefit indicators through a second construction module, and calls a smart contract to perform on-chain transaction confirmation and bill generation. Thus, by identifying the energy roles of target users within a target time period based on the time-series energy state database and generating transaction intention information based on the role identification results, the system improves transaction efficiency and enhances flexibility and transparency.
[0085] Corresponding to the above embodiments, the present invention also proposes a computer device.
[0086] The computer device in this embodiment of the invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the distributed energy peer-to-peer transaction optimization method of the above embodiment.
[0087] According to the computer device of the present invention, the target user's energy role in a target time period is identified based on a time-series energy state database, and transaction intention information is generated based on the role identification results, thereby improving transaction efficiency and enhancing flexibility and transparency.
[0088] Corresponding to the above embodiments, the present invention also proposes a non-transitory computer-readable storage medium.
[0089] The non-transitory computer-readable storage medium of this invention stores a computer program that, when executed by a processor, implements the above-described distributed energy peer-to-peer transaction optimization method.
[0090] According to embodiments of the present invention, a non-transitory computer-readable storage medium identifies the energy role of a target user within a target time period based on a time-series energy state database, and generates transaction intention information based on the role identification results, thereby improving transaction efficiency and enhancing flexibility and transparency.
[0091] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. "A plurality of" means two or more, unless otherwise explicitly specified.
[0092] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0093] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "over," and "on top" of the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.
[0094] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0095] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0096] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for optimizing peer-to-peer trading of distributed energy resources, characterized in that, Includes the following steps: Acquire dynamic energy data of energy trading participants in various time periods, and construct a time-series energy status database based on the dynamic energy data; The energy role of the target user within the target time period is identified based on the time-series energy state database. Based on the time-series energy state database and the energy role identification results, transaction intention information is generated. Based on the aforementioned transaction intention information, supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits are constructed. Based on the supply and demand balance constraints, the price range constraints, and the objective function, the objective matching scheme is solved by linear programming. The target matching scheme is standardized to generate a matching result database; Based on the matching result database and economic benefit indicators, a blockchain transaction data structure is constructed, and smart contracts are invoked to confirm on-chain transactions and generate invoices.
2. The distributed energy peer-to-peer trading optimization method according to claim 1, characterized in that, The dynamic energy data includes: household load power, distributed photovoltaic power generation data, energy storage device status data, and energy interaction data of electric vehicles.
3. The distributed energy peer-to-peer trading optimization method according to claim 2, characterized in that, The energy storage device status data includes energy storage charging amount and energy storage discharging amount; the electric vehicle's energy interaction data includes the electric vehicle's charging amount and discharging amount; and a time-series energy status database is constructed based on the dynamic energy data, including: The first state of charge of the energy storage device is calculated based on the energy storage charging amount and the energy storage discharging amount. The second state of charge of the electric vehicle is calculated based on the charging and discharging amounts of the electric vehicle. The time-series energy state database is constructed based on the household load power, distributed photovoltaic power generation data, energy storage device status data, electric vehicle energy interaction data, first state of charge, and second state of charge for each time period.
4. The distributed energy peer-to-peer trading optimization method according to claim 3, characterized in that, Identifying the energy role of the target user within a target time period based on the time-series energy state database includes: Extract the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data within the target time period from the time-series energy status database; The net energy index of the target user during the target time period is calculated based on the target user's household load power, distributed photovoltaic power generation data, energy storage device status data, and electric vehicle energy interaction data during the target time period. The target user's energy role within the target time period is identified based on the net energy index; wherein, if the net energy index is greater than 0, the target user is identified as an energy seller within the target time period; if the net energy index is less than 0, the target user is identified as an energy demander within the target time period.
5. The distributed energy peer-to-peer trading optimization method according to claim 4, characterized in that, Based on the time-series energy state database and combined with the energy role identification results, transaction intention information is generated, including: The initial transaction intention of the target user within the target time period is obtained based on the time-series energy state database and the energy role identification result; After the initial transaction intentions are balanced and verified, they are standardized and stored in the database to generate the transaction intention information.
6. The distributed energy peer-to-peer trading optimization method according to claim 5, characterized in that, The supply and demand balance constraint is constructed using the following formula: , in, This represents the maximum sellable electricity for user i within the set of energy seller roles during time period c. This represents the maximum purchasable electricity for user j within the set of energy demanders during time period c. This represents the group of energy sellers. This represents the set of energy demanders; The price range constraint is constructed using the following formula: , in, This represents the transaction price of electricity for user j in the user set representing the demand side during time period c. This indicates setting a ceiling on the electricity purchase price for the power grid. This represents the upper bound of electricity prices in relation to market structure. This represents the transaction price of electricity for user i in the energy seller role set during time period c. This indicates the reference electricity price for the power grid; The objective function is constructed using the following formula: , in, This indicates the energy seller role identifier for user i during time period c. This indicates that user j is an energy demander during time period c.
7. A distributed energy peer-to-peer trading optimization system, characterized in that, include: The acquisition module is used to acquire dynamic energy data corresponding to energy trading participants in various time periods, and to construct a time-series energy status database based on the dynamic energy data. The identification module is used to identify the energy role of the target user within a target time period based on the time-series energy state database. The first generation module is used to generate transaction intention information based on the time-series energy state database and in combination with the energy role identification result. The first construction module is used to construct supply and demand balance constraints, price range constraints, and an objective function oriented towards maximizing user benefits based on the transaction intention information. The solution module is used to solve the target matching scheme by linear programming based on the supply and demand balance constraint, the price range constraint and the objective function. The second generation module is used to standardize the target matching scheme to generate a matching result database. The second construction module is used to construct a blockchain transaction data structure based on the matching result database and economic benefit indicators, and to call smart contracts to confirm on-chain transactions and generate invoices.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the distributed energy peer-to-peer transaction optimization method according to any one of claims 1-6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the distributed energy peer-to-peer transaction optimization method according to any one of claims 1-6.