A residential energy system optimal control method based on data secure transmission

By establishing a residential energy system model and introducing blockchain technology, the problems of limited grid output power and low data security in residential energy management systems have been solved. Decentralized, tamper-proof, and controllable data security encryption collection and transmission have been achieved, improving dispatch efficiency and security.

CN116909151BActive Publication Date: 2026-06-23GUANGDONG UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG UNIV OF TECH
Filing Date
2023-08-02
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, residential energy management systems suffer from insecurity, low efficiency, and high costs when sharing data, and they do not consider the upper limit of the grid's output power, resulting in low dispatch efficiency.

Method used

A residential energy system model is established, taking into account the limited output power of the power grid. Blockchain technology is used to achieve decentralized, tamper-proof, and controllable secure encrypted data collection and transmission. An iterative optimization method is adopted to obtain the optimal control strategy, and data interaction is carried out through a proxy re-encryption mechanism and secure multi-party computation.

Benefits of technology

It achieves optimal control of residential energy systems, solves the problem of limited grid output power, improves data transmission security and efficiency, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116909151B_ABST
    Figure CN116909151B_ABST
Patent Text Reader

Abstract

The application provides a residential energy system optimal control method based on data safe transmission, comprising: establishing a residential energy system model; obtaining electricity price, residential load and total cost function at each moment; taking minimizing the value of the total cost function as a target, iteratively optimizing the residential energy control sub-model to obtain an optimal residential energy control strategy; controlling and scheduling the residential energy according to the optimal residential energy control strategy; in the scheduling process, storing the optimal control data into a corresponding database in the blockchain after encryption; a queryer queries the data of each database in the blockchain through a proxy re-encryption mechanism and calculates in a secure multi-party calculation mode; the application can effectively perform optimal control on the residential energy; in addition, the application also introduces the blockchain technology, realizes safe encryption collection, transmission and interaction of the decentralized, tamper-proof, controllable and traceable residential energy optimal control data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of residential energy system control technology, and more specifically, to an optimal control method for residential energy systems based on secure data transmission. Background Technology

[0002] Self-learning management and control of urban energy systems is a crucial vehicle for energy conservation and emission reduction, optimizing the allocation of new energy sources, and promoting the construction of smart cities. Seizing the opportunities presented by the development of next-generation artificial intelligence and building self-learning systems that meet the intelligent energy management and control needs of urban development in China is of paramount importance for implementing smart city construction. Furthermore, with the development of smart grids, increasingly higher intelligent requirements are being placed on the design of residential energy management systems. Intelligent residential energy management systems, through powerful communication capabilities, intelligent metering, and advanced optimization technologies, provide end-users with optimal energy usage management.

[0003] Traditional research on residential energy management systems only considers the limitations of battery storage and charging / discharging power. However, in reality, the output power of the power grid also has an upper limit, so this issue needs to be further considered in practical applications. On the other hand, when the energy system is distributing energy, the network is extremely vulnerable to information interference or data attacks from malicious nodes, which makes data interaction and sharing insecure, inefficient, and costly.

[0004] Existing technologies disclose a method for optimizing the scheduling of distributed energy systems based on demand response control. First, a smart load neural network model is trained based on electricity consumption data and simulation data to obtain a function of residential controllable active power demand with respect to the demand response control signal. Then, this function is substituted into a distributed energy management system model, and the current demand response control signal is optimized to minimize system operating costs. Next, the current demand response control signal is substituted into the function to calculate the residential controllable active power demand. Finally, the residential controllable active power demand, stationary active power demand, commercial active power demand, wind turbine and photovoltaic output, distributed generator operating costs, and energy storage system costs are substituted into the distributed energy management system model to optimize the scheduling strategy of the distributed energy system. Although the existing solutions can reduce system operating costs while improving the load capacity and utilization efficiency of the distributed energy system, they are still based on a centralized energy management system for scheduling, and still suffer from problems such as insecure data sharing, low efficiency, and high costs. Furthermore, this existing technology does not consider the issue of an upper limit to the grid's output power during actual scheduling. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, such as not considering the limited output power of the power grid and the low security, low efficiency and high cost of data transmission during scheduling, this invention provides an optimal control method for residential energy systems based on secure data transmission. This method considers the limited output power of the power grid during scheduling. Furthermore, by combining blockchain technology, it enables decentralized, tamper-proof, controllable and traceable secure encrypted collection and transmission of IoT data.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0007] This invention provides an optimal control method for a residential energy system, comprising the following steps:

[0008] S101: Establish a residential energy system model;

[0009] The residential energy system model includes: a power grid sub-model, a battery sub-model, and a residential energy control sub-model;

[0010] S102: Obtain the electricity price and residential load at each time point, and obtain the total cost function based on the established residential energy system model;

[0011] S103: With the goal of minimizing the total cost function, iteratively optimize the residential energy control sub-model to obtain the optimal residential energy control strategy;

[0012] S104: Control and schedule residential energy according to the optimal residential energy control strategy.

[0013] Preferably, the residential energy system in step S101 specifically comprises:

[0014] The residential energy system includes: a power grid, a battery, an inverter, a residential energy control module, and residential loads; the battery is connected to the input terminal of the residential energy control module through the inverter, the input terminal of the residential energy control module is also connected to the power grid, and the output terminal of the residential energy control module is connected to the residential loads.

[0015] The residential energy system includes three power supply modes: power supply to the residential load solely from the power grid, power supply to the residential load simultaneously from battery charging and peak-shifting of power supply from the power grid and battery, and power supply to the residential load solely from the battery.

[0016] Preferably, the residential energy system model established in step S101 is specifically as follows:

[0017] The specific sub-model of the power grid is as follows:

[0018] The output power P of the power grid at time t gt The following constraints must be met:

[0019]

[0020] P gt ≥0

[0021] in, and These are the minimum and maximum output power of the power grid, respectively;

[0022] The battery sub-model is specifically as follows:

[0023] E b(t+1) =E bt -P bt ×η(P bt )

[0024]

[0025]

[0026] Among them, E bt P represents the battery charge at time t; bt Let P be the output power of the battery at time t. bt A value greater than 0 indicates that the battery is discharging. bt <0 indicates battery discharge, P bt =0 indicates that the battery is idle; and These are the minimum and maximum battery capacity, respectively; and These are the minimum and maximum output power of the battery, respectively; η(P) bt The charge / discharge efficiency of the battery must satisfy:

[0027] η(P bt = 0.898 - 0.173|P bt | / P rate

[0028] Among them, P rate The rated output power of the battery, satisfying P rate >0;

[0029] The specific residential energy control sub-model is as follows:

[0030]

[0031] Where λ = 24 represents 24 hours in a day; γ represents the discount factor, satisfying 0 < γ < 1;

[0032]

[0033]

[0034]

[0035] u t =P bt

[0036] v t =u t+1 -u t

[0037]

[0038] Where m1, m2, and m3 are the first, second, and third constants, respectively; ∈ is the fourth constant, satisfying ∈ > 0; R a C is a symmetric positive definite matrix; t Let be the unit electricity price at time t; The median battery charge value satisfies... a t v is the first intermediate variable; t θ is the second intermediate variable; θ is the third intermediate variable.

[0039] The residential energy system model also satisfies the following constraints:

[0040] P L(t-1 ) = P b(t-1) η(P b(t-1) )+P gt

[0041] Among them, P L(t-1) This represents the electricity demand of residential users, satisfying P. L(t-1) =P Tt , where P Tt Let be the residential load at time t.

[0042] Preferably, the total cost function obtained in step S102 is specifically:

[0043]

[0044] Among them, C T Let T be the total electricity cost for a residential user at any given time.

[0045] Preferably, in step S103, the specific method for iteratively optimizing the residential energy control sub-model to obtain the optimal residential energy control strategy with the objective of minimizing the total cost function is as follows:

[0046] With the objective of minimizing the total cost function, the following HJB equation is obtained from the residential energy control sub-model:

[0047]

[0048] Based on the obtained HJB equations, the iterative equations corresponding to the residential energy control sub-model are established, specifically as follows:

[0049]

[0050] Where i is the iteration number, satisfying i = 1, 2, 3...;

[0051] The iterative control strategy is obtained based on the iterative equations corresponding to the residential energy control sub-model, specifically:

[0052]

[0053] The obtained iterative control strategy is iteratively optimized, and the optimal residential energy control strategy is obtained when the preset conditions are met.

[0054] Preferably, the battery is a lead-acid battery, and the inverter is a sinusoidal inverter based on power MOSFETs and pulse width modulation.

[0055] This invention also provides a blockchain-based method for secure data interaction in residential energy optimal control, utilizing data generated by the aforementioned residential energy system optimal control method, including the following steps:

[0056] S201: Data Acquisition and Classification: Acquire and classify data generated by the optimal control of the residential energy system in real time;

[0057] The data specifically refers to The classification categories include electricity consumption information, electricity price information, user information, and parameter information;

[0058] S202: Data storage: The categorized data is stored in encrypted form in the corresponding database in the blockchain;

[0059] The blockchain also includes a consensus layer comprising several consensus nodes, and enhances fault tolerance through an improved Byzantine fault-tolerant algorithm.

[0060] S203: Data Interaction: This includes data querying and data application, specifically:

[0061] Data Query: The queryer uses a proxy re-encryption mechanism to query data in various databases within the blockchain to complete the data query.

[0062] Data application: Each queryer corresponds to a consensus node in the blockchain. Each queryer uses a secure multi-party computation method to jointly share and compute data based on data from various databases in the blockchain and data from other queryers to complete the data application.

[0063] Preferably, the improved Byzantine fault-tolerant algorithm is specifically as follows:

[0064] The consensus layer consists of n consensus nodes, and its fault tolerance is f = (n-1) / 3.

[0065] S202.1: When the blockchain receives an information access request, the visitor uses their private key to complete identity authentication and broadcasts it to the entire network;

[0066] S202.2: When a consensus node receives a verification message, it determines whether it is the master node. If not, it proceeds to the next node to determine whether it is the master node again. If it is the master node, it determines whether the access request is valid. If valid, it forms a consensus proposal based on the access request and executes step S202.3. If invalid, it executes step S202.6.

[0067] S202.3: After a preset time, the master node sends the consensus proposal to the entire network;

[0068] S202.4: After receiving the consensus proposal, other consensus nodes will determine whether it is true. If the proposal is not true, the master node will be suspected by other consensus nodes; if the proposal is true, the master node will send a confirmation message to all consensus nodes.

[0069] S202.5: Consensus is reached when any consensus node receives 2f acknowledgment messages;

[0070] S202.6: Repeat steps S202.1 to S202.5 to perform consensus judgment in a loop.

[0071] Preferably, the joint sharing computation process in step S203 uses MapReduce for homomorphic encryption computation.

[0072] Preferably, the proxy re-encryption mechanism in step S203 specifically includes:

[0073] The proxy re-encryption mechanism includes: a key generation algorithm KeyGen, a proxy re-encryption key generation algorithm ReKey, an encryption algorithm Encrypt, a proxy re-encryption algorithm ReEncrypt, and a decryption algorithm Decrypt;

[0074] Using the "somewhat homomorphic" scheme, construct an integer w′. i,j,k =w i,0 ·w j,1 ·w k,2 mod w0, and i, j, k satisfy 1≤i, j, k≤β, where β is a preset constant and mod represents the modulo operation;

[0075] w′ used for encryption i,j,k The quantity τ is β 3 3β w in public key storage i,b The public key size will decrease from τ to It can encrypt k bits at a time;

[0076] KeyGen(1 k )→(pk i ,sk i ): Input security parameters The key generation algorithm KeyGen outputs a public / private key pair (pk) for user i. i ,sk i );

[0077] ReKey(pk A ,sk A , pk B ,sk B )→(rk A→B ): Enter Alice's public / private key (pk A ,sk A ) and Bob's public / private key (pk B ,sk B The ReKey proxy re-encryption key generation algorithm outputs a proxy re-encryption key rk. A→B In this context, Alice is the principal and Bob is the agent.

[0078] Encrypt(pk i ,m)→c i : Input user i's public key pk i and messages The encryption algorithm Encrypt outputs the ciphertext of message m.

[0079] ReEncrypt(rk A→B c A →c B : Input a proxy re-encryption key rk A→B And Alice's ciphertext c A The proxy re-encryption algorithm ReEncrypt outputs re-encrypted ciphertext for Bob.

[0080] Decrypt(sk i c i → m: Input user i's private key sk i and ciphertext c i The Decrypt algorithm outputs message m or error symbol ⊥ indicating the ciphertext c. i It's illegal.

[0081] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0082] This invention provides an optimal control method for residential energy systems based on secure data transmission. First, a residential energy system model is established. Electricity prices and residential loads at each moment are obtained, and a total cost function is derived from the established model. The residential energy control sub-model is iteratively optimized to minimize the total cost function, yielding the optimal residential energy control strategy. Residential energy is controlled and scheduled according to the optimal strategy. During scheduling, data generated by the optimal residential energy control is acquired in real time and categorized. The categorized data is stored in encrypted form in corresponding databases within a blockchain. Queuers use a proxy re-encryption mechanism to query data in various databases within the blockchain, completing the data query. Each querier corresponds to a consensus node in the blockchain, and each querier employs secure multi-party computation to jointly share and compute data from various databases and other queriers within the blockchain, completing data application.

[0083] In the process of residential energy dispatching, this invention not only considers the limitations of battery storage and charging / discharging power, but also the limitations of grid output power, thus enabling effective optimal control of residential energy. In addition, this invention introduces blockchain technology to achieve decentralized, tamper-proof, controllable, and traceable secure encrypted collection, transmission, and interaction of optimal residential energy control data. Attached Figure Description

[0084] Figure 1 This is a flowchart of an optimal control method for a residential energy system provided in Example 1.

[0085] Figure 2 This is a schematic diagram of the residential energy system provided in Example 1.

[0086] Figure 3 This is a flowchart of blockchain data storage and query provided in Example 2.

[0087] Figure 4 This is a schematic diagram of blockchain data application and secure multi-party computation provided in Example 2. Detailed Implementation

[0088] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0089] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0090] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

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

[0092] Example 1

[0093] like Figure 1 As shown, this embodiment provides an optimal control method for a residential energy system, including the following steps:

[0094] S101: Establish a residential energy system model;

[0095] The residential energy system model includes: a power grid sub-model, a battery sub-model, and a residential energy control sub-model;

[0096] S102: Obtain the electricity price and residential load at each time point, and obtain the total cost function based on the established residential energy system model;

[0097] S103: With the goal of minimizing the total cost function, iteratively optimize the residential energy control sub-model to obtain the optimal residential energy control strategy;

[0098] S104: Control and schedule residential energy according to the optimal residential energy control strategy;

[0099] like Figure 2 As shown, the residential energy system in step S101 specifically includes:

[0100] The residential energy system includes: a power grid, a battery, an inverter, a residential energy control module, and residential loads; the battery is connected to the input terminal of the residential energy control module through the inverter, the input terminal of the residential energy control module is also connected to the power grid, and the output terminal of the residential energy control module is connected to the residential loads.

[0101] The residential energy system includes three power supply modes: power supply to the residential load solely by the power grid, simultaneous battery charging, power supply to the residential load by the power grid and battery during off-peak hours, and power supply to the residential load solely by the battery.

[0102] The residential energy system model established in step S101 is specifically as follows:

[0103] The specific sub-model of the power grid is as follows:

[0104] The output power P of the power grid at time t gt The following constraints must be met:

[0105]

[0106] P gt ≥0

[0107] in, and These are the minimum and maximum output power of the power grid, respectively;

[0108] The battery sub-model is specifically as follows:

[0109] E b(t+1) =E bt -P bt ×η(P bt )

[0110]

[0111]

[0112] Among them, E bt P represents the battery charge at time t; bt Let P be the output power of the battery at time t. bt A value greater than 0 indicates that the battery is discharging. bt A value less than 0 indicates that the battery is discharged. and These are the minimum and maximum battery capacity, respectively; and These are the minimum and maximum output power of the battery, respectively; η(P) bt The charge / discharge efficiency of the battery must satisfy:

[0113] η(P bt = 0.898 - 0.173|P bt | / P rate

[0114] Among them, P rate The rated output power of the battery, satisfying P rate >0;

[0115] The specific residential energy control sub-model is as follows:

[0116]

[0117] Where λ = 24 represents 24 hours in a day; γ represents the discount factor, satisfying 0 < γ < 1;

[0118]

[0119]

[0120]

[0121] u t =P bt

[0122] v t =u t+1 -u t

[0123]

[0124] Where m1, m2, and m3 are the first, second, and third constants, respectively; ∈ is the fourth constant, satisfying ∈ > 0; R a C is a symmetric positive definite matrix; t Let be the unit electricity price at time t; The median battery charge value satisfies... a t v is the first intermediate variable; t θ is the second intermediate variable; θ is the third intermediate variable.

[0125] The residential energy system model also satisfies the following constraints:

[0126] P L(t-1) =P b(t-1) η(P b(t-1) )+P gt

[0127] Among them, P L(t-1) This represents the electricity demand of residential users, satisfying P. L(t-1) =P Tt , where P Tt Let be the residential load at time t;

[0128] The total cost function obtained in step S102 is specifically as follows:

[0129]

[0130] Among them, C T Let T be the total electricity cost for residential users at each of the T time points.

[0131] In step S103, the specific method for iteratively optimizing the residential energy control sub-model to obtain the optimal residential energy control strategy with the objective of minimizing the total cost function is as follows:

[0132] With the objective of minimizing the total cost function, the following HJB equation is obtained from the residential energy control sub-model:

[0133]

[0134] Based on the obtained HJB equations, the iterative equations corresponding to the residential energy control sub-model are established, specifically as follows:

[0135]

[0136] Where i is the iteration number, satisfying i = 1, 2, 3...;

[0137] The iterative control strategy is obtained based on the iterative equations corresponding to the residential energy control sub-model, specifically:

[0138]

[0139] The obtained iterative control strategy is iteratively optimized, and the optimal residential energy control strategy is obtained when the preset conditions are met.

[0140] The battery is a lead-acid battery, and the inverter is a sinusoidal inverter based on power MOSFETs and pulse width modulation.

[0141] In the specific implementation process, the first step is to establish a residential energy system model;

[0142] In this embodiment, the residential energy system uses the AC utility grid as the primary power source and operates in parallel with the battery storage system. The system consists of the grid, a sine wave inverter, batteries, and a residential energy control module. The inverter charges and discharges the batteries, and its structure is based on power MOSFET technology and pulse width modulation technology. The power quality output by the inverter is comparable to that provided by the grid. The batteries are composed of lead-acid batteries, which are the most commonly used type of rechargeable battery. Generally, the size of the batteries allows them to power residential loads for 12 hours.

[0143] There are three operating modes for residential energy systems: 1) Charging mode: When the system load is low and the electricity price is cheap, the power grid directly supplies power to the user while charging the battery; 2) Idle mode: The power grid directly supplies power to the user during certain periods. From an economic point of view, it is more cost-effective to use a fully charged battery during the evening peak hours; 3) Discharging mode: Considering subsequent load demand and time-varying electricity costs, the battery supplies power to the residential load alone during periods when the cost of electricity from the power grid is high.

[0144] The residential energy system model includes: a power grid sub-model, a battery sub-model, and a residential energy control sub-model;

[0145] The specific sub-model of the power grid is as follows:

[0146] The output power P of the power grid at time t gt The following constraints must be met:

[0147]

[0148] P gt ≥0

[0149] in, and These represent the minimum and maximum output power of the power grid, respectively; P gt ≥0 indicates that power flow from the battery to the grid is not allowed to ensure the power quality of the grid;

[0150] To extend battery life, considering storage limitations and charge / discharge power limitations, the specific battery sub-model established is as follows:

[0151] E b(t+1) =E bt -P bt ×η(P bt )

[0152]

[0153]

[0154] Among them, E bt P represents the battery charge at time t; bt Let P be the output power of the battery at time t. bt A value greater than 0 indicates that the battery is discharging. bt <0 indicates battery discharge, P bt =0 indicates that the battery is idle; and These are the minimum and maximum battery capacity, respectively; and These are the minimum and maximum output power of the battery, respectively; η(P) bt The charge / discharge efficiency of the battery must satisfy:

[0155] η(P bt = 0.898 - 0.173|P bt | / P rate

[0156] Among them, P rate The rated output power of the battery, satisfying P rate >0;

[0157] The specific residential energy control sub-model is as follows:

[0158]

[0159] Where λ = 24 represents 24 hours in a day; γ represents the discount factor, satisfying 0 < γ < 1;

[0160]

[0161]

[0162]

[0163] u t =P bt

[0164] v t =u t+1 -ut

[0165]

[0166] Where m1, m2, and m3 are the first, second, and third constants, respectively; ∈ is the fourth constant, satisfying ∈ > 0; R a C is a symmetric positive definite matrix; t Let be the unit electricity price at time t; The median battery charge value satisfies... a t v is the first intermediate variable; t θ is the second intermediate variable; θ is the third intermediate variable. Used to solve state-constrained problems, when a nt →c n or a nt →d n At that time, J(a) t Minimizing this term ()→∞ can prevent the system state from approaching its boundary.

[0167] Given the household load and real-time electricity consumption, the objective of optimal control is to find the optimal battery charging / discharging / idling control law at each time step, considering battery constraints, to minimize the total cost of grid power supply. To find the optimal control law, load balancing needs to be considered. Therefore, the residential energy system model also satisfies the following constraints:

[0168] P L(t-1) =P b(t-1) η(P b(t-1) )+P gt

[0169] Among them, P L(t-1) This represents the electricity demand of residential users, satisfying P. L(t-1) =P Tt , where P Tt Let be the residential load at time t; this constraint means that at any given time, the sum of the electricity from the grid and the battery must equal the electricity demand of the residential users.

[0170] Then, the electricity price and residential load at each time point are obtained, and the total cost function is derived based on the established residential energy system model, specifically:

[0171]

[0172] Among them, C T Let m1(C) be the total electricity cost for a residential user at time T. t P gt ) 2 The goal is to minimize the total cost from the power grid. It is to avoid the battery from being fully charged and discharged, m3(P bt ) 2 The goal is to minimize the charging and discharging power of the battery.

[0173] Then, with the goal of minimizing the total cost function, the residential energy control sub-model is iteratively optimized to obtain the optimal residential energy control strategy.

[0174] make u t =P bt Then the equation for the household energy system is:

[0175]

[0176] in, Therefore, a home energy system is a state- and control-constrained system;

[0177] Introducing virtual control input: v t =u t+1 -u t ,make The following augmentation system is obtained:

[0178] a t+1 =F(a) t )+Gv t

[0179] in, Therefore, the problem is transformed into the control problem of a state-constrained augmented system;

[0180] With the objective of minimizing the total cost function, the following HJB equation is obtained from the residential energy control sub-model:

[0181]

[0182] Based on the obtained HJB equations, the iterative equations corresponding to the residential energy control sub-model are established, specifically as follows:

[0183]

[0184] Where i is the iteration number, satisfying i = 1, 2, 3...;

[0185] The iterative control strategy is obtained based on the iterative equations corresponding to the residential energy control sub-model, specifically:

[0186]

[0187] The obtained iterative control strategy is iteratively optimized, and the optimal residential energy control strategy is obtained when the preset conditions are met.

[0188] Finally, the residential energy is controlled and dispatched according to the optimal residential energy control strategy.

[0189] This method considers not only the limitations of battery storage and charging / discharging power, but also the limitations of grid output power during residential energy dispatch, thus enabling effective optimal control of residential energy.

[0190] Example 2

[0191] This embodiment provides a blockchain-based method for secure data interaction in residential energy optimal control. The method utilizes data generated by a residential energy system optimal control method from Embodiment 1, and includes the following steps:

[0192] S201: Data Acquisition and Classification: Acquire and classify data generated by the optimal control of the residential energy system in real time;

[0193] The data specifically refers to The classification categories include electricity consumption information, electricity price information, user information, and parameter information;

[0194] S202: Data storage: The categorized data is stored in encrypted form in the corresponding database in the blockchain;

[0195] The blockchain also includes a consensus layer comprising several consensus nodes, and enhances fault tolerance through an improved Byzantine fault-tolerant algorithm.

[0196] S203: Data Interaction: This includes data querying and data application, specifically:

[0197] Data Query: The queryer uses a proxy re-encryption mechanism to query data in various databases within the blockchain to complete the data query.

[0198] Data application: Each queryer corresponds to a consensus node in the blockchain. Each queryer uses a secure multi-party computation method to jointly and share computation based on data from various databases in the blockchain and data from other queryers to complete the data application.

[0199] The improved Byzantine fault-tolerant algorithm is specifically as follows:

[0200] The consensus layer consists of n consensus nodes, and its fault tolerance is f = (n-1) / 3.

[0201] S202.1: When the blockchain receives an information access request, the visitor uses their private key to complete identity authentication and broadcasts it to the entire network;

[0202] S202.2: When a consensus node receives a verification message, it determines whether it is the master node. If not, it proceeds to the next node to determine whether it is the master node again. If it is the master node, it determines whether the access request is valid. If valid, it forms a consensus proposal based on the access request and executes step S202.3. If invalid, it executes step S202.6.

[0203] S202.3: After a preset time, the master node sends the consensus proposal to the entire network;

[0204] S202.4: After receiving the consensus proposal, other consensus nodes will determine whether it is true. If the proposal is not true, the master node will be suspected by other consensus nodes; if the proposal is true, the master node will send a confirmation message to all consensus nodes.

[0205] S202.5: Consensus is reached when any consensus node receives 2f acknowledgment messages;

[0206] S202.6: Repeat steps S202.1 to S202.5 to perform consensus judgment in a loop;

[0207] The joint shared computing process uses MapReduce for homomorphic encryption operations;

[0208] The proxy re-encryption mechanism is specifically as follows:

[0209] The proxy re-encryption mechanism includes: a key generation algorithm KeyGen, a proxy re-encryption key generation algorithm ReKey, an encryption algorithm Encrypt, a proxy re-encryption algorithm ReEncrypt, and a decryption algorithm Decrypt;

[0210] Using the "somewhat homomorphic" scheme, construct an integer w′. i,j,k =w i,0 ·w j,1 ·w k,2 mod w0, and i, j, k satisfy 1≤i, j, k≤β, where β is a preset constant and mod represents the modulo operation;

[0211] w′ used for encryption i,j,k The quantity τ is β 3 3β w in public key storage i,b The public key size will decrease from τ to It can encrypt k bits at a time;

[0212] KeyGen(1 k )→(pk i ,sk i ): Input security parameters The key generation algorithm KeyGen outputs a public / private key pair (pk) for user i.i ,sk i );

[0213] ReKey(pk A ,sk A , pk B ,sk B )→(rk A→B ): Enter Alice's public / private key (pk A ,sk A ) and Bob's public / private key (pk B ,sk B The ReKey proxy re-encryption key generation algorithm outputs a proxy re-encryption key rk. A→B In this context, Alice is the principal and Bob is the agent.

[0214] Encrypt(pk i ,m)→c i : Input user i's public key pk i and messages The encryption algorithm Encrypt outputs the ciphertext of message m.

[0215] ReEncrypt(rk A→B c A →c B : Input a proxy re-encryption key rk A→B And Alice's ciphertext c A The proxy re-encryption algorithm ReEncrypt outputs re-encrypted ciphertext for Bob.

[0216] Decrypt(sk i c i → m: Input user i's private key sk i and ciphertext c i The Decrypt algorithm outputs message m or error symbol ⊥ indicating the ciphertext c. i It's illegal.

[0217] In the specific implementation process, the data generated by the optimal control of residential energy is first acquired in real time and classified; the acquired data specifically includes... The categories include electricity consumption information, electricity price information, user information, and parameter information;

[0218] Storing data on the blockchain would consume excessive space, leading to resource waste. Therefore, this embodiment uses encrypted form to store sensitive and large-volume information off-chain, preventing users and queryers from arbitrarily altering it, thus ensuring data security. During secure information storage, users categorize uploaded information, such as electricity price information and electricity consumption information, and share these categories externally. Data within each category is encrypted using a public key and stored in a designated database, with related addresses stored in an index table. When a queryer needs to retrieve information (i.e., during the information sharing phase), a proxy re-encryption mechanism is used to avoid directly exposing users' private keys when sharing data. The queryer needs to decrypt the data using their own private key to obtain the required data. The specific process is as follows... Figure 3 As shown;

[0219] In blockchain, the decentralized nature of the system means that no participant is trusted. Therefore, consensus algorithms are used to address issues such as malicious nodes and conflicting interests among parties. Traditional consensus mechanisms only address specific problems and cannot solve the fault tolerance issues of all blockchain systems. Therefore, this embodiment also includes a consensus layer comprising several consensus nodes and enhances fault tolerance through an improved Byzantine fault-tolerant algorithm, specifically:

[0220] The consensus layer consists of n consensus nodes, and its fault tolerance is f = (n-1) / 3.

[0221] When the blockchain receives an information access request, the visitor uses their private key to complete identity authentication and broadcasts it to the entire network. When a consensus node receives the verification information, it determines whether it is the master node. If not, the request is passed to the next node for further verification. If it is the master node, it determines whether the access request is legitimate. If legitimate, a consensus proposal is formed based on the access request; otherwise, the next round of consensus is initiated. After a preset time, the master node sends the consensus proposal to the entire network. Other consensus nodes receive the proposal and determine whether it is genuine. If the proposal is not genuine, the master node is suspected by other consensus nodes. If the proposal is genuine, the master node sends a confirmation message to all consensus nodes. When any consensus node receives 2f confirmation messages, consensus is reached. The above steps are repeated to continuously determine consensus.

[0222] During data interaction, the queryer uses a proxy re-encryption mechanism to query data in various databases in the blockchain to complete the data query.

[0223] Each queryer corresponds to a consensus node in the blockchain. Each queryer uses a secure multi-party computation method to jointly share and compute data based on data from various databases in the blockchain and data from other queryers to complete data application.

[0224] After generating a computation request, the requesting party submits its certificate signature and encryption public key to the blockchain. Consensus nodes in the consensus layer ensure mutual trust between nodes. Then, based on the request content, the original data is queried, and data from different institutions is merged for computation. The computation result is then encrypted and returned using the requesting party's public key. During this process, each institution is unaware of the other requesting parties' information. After receiving the returned result, the requesting party decrypts it using its private key to obtain the final result. This method achieves collaborative data sharing and computation while protecting information privacy.

[0225] The joint shared computing process employs MapReduce for homomorphic encryption operations, which can improve the efficiency of data computation when dealing with big data problems. It is divided into two stages: Map and Reduce. During the encryption process, if it is a master node, it will allocate Map and Reduce tasks; otherwise, it will be determined that the node is a Map node and a Reduce node. The Map node is responsible for encrypting the data in parallel using the homomorphic encryption algorithm, while the Reduce node will summarize and process the encrypted data and output the data. Finally, the encrypted ciphertext is stored off-chain, and the user controls the data. Only authorized users can obtain the real data, thus avoiding the need for third-party data management agencies.

[0226] Traditional public-key encryption schemes require a large amount of space to store the public key, have long encryption times, and low computational efficiency. Therefore, this embodiment uses proxy re-encryption technology for encryption. The proxy re-encryption mechanism is as follows:

[0227] The proxy re-encryption mechanism includes: a key generation algorithm KeyGen, a proxy re-encryption key generation algorithm ReKey, an encryption algorithm Encrypt, a proxy re-encryption algorithm ReEncrypt, and a decryption algorithm Decrypt;

[0228] Using the "somewhat homomorphic" scheme, construct an integer w′. i,j,k =w i,0 ·w j,1 ·w k,2 mod w0, and i, j, k satisfy 1≤i, j, k≤β, where β is a preset constant and mod represents the modulo operation;

[0229] w′ used for encryption i,j,k The quantity τ is β 3 3β w in public key storage i,b The public key size will decrease from τ to It can encrypt k bits at a time;

[0230] KeyGen(1 k )→(pk i,sk i ): Input security parameters The key generation algorithm KeyGen outputs a public / private key pair (pk) for user i. i ,sk i );

[0231] ReKey(pk A ,sk A , pk B ,sk B )→(rk A→B ): Enter Alice's public / private key (pk A ,sk A ) and Bob's public / private key (pk B ,sk B The ReKey proxy re-encryption key generation algorithm outputs a proxy re-encryption key rk. A→B In this context, Alice is the principal and Bob is the agent.

[0232] Encrypt(pk i ,m)→c i : Input user i's public key pk i and messages The encryption algorithm Encrypt outputs the ciphertext of message m.

[0233] ReEncrypt(rk A→B c A →c B : Input a proxy re-encryption key rk A→B And Alice's ciphertext c A The proxy re-encryption algorithm ReEncrypt outputs re-encrypted ciphertext for Bob.

[0234] Decrypt(sk i c i → m: Input user i's private key sk i and ciphertext c i The Decrypt algorithm outputs message m or error symbol ⊥ indicating the ciphertext c. i Illegal;

[0235] The encryption algorithm used in this embodiment encrypts plaintext with k bits, and each component of the public key is in cubic form. Compared to algorithms such as DGHV, this results in a smaller ciphertext length and public key size, making it more suitable for large data processing. It can complete multi-party encryption processing at the minute level and achieves privacy protection without relying on third parties. It supports communication methods such as TCP / IP, PROFIBUS-DP, and RS485. A complete shared and secure multi-party computation model is provided. Figure 4 As shown;

[0236] This method addresses the needs for secure protection, controllability, rapid transmission, and traceability of residential energy optimal control data. By introducing blockchain technology, it achieves decentralized, tamper-proof, controllable, and traceable secure encrypted collection, transmission, and interaction of residential energy optimal control data.

[0237] The same or similar labels correspond to the same or similar parts;

[0238] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.

[0239] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. An optimal control method for a residential energy system, characterized in that, Includes the following steps: S101: Establish a residential energy system model; The residential energy system model includes: a power grid sub-model, a battery sub-model, and a residential energy control sub-model; S102: Obtain the electricity price and residential load at each time point, and obtain the total cost function based on the established residential energy system model; S103: With the goal of minimizing the total cost function, iteratively optimize the residential energy control sub-model to obtain the optimal residential energy control strategy; S104: Control and schedule residential energy according to the optimal residential energy control strategy; The residential energy system in step S101 specifically refers to: The residential energy system includes: a power grid, a battery, an inverter, a residential energy control module, and residential loads; the battery is connected to the input terminal of the residential energy control module through the inverter, the input terminal of the residential energy control module is also connected to the power grid, and the output terminal of the residential energy control module is connected to the residential loads. The residential energy system includes three power supply modes: power supply to the residential load solely by the power grid, simultaneous battery charging, power supply to the residential load by the power grid and battery during off-peak hours, and power supply to the residential load solely by the battery. The residential energy system model established in step S101 is specifically as follows: The specific sub-model of the power grid is as follows: The output power of the power grid at time t The following constraints must be met: in, and These are the minimum and maximum output power of the power grid, respectively; The battery sub-model is specifically as follows: s.t. in, Let be the battery charge at time t; Let be the output power of the battery at time t. This indicates that the battery is discharging. This indicates that the battery is discharging. This indicates that the battery is idle; and These are the minimum and maximum battery capacity, respectively; and These are the minimum and maximum output power of the battery, respectively. For the battery's charge and discharge efficiency, the following must be satisfied: in, The rated output power of the battery must meet the requirements. ; The specific residential energy control sub-model is as follows: in, =24, which means 24 hours in a day; Represents the discount factor, satisfying ; in, , and These are the first, second, and third constants, respectively; It is the fourth constant, satisfying ; It is a symmetric positive definite matrix; Let be the unit electricity price at time t; The median battery charge value satisfies... ; As the first intermediate variable; It is the second intermediate variable; It is the third intermediate variable; 、 、 、 、 、 ; The residential energy system model also satisfies the following constraints: in, This indicates the electricity demand of residential users and meets their needs. ,in, Let be the residential load at time t.

2. The optimal control method for a residential energy system according to claim 1, characterized in that, The total cost function obtained in step S102 is specifically as follows: in, for The total electricity cost for residential users at any given time.

3. The optimal control method for a residential energy system according to claim 2, characterized in that, In step S103, the specific method for iteratively optimizing the residential energy control sub-model to obtain the optimal residential energy control strategy with the objective of minimizing the total cost function is as follows: With the objective of minimizing the total cost function, the following HJB equation is obtained from the residential energy control sub-model: Based on the obtained HJB equations, the iterative equations corresponding to the residential energy control sub-model are established, specifically as follows: Where i is the iteration number, satisfying ; The iterative control strategy is obtained based on the iterative equations corresponding to the residential energy control sub-model, specifically: The obtained iterative control strategy is iteratively optimized, and the optimal residential energy control strategy is obtained when the preset conditions are met.

4. The optimal control method for a residential energy system according to any one of claims 2 to 3, characterized in that, The battery is a lead-acid battery, and the inverter is a sinusoidal inverter based on power MOSFETs and pulse width modulation.

5. A blockchain-based method for secure data interaction in residential energy optimal control, utilizing data generated by the residential energy system optimal control method described in any one of claims 1 to 4, characterized in that... Includes the following steps: S201: Data Acquisition and Classification: Acquire and classify data generated by the optimal control of the residential energy system in real time; The data specifically refers to { , , , , , , , , The classification categories include electricity consumption information, electricity price information, user information, and parameter information; S202: Data storage: The categorized data is stored in encrypted form in the corresponding database in the blockchain; The blockchain also includes a consensus layer comprising several consensus nodes, and enhances fault tolerance through an improved Byzantine fault-tolerant algorithm. S203: Data Interaction: This includes data querying and data application, specifically: Data Query: The queryer uses a proxy re-encryption mechanism to query data in various databases within the blockchain to complete the data query. Data application: Each queryer corresponds to a consensus node in the blockchain. Each queryer uses a secure multi-party computation method to jointly share and compute data based on data from various databases in the blockchain and data from other queryers to complete the data application.

6. A secure data interaction method for optimal residential energy control based on blockchain according to claim 5, characterized in that, The improved Byzantine fault-tolerant algorithm is specifically as follows: The consensus layer includes Each consensus node has a fault tolerance capability of [number]. ; S202.1: When the blockchain receives an information access request, the visitor uses their private key to complete identity authentication and broadcasts it to the entire network; S202.2: When a consensus node receives a verification message, it determines whether it is the master node. If not, it proceeds to the next node to determine whether it is the master node again. If it is the master node, it determines whether the access request is valid. If valid, it forms a consensus proposal based on the access request and executes step S202.

3. If invalid, it executes step S202.

6. S202.3: After a preset time, the master node sends the consensus proposal to the entire network; S202.4: After receiving the consensus proposal, other consensus nodes will determine whether it is true. If the proposal is not true, the master node will be suspected by other consensus nodes; if the proposal is true, the master node will send a confirmation message to all consensus nodes. S202.5: When any consensus node receives When a confirmed message is sent, a consensus is reached; S202.6: Repeat steps S202.1 to S202.5 to perform consensus judgment in a loop.

7. A secure data interaction method for optimal residential energy control based on blockchain according to claim 6, characterized in that, The joint shared computation process in step S203 uses MapReduce for homomorphic encryption computation.

8. A secure data interaction method for optimal residential energy control based on blockchain according to claim 7, characterized in that, The proxy re-encryption mechanism in step S203 is specifically as follows: The proxy re-encryption mechanism includes: a key generation algorithm KeyGen, a proxy re-encryption key generation algorithm ReKey, an encryption algorithm Encrypt, a proxy re-encryption algorithm ReEncrypt, and a decryption algorithm Decrypt; Construct an integer using a somewhat homomorphic scheme. ,and satisfy ,in, As a preset constant, Represents modulo operation; Used for encryption quantity for One, in public key storage indivual The public key size will be from Decrease to Encryption can be performed once. ; KeyGen Enter security parameters The KeyGen key generation algorithm provides users with... Output a public / private key pair ; ReKey Enter Alice's public / private key Bob's public / private keys The ReKey proxy re-encryption key generation algorithm outputs a proxy re-encryption key. In this context, Alice is the principal and Bob is the agent. Encrypt Enter user public key and messages The Encrypt algorithm outputs messages. ciphertext ; ReEncrypt Enter a proxy re-encryption key. And Alice's cipher The proxy re-encryption algorithm ReEncrypt outputs re-encrypted ciphertext for Bob. ; Decrypt Enter user private key and ciphertext The Decrypt algorithm outputs the message. or error symbol Indicates ciphertext It's illegal.