Self-adaptive federated learning method for intelligent power grid oriented to digital twinning driving
Through the adaptive federated learning method driven by digital twins, combined with federated learning and blockchain technology, it solves the real-time and accuracy problems of smart grid fault analysis and decision-making, and realizes real-time monitoring and fault prediction of the status of power grid equipment. Improved the overall performance and security of the system.
Patent Information
- Application Number
- CN202410805567.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-06-21
AI Technical Summary
It is difficult to provide accurate fault analysis and efficient operation decisions during the management and operation of smart grids. Traditional technologies have limitations in real-time performance and accuracy, and their ability to predict unknown situations is insufficient.
Adopt an adaptive federated learning method driven by digital twins, combine digital twin technology, federated learning and blockchain technology to build a two-layer privacy computing architecture for the smart grid system. Through blockchain asynchronous federated learning and dynamic adaptive aggregation factors, Real-time status monitoring and fault prediction are achieved, and data security is ensured through the contribution proof consensus algorithm.
It improves the real-time and responsiveness of the smart grid system, enhances the accuracy of fault analysis and decision-making efficiency, reduces the impact of outdated models on the global model, and improves the overall performance and security of the system.
Smart Images

Figure CN118747540A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of smart grids, and in particular relates to an adaptive federated learning method for a smart grid driven by digital twins. Background Art
[0002] Digital twin technology is a new technology based on digitization, simulation and simulation. Its core idea is to digitize physical entities in the real world, create accurate models of them in virtual environments, and realize accurate simulation and prediction of physical entities through real-time data updates and analysis. The application scope of this technology covers many fields such as industrial manufacturing, Internet of Things, health care, urban planning, etc., bringing new development opportunities to various industries. The application of digital twin technology has broad prospects and value. In the field of industrial manufacturing, digital twin technology can be used to optimize and adjust the production process to improve production efficiency and product quality; in the field of health care, digital twin technology can be used to simulate and analyze the human body to assist doctors in diagnosis and treatment; in the field of urban planning, digital twin technology can be used to simulate and plan cities to optimize urban layout and resource allocation.
[0003] Federated learning is a distributed machine learning method that aims to solve the problems of data privacy and data security. In traditional centralized machine learning, data is usually stored on a central server for training, which may involve risks of privacy leakage and data security. In federated learning, data is always kept locally and does not leave the device or data source. Only the updated parameters of the model are sent to the central server for aggregation, thus greatly reducing the risk of data leakage.
[0004] Asynchronous federated learning is a variant of federated learning. It mainly solves the problem of low model training efficiency caused by network delays, inconsistent device performance and other problems in federated learning. In traditional synchronous federated learning, all participants must wait for the slowest participant to complete training before the next round of model updates, which greatly reduces the efficiency of the entire system. In asynchronous federated learning, each participant can update the model according to its own progress without waiting for other participants, which can improve the training efficiency of the entire system. The main advantage of asynchronous federated learning is that it can make full use of the computing resources of the participants to achieve parallel model training, thereby accelerating the convergence of the model. In addition, asynchronous federated learning can also adapt to the device performance and network conditions of different participants, improving the stability and reliability of the system. Therefore, asynchronous federated learning is of great significance in dealing with distributed machine learning tasks in large-scale data and complex network environments. While achieving data privacy and security, it improves the efficiency and performance of machine learning systems.
[0005] Blockchain technology is a decentralized distributed ledger technology, which was originally proposed as the underlying technology of the digital currency Bitcoin. The core feature of blockchain is to link transaction data into blocks in chronological order, and to ensure that it cannot be tampered with and is securely transmitted through cryptographic technology. These blocks are connected in a chain structure to form an ever-growing data chain. Blockchain technology achieves data security, transparency and traceability through decentralization, distributed consensus mechanism and encryption algorithm.
[0006] First, blockchain technology realizes decentralized data storage and management. Traditional data storage and management methods usually rely on centralized databases or servers, which have the risk of single point failure and data tampering. Blockchain technology stores data in multiple nodes in the network in a distributed manner. Each node has a complete copy of the data, and there is no centralized control, thereby improving the security and reliability of the data. Secondly, blockchain technology realizes a distributed consensus mechanism. In the blockchain network, all nodes reach a consensus through a consensus algorithm to determine the validity and order of transactions, and package valid transactions into blocks, which are then linked into a blockchain through an encryption algorithm. The distributed consensus mechanism ensures the consistency and integrity of the data, avoids the risk of single point failure and data tampering, and thus improves the security and credibility of the data. In addition, blockchain technology realizes the application of encryption algorithms. In the blockchain network, each block contains the hash value of the previous block, and the transaction data and the hash value of the previous block are connected together through an encryption algorithm, thus forming an unalterable data chain. The encryption algorithm ensures that the data in the blockchain cannot be tampered with or forged, ensuring the security and credibility of the data. In general, blockchain technology achieves data security, transparency and traceability through decentralized data storage and management, distributed consensus mechanism and encryption algorithm, and provides a new solution for data management and transactions in various industries. With the continuous development and popularization of blockchain technology, it is believed that it will bring more innovation and change to society.
[0007] In recent years, as one of the most important civil infrastructures, the power grid is moving towards the direction of integrating advanced communication, information and control technologies. Smart grids with functions such as status monitoring, fault analysis, and automatic decision-making have become the mainstream trend of development. At present, although many advances have been made in the field of smart grid technology, there are still some challenges and limitations. As a highly complex and dynamically changing system, the management and operation of the power grid face many challenges. One of them is that due to the complex and heterogeneous power equipment and the dynamic and changing power grid environment, the current smart grid often finds it difficult to continuously provide accurate fault analysis and efficient operation decisions, which has become an important issue limiting the current smart grid service level. In addition, traditional power grid intelligent optimization technology has certain limitations in terms of real-time and accuracy. Since the power grid state needs to be continuously updated and optimized, a large amount of computing resources and time are consumed, resulting in the real-time and response speed of the power grid system being limited. In addition, traditional power grid intelligent models can often only simulate and predict known situations, and often cannot accurately predict and judge unknown situations. Summary of the invention
[0008] In order to solve the problems existing in the management and operation of existing smart grids, the present invention provides an adaptive federated learning method for smart grids driven by digital twins (DT). By combining digital twin technology, federated learning and blockchain technology, a new solution is provided for fault analysis, operation decision-making and other aspects of smart grid systems.
[0009] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0010] The present invention provides an adaptive federated learning method for a digital twin-driven smart grid, which mainly includes the following steps:
[0011] Step 1: Build a smart grid system;
[0012] A two-layer privacy computing architecture is introduced into the smart grid system, which consists of a power equipment layer and a digital twin layer. In the power equipment layer, each independently working site is denoted as a Station, and each node with monitoring, recording, and transmission capabilities is denoted as a Device. Each Station is regarded as a collection of a series of Devices.
[0013] Step 2: Design a general digital twin solution for smart grid systems;
[0014] At time t, for the kth Device M of Station k Digital Twin Model DT k It is expressed as:
[0015]
[0016] Among them, ω k (τ) represents the kth DeviceM k In the training parameters of the τth round, F[ω k (τ)] represents the kth DeviceM k The current training state, s k (t) represents the current system state, Δs k Represents the current physical device and digital twin model DT k The interaction data between Representing physical equipment and digital twin model DT k Historical data of interactions between
[0017] Step 3: Blockchain asynchronous federated learning workflow;
[0018] The local device uses the storage device of the station to which it belongs to store the monitored data and captured images, and uses the computing power equipment of the station to which it belongs to perform local operations and train local models to ensure privacy. The local device uploads the trained local model to the distributed database of the BS through the wireless BS in an asynchronous manner. The LeaderStation scores the local model and aggregates the global model. The latest global model hash value and all local model hash values received in this round are packaged on the blockchain, and the latest global model is stored in the distributed database of the BS. The local device continuously uses the latest global model to train the local model.
[0019] Step 4: Definition of outdated local model problem, design of adaptive aggregation factor and committee leader election in smart grid system;
[0020] S4.1, Definition of the problem of outdated local model in smart grid system;
[0021] S4.2, designing an adaptive aggregation factor based on Newton's cooling law according to the defined outdated local model problem;
[0022] S4.3. Measure the contribution of the Station to the training task, and elect the committee leader using the weighted random election algorithm based on the obtained contribution.
[0023] Furthermore, the blockchain is used to register and verify the legitimacy of nodes, and transmit the model to the digital twin layer through the wireless BS in an asynchronous manner; the BS holds a distributed database with data synchronization function.
[0024] Furthermore, each BS deploys a blockchain peer for communicating with other nodes and maintaining a shared ledger. The shared ledger on the node can ensure that the local model cannot be tampered with during the training process; a memory area is allocated in the distributed database of the BS as a cache for the local model, and the cache level is obtained by dividing the number of cached local models by the total number of nodes.
[0025] Furthermore, the current system state s k (t) is expressed as:
[0026] s k (t) = {f k (t),E k (t),R k (t)} (2)
[0027] Among them, f k (t) represents the current computing capacity of the node, expressed as the CPU idle rate; E k (t) represents energy consumption; R k (t) represents memory usage.
[0028] Furthermore, before training the local model, an initial global model is predefined; the smart contract on each node triggers the training of the local model, which is sent to the BS after training. When enough local models are cached, the Leader Station (a committee of stations participating in the joint training, the leader selected) performs aggregation and generates an updated global model, which is then packaged together with the hash value of the cached local model into the block.
[0029] Furthermore, in step S4.1, the outdated local model problem in the smart grid system is defined as follows:
[0030]
[0031] in, represents the global model obtained by joint learning, represents the objective function of the global model, and the constraint represents the DeviceM participating in the training task at the τth round of aggregation in the asynchronous federated learning scenario. x Send the local model ω obtained based on the λth round of global model training to BS x (λ), λ represents the number of previous global model rounds of the local model held by node k, and λ is much smaller than τ.
[0032] Furthermore, in step S4.2, Newton's cooling law is used to adjust the weight of the old model in the global model aggregation; the aggregation weight of node k in the τth round is:
[0033]
[0034] Among them, τ represents the current round number, λ represents the previous global model round number of the local model held by node k, and W 0 Represents the weight value of the oldest local model, MW 0 Indicates the weight value of the latest local model; Represents the attenuation coefficient, which depends on the training task. The larger it is, the smaller the proportion of local models that take a long time to train in the global model.
[0035] Furthermore, the total model of round τ The calculation formula is:
[0036]
[0037] Where K represents the total number of participants, ω k represents the local model submitted by the kth participant, represents the aggregate weight of node k in the τth round.
[0038] Furthermore, in step S4.3, the specific operation process of measuring the contribution of the device to the computing task is as follows:
[0039] Based on the subjective logic model, the benefit to the computing framework when node k interacts with BS p at time t is expressed as:
[0040]
[0041] Among them, f k (t) represents the computing power of node k at time t, represents the failure probability of data packet transmission, represents the number of positive interactions, β k t Indicates the number of malicious behaviors such as uploading lazy data, Indicates the evaluation quality of the local model, which is obtained by testing the Leader Station using the target small sample data; the calculation formula for the contribution value of node k to the calculation framework is:
[0042]
[0043] Among them, κ∈[0, 1] represents the coefficient of the uncertainty degree affecting the contribution value.
[0044] Furthermore, in step S4.3, the specific operation process of electing the committee leader using the weighted random election algorithm according to the obtained contribution is as follows:
[0045] After several new blocks are generated, a new committee leader will be elected. In each election, each station selects the top K nodes with the highest contribution value to represent the contribution of the station to the computing framework. The contribution value of station h is calculated as Map the contribution value to (0,1], and we get In each election, according to the weighted random sampling algorithm, for each Generate a random number r h =random(0,1) and calculate The station with the largest p value becomes the leader station, and the election frequency of the committee leader is the inverse of the number of blocks to wait before electing a new committee leader.
[0046] The beneficial effects of the present invention are:
[0047] The adaptive federated learning method for a digital twin-driven smart grid of the present invention combines digital twin technology, federated learning technology and blockchain technology, and has the following advantages over the prior art:
[0048] (1) The present invention introduces digital twin technology into the smart grid system, designs a quantitative solution for the status of power grid equipment and system, and realizes real-time simulation and reflection of the status and behavior of physical equipment in the smart grid system, thereby improving the real-time performance and responsiveness of the smart grid system. Compared with traditional methods based on historical data and static models, digital twin technology can more accurately understand the real-time status and operation of power grid equipment, providing a reliable basis for system fault analysis and decision-making. In addition, through digital twin technology, the smart grid system can more accurately monitor the operating status of power grid equipment, predict potential faults, and take corresponding measures in a timely manner, thereby improving the safety and reliability of the power grid.
[0049] (2) The present invention adopts asynchronous federated learning and designs a dynamic adaptive aggregation factor, aiming to assign appropriate weights to local models from the perspective of timeliness, thereby reducing the impact of outdated local models in the power grid on the global model and improving the efficiency of learning tasks. In traditional synchronous federated learning, all participants must wait for the slowest participant to complete training before the next round of model updates can be performed, which will result in low training efficiency for the entire system. Compared with traditional synchronous federated learning methods, each participant in asynchronous federated learning can update the model according to its own progress, thereby improving the training efficiency and response speed of the system. Asynchronous federated learning can better cope with the differences in data and computing power between participants, and improve the overall performance and robustness of the system. In addition, by designing a dynamic aggregation factor, it is possible to assign appropriate weights to local models based on timeliness, further improving the efficiency and accuracy of learning tasks.
[0050] (3) To solve the problem of malicious nodes that may exist in a complex power grid environment, the present invention uses blockchain technology to authenticate the identity of nodes and record the models uploaded by each node for traceability. However, traditional blockchain technology performs poorly when processing large-scale data and high-concurrency scenarios. Each transaction in the blockchain needs to be verified and agreed upon by all nodes. When the number of transactions increases, it will cause network congestion and performance degradation, affecting the real-time performance and response speed of the system. In addition, there are also some problems with the consensus mechanism in the blockchain, such as the "51% attack", which may lead to data tampering and reduced security. To solve this problem, the present invention combines blockchain technology with federated learning and proposes a "contribution proof" consensus algorithm. Compared with traditional blockchain technology, the "contribution proof" consensus algorithm can better handle large-scale data and high-concurrency scenarios, improve the overall performance and security of the system, and at the same time, through the digital twin evaluation device's contribution to the computing framework and combined with the random process to reduce the probability of election fraud, improve the security and credibility of the smart grid system, and provide comprehensive protection for the security of the smart grid system. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 The following is an architecture diagram of the smart grid system.
[0052] Figure 2 This is a flow chart of an adaptive federated learning method for a digital twin-driven smart grid according to the present invention.
[0053] Figure 3 Flowchart for blockchain committee leader election. DETAILED DESCRIPTION
[0054] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0055] The present invention provides an adaptive federated learning method for a digital twin-driven smart grid, which specifically includes the following steps:
[0056] Step 1: Construct the smart grid system architecture;
[0057] The smart grid system is mainly composed of the power equipment layer and the digital twin layer. Among them, the main function of the power equipment layer is to provide data perception, collection, transmission and local training of the joint model. In the present invention, Figure 1As shown in the figure, the smart grid system is divided into four parts: power generation, transmission, distribution and consumption. The power generation part includes power generation facilities such as hydropower stations, nuclear power stations, and thermal power stations. The transmission part includes power transmission facilities such as high-voltage wires and substations. The distribution part includes distribution lines, distribution transformers and other distribution equipment. The power consumption part includes household electricity, industrial electricity, commercial electricity, etc. These four parts plus their sensors, networks, storage, computing equipment, etc. together constitute the power equipment layer. Each independently working site is recorded as a Station, such as a substation, a thermal power station, a factory with an independent meter, and a home user. Each Station is regarded as a collection of a series of Devices. Each node with monitoring, recording and transmission capabilities is recorded as a Device, such as temperature and humidity sensors, cameras, voltmeters, ammeters, etc. The local Device uses the storage device of the Station to which it belongs to store the monitored data and captured images, uses the Station's computing power equipment to perform local calculations, and trains local models to ensure privacy. The blockchain registers and verifies the legitimacy of the node. In order to reduce the discrete effect, an asynchronous method is used to transmit the model through the wireless base station and the digital twin (DT) layer.
[0058] The main functions of the digital twin layer are to verify the legitimacy of access nodes, receive legal models and calculate model weights to update the status of smart grid system replicas, trace uploaded local models, calculate Station contribution values, power load prediction, intelligent inspection, fault diagnosis and decision support, etc. The blockchain is maintained by a base station (BS) equipped with computing and caching resources. It holds a distributed database with data synchronization functions, stores the registration information, key features and federated learning parameters collected by grid equipment under the same training task, and is responsible for the legitimacy verification of access nodes. At the same time, the blockchain interacts with the DT layer to obtain the contribution of each device and Station to the training task. All BSs execute the consensus process of the blockchain to achieve global model consistency. All Stations participating in the task constitute committee members and are eligible to be elected as committee leaders through the "Proof of Contribution" consensus algorithm. The identity of the next committee leader is randomly determined by the contribution. The DT layer combines the power equipment layer sensors, machine learning algorithms and software analysis with spatial network graphics and other technologies to synchronize the status of each node through asynchronous federated learning and create a real-time digital simulation model of the smart grid system entity. The DT layer can not only collect the operation data of physical entities, but also implement control to change the state of physical entities. It can not only achieve collaboration with the device layer and blockchain through virtualization and resource scheduling, but also achieve smart grid system-level intelligent decision-making, distributed resource scheduling and advanced analysis through diversified artificial intelligence methods, and achieve instant storage and processing of delay-sensitive data, advanced grid scheduling and management services, and provide centralized resource coordination and comprehensive analysis. This continuous interaction with physical entities realizes two-way closed-loop information feedback.
[0059] Step 2: Design of a general digital twin solution for smart grid systems;
[0060] like Figure 1 As shown, the present invention introduces a two-layer privacy computing architecture in the smart grid system, which consists of a power equipment layer and a digital twin layer. Power equipment with limited communication and computing resources is connected to the DT server through a wireless communication link. The DT server maps the physical state of the power equipment and updates the model in real time. The data record of the power equipment is established by the Station to which it belongs. By collecting and processing the existing key physical state of the power equipment, it is passed to the DT server in the form of a model after blockchain authentication, dynamically presenting the historical and current behaviors of the power equipment.
[0061] In the present invention, the power station on the power generation side, the transmission station, substation, distribution station on the transmission side and the user on the power consumption side are all referred to as Station. To indicate that each station will have a series of devices locally, denoted as For example, ammeter, voltmeter, electric field strength, arc light and UHF sensor, etc. These devices are connected through Base Station. Establish a connection with the blockchain and DT. By collecting data, DT can describe the status of different devices.
[0062] At time t, for the kth Device M of Station k Digital Twin Model DT k It can be expressed as:
[0063]
[0064] Among them, ω k (τ) represents the kth DeviceM k In the training parameters of the τth round, F[ω k (τ)] represents the kth DeviceM k The current training state, s k (t) represents the current system state, Δs k Represents the current physical device and digital twin model DT k The interaction data between Representing physical equipment and digital twin model DT k The historical data of the interaction between the two systems, such as historical system status, historical update data, and historical model accuracy. Furthermore, the current system status s k (t) can be expressed as:
[0065] s k (t) = {f k (t),E k (t),R k (t)} (2)
[0066] Among them, f k (t) represents the current computing capacity of the node, expressed as the CPU idle rate; E k (t) represents energy consumption; R k (t) represents memory usage.
[0067] The digital twin model can receive the physical status data of the underlying equipment of the power grid, provide real-time feedback while maintaining consistency with the underlying equipment of the power grid, and jointly model according to specific tasks, so as to achieve dynamic optimization of the underlying equipment of the power grid. The establishment of the digital twin model can effectively help the smart grid system make intelligent decisions and improve service levels.
[0068] The present invention introduces digital twin technology into the smart grid system, designs a quantification scheme for grid equipment and system status, and provides a real-time physical entity digital simulation model of the smart grid system, which can accurately reflect the working conditions and status of power equipment, thereby providing a reliable basis for fault analysis and decision-making.
[0069] Step 3: Blockchain asynchronous federated learning workflow;
[0070] In the smart grid system, electrical devices, i.e., devices, have the same learning objectives in the network, such as intelligent fault diagnosis. Figure 2 As shown in the figure, local devices such as high-voltage voltmeters, high-voltage ammeters, cameras, and smart home meters belonging to different stations continuously train local models based on local data with the help of the computing power equipment of the station to which they belong.
[0071] After the local model training is completed, the local device uploads its trained local model to the blockchain maintained by the BS. Each BS deploys a blockchain peer to communicate with other nodes and maintain a shared ledger. The shared ledger on the node ensures that the local model cannot be tampered with during the training process. In addition, after the local device uploads the local model to the BS, the Leader Station scores the local model for verification and traceability by other nodes, and performs global model aggregation. The local device continuously uses the latest global model to train the local model.
[0072] A memory area is allocated in the distributed database of BS as a cache for local models, where the cache level is calculated by dividing the number of cached local models by the total number of nodes. For example, when there are 5 nodes in the network, a cache level of 60% means that 3 local models are cached in one block for asynchronous aggregation. When enough local models are cached, the smart contract immediately performs aggregation and generates an updated global model, which is then packaged into the block together with the cached local models.
[0073] like Figure 2As shown in the figure, before training the local model, an initial global model is predefined; the smart contract on each node triggers the training of the local model. Assume that there are 5 nodes (A, B, C, E, F) in the network, of which A, C, and F nodes first complete the training of the three local models A0, C0, and F0, and then upload the trained three local models A0, C0, and F0 to the BS cache area for aggregating the global model G0, and create a new block Block0 to store the hash values of the local models A0, C0, F0 and the global model G0. After that, the training of the three local models A1, B0, and E0 is completed by the three nodes A, B, and E, but due to the poor connection of the high-voltage meter network, the upload of the local model A1 fails. Without waiting for the upload of the local model A1, after the local model F1 is uploaded successfully, the global model G1 is calculated based on the local models B0, E0, and F1, and a global Block 1 is created to store the hash value. After that, the upload of local model F2 fails, but local model A2 and outdated C1 are successfully uploaded and will be included in the next block for aggregation.
[0074] The present invention uses blockchain to make the training process consistent, transparent and credible. In addition, the novel committee-based "Proof of Contribution" consensus algorithm in the blockchain can achieve anti-attack through a general machine learning model.
[0075] The asynchronous federated learning adopted by the present invention allows each participant to update the model according to its own progress, thereby improving the training efficiency and response speed of the system. In addition, the federated learning technology distributes and learns the data of different power equipment, breaking the limitations of data islands and realizing data sharing and collaborative training. In addition, the design of dynamic adaptive aggregation factors can assign appropriate weights to local models according to timeliness, further improving the efficiency and accuracy of learning tasks.
[0076] The present invention introduces blockchain technology into the smart grid system, and uses its tamper-proof characteristics to ensure the security and credibility of data. Through blockchain technology, a decentralized trust mechanism is established to ensure that the data in the smart grid system is not tampered with or maliciously attacked.
[0077] Step 4: Definition of outdated local model problem, design of adaptive aggregation factor and committee leader election in smart grid system;
[0078] S4.1. Problem definition;
[0079] The goal of federated learning is to train a global model for a specific task through a large number of devices in the smart grid system. Due to the complex and heterogeneous power equipment and the dynamic and changing power grid environment, minimizing the outdated local model is an optimization problem, namely:
[0080]
[0081] in, represents the global model obtained by joint learning, represents the objective function of the global model, and the constraint represents the DeviceM participating in the training task at the τth round of aggregation in the asynchronous federated learning scenario. x Send the local model ω obtained based on the λth round of global model training to BS x (λ), λ represents the number of previous global model rounds of the local model held by node k, where λ is much smaller than τ. There are two perspectives on the number of rounds. One is the global perspective, where the number of rounds increases by 1 after each aggregation, for example, the global number of rounds is 0, 1, 2, 3, 4... until τ; the other perspective is the local perspective. For example, after node k receives the third global model, it performs local training and obtains the third local model of node k after the training is completed. Due to insufficient machine computing power or temporary disconnection, the global aggregation has reached 100 rounds at this time. Then the third local model of node k trained based on the third global model is much smaller than 100. In this example, λ is 3 and τ is 100.
[0082] For the current global model, the local model ω x (λ) is too old and will affect the accuracy of the current global model.
[0083] S4.2, adaptive aggregation factor;
[0084] In view of the above optimization problem, the present invention designs an adaptive aggregation factor based on the model timeliness measurement, aiming to reveal the law that the local model weight decreases over time. Taking the famous Newton's cooling law in the field of thermal science as an example, a model timeliness measurement factor based on Newton's cooling law is designed. Newton's cooling law gives the relationship between self-heat and time, and is also widely used in the computer field.
[0085] Newton's law of cooling states that the cooling rate of an object is proportional to the temperature difference between the object and its surroundings, T0. When the temperature of an object is higher than the surroundings, it gradually transfers heat to the surrounding medium and gradually cools down, that is:
[0086]
[0087] Where T'(t) represents the derivative of the object temperature T with respect to time t (i.e., cooling rate); constant It represents the ratio between the ambient temperature and the cooling rate. Different objects have different Value; H 0 Indicates the indoor temperature.
[0088] Rewrite formula (4) as:
[0089]
[0090] Integrating both sides simultaneously, we get:
[0091]
[0092] According to the derivative of lnx is 1 / x, we get:
[0093]
[0094] Using the initial time t 0 The object temperature T 0 Solve for the constant C:
[0095]
[0096] Newton's cooling law is applied to design the weight of the local model in asynchronous federated learning according to time decay. In asynchronous federated learning, the upload time of each local device is uncertain. Long local training time will cause the local model to be outdated and reduce the accuracy of the global model. Therefore, Newton's cooling law is used to adjust the weight of the old model in the global model aggregation. The aggregate weight of node k in the τth round is:
[0097]
[0098] Among them, τ represents the current round number, λ represents the previous global model round number of the local model held by node k, and W 0 Represents the weight value of the oldest local model, MW 0 Indicates the weight value of the latest local model; Represents the attenuation coefficient, which depends on the training task. The larger it is, the smaller the proportion of local models that take a long time to train in the global model.
[0099] The total model of the τth round The specific calculation formula is as follows:
[0100]
[0101] Where K represents the total number of participants, ω k represents the local model submitted by the kth participant, represents the aggregate weight of node k in the τth round.
[0102] Obviously, the weight of the local model decays according to its freshness. The fresher the local model, the greater the weight it gets. Conversely, the older the local model, the lower the weight it gets. The degree of decay is controlled by the decay coefficient.
[0103] S4.3, Contribution measurement and committee leader election;
[0104] In the federated learning of smart grid systems, in order to resist malicious attacks and improve learning accuracy, the contribution of nodes to the system should be measured, and nodes with high contribution should be more likely to be elected as leaders in the system. Different from the traditional contribution model that only considers security threats, the present invention comprehensively considers the contribution of participants to the system through DT evaluation of the system status of the Station, the quality of the local model, the number of malicious interactions, etc.
[0105] It should be noted that nodes will inevitably have poor states such as low available CPU frequency and high packet loss rate during the calculation process, which can be captured by DT layer by layer. The worse the captured node state is, the lower the system's trust in the node. Therefore, nodes with better historical states should have a higher voice in calculations. In addition, in a Byzantine attack, a malicious device may provide incorrect or low-quality updates to the BS instead of valid updates. Therefore, the present invention introduces system state and learning quality to weaken the threat of malicious data.
[0106] S4.3.1, measure the contribution of Device to the training task;
[0107] In order to further adapt to the decentralization of smart grid systems and the efficiency of block packaging under resource-constrained conditions, a committee leader weighted random election algorithm was proposed based on the device status of committee member nodes and model accuracy evaluation. The committee member node device status and the accuracy of the historical submission model were dynamically measured, and the committee leader was selected in combination with a random algorithm to complete the consensus work and reduce the possibility of cheating.
[0108] Based on the subjective logic model, the benefit to the computing framework when node k interacts with BS p at time t can be expressed as:
[0109]
[0110] Among them, f k (t) represents the computing power of node k at time t, represents the failure probability of data packet transmission, Indicates the number of positive interactions, Indicates the number of malicious behaviors such as uploading lazy data, Indicates the evaluation quality of the local model, which is obtained by testing the Leader Station using the target small sample data (in the first election, The value is 1). The specific calculation formula for the contribution value of node k to the calculation framework is:
[0111]
[0112] Among them, κ∈[0, 1] represents the coefficient of the uncertainty degree affecting the contribution value.
[0113] S4.3.2, weighted random election algorithm;
[0114] After a few new blocks are generated, a new committee leader is elected. Specifically, as reliability requirements increase, the frequency of electing new committee leaders increases. The identity of the new committee leader is derived from the contribution combined with a weighted random election algorithm, the "Proof of Contribution" consensus algorithm.
[0115] In each election, each station selects the top K nodes with the highest contribution values to represent the contribution of the station to the computing framework. The contribution value of station h is calculated as Map the contribution value to (0,1], and we get In each election, according to the weighted random sampling algorithm, for each Generate a random number r h =random(0,1) and calculate The station with the largest p value becomes the LeaderStation. The election frequency of the committee leader is the inverse of the number of blocks to wait before electing a new committee leader. Assuming the election frequency of the committee leader is 1 / 20, this means that as long as 20 blocks are added to the blockchain, the identity of the new committee leader can be calculated in the same way. The relationship between the local model received in each round of the BS's distributed database and the hash value on the blockchain is as follows: Figure 3 As shown in the figure, before the training task starts, the hydropower station is randomly selected as the committee leader. Assuming the cache level is 3, when the BS receives three local models in the distributed database When the hydropower station performs aggregation, a global model is generated. The newly generated global model and the three received local models are packaged into a new block Block0. After the first round of aggregation, an election is triggered. The contribution value of each Station is calculated by formula (12), and the nuclear power plant is selected as the next leader in combination with weighted random sampling. The election is held after 20 blocks are generated. All received local models are stored in the distributed database of the BS for download by all participants; the hash value of the local model is stored in the blockchain and synchronized to all nodes to verify the local model. If the downloaded local model is modified and inconsistent with the hash value stored on the blockchain, the committee leader will ignore the downloaded local model and the subsequent local models of the node until a new committee leader is elected. In addition, the process of global model aggregation can also be verified by all committee members to prevent the committee leader from doing evil.
[0116] Based on DT's continuous evaluation of participants, the contribution of nodes to the computing framework is taken into account through computing power, transmission stability, etc., which effectively resists security threats caused by malicious participants. By adding randomness, the robustness of the framework can be enhanced and the possibility of election fraud can be reduced.
[0117] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An adaptive federated learning method for digital twin-driven smart grid, characterized in that: The following steps are involved: Step 1: Build a smart grid system; A two-layer privacy computing architecture is introduced into the smart grid system, which consists of a power equipment layer and a digital twin layer. In the power equipment layer, each independently working site is denoted as a Station, and each node with monitoring, recording, and transmission capabilities is denoted as a Device. Each Station is regarded as a collection of a series of Devices. Step 2: Design a general digital twin solution for smart grid systems; At time t, for the kth Device M of Station k Digital Twin Model DT k It is expressed as: Among them, ω k (τ) represents the kth DeviceM k In the training parameters of the τth round, F[ω k (τ)] represents the kth Device M k The current training state, s k (t) represents the current system state, Δs k Represents the current physical device and digital twin model DT k The interaction data between Representing physical equipment and digital twin model DT k Historical data of interactions between Step 3: Blockchain asynchronous federated learning workflow; The local device uses the storage device of the station to which it belongs to store the monitored data and captured images, and uses the computing power equipment of the station to which it belongs to perform local operations and train local models to ensure privacy. The local device uploads the trained local model to the distributed database of the BS through the wireless BS in an asynchronous manner. The Leader Station scores the local model and aggregates the global model. The latest global model hash value and all local model hash values received in this round are packaged on the blockchain, and the latest global model is stored in the distributed database of the BS. The local device continuously uses the latest global model to train the local model. Step 4: Definition of outdated local model problem, design of adaptive aggregation factor and committee leader election in smart grid system; S4.1, Definition of the problem of outdated local model in smart grid system; S4.2, designing an adaptive aggregation factor based on Newton's cooling law according to the defined outdated local model problem; S4.
3. Measure the contribution of the Station to the training task, and elect the committee leader using the weighted random election algorithm based on the obtained contribution.
2. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: The blockchain is used to register and verify the legitimacy of nodes, and transmits the model to the digital twin layer through the wireless BS in an asynchronous manner; the BS holds a distributed database with data synchronization function.
3. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: Each BS deploys a blockchain peer for communicating with other nodes and maintains a shared ledger. The shared ledger on the node can ensure that the local model cannot be tampered with during the training process. A memory area is allocated in the distributed database of the BS as a cache for the local model. The cache level is obtained by dividing the number of cached local models by the total number of nodes.
4. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: The current system status s k (t) is expressed as: s k (t)={f k (t),E k (t),R k (t)} (2) Among them, f k (t) represents the current computing capacity of the node, expressed as the CPU idle rate; E k (t) represents energy consumption; R k (t) represents memory usage.
5. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: Before training the local model, an initial global model is predefined; the smart contract on each node triggers the training of the local model, which is sent to the BS after training. When enough local models are cached, LeaderStation performs aggregation and generates an updated global model, which is then packaged into the block together with the hash value of the cached local model.
6. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: In step S4.1, the outdated local model problem in the smart grid system is defined as follows: in, represents the global model obtained by joint learning, represents the objective function of the global model, and the constraint represents the DeviceM participating in the training task at the τth round of aggregation in the asynchronous federated learning scenario. x Send the local model ω obtained based on the λth round of global model training to BS x (λ), λ represents the number of previous global model rounds of the local model held by node k, and λ is much smaller than τ.
7. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: In step S4.2, Newton's cooling law is used to adjust the weight of the old model in the global model aggregation; the aggregation weight of node k in the τth round is: Among them, τ represents the current round number, λ represents the previous global model round number of the local model held by node k, W0 represents the weight value of the oldest local model, and MW0 represents the weight value of the freshest local model; Represents the attenuation coefficient, which depends on the training task. The larger it is, the smaller the proportion of local models that take a long time to train in the global model.
8. The adaptive federated learning method for a digital twin-driven smart grid according to claim 7, characterized in that:The total model of the τth round The calculation formula is: Where K represents the total number of participants, ω k represents the local model submitted by the kth participant, represents the aggregate weight of node k in the τth round.
9. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: In step S4.3, the specific operation process of measuring the contribution of the device to the computing task is as follows: Based on the subjective logic model, the benefit to the computing framework when node k interacts with BS p at time t is expressed as: Among them, f k (t) represents the computing power of node k at time t, represents the failure probability of data packet transmission, Indicates the number of positive interactions, Indicates the number of malicious behaviors such as uploading lazy data, Indicates the evaluation quality of the local model, which is obtained by testing the Leader Station using the target small sample data; the calculation formula for the contribution value of node k to the calculation framework is: Among them, κ∈[0, 1] represents the coefficient of the uncertainty degree affecting the contribution value.
10. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that: In step S4.3, the specific operation process of electing the committee leader using the weighted random election algorithm according to the obtained contribution is as follows: After several new blocks are generated, a new committee leader will be elected. In each election, each station selects the top K nodes with the highest contribution value to represent the contribution of the station to the computing framework. The contribution value of station h is calculated as Map the contribution value to (0,1], and we get In each election, according to the weighted random sampling algorithm, for each S in the training task h ∈S, generate a random number r h =random(0,1) and calculate The station with the largest p value becomes the leader station, and the election frequency of the committee leader is the inverse of the number of blocks to wait before electing a new committee leader.
Citation Information
Patent Citations
Federal learning-based reliability optimization method for digital twinning-assisted industrial Internet of Things
CN115310360A
Federal learning freshness optimization method and system based on digital twinning assistance
CN115481748A
Cited By
Energy industry intelligent algorithm optimization method based on federal learning
CN119249363A
Method and system for evaluating digital twinborn integrity of power equipment
CN119940989A
Project cost method and device based on artificial intelligence
CN120181906A
Artificial intelligence-based engineering cost method and device
CN120181906B
Intelligent power grid dispatching system and method based on digital twinning and deep learning
CN121036317A
