Power grid sensor time calibration method and system based on quantum communication
By comparing sensor timestamps and calibrating using proximity sensor information, the problem of sensor time inconsistency is solved, low-cost and high-reliability time synchronization is achieved, and the security and accuracy of the power grid sensor network is enhanced.
Patent Information
- Application Number
- CN202510414872.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-18
AI Technical Summary
After the sensor is restarted, encountered a fault or power outage, its time may be inconsistent with the system time, which will affect the accuracy and reliability of data synchronization and power grid operation. Especially in remote areas with poor signal quality, centralized timing solutions are not applicable.
Using a quantum communication-based method, by comparing local timestamps with historical data timestamps, using the time information of neighboring sensors for calibration, generating and verifying verification random numbers and authentication parameters, safe synchronization between sensors is achieved.
It realizes that the sensor is consistent with the system time after restarting, failing or power outage, reduces costs, improves the accuracy of data synchronization and the reliability of grid operation, and enhances the ability to resist attacks.
Smart Images

Figure CN120342535A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of time calibration, and in particular to a method and system for calibrating the time of grid sensors based on quantum communication. Background Art
[0002] In the process of power transmission and distribution, it is crucial to maintain the stable operation of the power grid; in order to monitor the state of the power grid, sensors play a key role in the power system, and these sensors are responsible for collecting various data, such as current, voltage or temperature, to ensure the reliability and efficiency of the power grid operation; however, due to cost considerations, many sensors are not equipped with a real-time clock, or the function of the real-time clock is not fully realized; this results in the situation that after the sensor restarts, encounters a fault or power outage, its time may be inconsistent with the system time.
[0003] Time inconsistency will cause multiple problems; firstly, the data synchronization problem will affect the accuracy and reliability of the data, because the timestamps of data from different sensors may be inconsistent; secondly, this time deviation will also affect the analysis and decision-making of the power grid operation data, which may lead to incorrect load forecasting or fault diagnosis; in addition, the time error may also affect the emergency response mechanism, such as data backtracking and event reconstruction in the event of a power grid fault or other emergencies; if the Beidou time service or other centralized time service schemes are adopted, the cost or network requirements are relatively high, and for sensors located in remote areas with poor signal quality, this centralized time service scheme is not applicable; therefore, there is an urgent need for a method for calibrating the time of sensors that can ensure that after the sensor restarts, encounters a fault or power outage, its time can still be consistent with the system time, and can also be used for calibrating the time of sensors in areas with poor signal quality. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the technical problem to be solved by the present invention is: how to provide a method for calibrating the time of sensors that can ensure that after the sensor restarts, encounters a fault or power outage, its time can still be consistent with the system time, and can also be used for calibrating the time of sensors in areas with poor signal quality.
[0006] To solve the above technical problem, the present invention provides the following technical solution: a method for calibrating the time of grid sensors based on quantum communication, which includes the following steps,
[0007] Compare the local timestamp with the historical data timestamp, and the first sensor performs a synchronous calibration request operation and a time calibration permission operation according to the comparison result; use the second sensor to verify the synchronous calibration request, and perform a synchronous information operation according to the verification result; based on the synchronous information operation and the time calibration permission operation, the first sensor verifies the synchronous information and performs a time calibration operation according to the verification result.
[0008] As a preferred solution of a method for calibrating the time of a power grid sensor based on quantum communication according to the present invention, wherein: the synchronous calibration request operation includes the following steps: a first sensor generates a first verification random number; encrypts the first verification random number and the device serial number into a first authentication parameter; and sends the first verification random number, the first authentication parameter, and the device serial number as a synchronous calibration request to a second sensor.
[0009] As a preferred solution of a method for calibrating the time of a power grid sensor based on quantum communication according to the present invention, wherein: the second sensor is used to verify the synchronous calibration request and perform synchronous information operation according to the verification result, including the following steps: when the second sensor receives the synchronous calibration request, encrypts the first verification random number and the device serial number into a second authentication parameter; compares the second authentication parameter with the first authentication parameter to determine whether to accept the synchronous calibration request; generates a second verification random number, and encrypts the second verification random number and the current local timestamp into a third authentication parameter; and sends the second verification random number, the third authentication parameter, and the current local timestamp as synchronous information to the sensor network.
[0010] As a preferred solution of a method for calibrating the time of a power grid sensor based on quantum communication according to the present invention, wherein: the time calibration operation is performed according to the verification result, including the following steps: after the first sensor receives the synchronous information, determines whether its own time calibration permission is open. If the time calibration permission is open, encrypts the second verification random number and the current local timestamp into a fourth authentication parameter; compares the fourth authentication parameter with the third authentication parameter to determine whether to calibrate the local system time through the current local timestamp.
[0011] As a preferred solution of a method for calibrating the time of a power grid sensor based on quantum communication according to the present invention, wherein: calibrating the local system time through the current local timestamp includes the following steps: performing clustering analysis on the current local timestamp sent by the sensor to determine the aligned sensor; determining the standard sensor according to the mean value of the current local timestamp sent by the aligned sensor and the current local timestamp, and obtaining the local timestamp T2 when the first sensor receives the synchronous information of the standard sensor; sending a response request including the current receiver timestamp T3 to the standard sensor; the standard sensor immediately replies after receiving the request, including the current timestamp T4 of the standard sensor; calculating the time offset and network delay between the first sensor and the standard sensor; and synchronizing the local system time T of the first sensor.
[0012] As a preferred solution of a time calibration method for grid sensors based on quantum communication according to the present invention, the generation of the first verification random number includes the following steps: generating a seed random number through a quantum random number generator; dividing the seed random number into multiple initialization vectors; caching the initialization vectors in an initialization list of the sensor; and taking out the initialization vector from the initialization list as the first verification random number according to the action trigger of the message sent by the sensor. The generation of the second verification random number is the same by analogy.
[0013] As a preferred solution of a time calibration method for grid sensors based on quantum communication according to the present invention, the initialization list includes a first cache table and a second cache table; the management of the initialization list includes the following steps: the first cache table is connected to the initialization list. When the second cache table finishes reading data from the first cache table, the first cache table requests the quantum random number generator to generate a random number and stores the initialization vector obtained by dividing the random number; the second cache table is connected to the first cache table. When the initialization vector of the first cache table is exhausted, the second cache table reads and stores the data in the first cache table; each value of the second cache table is provided with a status flag bit to record whether it has been read and prevent the reused of the read initialization vector.
[0014] Another object of the present invention is to provide a time calibration system for grid sensors based on quantum communication.
[0015] To solve the above technical problems, the present invention provides the following technical solution: a time calibration system for grid sensors based on quantum communication, including: a calibration request module, used for comparing the local timestamp with the historical data timestamp, and the first sensor performs a synchronous calibration request operation and a time calibration permission operation according to the comparison result; a synchronization information module, used for verifying the synchronous calibration request by using the second sensor and performing a synchronization information operation according to the verification result; a time calibration module, used for verifying the synchronization information based on the synchronization information operation and the time calibration permission operation, and the first sensor performs a time calibration operation according to the verification result.
[0016] The present invention provides a computer device, including a memory and a processor, and the memory stores a computer program, where: when the processor executes the computer program, the steps of a time calibration method for grid sensors based on quantum communication according to the present invention are implemented.
[0017] The present invention provides a computer-readable storage medium, on which a computer program is stored, where: when the computer program is executed by a processor, the steps of a time calibration method for grid sensors based on quantum communication according to the present invention are implemented.
[0018] Advantages of the present invention: By comparing the current timestamp with the timestamps in the corresponding historical data, the present invention determines whether the corresponding sensor has undergone a time reset. If so, it initiates time calibration and calibrates the time of the sensor to be calibrated that has undergone a time reset using the time information of multiple adjacent sensors. The standard clock for verifying the time is located near the sensor to be calibrated, and high-speed power line carrier communication for short-range communication can be used, avoiding the high demand for network signals in centralized time verification and eliminating the need to configure a dedicated time synchronization device for each sensor, resulting in lower costs. When the sensors of the present invention communicate with each other, they generate an authentication code through a shared key, a verification random number, and the corresponding message, and then send the verification random number, the message, and the authentication code to other sensors. Other sensors obtain the authentication code by encrypting the sent authentication code and the message using the same encryption method and the shared key, and determine whether a replay attack has occurred by comparing whether the authentication codes before and after are the same, thereby avoiding replay attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings. Among them:
[0020] Figure 1 FIG. is the overall flowchart of the power grid sensor time calibration method based on quantum communication in Embodiment 1.
[0021] Figure 2 FIG. is the structural schematic diagram of the computer device in Embodiment 3. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0022] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following detailed description of the specific embodiments of the present invention is made in conjunction with the drawings in the specification.
[0023] In the following description, many specific details are set forth to facilitate a thorough understanding of the present invention. However, the present invention can also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.
[0024] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that can be included in at least one implementation manner of the present invention. The "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that excludes other embodiments.
[0025] Example 1, referring to Figure 1 , which is the first embodiment of the present invention. This embodiment provides a method for calibrating the time of power grid sensors based on quantum communication.
[0026] The existing time calibration methods mainly have the following problems: Due to cost considerations, many sensors are not equipped with real-time clocks, or the functions of real-time clocks are not fully realized; this leads to the situation that after the sensor restarts, encounters a fault or loses power, its time may be inconsistent with the system time; and the time inconsistency will cause multiple problems; First, the data synchronization problem will affect the accuracy and reliability of data because the data timestamps from different sensors may be inconsistent; Second, this time deviation will also affect the analysis and decision-making of power grid operation data, which may lead to incorrect load forecasting or fault diagnosis; In addition, incorrect time may also affect the emergency response mechanism, such as data backtracking and event reconstruction during power grid faults or other emergencies; If Beidou time service or other centralized time service schemes are adopted, the cost or network requirements are relatively high, and for sensors located in remote areas with poor signal quality, this centralized time service scheme is not applicable.
[0027] The present invention provides a solution that can effectively solve the above-mentioned problems. Next, multiple embodiments will be combined to elaborate in detail on how to implement the method for calibrating the time of power grid sensors based on quantum communication.
[0028] Figure 1 The overall flowchart of the method for calibrating the time of power grid sensors based on quantum communication is shown, including:
[0029] S1: Compare the local timestamp with the historical data timestamp, and the first sensor performs a synchronous calibration request operation and a time calibration permission operation according to the comparison result.
[0030] It should be noted that the collaborative design of the first sensor and the second sensor aims to achieve high-precision time synchronization and secure calibration of the power grid sensor network; the first sensor, as the initiating node for time calibration, is responsible for detecting local timestamp anomalies and actively initiating synchronization requests. Its core functions include timestamp comparison, quantum random number generation, encryption parameter encapsulation, and permission open control; the second sensor, on the other hand, serves as the verification and response unit for neighboring nodes, responsible for verifying the legitimacy of the synchronization requests from the first sensor and providing a calibration reference through encrypted interaction and timestamp broadcasting; through a hierarchical collaboration mechanism, both the real-time nature of time synchronization is ensured, and the anti-attack ability is enhanced through multiple encryption verifications and dynamic random number management; specifically, when the first sensor detects that the local timestamp lags behind, it sends a synchronization request to the neighboring second sensor; after receiving the request, the second sensor first verifies the legitimacy of the synchronization request. If the verification passes, it provides a trusted time reference for the first sensor, where the first sensor assumes the role of active calibration and the second sensor assumes the role of a trusted time source; through this division of labor, not only the single-point failure risk of a centralized time server is avoided, but also the reliability of time synchronization is ensured through a distributed verification mechanism.
[0031] In an embodiment of the present invention, the first sensor is the sensor to be calibrated.
[0032] In an embodiment of the present invention, the first sensor performs a synchronization calibration request operation and a time calibration permission operation according to the comparison result, including the following steps:
[0033] The first sensor periodically compares the current local timestamp with the historical data timestamp collected by the first sensor. If the current local timestamp is less than or equal to the historical data timestamp collected by the first sensor, it broadcasts a synchronization calibration request to the neighboring sensors and opens the time calibration permission.
[0034] In an embodiment of the present invention, the synchronization calibration request operation includes the following steps:
[0035] The first sensor generates a first verification random number.
[0036] Encrypts the first verification random number and the device serial number into a first authentication parameter.
[0037] Sends the first verification random number, the first authentication parameter, and the device serial number as a synchronization calibration request to the second sensor.
[0038] Exemplarily, performing the synchronization calibration request operation includes:
[0039] Each time a synchronization calibration request is sent, the first sensor that sends the synchronization calibration request generates a first verification random number cr1 through a quantum random number generator.
[0040] Using the shared secret key sk, encrypt the first verification random number cr1 and the device serial number cn into the first authentication parameter QP1 through asymmetric encryption.
[0041] Send the first verification random number cr1, the first authentication parameter QP1, and the device serial number cn to the second sensor as a synchronization calibration request.
[0042] In an alternative embodiment, the encryption process of the synchronization calibration request can also combine quantum key distribution technology to achieve key update; for example, when the sensor to be calibrated and a neighboring sensor establish a communication link, negotiate a one-time session key through a quantum channel, and perform an exclusive OR operation with the shared key to generate a mixed key for encrypting the first verification random number and the device serial number; and after each synchronization calibration request is completed, the mixed key automatically expires, and a session key needs to be re-negotiated for the next request, thereby resisting the long-term security risk caused by key leakage.
[0043] In an alternative embodiment, when the first sensor generates the first verification random number, the splitting strategy of the seed random number can be adjusted to meet different security level requirements; for example, when the power grid is in a high-risk operating state (such as being under a cyber attack or electromagnetic interference), the seed random number can be split into a relatively large number of initialization vectors, and each initialization vector is secondarily scrambled through a hash function to enhance the unpredictability of the random number; while in the normal operating state, a uniform splitting strategy with a smaller number of initialization vectors can be adopted to balance the random number utilization rate and the computational overhead; in addition, to avoid the pattern predictability caused by the fixed length of the split initialization vectors, a bit mask technology can be introduced, that is, a random bit flipping operation is performed on the seed random number before each split (such as inverting specific bit positions according to a preset probability), further enhancing the anti-reverse analysis ability.
[0044] In the embodiment of the present invention, generating the first verification random number cr1 includes the following steps:
[0045] Generate a seed random number through a quantum random number generator.
[0046] The sensor splits the seed random number into multiple initialization vectors.
[0047] The sensor caches the initialization vectors in the initialization list of the sensor.
[0048] The sensor triggers to take out any one of the initialization vectors from the initialization list as the first verification random number cr1 according to the action of the message sent by the sensor, and the generation of the second verification random number cr2 is the same.
[0049] In an alternative embodiment, the initialization list may adopt a multi-level cache architecture; for example, a three-level cache table (the first cache table, the second cache table, and the spare cache table) is set up, where the first cache table is responsible for providing the initialization vector in real time, the second cache table takes over the service when the first cache table is exhausted, and the spare cache table is temporarily enabled when the quantum random number generator cannot replenish data in time due to high load; to prevent data competition among multiple caches, a priority scheduling algorithm based on timestamps can also be adopted. When the remaining amount of the first cache table is lower than the threshold, the second cache table is triggered to load data and the first cache table is marked as read-only; if the second cache table also drops below the threshold later, the spare cache table is enabled and new synchronization calibration requests are suspended until the quantum random number generator completes data replenishment.
[0050] In an embodiment of the present invention, the initialization list includes a first cache table and a second cache table.
[0051] In an embodiment of the present invention, the management of the initialization list includes the following steps:
[0052] The first cache table is connected to the initialization list. When the second cache table finishes reading data from the first cache table, the first cache table requests the quantum random number generator to generate random numbers and stores the initialization vectors obtained by splitting the random numbers.
[0053] The second cache table is connected to the first cache table. When the initialization vectors in the first cache table are exhausted, the second cache table reads and stores the data in the first cache table.
[0054] Each value in the second cache table is provided with a status flag bit to record whether it has been read and prevent the reused initialization vectors from being reused.
[0055] Furthermore, each value in the second cache table is provided with a status flag bit to record whether it has been read and prevent the reused initialization vectors from being reused, including:
[0056] Each value in the second cache table is provided with a status flag bit. Each time data is read from the first cache table, the status flag bit of each value in the second cache table is set to unread. If the value in the second cache table is taken out as the first verification random number cr1 or the second verification random number cr2, the status flag bit of the corresponding value in the second cache table is marked as read.
[0057] If the status flag bit of the corresponding value in the second cache table is marked as read, when reading the initialization vector from the second cache table, the value corresponding to the marked status flag bit cannot be read.
[0058] In an embodiment of the present invention, the communication between the first sensor and other sensors is achieved through a Lora network or a high-speed power line carrier.
[0059] It should be noted that the present invention solves the problems of determinism and predictability in random number generation for traditional power grid sensor time synchronization. By introducing a quantum random number generator and a multi-cache table management mechanism, the generation and state tracking of random numbers are realized. In traditional methods, random number generation often relies on pseudo-random algorithms, which have theoretical predictability and are easily obtained by attackers through reverse derivation of the random number sequence. However, the present invention ensures the unique use and non-repeatability of each initialization vector through quantum randomness and dual-cache table state marking, effectively enhancing the randomness entropy increase characteristics of the present invention. This means that even if an attacker obtains partial random number information, they cannot accurately predict the subsequent random number sequence, fundamentally improving the security and uncrackability of the sensor time calibration process and providing a higher-level security protection mechanism for the time synchronization of critical power grid infrastructure.
[0060] S2: Use the second sensor to verify the synchronization calibration request and perform synchronization information operations according to the verification result.
[0061] In an optional embodiment, when verifying the synchronization calibration request, the second sensor can introduce a multi-factor authentication mechanism based on geographical location fingerprints to enhance security. For example, after receiving the synchronization calibration request from the first sensor, in addition to verifying the first authentication parameter, the second sensor can also calculate the physical location credibility of the request source by combining the signal strength of the Lora network or the phase characteristics of high-speed power line carrier with the pre-stored geographical location database of adjacent sensors. If the deviation between the signal characteristics and the pre-stored location exceeds the threshold, it is determined as an abnormal request and the synchronization is rejected, thereby effectively defending against long-distance spoofing attacks.
[0062] In the embodiment of the present invention, the second sensor is an adjacent sensor.
[0063] In the embodiment of the present invention, using the second sensor to verify the synchronization calibration request and perform synchronization information operations according to the verification result includes the following steps:
[0064] When the second sensor receives the synchronization calibration request, encrypt the first verification random number and the device serial number into the second authentication parameter.
[0065] Compare the second authentication parameter with the first authentication parameter to determine whether to accept the synchronization calibration request.
[0066] Generate the second verification random number, and encrypt the second verification random number and the current local timestamp into the third authentication parameter.
[0067] Send the second verification random number, the third authentication parameter, and the current local timestamp as synchronization information to the sensor network.
[0068] In an optional embodiment, the process of the second sensor generating the second verification random number can implement encryption algorithm selection by combining a lightweight machine learning model; for example, the second sensor has a built-in encryption policy decision module based on the random forest algorithm, which monitors network load, remaining power, and historical attack records in real time. According to the input parameters, the encryption policy decision module selects the encryption algorithm; elliptic curve encryption with lower computational overhead is preferred in high-load or low-battery scenarios, and asymmetric encryption algorithms with higher security are switched to when potential attacks are detected.
[0069] In an optional embodiment, the process of sending synchronization information can also integrate the Byzantine fault tolerance mechanism to deal with malicious nodes; after the second sensor generates the third authentication parameter, it sends the synchronization information (including the second verification random number, the third authentication parameter, and the current local timestamp) to a preset number of witness sensors simultaneously; the witness sensors verify the legitimacy of the third authentication parameter through a majority voting mechanism (for example, when more than half of the witness sensors return a verification pass, it is allowed to be sent to the entire network), thereby blocking the spread of tampered synchronization information in the network.
[0070] Exemplarily, performing synchronization information operations according to the verification result includes:
[0071] When the second sensor receives a synchronization calibration request, it encrypts the first verification random number cr1 and the device serial number cn into the second authentication parameter QP2 using the shared key sk and the same asymmetric encryption method.
[0072] Compare the second authentication parameter QP2 with the first authentication parameter QP1. If the second authentication parameter QP2 is equal to the first authentication parameter QP1, accept the synchronization calibration request.
[0073] Generate the second verification random number cr2 through a quantum random number generator, and use the shared key sk to encrypt the second verification random number cr2 and the current local timestamp tc into the third authentication parameter QP3 through asymmetric encryption.
[0074] Send the second verification random number cr2, the third authentication parameter QP3, and the current local timestamp tc as synchronization information to the sensor network.
[0075] If the second authentication parameter QP2 is not equal to the first authentication parameter QP1, do not accept the synchronization calibration request.
[0076] It should be noted that by constructing a multi-layer authentication and verification system based on a shared key, the present invention effectively solves the problems of identity authentication and information credibility in the time synchronization of traditional power grid sensors. Traditional time calibration schemes for power grid sensors often have technical limitations such as single authentication and insufficient security, and are vulnerable to man-in-the-middle attacks and information tampering risks. The present invention designs a four-layer authentication parameter generation and cross-verification mechanism. Each layer of authentication introduces the asymmetric encryption of random numbers, device serial numbers, and local timestamps, forming a multi-layer defense authentication barrier, making it difficult for attackers to forge legitimate time synchronization requests, and even if they obtain partial authentication information, they cannot construct a complete authentication chain. More importantly, it can adjust authentication parameters in real time, improve the anti-attack ability of the sensor network, and provide a more reliable and intelligent time synchronization solution for the critical information infrastructure of the power grid.
[0077] S3: Based on the synchronization information operation and the time calibration permission operation, the first sensor verifies the synchronization information and performs a time calibration operation according to the verification result.
[0078] In the embodiment of the present invention, performing a time calibration operation according to the verification result includes the following steps:
[0079] After receiving the synchronization information, the first sensor determines whether its own time calibration permission is open. If the time calibration permission is open, it encrypts the second verification random number and the current local timestamp into a fourth authentication parameter.
[0080] Compare the fourth authentication parameter with the third authentication parameter to determine whether to calibrate the local system time with the current local timestamp.
[0081] Exemplarily, performing a time calibration operation according to the verification result includes:
[0082] After receiving the synchronization information, the first sensor determines whether its own time calibration permission is open. If the time calibration permission is open, it encrypts the second verification random number cr2 and the current local timestamp tc into a fourth authentication parameter QP4 using the shared key sk and the same asymmetric encryption method.
[0083] Compare the fourth authentication parameter QP4 with the third authentication parameter QP3. If the fourth authentication parameter QP4 is equal to the third authentication parameter QP3, calibrate the local system time with the current local timestamp tc.
[0084] If the fourth authentication parameter QP4 is not equal to the third authentication parameter QP3, reject calibrating the local system time with the current local timestamp tc.
[0085] In the embodiment of the present invention, calibrating the local system time with the current local timestamp includes the following steps:
[0086] Cluster analyze the current local timestamps sent by the sensors to determine the aligned sensors.
[0087] Determine the standard sensor according to the mean of the current local timestamps sent by the aligned sensors and the current local timestamps, and obtain the local timestamp T2 when the first sensor receives the synchronization information of the standard sensor.
[0088] Send a response request containing the current receiver timestamp T3 to the standard sensor.
[0089] After receiving the request, the standard sensor immediately replies, including the current timestamp T4 of the standard sensor.
[0090] Calculate the time offset and network delay between the first sensor and the standard sensor.
[0091] The first sensor synchronizes its local system time T.
[0092] In an optional embodiment, the cluster analysis can adopt a density-based adaptive algorithm to adjust the cluster parameters by real-time monitoring of the changes in the sensor network topology; wherein, when the timestamp dispersion increases due to grid load fluctuations or electromagnetic interference, the proximity domain radius is automatically expanded and the minimum sample number requirement is reduced to ensure that effective aligned sensors can still be selected in a complex environment; meanwhile, a time window sliding mechanism can be introduced to perform cluster analysis only on the historical timestamps within the last few seconds to avoid the interference of old data on the calibration results.
[0093] In an optional embodiment, compared with the determination of the aligned sensors, the selection of the standard sensor can be combined with a multi-dimensional credibility evaluation model; for example, a comprehensive weight is assigned to each candidate aligned sensor, and the comprehensive weight is jointly determined by the historical calibration success rate, signal strength stability, and geographical location distribution uniformity; specifically, if the historical calibration success rate and signal strength fluctuation of a certain sensor reach specific thresholds and it is located at a key node position in the power grid topology, the corresponding credibility weight is raised to the highest priority, thereby effectively avoiding calibration deviations caused by single-point failures.
[0094] Exemplarily, calibrating the local system time through the current local timestamp tc includes:
[0095] Cluster analyze the current local timestamps tc sent by multiple received sensors to obtain multiple timestamp clusters, and select the sensor corresponding to the timestamp cluster with the largest density as the aligned sensor.
[0096] Take the mean of the current local timestamps tc sent by the aligned sensors to obtain the mean value Compare with the mean value The alignment sensor corresponding to the current local timestamp tc with the smallest difference is used as the standard sensor, and the local timestamp T2 when the first sensor receives the synchronization information sent by the standard sensor is obtained.
[0097] The first sensor sends a response request including the current receiving end timestamp T3 to the standard sensor.
[0098] The standard sensor responds immediately after receiving the request, and the response information also includes the current timestamp T4 of the standard sensor.
[0099] The time offset and network delay between the first sensor and the standard sensor are calculated.
[0100] The first sensor synchronizes its own local system time T.
[0101] In an optional embodiment, a redundant verification mechanism may be additionally introduced into the calculation of time offset and network delay; wherein, after the four-way handshake timestamp interaction is completed, the first sensor may send a secondary confirmation request to the standard sensor, requiring a reply of a verification package containing an additional timestamp within a preset time window, thereby eliminating the influence of occasional network jitter through cross-validation of multiple sets of timestamp data; in addition, an outlier detection module may be set up, and if the time offset or network delay calculated at a certain time exceeds the preset statistical range, a recalibration process is automatically triggered to avoid erroneous synchronization due to sudden interference.
[0102] Furthermore, in the embodiment of the present invention, the specific formula for calculating the time offset between the first sensor and the standard sensor is as follows:
[0103]
[0104] In the embodiment of the present invention, the specific formula for calculating the network delay between the first sensor and the standard sensor is as follows:
[0105]
[0106] In the embodiment of the present invention, the specific formula for the first sensor to synchronize its own local system time T is as follows:
[0107] T=T c -oft+dy;
[0108] Among them, T c The current timestamp of the first sensor.
[0109] It should be noted that the present invention effectively solves the problems of accuracy and consistency in time synchronization of the power grid distributed sensor network. Since traditional methods often adopt simple time averaging or rely on a single trusted node, it is difficult to cope with the time discreteness and abnormal conditions of sensors in a complex power grid environment. By introducing a multi-sensor clustering analysis strategy, the present invention selects the time stamp cluster with the largest density and further screens the standard sensors closest to the cluster mean. It can not only effectively filter abnormal time stamps but also adapt to the complex and changeable operating environment of the power grid. Therefore, compared with traditional time synchronization technologies, the present invention can improve the robustness and self-adaptability of time calibration, enabling the power grid sensor network to maintain high-precision and high-reliability time synchronization in a decentralized and uncertain environment.
[0110] In summary, the present invention judges whether the corresponding sensor has undergone time reset by comparing the current time stamp with the time stamp in the corresponding historical data. If a time reset has occurred, a time calibration is initiated. The time of the sensor to be calibrated that has undergone time reset is calibrated using the time information of multiple neighboring sensors. The standard clock for verifying the time is located near the sensor to be calibrated, and a high-speed power line carrier for short-distance communication can be used, avoiding the high demand for network signals in centralized time verification and eliminating the need to configure a dedicated time service device for each sensor, resulting in lower costs. When the sensors in the present invention communicate with each other, an authentication code is generated by sharing a secret key, verifying a random number, and the corresponding message, and then the verified random number, message, and authentication code are sent to other sensors together. Other sensors obtain the authentication code by encrypting the sent authentication code and message using the same encryption method and shared secret key, and judge whether a replay attack has occurred by comparing whether the authentication codes before and after are the same, thus avoiding replay attacks.
[0111] Embodiment 2 is the second embodiment of the present invention. This embodiment provides a power grid sensor time calibration system based on quantum communication, including: a calibration request module for comparing the local time stamp with the historical data time stamp, and the first sensor performing a synchronous calibration request operation and a time calibration permission operation according to the comparison result; a synchronization information module for verifying the synchronous calibration request using the second sensor and performing a synchronization information operation according to the verification result; a time calibration module for verifying the synchronization information based on the synchronization information operation and the time calibration permission operation, and the first sensor performing a time calibration operation according to the verification result.
[0112] Embodiment 3 is the third embodiment of the present invention. What is different from the previous two embodiments is:
[0113] Such as Figure 2As shown, when the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0114] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a predefined sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or used in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
[0115] More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection part with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber device, and portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or otherwise processing it as appropriate, and then storing it in a computer memory.
[0116] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
[0117] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A time calibration method for power grid sensors based on quantum communication, characterized in that: including comparing the local timestamp with the historical data timestamp, and the first sensor performing a synchronous calibration request operation and a time calibration permission operation according to the comparison result; using the second sensor to verify the synchronous calibration request and performing a synchronous information operation according to the verification result; based on the synchronous information operation and the time calibration permission operation, the first sensor verifies the synchronous information and performs a time calibration operation according to the verification result.
2. The time calibration method of the power grid sensor based on quantum communication according to claim 1, characterized in that: The synchronous calibration request operation includes the following steps: The first sensor generates a first verification random number; encrypting the first verification random number and the device serial number into a first authentication parameter; sending the first verification random number, the first authentication parameter, and the device serial number as a synchronous calibration request to the second sensor.
3. The time calibration method for a power grid sensor based on quantum communication according to claim 2, characterized in that: The step of using the second sensor to verify the synchronous calibration request and performing a synchronous information operation according to the verification result includes the following steps: When the second sensor receives the synchronous calibration request, encrypting the first verification random number and the device serial number into a second authentication parameter; comparing the second authentication parameter with the first authentication parameter to determine whether to accept the synchronous calibration request; generating a second verification random number and encrypting the second verification random number and the current local timestamp into a third authentication parameter; sending the second verification random number, the third authentication parameter, and the current local timestamp as synchronous information to the sensor network.
4. The time calibration method for a power grid sensor based on quantum communication according to claim 3, characterized in that: The step of performing a time calibration operation according to the verification result includes the following steps: After receiving the synchronous information, the first sensor determines whether its time calibration permission is open. If the time calibration permission is open, encrypting the second verification random number and the current local timestamp into a fourth authentication parameter; comparing the fourth authentication parameter with the third authentication parameter to determine whether to calibrate the local system time with the current local timestamp.
5. The method for calibrating the time of a power grid sensor based on quantum communication according to claim 4, characterized in that: The step of calibrating the local system time with the current local timestamp includes the following steps: performing a cluster analysis on the current local timestamp sent by the sensor to determine the aligned sensor; determining a standard sensor according to the mean of the current local timestamps sent by the aligned sensors and the current local timestamp, and obtaining the local timestamp T2 when the first sensor receives the synchronous information from the standard sensor; sending a response request including the current receiver timestamp T3 to the standard sensor; The standard sensor immediately replies after receiving the request, including the current timestamp T4 of the standard sensor; calculating the time offset and network delay between the first sensor and the standard sensor; The first sensor synchronizes its local system time T.
6. A time calibration method for a power grid sensor based on quantum communication according to claim 5, characterized in that: The step of generating the first verification random number includes the following steps: generating a seed random number through a quantum random number generator; dividing the seed random number into multiple initialization vectors; caching the initialization vectors in the initialization list of the sensor; triggering to take out the initialization vector from the initialization list as the first verification random number according to the action of the message sent by the sensor, and the generation of the second verification random number is the same.
7. The time calibration method for a power grid sensor based on quantum communication according to claim 6, characterized in that: The initialization list includes a first cache table and a second cache table; The management of the initialization list includes the following steps: The first cache table is connected to the initialization list. When the second cache table finishes reading data from the first cache table, the first cache table requests the quantum random number generator to generate a random number and stores the initialization vector obtained by splitting the random number. The second cache table is connected to the first cache table. When the initialization vector of the first cache table is exhausted, the second cache table reads and stores the data in the first cache table. Each value in the second cache table is provided with a status flag bit to record whether it has been read and prevent the reused of the read initialization vector.
8. A time calibration system for grid sensors based on quantum communication, which applies a time calibration method for grid sensors based on quantum communication as described in any one of claims 1 to 7, characterized in that: Including, A calibration request module, which is used to compare the local timestamp with the historical data timestamp, and the first sensor performs a synchronous calibration request operation and a time calibration permission operation according to the comparison result. A synchronization information module, which is used to verify the synchronous calibration request by using the second sensor and perform a synchronization information operation according to the verification result. A time calibration module, which is used to verify the synchronization information based on the synchronization information operation and the time calibration permission operation, and the first sensor performs a time calibration operation according to the verification result.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of a method for calibrating the time of a power grid sensor based on quantum communication according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of a method for calibrating the time of a power grid sensor based on quantum communication according to any one of claims 1 to 7 are implemented.