Distributed energy management system based on block chain and smart contract
By adopting a distributed energy management system with blockchain and smart contracts in the power management system, the data security, real-time monitoring and resource allocation problems of existing systems are solved, and more efficient, reliable and secure power system management is achieved.
Patent Information
- Application Number
- CN202510122514.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-06-06
AI Technical Summary
The existing power management systems have data security threats, lack of real-time monitoring and pre-control mechanisms, and unreasonable resource allocation, making it difficult to cope with the needs of modern power systems.
Adopt a distributed energy management system based on blockchain and smart contracts, and through the distributed data platform of blockchain and the automated management of smart contracts, we ensure data security and transparency, real-time monitoring and optimized resource allocation.
Improves the integrity of power data and system reliability and security, improves management efficiency and accuracy, and reduces human errors and operating costs.
Smart Images

Figure CN120109814A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power management systems, and in particular to a distributed energy management system based on blockchain and smart contracts and applied to a power system. Background Art
[0002] With the widespread access to renewable energy and the in-depth development of electricity marketization, the complexity and uncertainty of the power system have increased significantly. The main reasons are: the power generation capacity of renewable energy such as solar and wind power is affected by multiple factors such as weather, season and geographical location, resulting in significant volatility in energy supply. This volatility increases the difficulty of scheduling and operation of the power system. In addition, there are differences between renewable energy power generation equipment and traditional power generation equipment in terms of technical parameters, control methods and operation strategies. In order to meet these challenges, power management systems have emerged. Power management systems play a vital role in the power industry. They play an important role in improving production efficiency, ensuring equipment safety, optimizing resource allocation, improving data analysis capabilities, supporting decision-making, adapting to renewable energy access, and meeting the challenges of electricity marketization.
[0003] Currently, most existing power management systems adopt a centralized architecture, relying on a single control center for data management and dispatching instructions. This centralized architecture is vulnerable to network security threats. Once attacked, the entire system may be paralyzed. In addition, the data transmission and storage links lack security guarantees and are easily tampered with or stolen, reducing the reliability of the system. Finally, most current power management systems focus on post-analysis and lack effective real-time monitoring and pre-control mechanisms, power demand forecasting and equipment status monitoring methods, resulting in unreasonable resource allocation, delayed fault response, and increased system operating costs.
[0004] Therefore, the existing centralized power management system is difficult to meet the needs of modern power systems, especially in terms of data security, real-time response and optimal resource allocation. Summary of the invention
[0005] In order to solve at least one of the problems mentioned in the above background technology, the purpose of the present invention is to provide a distributed energy management system based on blockchain and smart contracts to improve the reliability and security of the system and improve management efficiency and accuracy.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A distributed energy management system based on blockchain and smart contracts, comprising: a distributed data platform based on blockchain, wherein each node is connected to each power facility of the power system, and each node obtains data of corresponding power settings and shares it with other nodes; the distributed data platform is configured with: a smart contract deployment module, which is used to deploy smart contracts on the distributed data platform; each power facility interacts with the distributed data platform through the smart contract, and autonomously configures power output according to the smart contract.
[0008] Furthermore, the smart contract adopts a Solidity contract, in which transaction rules are pre-set, including: pre-setting the maximum power generation that can be received and connected to the grid, and accepting the power generation output by the power facility when the power generation requested to be output by the corresponding power facility does not exceed the maximum power generation, otherwise refusing to accept it.
[0009] In order to ensure the reasonable allocation of power resources and improve resource utilization, the present invention provides a preferred solution. The distributed energy management system also includes: a power demand forecasting module, which is distributed at each power facility and is used to predict the power consumption on the demand side of each power facility; in order to achieve accurate prediction of power demand, the power demand forecasting module adopts edge computing equipment, and realizes power demand forecasting at each power facility through the ARIMA model supported by edge computing.
[0010] In order to realize the real-time monitoring mechanism and detect anomalies in time, the present invention provides a preferred solution. The distributed energy management system also includes: a sensor network, including multiple sensors of various types, distributed at various power facilities, for obtaining data from each power facility in real time; a data analysis subsystem, for receiving real-time data obtained by the sensor network and performing anomaly analysis. Once an anomaly is found, an alarm is immediately triggered, and a fault analysis is performed to determine whether a fault has occurred and obtain corresponding fault data.
[0011] Furthermore, in order to more effectively reduce the occurrence of unexpected downtime events, the present invention provides a preferred solution, and the data analysis subsystem of the distributed energy management system is configured with: a fault identification module, which is used to analyze historical fault data and establish a fault mode library based on this, and when a new abnormal situation is monitored through the sensor network, it quickly identifies the fault mode; in order to further enhance the system's intelligent processing capabilities and self-repair mechanism, the fault identification module uses a K-nearest neighbor algorithm to perform historical fault data analysis and fault identification.
[0012] In order to further improve the security of the energy management system, the present invention provides a preferred solution, in which the system adopts a multi-level security protection system including firewalls, intrusion detection and data encryption.
[0013] Compared with the prior art, the above technical solution can mainly achieve the following beneficial technical effects:
[0014] The distributed energy management system based on blockchain and smart contracts in the present invention constructs a distributed data platform based on blockchain. Since each node in the blockchain maintains a copy of the data status and the ledger and uses a data encryption and verification mechanism, it can prevent data from being tampered with, ensuring the safe and transparent transmission of power data, and effectively improving the integrity of power data, the reliability and security of the system.
[0015] The distributed energy management system based on blockchain and smart contracts of the present invention utilizes smart contracts to automatically manage the configuration and scheduling of the power system, ensuring that all operations are traceable, thereby improving the transparency and credibility of the system while reducing human errors, and achieving efficient and accurate power system management. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0017] Figure 1 This is a schematic diagram of a distributed data platform based on blockchain in a distributed energy management system based on blockchain and smart contracts in Embodiment 1 of the present invention;
[0018] Figure 2 This is a schematic diagram of a distributed energy management system based on blockchain and smart contracts according to Embodiment 1 of the present invention;
[0019] Figure 3 Schematic diagram of distributed energy management system based on blockchain and smart contracts in Embodiment 2 of the present invention
[0020] Figure 4 This is a flow chart of predicting power demand by a power demand prediction module in a distributed energy management system based on blockchain and smart contracts in Embodiment 2 of the present invention;
[0021] Figure 5 This is a schematic diagram of a distributed energy management system based on blockchain and smart contracts according to the third embodiment of the present invention;
[0022] Figure 6 This is a flow chart of a fault identification module in a distributed energy management system based on blockchain and smart contracts according to the third embodiment of the present invention;
[0023] Figure 7 This is a schematic diagram of a distributed energy management system based on blockchain and smart contracts according to Embodiment 3 of the present invention.
[0024] The figure numbers are as follows: power facility 1, sensor 2, power demand prediction module 3, blockchain-based distributed data platform 4, node 41, smart contract deployment module 42, central server 5, data analysis subsystem 51, fault identification module 511. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] Embodiment 1
[0027] In traditional power systems, the system is unreliable due to data security vulnerabilities, especially in the data transmission and storage links, which are vulnerable to hacker attacks, resulting in the risk of system paralysis or data leakage. Moreover, in the existing power management methods, the level of automated management is low, and manual intervention is frequent, which not only consumes manpower but also easily introduces misoperation, and the stability and efficiency of the system are low. Therefore, in order to solve the above problems, this embodiment provides a distributed energy management system based on blockchain and smart contracts, which is applied to power systems. Please refer to Figure 1 and Figure 2 , mainly including the following: a distributed data platform 4 based on blockchain, each of whose nodes 41 is connected to each power facility 1 of the power system, each node 41 obtains the data of the corresponding power setting and shares it with the other nodes 41; the distributed data platform 4 based on blockchain is configured with: a smart contract deployment module 42, which is used to deploy smart contracts on the distributed data platform 4 based on blockchain; each node 41 participates in data synchronization and verification, each node 41 maintains a copy of the data status and the ledger, and digitally signs the newly generated data through an encryption algorithm. Each power facility 1 interacts with the distributed data platform 4 based on blockchain through a smart contract, and autonomously configures the power output according to the smart contract. The smart contract adopts a Solidity contract, and the transaction rules are pre-set in the contract, including: presetting the maximum power generation that can be received and connected to the grid by the distributed energy management system based on blockchain and smart contracts, and receiving the power generation output by the power facility 1 when the power generation requested to be output by the corresponding power facility 1 does not exceed the maximum power generation, otherwise it refuses to receive. More specific instructions are as follows:
[0028] The system of this embodiment first constructs a distributed data platform 4 based on blockchain, in which each node 41 maintains a copy of the data status and the ledger, and uses asymmetric encryption for digital signature, specifically using the RSA encryption algorithm ($C=m^e\mod n$), where $m$ represents plain text, $e$ represents the encryption key, and $n$ represents the modulus, to prevent data from being tampered with, improve data security and system reliability. Secondly, the system uses smart contract technology to automatically manage the configuration and scheduling of the power system. This embodiment gives the smart contract code established in specific practical applications, as follows:
[0029]
[0030]
[0031] The above code is explained as follows:
[0032] Specify the Solidity compiler version to be 0.8.0 or above;
[0033] Define a smart contract called PowerSystem;
[0034] Create a public mapping to store the balance of each account (here refers to the power generation)
[0035] Addresses are mapped to unsigned integers (generated amounts);
[0036] Assume maxOutput is the maximum power generation variable defined in the contract;
[0037] Define a public function to update the power generation of a specified account;
[0038] Use the require function to check whether the incoming power generation exceeds the maximum limit;
[0039] If exceeded, the transaction will be rolled back and an error message will be displayed;
[0040] If the power generation does not exceed the limit, the power generation of the sender (caller) is updated;
[0041] Add the incoming generation to the sender's current generation.
[0042] The smart contract ensures that all operations are well documented, thereby improving system transparency and credibility and reducing the occurrence of human errors. Smart contracts are used to automate power dispatch. For example, the Solidity contract code mentioned above can automatically adjust the power output of the wind farm according to pre-set rules without human intervention, greatly reducing dispatch errors.
[0043] In the actual application scenario of smart grid, the power company deployed a distributed data platform 4 based on blockchain, in which each power facility 1 participates in data synchronization and verification as a node 41. Whenever a new data record is generated, the system automatically generates a unique hash value, and then signs it using the above-mentioned RSA encryption algorithm to ensure the authenticity and integrity of the data. When the data needs to be shared with other participants, only the public key needs to be provided to verify the source of the data, avoiding the possibility of a man-in-the-middle attack. Smart contracts are used to automate power dispatch. For example, the above-mentioned Solidity contract code can automatically adjust the power output of a wind farm according to pre-set rules without human intervention, greatly reducing dispatch errors.
[0044] Embodiment 2
[0045] Embodiment 1 is optimized to provide a more preferred implementation mode. Compared with Embodiment 1, the distributed energy management system based on blockchain and smart contracts in this embodiment has the following additional features:
[0046] The existing power management system lacks effective real-time monitoring and pre-control mechanisms, especially the lack of real-time monitoring of key equipment status, which makes it impossible to accurately predict power demand, resulting in waste of resources and slow emergency response. To address this problem, first of all, this technical solution adds multi-level security protection measures and real-time monitoring methods. On the basis of the original system, the system introduces firewalls, intrusion detection systems and data encryption technology to form an all-round security barrier.
[0047] Secondly, please refer to Figure 3 In this embodiment, a power demand forecasting module 3 is also provided at each power facility 1 to forecast the power consumption on the demand side of each power facility 1. The power demand forecasting module 3 uses an edge computing device with computing capabilities to realize power demand forecasting at each power facility 1 through an ARIMA model supported by edge computing.
[0048] The power demand forecasting module 3 uses edge computing devices with computing capabilities. Each power facility 1 deploys an edge computing device as an edge computing node 41. Each edge computing node 41 realizes the power demand forecast of each power facility 1 through the ARIMA model supported by edge computing. The edge computing technology realizes the accurate forecast of power demand and uses the ARIMA model ($y_t=c+\phi_1y_{t-1}+\phi_2y_{t-2}+...+w_t$) for forecasting, where $c$ represents the constant term, $\phi_i$ represents the parameter, and $w_t$ represents the random error term, which improves the utilization of resources. Please refer to Figure 4 , which is achieved through the following steps:
[0049] S11: Data preparation and preprocessing: Collect the historical power demand time series data of each power facility 1, clean the data, and remove outliers and missing values;
[0050] S12: Forecast model construction and parameter estimation: Establish an ARIMA model in the form of:
[0051] y t =c+φ 1 y t-1 +φ 2 y t-2 +···+φ p y t-p +ω t
[0052] Among them, y t is the power demand at time t, c is a constant term, φ i is the autoregressive coefficient, ω t is the random error term, and p is the order of the autoregressive term; determine the p value by looking at the autocorrelation function and partial autocorrelation function graph of the data, or by using the information criterion; then fit the ARIMA model to obtain the parameters c and φ i An estimated value of
[0053] S13: Prediction calculation: Initialization, setting the initial y t-1 ,y t-2 ,···,y t-p Values, which come from the last p observations of historical data; starting from t = p + 1, y is iteratively calculated using the following formula t Predicted value of:
[0054]
[0055] in, is the predicted value at time t. Historical data is used for the first prediction, while the previous prediction value is used for subsequent predictions.
[0056] In the distributed energy management system based on blockchain and smart contracts optimized in this embodiment, edge computing nodes 41 are distributed in various areas of the power grid to continuously collect historical electricity consumption data and meteorological information. A demand forecasting model is established through the ARIMA model, and the forecast results can be set to be updated every hour to dynamically adjust the power generation plan.
[0057] Embodiment 3
[0058] Embodiment 2 is optimized to provide a more preferred implementation mode. Compared with Embodiment 2, the distributed energy management system based on blockchain and smart contracts in this embodiment has the following additional features:
[0059] Please refer to Figure 5 In order to further improve the monitoring mechanism of the system, the distributed energy management system based on blockchain and smart contracts in this embodiment is also equipped with a sensor network, including multiple sensors 2 of various types, distributed at each power facility 1, for real-time acquisition of data from each power facility 1; a data analysis subsystem 51, for receiving real-time data acquired by the sensor network, and performing abnormal analysis, triggering an alarm immediately once an abnormality is found, and performing fault analysis to determine whether a fault has occurred and obtain corresponding fault data; a central server 5, the data analysis subsystem 51 is configured in the central server 5, and the sensor network uploads the collected data to the central server 5. A fault identification module 511 is set in the data analysis subsystem 51, which is used to analyze historical fault data, and establish a fault mode library based on it, and quickly identify the fault mode when a new abnormal situation is detected through the sensor network. The sensor network continuously sends the health status of the equipment to the central server 5, and the data analysis subsystem 51 is used to regularly evaluate and identify faults. Once an abnormality is found, an alarm is immediately triggered to notify the operation and maintenance personnel to take preventive measures, effectively reducing the probability of unexpected downtime.
[0060] In order to further enhance the intelligent processing capability and self-repair mechanism of the system, the system integrates a machine learning model, specifically using the K nearest neighbor algorithm ($kNN:f(x)=argmax_y P(y|x)$) to analyze a large amount of historical fault data and extract a fault pattern library. Once sensor 2 detects an abnormal situation with a similar pattern, the system can quickly initiate an emergency plan, such as switching to a backup line or adjusting load distribution, to minimize the fault recovery time. That is, the fault identification module 511 uses the K nearest neighbor algorithm to analyze historical fault data and identify faults, please refer to Figure 6 , which is achieved through the following steps:
[0061] S21: Collect historical fault data: Collect historical fault data including fault mode, sensor 2 readings when the fault occurs, device status and environmental condition data;
[0062] S22: Feature extraction: extract features from historical fault data to obtain fault features corresponding to different fault modes;
[0063] S23: Fault feature data preprocessing: Clean the acquired fault feature data to remove noise and outliers, and then standardize or normalize the data to ensure that different features have similar scales;
[0064] S24: Building a fault mode library: using the preprocessed historical fault data as a training set, determining the k value, and training the kNN model to build a fault mode library; storing the trained kNN model, model parameters, and several representative fault samples as references, such as the central sample of each category;
[0065] S25: Fault identification: Input the data of each power facility 1 collected in real time from the sensor network into the trained kNN model to predict the fault mode to which the real-time data belongs. Figure 7 ,The specific calculation steps of the kNN model in real-time fault identification are as follows:
[0066] S251: Obtain real-time data: Obtain device data monitored by sensor 2 in real time.
[0067] S252: real-time data preprocessing: cleaning, standardizing or normalizing the real-time data;
[0068] S253: Calculate distance: For the preprocessed real-time data, calculate the distance between it and each fault sample in the fault mode library. The distance measurement method uses the Euclidean distance:
[0069]
[0070] Among them, x is real-time data, x i is the i-th sample in the fault mode library, x j and x ij are the values of real-time data and samples on the jth feature, respectively, and n is the number of features;
[0071] S254: Select k nearest neighbors: select k samples with the closest distance according to the calculated distance;
[0072] S255: Count the fault types: Count the fault modes to which the k samples belong, and determine the majority fault mode as the prediction result of the real-time data.
[0073] In actual implementation, in a distributed energy management system based on blockchain and smart contracts, the operation and maintenance team regularly uploads fault logs to the cloud database, which are used to train the neural network model after cleaning and labeling. The model can capture the common characteristics of different fault types. When the signal captured by the sensor network highly matches a certain pattern, the system will automatically execute the corresponding remedial measures to reduce or even eliminate the impact of the fault.
[0074] Through the above embodiments, the distributed energy management system based on blockchain and smart contracts of the present invention can achieve the following beneficial technical effects compared with the prior art:
[0075] The distributed energy management system based on blockchain and smart contracts in the present invention constructs a distributed data platform based on blockchain, ensuring the secure and transparent transmission of power data. Since each node maintains a copy of the data status and the ledger and uses a data encryption and verification mechanism (asymmetric encryption digital signature), it can prevent data from being tampered with, effectively improving the integrity of power data, the reliability and security of the system.
[0076] The distributed energy management system based on blockchain and smart contracts of the present invention utilizes smart contract technology to automatically manage the configuration and scheduling of the power system, ensuring that all operations are traceable, thereby improving the transparency and credibility of the system, while reducing human errors and achieving efficient and accurate power system management.
[0077] The distributed energy management system of the present invention based on blockchain and smart contracts builds a multi-level security protection system. Through the application of firewalls, intrusion detection systems and data encryption technology, the system's ability to resist external threats is enhanced, data security is improved, and the safety of data during transmission and storage is ensured.
[0078] The distributed energy management system based on blockchain and smart contracts introduces edge computing technology to achieve real-time and efficient electricity demand forecasting. Through edge computing nodes, historical electricity consumption data and real-time weather information are collected and processed, prediction models are quickly generated, and the formulation of power generation plans is guided, which greatly improves the prediction accuracy.
[0079] The distributed energy management system based on blockchain and smart contracts in the present invention deploys a wide range of sensor networks to comprehensively monitor the status of key equipment. The power demand forecasting technology (ARIMA model) supported by edge computing and the widely deployed sensor network together constitute a comprehensive real-time monitoring framework. The data collected by the sensors is transmitted to the central server through the Internet of Things technology, and the artificial intelligence algorithm is used to automatically identify abnormal behaviors, warn of potential failures in advance, and avoid and prevent the occurrence of unplanned downtime events.
[0080] In summary, the distributed energy management system based on blockchain and smart contracts has comprehensively improved the intelligence level of the power system through the comprehensive application of the above measures, optimized resource allocation, improved operating efficiency, reduced the possibility of failures, and provided users with more stable and reliable power services.
[0081] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the above-mentioned embodiments of the methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0082] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0083] The above-described embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A distributed energy management system based on blockchain and smart contracts, characterized in that: include: A distributed data platform based on blockchain, each of whose nodes is connected to each power facility of the power system, and each node obtains data of the corresponding power facility and shares it with other nodes; the distributed data platform is configured with: a smart contract deployment module, which is used to deploy smart contracts on the distributed data platform; each power facility interacts with the distributed data platform through the smart contract, and autonomously configures power output according to the smart contract.
2. The distributed energy management system based on blockchain and smart contracts according to claim 1 is characterized in that: The smart contract adopts a Solidity contract, and the transaction rules are pre-set in the contract, including: pre-setting the maximum power generation that can be received and connected to the grid, and accepting the power generation output by the power facility when the power generation requested to be output by the corresponding power facility does not exceed the maximum power generation, otherwise refusing to accept it.
3. The distributed energy management system based on blockchain and smart contracts according to claim 1 is characterized in that: Also includes: The power demand forecasting module is distributed in each power facility and is used to forecast the power consumption on the demand side of each power facility; The power demand forecasting module adopts edge computing equipment and realizes power demand forecasting at each power facility through the ARIMA model supported by edge computing.
4. The distributed energy management system based on blockchain and smart contracts according to claim 3 is characterized in that: The power demand forecasting module adopts edge computing devices. Each power facility deploys an edge computing device as an edge computing node. Each edge computing node realizes the power demand forecasting of each power facility through the ARIMA model supported by edge computing. Specifically, it includes the following: S11: Data preparation and preprocessing: Collect historical power demand time series data from various power facilities, clean the data, and remove outliers and missing values; S12: Forecast model construction and parameter estimation: Establish an ARIMA model in the form of: y t =c+φ1y t-1 +φ2y t-2 +···+φ p y t-p +oh t Among them, y t is the power demand at time t, c is a constant term, φ i is the autoregressive coefficient, ω t is the random error term, and p is the order of the autoregressive term; determine the p value by looking at the autocorrelation function and partial autocorrelation function graph of the data, or by using the information criterion; then fit the ARIMA model to obtain the parameters c and φ i An estimated value of S13: Prediction calculation: Initialization, setting the initial y t-1 ,y t-2 ,···,y t-p Values, which come from the last p observations of historical data; starting from t = p + 1, y is iteratively calculated using the following formula t Predicted value of: in, is the predicted value at time t. Historical data is used for the first prediction, while the previous prediction value is used for subsequent predictions.
5. The distributed energy management system based on blockchain and smart contracts according to any one of claims 1 to 4, characterized in that: Also includes: A sensor network, including multiple sensors of various types, distributed at various power facilities, for obtaining data from each power facility in real time; The data analysis subsystem is used to receive real-time data obtained by the sensor network and perform abnormal analysis. Once an abnormality is found, an alarm is immediately triggered, and a fault analysis is performed to determine whether a fault has occurred and obtain the corresponding fault data.
6. The distributed energy management system based on blockchain and smart contracts according to claim 5 is characterized in that: The data analysis subsystem is configured with: a fault identification module, which is used to analyze historical fault data and establish a fault mode library based on it, and quickly identify the fault mode when a new abnormal situation is monitored through the sensor network; the fault identification module uses a K-nearest neighbor algorithm to analyze historical fault data and identify faults.
7. The distributed energy management system based on blockchain and smart contracts according to claim 6 is characterized in that: The fault identification module uses the K nearest neighbor algorithm to analyze historical fault data and identify faults, which specifically includes the following: S21: Collect historical fault data: Collect historical fault data including fault mode, sensor readings when the fault occurred, equipment status and environmental condition data; S22: Feature extraction: extract features from historical fault data to obtain fault features corresponding to different fault modes; S23: Fault feature data preprocessing: clean the acquired fault feature data, and then standardize or normalize the data; S24: Building a fault mode library: using the preprocessed historical fault data as a training set, determining the k value, and training the kNN model to build a fault mode library; storing the trained kNN model, model parameters, and several representative fault samples as references; S25: Fault identification: The data of each power facility collected in real time from the sensor network is input into the trained kNN model to predict the fault mode to which the real-time data belongs.
8. The distributed energy management system based on blockchain and smart contracts according to claim 7 is characterized in that: In step S25, the specific calculation steps of the kNN model in real-time fault identification are as follows: S251: Obtain real-time data: Obtain device data monitored by the sensor in real time. S252: real-time data preprocessing: cleaning, standardizing or normalizing the real-time data; S253: Calculate distance: For the preprocessed real-time data, calculate the distance between it and each fault sample in the fault mode library. The distance measurement method uses the Euclidean distance: Among them, x is real-time data, x i is the i-th sample in the fault mode library, x j and x ij are the values of real-time data and samples on the jth feature, respectively, and n is the number of features; S254: Select k nearest neighbors: select k samples with the closest distance according to the calculated distance; S255: Count the fault types: Count the fault modes to which the k samples belong, and determine the majority fault mode as the prediction result of the real-time data.
9. The distributed energy management system based on blockchain and smart contracts according to claim 5 is characterized in that: Also includes: The data analysis subsystem is configured in the central server, and the sensor network uploads the collected data to the central server.
10. The distributed energy management system based on blockchain and smart contracts according to claim 1 is characterized in that: The system adopts a multi-level security protection system including firewalls, intrusion detection and data encryption.