An adaptive federated learning method for digital twin driven smart grid
Patent Information
- Application Number
- CN202410805567.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2044-06-21
AI Technical Summary
[0008]为了解决现有智能电网在管理和运行过程存在的问题,本发明提供一种面向数字孪生(Digital Twin,DT)驱动的智能电网的自适应联邦学习方法,通过将数字孪生技术、联邦学习和区块链技术相结合,为智能电网系统的故障分析、运行决策等方面提供了全新的解决方案
[0048]本发明的一种面向数字孪生驱动的智能电网的自适应联邦学习方法结合了数字孪生技术、联邦学习技术和区块链技术,与现有技术相比具有以下优点:
Smart Images

Figure CN118747540B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart grid technology, specifically relating to an adaptive federated learning method for digital twin-driven smart grids. Background Technology
[0002] Digital twin technology is a novel technology based on digitization, simulation, and analogy. Its core idea is to digitize physical entities in the real world, create accurate models of them in a virtual environment, and achieve accurate simulation and prediction of these physical entities through real-time data updates and analysis. This technology has applications spanning multiple fields, including industrial manufacturing, the Internet of Things (IoT), healthcare, and urban planning, bringing new development opportunities to various industries. The applications of digital twin technology have broad prospects and value. In industrial manufacturing, digital twin technology can be used to optimize and adjust production processes, improving production efficiency and product quality. In healthcare, it can be used to simulate and analyze the human body, assisting doctors in diagnosis and treatment. In urban planning, it can be used to simulate and plan cities, optimizing urban layout and resource allocation.
[0003] Federated learning is a distributed machine learning approach designed to address data privacy and security concerns. In traditional centralized machine learning, data is typically stored centrally on a single server for training, which can pose risks of privacy breaches and data security vulnerabilities. In federated learning, however, data remains locally on the device and does not leave the data source. Only updated model parameters are sent to a central server for aggregation, thus significantly reducing the risk of data leakage.
[0004] Asynchronous federated learning, a variant of federated learning, primarily addresses the inefficiency of model training caused by network latency and inconsistent device performance in federated learning. In traditional synchronous federated learning, all participants must wait for the slowest participant to complete training before proceeding to the next round of model updates, significantly reducing overall system efficiency. In asynchronous federated learning, each participant can update the model according to its own progress, without waiting for others, thus improving overall system training efficiency. The main advantage of asynchronous federated learning lies in its ability to fully utilize the computing resources of participants, enabling parallel model training and accelerating model convergence. Furthermore, asynchronous federated learning can adapt to the different device performance and network conditions of participants, improving system stability and reliability. Therefore, asynchronous federated learning is significant in handling distributed machine learning tasks in large-scale data and complex network environments, improving the efficiency and performance of machine learning systems while ensuring data privacy and security.
[0005] Blockchain technology is a decentralized distributed ledger technology, initially proposed as the underlying technology for the digital currency Bitcoin. The core feature of blockchain is linking transaction data into blocks in chronological order, and using cryptographic techniques to ensure its immutability and secure transmission. These blocks are linked together in a chain structure, forming a continuously growing data chain. Through decentralization, distributed consensus mechanisms, and encryption algorithms, blockchain technology achieves data security, transparency, and traceability.
[0006] First, blockchain technology enables decentralized data storage and management. Traditional data storage and management methods typically rely on centralized databases or servers, which are susceptible to single points of failure and data tampering. Blockchain technology, however, distributes data across multiple nodes in the network, with each node having a complete copy of the data. There is no centralized control, thus improving data security and reliability. Second, blockchain technology implements a distributed consensus mechanism. In a blockchain network, all nodes reach agreement through a consensus algorithm, determining the validity and order of transactions. Valid transactions are packaged into blocks, which are then linked together using cryptographic algorithms to form the blockchain. This distributed consensus mechanism ensures data consistency and integrity, avoiding single points of failure and data tampering risks, thereby improving data security and trustworthiness. Third, blockchain technology applies cryptographic algorithms. In a blockchain network, each block contains the hash value of the previous block. Cryptographic algorithms connect transaction data with the hash value of the previous block, forming an immutable data chain. Cryptographic algorithms guarantee that data in the blockchain cannot be tampered with or forged, ensuring data security and trustworthiness. In summary, blockchain technology, through decentralized data storage and management, distributed consensus mechanisms, and the application of cryptographic algorithms, achieves data security, transparency, and traceability, providing entirely new solutions for data management and transactions across 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, the power grid, as a crucial civilian infrastructure, has been moving towards integrating advanced communication, information, and control technologies. Smart grids, with functions such as condition monitoring, fault analysis, and automatic decision-making, have become the mainstream development trend. Currently, despite significant progress in the field of smart grid technology, several challenges and limitations remain. As a highly complex and dynamically changing system, the power grid faces numerous challenges in its management and operation. One such challenge is that due to the complex and heterogeneous power equipment and the dynamically changing grid environment, current smart grids often struggle to consistently provide accurate fault analysis and efficient operational decisions, which has become a significant issue limiting the current service level of smart grids. Furthermore, traditional smart grid optimization technologies have limitations in terms of real-time performance and accuracy. Because the power grid condition needs continuous updating and optimization, it consumes substantial computing resources and time, thus limiting the real-time performance and response speed of the power grid system. In addition, traditional smart grid models often can only simulate and predict known situations, and are often unable to accurately predict and judge unknown situations. Summary of the Invention
[0008] To address the problems existing in the management and operation of current smart grids, this invention provides an adaptive federated learning method for digital twin (DT) driven smart grids. By combining digital twin technology, federated learning, and blockchain technology, it offers a novel solution for fault analysis and operational decision-making in smart grid systems.
[0009] The technical solution adopted by this invention to solve the technical problem is as follows:
[0010] This invention provides an adaptive federated learning method for digital twin-driven smart grids, which mainly includes the following steps:
[0011] Step 1: Construct a smart grid system;
[0012] The smart grid system introduces a two-layer privacy computing architecture, consisting of a power equipment layer and a digital twin layer. In the power equipment layer, each independently operating station is called a Station, and each node with monitoring, recording, and transmission capabilities is called a Device. Each Station is regarded as a collection of Devices.
[0013] Step 2: Design a general digital twin solution for smart grid systems;
[0014] exist At that moment, for the Station's first Device Digital twin model Represented as:
[0015] (1);
[0016] in, Indicates the first Device In the The training parameters of the round, Indicates the first Device Current training status, Indicates the current system state. Represents the physical device and digital twin model at the current moment. Interaction data between them Representing physical devices and digital twin models Historical data of interactions between them;
[0017] Step 3: Blockchain Asynchronous Federated Learning Workflow;
[0018] The local device uses the storage devices of its station to store the monitored data and captured images, and uses the computing power of its station to perform local calculations and train the local model to ensure privacy. The local device asynchronously uploads the trained local model to the distributed database of the wireless BS. The LeaderStation scores the local model and performs global model aggregation. It packages the latest global model hash value and all the local model hash values received in this round onto the blockchain and stores the latest global model in the distributed database of the BS. The local device continuously uses the latest global model to train the local model.
[0019] Step 4: Defining the outdated local model problem in smart grid systems, designing adaptive aggregation factors, and electing committee leaders;
[0020] S4.1 Definition of the outdated local model problem in smart grid systems;
[0021] S4.2 Based on the defined outdated local model problem, design an adaptive aggregation factor based on Newton's law of cooling;
[0022] S4.3 Measure the Station's contribution to the training task, and elect a committee leader based on the obtained contribution using a weighted random election algorithm.
[0023] Furthermore, the blockchain is used to register and verify the legitimacy of nodes, and transmits the model to the digital twin layer asynchronously via a wireless BS; the BS holds a distributed database with data synchronization capabilities.
[0024] Furthermore, each BS deploys a blockchain peer for communicating with other nodes and maintaining a shared ledger. The shared ledger on the node ensures that the local model is immutable during training. A memory area is allocated in the distributed database of the BS as a cache for the local model, and the cache level is calculated by dividing the number of cached local models by the total number of nodes.
[0025] Furthermore, the current system state Represented as:
[0026] (2);
[0027] in, This represents the current computing power of a node, expressed as CPU idle rate. Indicates energy consumption; This indicates 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, and after the local model is trained, it is sent to the BS. When enough local models are cached, the Leader Station (the leader selected by the committee of the Stations participating in the joint training) performs aggregation and generates an updated global model, and then packages it together with the hash value of the cached local models into a block.
[0029] Furthermore, in step S4.1, the outdated local model problem in the smart grid system is defined as follows:
[0030]
[0031] ;
[0032] in, This represents the global model obtained through joint learning. The objective function of the global model is represented by the constraint, which represents the condition in the asynchronous federated learning scenario at the th... During the round of aggregation, the first participating in the training task Device Send to BS based on the The local model obtained by training the global model , Represents a node The number of preceding global model rounds of the local model held. much smaller .
[0033] Furthermore, in step S4.2, Newton's law of cooling is used to adjust the weights of the old model in the global model aggregation; nodes In the The aggregate weight of the round is:
[0034] (9);
[0035] in, Indicates the current round number. Represents a node The number of preceding global model rounds of the local model held. This represents the weight values of the oldest local model. This represents the weight values of the freshest local model; This represents the decay coefficient, which depends on the training task. The larger the value, the smaller the proportion of the local model, which takes longer to train, in the global model.
[0036] Furthermore, the first Wheel total model The calculation formula is:
[0037] (10);
[0038] in, Indicates the total number of participants. Indicates the first The local models submitted by each participating party Represents a node In the Aggregate weights of the round.
[0039] Furthermore, in step S4.3, the specific operational procedure for measuring the contribution of the Device to the computing task is as follows:
[0040] Based on the subjective logic model, at time... node With BS The benefits of interaction to the computing framework are expressed as follows:
[0041] (11);
[0042] in, Represents a node At any moment computing power This indicates the probability of data packet transmission failure. Indicates the number of positive interactions. This indicates the number of times malicious actions such as uploading lazy data have occurred. The evaluation quality of the local model is indicated by Leader Station's testing using a small sample of target data; nodes The formula for calculating the contribution value of the computing framework is as follows:
[0043] (12);
[0044] in, A coefficient representing the degree of uncertainty affecting the contribution value.
[0045] Furthermore, in step S4.3, the specific operation procedure for electing committee leaders using a weighted random election algorithm based on the obtained contribution is as follows:
[0046] After several new blocks are generated, a new committee leader will be elected; in each election, each Station elects a new leader. The node with the highest contribution value is used to represent the Station's contribution to the computing framework. The contribution value is calculated as follows Mapping contribution values to ,get In each election, a weighted random sampling algorithm is used for each train task. Generate random numbers And calculate , The Station with the highest value becomes the Leader Station, and the election frequency of the committee leader is the reciprocal of the number of blocks waiting before electing a new committee leader.
[0047] The beneficial effects of this invention are:
[0048] The adaptive federated learning method for digital twin-driven smart grids of the present invention combines digital twin technology, federated learning technology, and blockchain technology, and has the following advantages compared with existing technologies:
[0049] (1) This invention introduces digital twin technology into smart grid systems, providing a quantitative scheme for the design of grid equipment and system status. This enables real-time simulation and reflection of the physical equipment status and behavior of 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 operating conditions of grid equipment, providing a reliable basis for system fault analysis and decision-making. Furthermore, through digital twin technology, smart grid systems can more precisely monitor the operating status of grid equipment, predict potential faults, and take timely corresponding measures, thereby improving the safety and reliability of the power grid.
[0050] (2) This invention employs asynchronous federated learning and designs a dynamic adaptive aggregation factor, aiming to allocate appropriate weights to local models from a timeliness perspective, thereby reducing the impact of outdated local models on the global model and improving the efficiency of the learning task. In traditional synchronous federated learning, all participants must wait for the slowest participant to complete training before the next round of model updates can begin, leading to low training efficiency for the entire system. Compared to traditional synchronous federated learning, in asynchronous federated learning, each participant can update its model according to its own progress, thus improving the system's training efficiency and response speed. Asynchronous federated learning can better cope with differences in data and computing power among participants, improving the overall performance and robustness of the system. Furthermore, by designing a dynamic aggregation factor, appropriate weights can be allocated to local models based on timeliness, further improving the efficiency and accuracy of the learning task.
[0051] (3) To address the potential for malicious nodes in complex power grid environments, this invention employs blockchain technology for node authentication and records the models uploaded by each node for traceability. However, traditional blockchain technology performs poorly when handling large-scale data and high-concurrency scenarios. Each transaction in the blockchain requires verification and consensus from all nodes. As the number of transactions increases, network congestion and performance degradation occur, affecting the system's real-time performance and response speed. Furthermore, the consensus mechanism in the blockchain also has some problems, such as the "51% attack," which may lead to data tampering and reduced security. To solve this problem, this invention combines blockchain technology with federated learning and proposes a "proof-of-contribution" consensus algorithm. Compared with traditional blockchain technology, the "proof-of-contribution" consensus algorithm can better handle large-scale data and high-concurrency scenarios, improving the overall performance and security of the system. At the same time, it evaluates the contribution of the computing framework by digital twins and combines random processes to reduce the probability of election fraud, thereby enhancing the security and credibility of the smart grid system and providing comprehensive protection for the security of the smart grid system. Attached Figure Description
[0052] Figure 1 This is a diagram showing the architecture of a smart grid system.
[0053] Figure 2 This is a flowchart of an adaptive federated learning method for a digital twin-driven smart grid according to the present invention.
[0054] Figure 3 A flowchart for the election of leaders of the blockchain committee. Detailed Implementation
[0055] The present invention will be further described in detail below with reference to the accompanying drawings.
[0056] This invention provides an adaptive federated learning method for digital twin-driven smart grids, which specifically includes the following steps:
[0057] Step 1: Construct the architecture of the smart grid system;
[0058] The smart grid system mainly consists of a power equipment layer and a digital twin layer. The primary function of the power equipment layer is to provide data sensing, acquisition, transmission, and local training of the joint model. In this invention, as... Figure 1 As shown, 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 plants, and thermal power plants; the transmission part includes transmission facilities such as high-voltage power lines and substations; the distribution part includes power distribution equipment such as distribution lines and distribution transformers; and the consumption part includes household electricity consumption, industrial electricity consumption, and commercial electricity consumption. These four parts, along with their associated sensors, networks, storage, and computing devices, together constitute the power equipment layer. Each independently operating site is called a Station, such as a substation, thermal power plant, a factory with its own electricity meter, or a residential user. Each Station is considered a collection of devices. Each node capable of monitoring, recording, and transmitting data is called a Device, such as a temperature and humidity sensor, camera, voltmeter, ammeter, etc. Local Devices use the storage devices of their respective Stations to store the monitored data and captured images, and use the computing power of the Stations to perform local calculations and train local models to ensure privacy. The blockchain registers and verifies the legitimacy of nodes. To reduce the discrete player effect, the model is transmitted asynchronously through wireless base stations and the Digital Twin (DT) layer.
[0059] The main functions of the digital twin layer are to verify the legitimacy of access nodes, receive legitimate models and calculate model weights to update the state of the smart grid system replica, trace uploaded local models, calculate station contribution values, predict power load, perform intelligent inspections, diagnose faults, and assist in decision-making. The blockchain is maintained by base stations (BS) equipped with computing and caching resources. Each base station holds a distributed database with data synchronization capabilities, storing registration information, key features, and federated learning parameters collected by grid equipment for access nodes under the same training task, and is responsible for verifying the legitimacy of access nodes. Simultaneously, the blockchain interacts with the DT layer to obtain the contribution of each device and station to the training task. All BSs execute the blockchain's consensus process to achieve global model consistency. All stations participating in the task constitute committee members, eligible to be elected as committee leaders through a "proof-of-contribution" consensus algorithm; the next committee leader is randomly determined by contribution. The DT layer combines power equipment layer sensors, machine learning algorithms, and software analysis with spatial network graphs, synchronizing the states of each node through asynchronous federated learning and creating a real-time digital simulation model of the smart grid system entity. The DT layer can not only collect operational data from physical entities, but also implement control to change their state. It can collaborate with the device layer and blockchain through virtualization and resource scheduling, and utilize diverse artificial intelligence methods to achieve intelligent decision-making at the smart grid system level, distributed resource scheduling, and advanced analytics. This enables real-time storage and processing of latency-sensitive data, advanced grid scheduling and management services, and centralized resource coordination and comprehensive analysis. This continuous interaction with physical entities achieves two-way closed-loop information feedback.
[0060] Step 2: Design of a general digital twin solution for smart grid systems;
[0061] like Figure 1 As shown, this invention introduces a two-layer privacy computing architecture in a smart grid system, consisting of a power device layer and a digital twin layer. Power devices with limited communication and computing resources connect to the DT server via wireless communication links. The DT server maps the physical states of the power devices and updates the model in real time. Data records for the power devices are established by their respective stations. By collecting and processing the existing key physical states of the power devices, the data is transmitted to the DT server in model form after blockchain authentication, dynamically presenting the historical and current behavior of the power devices.
[0062] In this invention, power generation stations on the generation side, transmission stations, substations, and distribution stations on the transmission side, and users on the consumption side are all collectively referred to as "Station". This indicates that each Station will have a series of Devices locally, denoted as... For example, ammeters, voltmeters, electric field strength sensors, arc flash sensors, and ultra-high frequency sensors, these devices are connected to a base station. By connecting with blockchain and DT, and collecting data, DT can characterize the state of different devices.
[0063] exist At that moment, for the Station's first Device Digital twin model It can be represented as:
[0064] (1);
[0065] in, Indicates the first Device In the The training parameters of the round, Indicates the first Device Current training status, Indicates the current system state. Represents the physical device and digital twin model at the current moment. Interaction data between them Representing physical devices and digital twin models Historical data on interactions between systems, such as historical system states, historical update data, and historical model accuracy. Furthermore, the current system state. It can be represented as:
[0066] (2);
[0067] in, This represents the current computing power of a node, expressed as CPU idle rate. Indicates energy consumption; This indicates memory usage.
[0068] This digital twin model can receive physical state data from the underlying equipment of the power grid, provide real-time feedback while maintaining consistency with the underlying equipment, and jointly model according to specific tasks, thereby achieving 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.
[0069] This invention introduces digital twin technology into smart grid systems, providing a quantitative scheme for the design of grid equipment and system status. It offers 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, thus providing a reliable basis for fault analysis and decision-making.
[0070] Step 3: Blockchain Asynchronous Federated Learning Workflow;
[0071] In smart grid systems, electrical devices (devices) share the same learning objectives within the network, such as intelligent fault diagnosis. Figure 2 As shown, 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 and with the help of the computing power of their respective stations.
[0072] After the local model training is complete, the local device uploads its trained local model to the blockchain maintained by the BS. Each BS deploys a blockchain peer for communication with other nodes and maintains a shared ledger. The shared ledger on the nodes ensures that the local model is immutable during training. Furthermore, after the local device uploads its local model to the BS, the Leader Station scores the local model for other nodes to verify, trace, and aggregate global models. The local device continuously uses the latest global model to train its local model.
[0073] In the distributed database of BS, a memory area is allocated as a cache for local models. 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 a block for asynchronous aggregation. When enough local models are cached, the smart contract immediately executes the aggregation and generates an updated global model, which is then packaged into a block along with the cached local models.
[0074] like Figure 2As shown, an initial global model is predefined before training the local models; the smart contract on each node triggers the training of the local models. Assuming there are 5 nodes in the network (A, B, C, E, F), nodes A, C, and F first complete the training of three local models A0, C0, and F0, respectively. Then, they upload the trained local models A0, C0, and F0 to the BS cache for aggregation with the global model G0. A new block, Block 0, is created to store the hash values of the local models A0, C0, F0, and the global model G0. Next, nodes A, B, and E complete the training of three local models A1, B0, and E0. However, due to poor network connectivity at the high-voltage meter, the upload of local model A1 fails. Without waiting for A1 to upload, local model F1 is successfully uploaded. Based on local models B0, E0, and F1, the global model G1 is calculated, and a global block, Block 1, is created to store the hash values. Subsequently, the upload of local model F2 failed, but local model A2 and the outdated C1 were successfully uploaded and will be included in the next block for aggregation.
[0075] This invention leverages blockchain technology to ensure a consistent, transparent, and trustworthy training process. Furthermore, the novel committee-based "proof-of-contribution" consensus algorithm in blockchain can be made attack-resistant through general machine learning models.
[0076] The asynchronous federated learning employed in this invention allows each participant to update its model according to its own progress, thereby improving the system's training efficiency and response speed. Furthermore, federated learning technology distributes and learns data from different power devices, breaking down data silos and enabling data sharing and collaborative training. In addition, the design of a dynamic adaptive aggregation factor can assign appropriate weights to local models based on timeliness, further improving the efficiency and accuracy of the learning task.
[0077] This invention introduces blockchain technology into the smart grid system, utilizing its immutability to ensure data security and trustworthiness. By establishing a decentralized trust mechanism through blockchain technology, it ensures that data in the smart grid system is not subject to tampering or malicious attacks.
[0078] Step 4: Defining the outdated local model problem in smart grid systems, designing adaptive aggregation factors, and electing committee leaders;
[0079] S4.1 Problem Definition;
[0080] The goal of federated learning is to train a global model using a large number of devices in a smart grid system for a specific task. Due to the complex and heterogeneous power devices and the dynamically changing grid environment, minimizing this model with outdated local models becomes an optimization problem, namely:
[0081]
[0082] ;
[0083] in, This represents the global model obtained through joint learning. The objective function of the global model is represented by the constraint, which represents the condition in the asynchronous federated learning scenario at the th... During the round of aggregation, the first participating in the training task Device Send to BS based on the The local model obtained by training the global model , Represents a node The number of preceding global model rounds of the local model held, where, much smaller The number of rounds has two perspectives: a global perspective and a global perspective. The global round number increments by 1 with each aggregation, for example, from 0 to 1, 2, 3, 4, and so on. Another perspective is the local perspective, such as the node. After receiving the third global model, local training is performed, and the nodes are obtained after training is complete. The third local model, due to insufficient machine computing power or a temporary disconnection, has reached the 100th round of global aggregation. Therefore, the node trained based on this third global model... The third local model is much smaller than 100. In this example, It is 3. It is 100.
[0084] For the current global model, the local model Outdated technology can affect the accuracy of the current global model.
[0085] S4.2, Adaptive Aggregation Factor;
[0086] To address the aforementioned optimization problem, this invention designs an adaptive aggregation factor based on a model timeliness metric, aiming to reveal the pattern of local model weights decreasing over time. Taking Newton's law of cooling, a well-known principle in thermodynamics, as an example, a model timeliness metric based on Newton's law of cooling is designed. Newton's law of cooling describes the relationship between heat generation and time and is widely used in the field of computer science.
[0087] Newton's law of cooling states that the rate of cooling of an object is directly proportional to the temperature difference T0 between the object and its surrounding environment. When the object's temperature is higher than its surroundings, it gradually transfers heat to the surrounding medium and gradually cools down, that is:
[0088] (4);
[0089] in, Represents the temperature of an object Regarding time The derivative of (i.e., cooling rate); a constant. This represents the ratio between ambient temperature and cooling rate; different objects have different ratios. value; Indicates indoor temperature.
[0090] Formula (4) can be rewritten as:
[0091] (5);
[0092] Integrating both sides simultaneously, we get:
[0093] (6);
[0094] according to The derivative is ,get:
[0095] (7);
[0096] Using the initial time object temperature Solve for the constant C:
[0097] (8);
[0098] This paper applies Newton's law of cooling to design the time-decaying weights of local models in asynchronous federated learning. In asynchronous federated learning, the upload time of each local device is uncertain. Excessive local training time can lead to local models becoming outdated, reducing the accuracy of the global model. Therefore, Newton's law of cooling is used to adjust the weights of older models in the global model aggregation. (Node) In the The aggregate weight of the round is:
[0099] (9);
[0100] in, Indicates the current round number. Represents a node The number of preceding global model rounds of the local model held. This represents the weight values of the oldest local model. This represents the weight values of the freshest local model; This represents the decay coefficient, which depends on the training task. The larger the value, the smaller the proportion of the local model, which takes longer to train, in the global model.
[0101] No. Wheel total model The specific calculation formula is as follows:
[0102] (10);
[0103] in, Indicates the total number of participants. Indicates the first The local models submitted by each participating party Represents a node In the Aggregate weights of the round.
[0104] Clearly, the weights of local models decay according to their freshness; the fresher the local model, the greater its weight, and vice versa. The degree of decay is controlled by the decay coefficient.
[0105] S4.3 Contribution Measurement and Committee Leader Election;
[0106] In federated learning of smart grid systems, to resist malicious attacks and improve learning accuracy, the contribution of nodes to the system should be measured, and nodes with higher contribution levels should be more likely to be elected as leaders. Unlike traditional contribution models that only consider security threats, this invention comprehensively considers the contributions of participants to the system through DT evaluation of the station's system state, local model quality, and the number of malicious interactions.
[0107] It is important to note that nodes inevitably experience unfavorable conditions during computation, such as low available CPU frequency and high packet loss rate. These can be detected by the Data Transmission Team (DT). The worse the detected node state, the lower the system's trust in that node. Therefore, nodes with better historical states should have greater influence in computation. Furthermore, in Byzantine attacks, malicious devices may provide incorrect or low-quality updates to the System Base (BS), rather than valid updates. Therefore, this invention introduces system state and learning quality to mitigate the threat of malicious data.
[0108] S4.3.1 Measure the contribution of the Device to the training task;
[0109] To further adapt to the decentralized nature of smart grid systems and the high efficiency of block packaging under resource constraints, a weighted random election algorithm for committee leaders is proposed based on the device status of committee member nodes and the accuracy of model submissions. This algorithm dynamically measures the device status of committee member nodes and the accuracy of historically submitted models, and combines random algorithms to select committee leaders to complete consensus work, thereby reducing the possibility of cheating.
[0110] Based on the subjective logic model, at time... node With BS The benefits of interaction to the computational framework can be expressed as follows:
[0111] (11);
[0112] in, Represents a node At any moment computing power This indicates the probability of packet transmission failure. Indicates the number of positive interactions. This indicates the number of times malicious actions such as uploading lazy data have occurred. The evaluation quality of the local model is indicated by Leader Station's testing using a small sample of target data (during the initial election). (Value is 1). Node The specific formula for calculating the contribution value of the computing framework is as follows:
[0113] (12);
[0114] in, A coefficient representing the degree of uncertainty affecting the contribution value.
[0115] S4.3.2, Weighted Random Election Algorithm;
[0116] After several new blocks are generated, a new committee leader is elected. Specifically, as reliability requirements increase, the frequency of electing new committee leaders also increases. The identity of the new committee leader is determined by a contribution-weighted random election algorithm, also known as the "proof-of-contribution" consensus algorithm.
[0117] In each election, before each Station is elected... The node with the highest contribution value is used to represent the Station's contribution to the computing framework. The contribution value is calculated as follows Mapping contribution values to ,get In each election, a weighted random sampling algorithm is used for each [item / group] in the training task. Generate random numbers And calculate , The Station with the largest value becomes the LeaderStation. The election frequency of the committee leader is the reciprocal of the number of blocks waiting before electing a new committee leader. Assuming the election frequency of the committee leader is 1 / 20, this means that by appending 20 blocks 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 in the BS distributed database and the hash value on the blockchain is as follows: Figure 3 As shown, before the training task begins, a hydroelectric power station is randomly selected as the committee leader. Assuming the cache level is 3, when the distributed database of the BaseSend receives three local models... , , At that time, the hydropower station performs aggregation to generate a global model. The newly generated global model and the three received local models are packaged into a new block, Block0. An election is triggered after the first round of aggregation. The contribution value of each Station is calculated by formula (12), and the nuclear power plant is elected as the next leader by weighted random sampling. A new election is held after 20 blocks are generated. All received local models are stored in the distributed database of 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 that 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 acting maliciously.
[0118] Based on DT's continuous evaluation of participants, the contribution of nodes to the computing framework is considered through factors such as computing power and transmission stability, which effectively resists security threats caused by malicious participants. The addition of randomness can enhance the robustness of the framework and reduce the possibility of election fraud.
[0119] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. An adaptive federated learning method for digital twin-driven smart grids, characterized in that, Includes the following steps: Step 1: Construct a smart grid system; The smart grid system introduces a two-layer privacy computing architecture, consisting of a power equipment layer and a digital twin layer. In the power equipment layer, each independently operating station is called a Station, and each node with monitoring, recording, and transmission capabilities is called a Device. Each Station is regarded as a collection of Devices. Step 2: Design a general digital twin solution for smart grid systems; exist At that moment, for the Station's first Device Digital twin model Represented as: (1); in, Indicates the first Device In the The training parameters of the round, Indicates the first Device Current training status, Indicates the current system state. Represents the physical device and digital twin model at the current moment. Interaction data between them Representing physical devices and digital twin models Historical data of interactions between them; Step 3: Blockchain Asynchronous Federated Learning Workflow; The local device uses the storage device of its station to store the monitored data and captured images, and at the same time uses the computing power of its station to perform local calculations and train the local model to ensure privacy. The local device uploads the trained local model asynchronously to the distributed database of the BS via the wireless BS. The Leader Station scores the local model and performs global model aggregation. It packages the latest global model hash value and the hash values of all local models received in this round onto the blockchain and stores the latest global model in the distributed database of the BS. The local device continuously uses the latest global model to train the local model. Step 4: Defining the outdated local model problem in smart grid systems, designing adaptive aggregation factors, and electing committee leaders; S4.1 Definition of the outdated local model problem in smart grid systems; The problem of outdated local models in smart grid systems is defined as follows: ; in, This represents the global model obtained through joint learning. The objective function of the global model is represented by the constraint, which represents the condition in the asynchronous federated learning scenario at the th... During the round of aggregation, the first participating in the training task Device Send to BS based on the The local model obtained by training the global model , Represents a node The number of preceding global model rounds of the local model held. much smaller ; S4.2 Based on the defined outdated local model problem, design an adaptive aggregation factor based on Newton's law of cooling; Newton's law of cooling is used to adjust the weights of the old model in the global model aggregation; node n is at the The aggregate weight of the round is: (9); in, Indicates the current round number. This represents the number of the preceding global model rounds of the local model held by node n. This represents the weight values of the oldest local model. This represents the weight values of the freshest local model; This represents the decay coefficient, which depends on the training task. The larger the value, the smaller the proportion of the local model, which takes longer to train, in the global model; S4.3 Measure the Device’s contribution to the training task and elect a committee leader based on the obtained contribution using a weighted random election algorithm.
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 asynchronously via a wireless BS; 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 communication with other nodes and maintains a shared ledger. The shared ledger on the node ensures that the local model is immutable during training. The distributed database of the BS allocates a memory area as a cache for the local model, and the cache level is calculated 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 state Represented as: (2); in, This represents the current computing power of a node, expressed as CPU idle rate. Indicates energy consumption; This indicates 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. After the local model is trained, it is sent to the BS. When the local model is cached, the Leader Station performs aggregation and generates an updated global model, and then packages it together with the hash value of the cached local model into a block.
6. The adaptive federated learning method for a digital twin-driven smart grid according to claim 1, characterized in that, No. Wheel total model The calculation formula is: (10); Where N represents the total number of participants. This represents the local model submitted by the nth participant. Indicates that node n is at the 1st rank. Aggregate weights of the round.
7. 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 procedure for measuring the contribution of the Device to the computing task is as follows: Based on the subjective logic model, at time... node With the The benefits of B / S interactions to the computing framework are expressed as follows: (11); in, Represents a node At any moment computing power This indicates the probability of packet transmission failure. Indicates the number of positive interactions. Indicates the number of times malicious acts were uploaded. The evaluation quality of the local model is indicated by LeaderStation's testing using a small sample of target data; nodes The formula for calculating the contribution of the computing framework is as follows: (12); in, A coefficient representing the degree of uncertainty in the impact of contribution.
8. 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 procedure for electing committee leaders using a weighted random election algorithm based on the obtained contribution is as follows: After several new blocks are generated, a new committee leader will be elected; in each election, each Station elects a new leader. The node with the highest contribution is used to represent the Station's contribution to the computing framework. The contribution of each station is calculated as follows: Mapping contribution to ,get In each election, a weighted random sampling algorithm is used for each train task. Generate random numbers And calculate , The Station with the highest value becomes the Leader Station, and the election frequency of the committee leader is the reciprocal of the number of blocks waiting 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