Method, device and equipment for calibrating clock of device based on protocol conversion gateway

By receiving the master clock reference time value through a protocol conversion gateway and using a mapping table to calculate and generate clock adjustment instructions, the clock calibration problem of heterogeneous equipment in integrated photovoltaic-storage-charging power stations is solved, achieving high-precision time synchronization and improving the quality of power station data analysis and decision-making.

CN122093007BActive Publication Date: 2026-07-03SHENZHEN RUNSHIHUA SOFTWARE & INFORMATION TECH SERVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN RUNSHIHUA SOFTWARE & INFORMATION TECH SERVICE CO LTD
Filing Date
2026-04-24
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In integrated photovoltaic, energy storage, and charging power stations, heterogeneous equipment cannot achieve clock calibration due to different communication protocols, resulting in misalignment of operating data time phase and affecting the realization of power station intelligence.

Method used

The gateway receives the reference time value of the master clock through a protocol conversion, uses a mapping table to obtain the communication protocol type and time data object address of heterogeneous devices, calculates the time offset, and generates a clock adjustment command that conforms to the communication protocol for calibration.

Benefits of technology

It has achieved high-precision clock calibration for heterogeneous equipment within the photovoltaic-storage-charging integrated power station, providing a unified time reference and improving the quality of power station data analysis and decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122093007B_ABST
    Figure CN122093007B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of industrial smart grid, and discloses a device clock calibration method and device based on a protocol conversion gateway and equipment, the method comprises the following steps: a protocol conversion gateway receives a reference time value of a master clock through a precision time protocol interface; a preset mapping table is inquired according to the identification of a target device to obtain a communication protocol type and a time data address, so as to obtain a local clock value of the target device; the deviation between the local clock value and the reference time value is calculated to obtain a time offset; the time offset is converted into a corresponding clock adjustment instruction based on the communication protocol type and is issued to calibrate the clock of the target device. The protocol conversion gateway and the built-in mapping table are arranged in the embodiment, high-precision and unified clock calibration of heterogeneous devices with different communication protocols in a light storage and charging integrated power station is realized, and a reliable time reference is provided for multi-source data fusion and collaborative control of the light storage and charging integrated power station.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial smart grid technology, specifically to a device clock calibration method, apparatus, and device based on a protocol conversion gateway. Background Technology

[0002] The integrated photovoltaic-storage-charging power station integrates heterogeneous devices from different manufacturers and using various communication protocols (such as Modbus-TCP, OPC UA, IEC 61850, etc.), including photovoltaic inverters, energy storage converters, charging piles, smart meters, etc. The stable and coordinated operation of these heterogeneous devices highly depends on a high-precision and consistent time base to ensure strict alignment of status monitoring, event recording, control commands and power data on the time axis.

[0003] However, due to the different communication protocols of heterogeneous devices, unified management of all heterogeneous devices within the station is impossible. This results in a significant time phase misalignment in the operational data (such as power, voltage, energy, and events) reported by the subsystems corresponding to each device in the integrated photovoltaic-storage-charging power station. This underlying time asynchrony severely contaminates the data sources for advanced applications such as energy management, status assessment, fault analysis, and optimized scheduling at the upper levels of the power station. Consequently, the accuracy and reliability of collaborative control and intelligent decision-making based on multi-source data fusion are greatly reduced, seriously affecting the realization of power station intelligence. Summary of the Invention

[0004] In view of the above problems, embodiments of the present invention provide a device clock calibration method, apparatus and device based on a protocol conversion gateway, which is used to solve the problem that device clock calibration cannot be achieved in integrated energy storage and charging power stations due to the different communication coordination of heterogeneous devices.

[0005] According to one aspect of the present invention, a device clock calibration method based on a protocol conversion gateway is provided. The device is a heterogeneous device in a photovoltaic-storage-charging integrated power station using different communication protocols. The heterogeneous device includes a photovoltaic inverter, an energy storage converter, a charging pile, and an energy metering device. Each of the heterogeneous devices is communicatively connected to the protocol conversion gateway based on a corresponding communication protocol. The method is implemented based on the protocol conversion gateway and includes:

[0006] Receive the reference time value of the current moment from the master clock through the precision time protocol interface;

[0007] The target device is queried from a pre-set mapping table based on its device identifier to obtain its communication protocol type and time data object address. A clock read request is generated based on the communication protocol type and sent to the time data object address of the target device to obtain the device clock value of the target device at the current moment. The target device is one of the multiple heterogeneous devices awaiting clock calibration in the integrated photovoltaic-storage-charging power station. The mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address.

[0008] Calculate the time offset based on the deviation between the device clock value and the reference time value;

[0009] According to the clock adjustment instruction format specified by the communication protocol type, the time offset is converted into a corresponding clock adjustment instruction, and the clock adjustment instruction is sent to the time data object address to calibrate the device clock of the target device. The clock adjustment instruction includes the time data object address and adjustment parameters.

[0010] In one alternative approach, the establishment of the mapping table includes:

[0011] Obtain an initial list of all equipment for the photovoltaic-storage-charging integrated power station. The initial list of all equipment shall include at least the equipment identifier and equipment model of each heterogeneous device.

[0012] The device model is matched with a pre-set feature library of optical storage and charging devices to determine the device type corresponding to each device identifier;

[0013] Determine the communication protocol type corresponding to the heterogeneous device based on the device type;

[0014] The address of the time data object corresponding to the heterogeneous device is determined according to the communication protocol type;

[0015] A mapping relationship is established based on the device identifier, the communication protocol type, and the time data object address to obtain the mapping table corresponding to the heterogeneous device.

[0016] In one optional embodiment, the mapping table further includes a sampling time interval and a sampling number N; the protocol conversion gateway calculates a time offset based on the deviation between the device clock value and the reference time value, including:

[0017] The mapping table is queried based on the device identifier of the target device to determine the corresponding sampling time interval and the number of sampling N;

[0018] Based on the sampling time interval, the device clock value and the reference time value are obtained sequentially at N sampling times to obtain N sets of sampling data;

[0019] Based on the deviation between the device clock value and the reference time value in each set of sampled data, N single clock drift values ​​are calculated;

[0020] The time offset is obtained by calculating the average of the N single clock drifts.

[0021] In one optional embodiment, after calculating the time offset based on the deviation between the device clock value and the reference time value, the protocol conversion gateway further includes:

[0022] Based on the device identifier of the target device, the end timestamp of the current sampling and statistical period, and the time offset, a clock drift compensation table is generated, wherein the end timestamp of the current sampling and statistical period is the reference time value corresponding to the Nth group of sampling data;

[0023] The clock drift compensation table is written into a timing database to form historical drift data of the target device; the historical drift data is a sequence of multiple time offsets.

[0024] In one alternative approach, after the protocol conversion gateway calculates the time offset based on the deviation between the device clock value and the reference time value, the method further includes:

[0025] The actual frequency and nominal frequency of the crystal oscillator of the target device are obtained, and the relative frequency deviation Δf is calculated.

[0026] Obtain the temperature coefficient c and temperature change ΔS of the target device;

[0027] Based on the relative frequency deviation Δf, the temperature coefficient c, and the temperature change ΔS, calculate the cumulative clock drift:

[0028] T represents the total duration of the current sampling and statistical period.

[0029] The accumulated clock drift is compared with the total drift within the statistical period to obtain a first deviation value, and it is determined whether the absolute value of the first deviation value is greater than a preset deviation threshold; wherein, the total drift is the sum of N time offsets;

[0030] If the value is greater than the specified value, shorten the sampling time interval and update the mapping table.

[0031] If the sampling time interval is less than or equal to the specified time interval, maintain or increase the sampling time interval and update the mapping table.

[0032] In an alternative approach, the method further includes predicting the next calibration time of the target device based on the time-series database, including:

[0033] The historical drift data of the target device is obtained based on the time-series database;

[0034] Based on linear regression analysis and least squares fitting, the historical drift data is analyzed and fitted to establish a relationship model between the drift amount of the target device and time. The relationship model is as follows:

[0035] ;

[0036] Δt(T) is the predicted cumulative drift amount after time T since the last calibration; a is the drift rate coefficient of the target device, b is the initial drift amount of the target device, and T is the time variable;

[0037] The predicted clock drift of the target device at future time t is obtained based on the relationship model.

[0038] Based on the predicted clock drift amount and the preset drift threshold, determine the theoretical critical moment when the predicted clock drift amount reaches the preset drift threshold;

[0039] The next calibration time corresponding to the target device is determined based on the theoretical critical time, and the next calibration time is updated in the mapping table; the next calibration time is earlier than the theoretical critical time.

[0040] In one optional approach, the protocol conversion gateway converts the time offset into a corresponding clock adjustment instruction according to the clock adjustment instruction format specified by the communication protocol type, and sends the clock adjustment instruction to the time data object address to calibrate the device clock of the target device, including:

[0041] Determine whether the absolute value of the time offset is greater than a preset drift threshold;

[0042] If the value is greater than the specified value, the time offset is converted into the corresponding clock adjustment command based on the communication protocol type and sent to the target device.

[0043] If the value is less than or equal to the time offset, the device identifier, the time offset, and the corresponding sampling time are written into the time series database.

[0044] In one alternative approach, if the value is greater than a certain threshold, the time offset is converted into a corresponding clock adjustment command based on the communication protocol type and sent to the target device, including:

[0045] The time offset is divided into M-component correction adjustment amounts, where M is the preset number of corrections;

[0046] Based on the communication protocol type, generate a corresponding sub-clock adjustment instruction for each of the sub-correction adjustment amounts;

[0047] The sub-clock adjustment command is sent to the target device sequentially according to the calibration interval to calibrate the device clock of the target device until M calibrations are completed;

[0048] Wherein, the correction interval Δt interval satisfy:

[0049] , where Δt adjust The sub-correction adjustment amount is denoted as 'a', where 'a' is the drift rate coefficient of the target device.

[0050] According to a second aspect of the present invention, a device clock calibration apparatus based on a protocol conversion gateway is provided, the apparatus comprising:

[0051] The reference time module is used by the protocol conversion gateway to receive the reference time value of the current moment output by the master clock through the precision time protocol interface.

[0052] The device clock module is used to query a preset mapping table based on the device identifier of the target device to obtain the communication protocol type and time data object address of the target device; generate a clock read request based on the communication protocol type, and send the read request to the time data object address of the target device to obtain the device clock value of the target device at the current time; the target device is one of multiple heterogeneous devices in the photovoltaic-storage-charging integrated power station that need to be clocked; the mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address;

[0053] The calculation module is used to calculate the time offset based on the deviation between the device clock value and the reference time value;

[0054] The time calibration module is used to convert the time offset into a corresponding clock adjustment instruction according to the clock adjustment instruction format specified by the communication protocol type, and send the clock adjustment instruction to the time data object address to calibrate the device clock of the target device, wherein the clock adjustment instruction includes the time data object address and adjustment parameters;

[0055] The heterogeneous devices are those that use different communication protocols in the integrated photovoltaic-storage-charging power station. The heterogeneous devices include photovoltaic inverters, energy storage converters, charging piles, and power metering devices. Each of the heterogeneous devices communicates with the protocol conversion gateway based on its corresponding communication protocol.

[0056] According to a third aspect of the present invention, a computer device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0057] The memory is used to store at least one executable instruction that causes the processor to perform the operation of any of the protocol conversion gateway-based device clock calibration methods provided in the first aspect above.

[0058] This invention implements communication connections with the master clock and different heterogeneous devices in a photovoltaic-storage-charging integrated power station based on a protocol conversion gateway. It automatically reads the device clock values ​​of each heterogeneous device and the reference time value of the master clock based on a built-in mapping table. This invention can initiate clock information acquisition requests to heterogeneous devices such as photovoltaic inverters, energy storage converters, charging piles, and energy metering devices using different communication protocols, based on a preset mapping table. It obtains the device clock values ​​of the heterogeneous devices, compares them with the high-precision reference time of the master clock, calculates the corresponding time offset, and finally generates clock adjustment instructions conforming to the communication protocol specifications of each heterogeneous device and issues them for execution. It fundamentally solves the problem of difficulty in uniformly collecting and accurately correcting clock information in integrated photovoltaic-storage-charging power stations due to the diverse equipment types and different communication protocols. It can provide a unified and high-precision time reference for all heterogeneous equipment in the power station, thereby generating multi-source equipment operation data that is strictly aligned on the time axis. This provides a consistent time information basis for subsequent energy collaborative management, status assessment and optimized scheduling models in integrated photovoltaic-storage-charging power stations, and greatly improves the data quality of the entire station's data analysis and decision-making.

[0059] The above description is merely an overview of the technical solutions of the embodiments of the present invention. In order to better understand the technical means of the embodiments of the present invention and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0060] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0061] Figure 1 A schematic flowchart of the device clock calibration method based on a protocol conversion gateway provided in Embodiment 1 of the present invention is shown;

[0062] Figure 2A schematic diagram of the device clock calibration device based on a protocol conversion gateway provided in Embodiment 2 of the present invention is shown.

[0063] Figure 3 A schematic diagram of the structure of the computer device provided in Embodiment 3 of the present invention is shown. Detailed Implementation

[0064] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Example 1

[0065] Please see Figure 1 and Figure 2 This embodiment 1 provides a device clock calibration method based on a protocol conversion gateway. The device is a heterogeneous device in a photovoltaic-storage-charging integrated power station using different communication protocols. The heterogeneous device includes a photovoltaic inverter, an energy storage converter, a charging pile, and an energy metering device. Each of the heterogeneous devices communicates with the protocol conversion gateway based on its corresponding communication protocol. This method is executed by the protocol conversion gateway and includes:

[0066] S1: Receives the reference time value of the current moment from the master clock output through the precision time protocol interface.

[0067] Specifically, the master clock is a Grandmaster clock that supports the IEEE 1588 Precision Time Protocol (PTP) and can obtain high-precision UTC (Coordinated Universal Time) through GPS / BeiDou satellite navigation system signals.

[0068] The protocol conversion gateway maintains precise synchronization with the master clock via the PTP interface on its Ethernet port. It receives and parses PTP synchronization messages sent by the master clock in real time to obtain a reference time value with sub-microsecond accuracy. This reference time value will serve as the absolute reference for calibrating the clocks of all equipment in the integrated photovoltaic-storage-charging power station.

[0069] By adopting the PTP protocol master clock, the time synchronization accuracy of various heterogeneous devices in the photovoltaic-storage-charging integrated power station is improved from the millisecond level to the sub-microsecond level. This fundamentally meets the stringent requirements of time consistency for the refined data analysis of the power system in the photovoltaic-storage-charging integrated power station, and provides a reliable reference time for the calibration of all subsequent devices.

[0070] S2: Query a preset mapping table based on the device identifier of the target device to obtain the communication protocol type and time data object address of the target device; generate a clock read request based on the communication protocol type and send the read request to the time data object address of the target device to obtain the device clock value of the target device at the current time; the target device is one of the multiple heterogeneous devices waiting for clock calibration in the integrated photovoltaic-storage-charging power station; the mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address.

[0071] The mapping table records information on all target devices within the integrated photovoltaic-storage-charging power station that require clock synchronization calibration. The mapping table records at least the device ID, communication protocol type, and time object address for each target device. The device ID distinguishes different devices; the communication protocol type specifies the protocol required to communicate with the target device, such as "Modbus-TCP (function code 03, register address 40001)" or "OPC UA (node ​​ns=3; s=Device.LocalTime)"; and the time object address precisely identifies the specific storage unit or data node corresponding to reading the device clock value under that communication protocol.

[0072] When calibration of a target device is required, the protocol conversion gateway queries the mapping table based on the device identifier corresponding to the target device. After obtaining the communication protocol type corresponding to the target device, the protocol conversion gateway calls the corresponding internal protocol processing unit (such as the Modbus-TCP client library or OPC UA client stack) to generate a specific read request according to the message format specification of the communication protocol corresponding to the target device. For example, for a Modbus-TCP device, a "Read Holding Register" request instruction is generated; for an OPC UA device, a "Read Node Attributes" request instruction is generated.

[0073] The protocol conversion gateway sends a read request over the network to the target device's IP address and port, specifying the address of the time data object obtained during the access process. Upon receiving the read request, the target device responds according to its internal logic, returning its current device clock value.

[0074] This embodiment, based on a protocol conversion gateway and a built-in mapping table, abstracts physically different and protocol-different heterogeneous devices into logically unified manageable objects. This enables the protocol conversion gateway to interact with all heterogeneous devices using the same process, solving the core problem of the inability to uniformly collect clock information in integrated photovoltaic, energy storage, and charging power stations due to communication protocol barriers.

[0075] S3: Calculate the time offset based on the deviation between the device clock value and the reference time value.

[0076] Upon receiving a response from the target device, the protocol conversion gateway records the base time of the current time t and the parsed device clock, and calculates the time offset Δt for the current time:

[0077] The reference time value at the current time t, T dev (t) represents the device clock value of the target device at the current time t.

[0078] S4: According to the clock adjustment instruction format specified by the communication protocol type, the time offset is converted into a corresponding clock adjustment instruction, and the clock adjustment instruction is sent to the time data object address to calibrate the device clock of the target device, wherein the clock adjustment instruction includes the time data object address and adjustment parameters.

[0079] Specifically, the protocol conversion gateway, based on the communication protocol type of the target device in the mapping table, calls the protocol processing module to convert the abstract time offset Δt(t) into a specific clock adjustment instruction that conforms to the communication protocol specification corresponding to the target device. For example, for a Modbus device that supports "write register" to set the time, a "write single register" instruction is generated to write the time offset Δt as an offset compensation amount to a specific register.

[0080] The generated clock adjustment command not only includes adjustment parameters, namely, obtaining the offset compensation amount of the device clock based on the time offset Δt, but also precisely specifies the address of the corresponding time data object, ensuring that the clock adjustment command can be correctly received by the target device and applied to the internal device clock.

[0081] Furthermore, after obtaining the time offset Δt(t), it is determined whether the absolute value of the time offset is greater than a preset drift threshold.

[0082] If the value is greater than the specified value, the time offset is converted into the corresponding clock adjustment command based on the communication protocol type and sent to the target device.

[0083] If the value is less than or equal to the time offset, the device identifier, the time offset, and the corresponding sampling time are written into the time series database.

[0084] Specifically, after obtaining the time offset Δt(t), the protocol conversion gateway determines whether the target device needs clock calibration. It checks whether the absolute value of the current time offset Δt(t) is greater than the preset drift threshold δ1.

[0085] When |Δt(t)|>δ1, it is determined that the current time offset Δt(t) has exceeded the allowable safety and accuracy range, and the target device's clock needs to be calibrated. The protocol conversion gateway then converts the time offset Δt(t) into a specific clock adjustment command specified by the communication protocol, based on the target device's communication protocol type obtained from the mapping table. This clock adjustment command explicitly includes the time data object address and the adjustment parameters calculated based on Δt(t). Subsequently, this clock adjustment command is sent to the target device, which receives and executes it to correct its clock, completing a closed-loop calibration.

[0086] When |Δt(t)|≤δ, the current time offset Δt(t) is determined to be within an acceptable range, and there is no need to perform immediate calibration on the target device.

[0087] The preset drift threshold corresponding to the target device can be determined according to the clock accuracy requirements of the device type. For example, for an energy metering device, δ1=1ms; for a power control device, δ1=100μs.

[0088] This embodiment determines whether to perform clock calibration on the target device by setting a preset drift threshold, avoiding invalid and frequent calibration actions caused by minor fluctuations in the target device's clock or measurement noise. This significantly saves communication and computing resources, reduces unnecessary intervention in the target device, and improves the overall operational stability of the photovoltaic-storage-charging integrated power station.

[0089] In one implementation of this embodiment, if the time offset is greater than a certain value, the time offset is converted into a corresponding clock adjustment command based on the communication protocol type and sent to the target device, including:

[0090] The time offset Δt(t) is divided into M sub-correction adjustment amounts, where M is the preset number of corrections (e.g., M=5). The sub-correction adjustment amount is:

[0091] .

[0092] Based on the communication protocol type, a corresponding sub-clock adjustment instruction is generated for each of the sub-correction adjustment amounts.

[0093] The sub-clock adjustment command is sent to the target device sequentially according to the calibration interval to calibrate the device clock of the target device until M calibrations are completed;

[0094] Wherein, the sub-correction interval Δt interval satisfy:

[0095] , where Δt adjust'a' represents the sub-correction adjustment amount; 'a' represents the drift rate coefficient of the target device.

[0096] By dividing the time offset into M sub-correction adjustment amounts, the large clock jumps of the target device are decomposed into multiple small-amplitude gradual adjustments. This effectively avoids the risks that the target device may have internal timing logic errors, application process interruptions, or network synchronization oscillations due to excessive single correction amounts. It significantly improves the safety, smoothness, and device compatibility of the target device calibration process.

[0097] For each Δt adjust Each protocol conversion gateway generates an independent sub-calibration instruction containing the sub-calibration adjustment amount according to the corresponding communication protocol format of the target device.

[0098] By setting the correction interval Δt interval And successively at t, t+Δt interval ,t+2*Δt interval ...by issuing sub-instructions at all times, the target device can accurately receive and execute every minute adjustment step, ensuring the feasibility of the strategy.

[0099] Δt interval ≥2×Δt adjust / a ensures that the time interval between the two corrections is sufficient to account for the deviation caused by the target device's own drift (approximately a×Δt). interval It will not exceed the single correction amount Δt adjust This half-rate prevents the correction speed from falling behind the drift speed, ensuring the effectiveness of the correction.

[0100] By introducing the drift rate 'a', the correction rhythm can be dynamically adjusted according to the stability of the target device. For target devices with fast drift (large 'a'), the correction interval is automatically shortened and the correction rhythm is accelerated; for stable target devices, the correction interval is extended and the correction rhythm is slowed down.

[0101] This embodiment transforms the potentially abrupt clock jumps in the target device's clock calibration into a smooth, safe, and gentle adjustment process that matches the physical characteristics of the target device by introducing progressive correction and adaptive correction interval control. This ensures that the engineering practicality and system robustness of the calibration process are greatly improved without reducing the final clock synchronization accuracy.

[0102] In one implementation of this embodiment, the establishment of the mapping table includes:

[0103] Obtain an initial list of all equipment for the photovoltaic-storage-charging integrated power station. The initial list of all equipment includes at least the equipment identifier and equipment model of each heterogeneous device.

[0104] Specifically, during the initial deployment of clock synchronization in a photovoltaic-storage-charging integrated power station, a structured initial list of all equipment is obtained from the power station's asset management system, monitoring system, or through standard network discovery protocols (such as SNMP scanning or web crawling). This initial list of all equipment must include at least the equipment identifier (such as equipment ID, asset number, or serial number) and manufacturer model number (Manufacturer Model Number) for each heterogeneous device within the integrated photovoltaic-storage-charging power station that requires clock synchronization. The equipment identifier uniquely identifies the corresponding device within the integrated photovoltaic-storage-charging power station, while the manufacturer model number describes the specific product model of that device.

[0105] Generally, product models include manufacturer codes (such as SUN, PCS, EV), series numbers (such as 2000, 3000), and power ratings (such as 100K, 250K).

[0106] The device model is matched with a pre-set feature library of optical storage and charging devices to determine the device type corresponding to each device identifier.

[0107] Specifically, the protocol conversion gateway performs keyword matching between the device models on the initial list of devices across the entire site and its internal pre-built optical storage and charging device feature library. This feature library defines the mapping rules between device types and keywords. The protocol conversion gateway executes the fuzzy matching logic as follows: query the device model characters;

[0108] If the model prefix contains keywords such as "SUN" or "SG", the device is identified as a photovoltaic inverter.

[0109] If the model prefix contains keywords such as "PCS", "PWS", or "ES", it is determined to be an energy storage converter.

[0110] If the model prefix contains keywords such as "EV", "DC", or "CP", it is determined to be a charging pile.

[0111] If the model prefix includes "DTSD", "DSSD", "ACR", etc., it is determined to be an electricity metering device.

[0112] Furthermore, the initial list of all equipment at the site includes the equipment identifier and equipment name of each of the heterogeneous devices. The equipment names are matched with a pre-set feature database of optical storage and charging equipment to determine the equipment type corresponding to each equipment identifier.

[0113] Specifically, the protocol conversion gateway performs keyword matching between the device models on the initial list of devices across the entire site and its internally pre-built optical storage and charging device feature library. This feature library defines the mapping rules between device types and keywords. The protocol conversion gateway executes fuzzy matching logic by querying the device name characters;

[0114] If the characters contain keywords such as "inverter", "photovoltaic", or "inverter", then the device is determined to be a photovoltaic inverter.

[0115] If the device contains keywords such as "PCS", "energy storage", or "charging and discharging", it is identified as an energy storage converter.

[0116] If the keywords include "charger", "charging pile", or "charging gun", it is identified as a charging pile.

[0117] If the device contains keywords such as "meter", "electricity meter", or "electricity", it is identified as an electricity metering device.

[0118] Fuzzy keyword matching can effectively address the issue of inconsistent device model / name naming, covering the vast majority of standard devices.

[0119] If a matching device model fails, the protocol conversion gateway attempts to remotely read the device configuration file using a known common protocol (such as sending a read vendor identifier request to Modbus register 0001H), or calls the standard API interface provided by the device manufacturer to query device information, perform identification processing, and obtain the device type corresponding to the device model / device name. Once identification is successful, the mapping relationship between the identified device type and the corresponding device model / device name is added or updated as a new record to the optical storage and charging device feature library for future reference. This embodiment, through a proactive interactive supplementary mechanism, greatly improves the success rate and coverage of device type identification.

[0120] For example, by querying the pre-set feature library of photovoltaic, energy storage and charging equipment, the protocol conversion gateway can automatically identify that the equipment with model number "SUN2000-100KTL" is a photovoltaic inverter and the equipment with model number "PCS100" is an energy storage converter. This normalizes the complex equipment models into a limited number of standard equipment types, greatly reducing the workload of manual identification.

[0121] The communication protocol type corresponding to the heterogeneous device is determined based on the device type. After determining the device type of each device, the protocol conversion gateway determines the communication protocol type typically used by that type of device according to internally preset configuration rules. These configuration rules are domain-specific knowledge, and for example, can be defined as follows: "Photovoltaic inverters" default to using the "Modbus-TCP protocol"; "Electricity metering devices" default to using the "DL / T645-2007 protocol". The protocol conversion gateway applies these configuration rules to automatically assign the corresponding communication protocol type to each device identifier.

[0122] The protocol conversion gateway assigns the corresponding communication protocol to the device identifier based on the device type, making the configuration management within the protocol conversion gateway simpler and more unified. When a new device of the same type is added to the photovoltaic-storage-charging integrated power station, no additional protocol configuration is required. The protocol conversion gateway can automatically assign the device identifier and corresponding communication protocol type of the new device and update it to the mapping table.

[0123] The address of the time data object corresponding to the heterogeneous device is determined based on the communication protocol type. After clarifying the communication protocol type corresponding to the device identifier, the protocol conversion gateway further determines the address of the time data object required to read the local clock of the device corresponding to the device identifier, based on the protocol specification of the communication protocol and the conventions of the device type. Specifically, the address of the time data object includes: for the Modbus-TCP protocol, the address is usually one or more holding register addresses (such as the starting address "40001"); for the OPC UA protocol, the address is a node identifier (NodeId, such as "ns=3;s=Device.LocalTime").

[0124] A mapping relationship is established based on the device identifier, the communication protocol type, and the time data object address to obtain the mapping table corresponding to the heterogeneous device.

[0125] This embodiment automatically derives a mapping record by using rules within the protocol conversion gateway (initial list of all devices, optical storage and charging device feature library, configuration rules, etc.). It automatically and logically associates the communication protocol type and time data object address determined by each device identifier. Subsequently, the protocol conversion gateway summarizes, organizes, and formats all device mapping records, ultimately generating a complete mapping table that can be queried by the protocol conversion gateway. This mapping table is typically persistently stored locally on the protocol conversion gateway in the form of a database table or configuration file.

[0126] Furthermore, for newly added equipment in a photovoltaic-storage-charging integrated power station, the protocol conversion gateway scans and identifies the newly connected equipment, obtaining its network address information and open port information. The protocol conversion gateway can automatically assign a device identifier to the newly added equipment.

[0127] Simultaneously, the network address information is compared with the initial list of devices across the entire site to determine the device type corresponding to the newly added device. The communication protocol type corresponding to the new device is determined based on the open port information, and a communication connection is established with the new device based on the communication protocol type. The time data object address corresponding to the new device is obtained based on the communication protocol type. A mapping relationship is established based on the device identifier, communication protocol type, and time data object address, forming a complete mapping record, which is then updated in the mapping table.

[0128] In one implementation, the mapping table further includes a sampling time interval and a sampling number N; the protocol conversion gateway calculates a time offset based on the deviation between the device clock value and the reference time value, including:

[0129] The mapping table is queried based on the device identifier of the target device to determine the corresponding sampling time interval and the number of sampling N;

[0130] Based on the sampling time interval, the device clock value and the reference time value are obtained sequentially at N sampling times to obtain N sets of sampling data;

[0131] Based on the deviation between the device clock value and the reference time value in each set of sampled data, N single clock drift values ​​are calculated;

[0132] The time offset is obtained by calculating the average of the N single clock drifts.

[0133] Specifically, when clock skew calibration is required for a target device, the protocol conversion gateway first queries the mapping table based on the target device's device identifier to obtain the sampling time interval t of the target device. sample The sampling time interval and sampling number N for the target device can be pre-configured in the mapping table based on device type, network conditions, and clock accuracy requirements. The sampling time interval t... sample It is the time interval between the previous sampling time and the next sampling time within the current sampling statistical period. The number of samplings N is the number of sampling actions performed within the current sampling statistical period.

[0134] Different devices can be configured with different sampling frequencies (sampling time intervals) and sample sizes (number of samples). For devices with poor clock stability, more intensive sampling (smaller sampling time intervals and / or larger N) can be used to obtain more accurate estimates; conversely, the sampling frequency and number of samples can be relaxed to save resources.

[0135] Protocol conversion gateway with t sample Sampling is performed at N consecutive time intervals t1, t2, ..., tN. At each sampling time tk, the protocol conversion gateway performs synchronization to acquire tk. ptp (tk) and t dev (tk), thus obtaining the kth set of sampled data. After all sampling is completed, a total of N sets of sampled data are obtained.

[0136] Calculate the single clock drift amount corresponding to each set of sampled data:

[0137] .

[0138] Calculate the arithmetic mean Δt of these N Δt(tk). avg , with Δt avg The time offset is used as the high-confidence output of this statistical period.

[0139] By obtaining the average of N single clock drift values ​​through multiple samplings as the final time offset for calibration, the influence of random noise on the calibration time offset can be significantly reduced, resulting in a more accurate final Δt. avg It is closer to the actual deviation between the device clock and the master clock at the current stage.

[0140] Δt avg The absolute value is compared with the preset drift threshold δ1 to determine whether the target device should be calibrated. This can effectively avoid miscalibration (such as being wrongly judged as out of tolerance when the actual threshold is not exceeded) or missed calibration (such as being missed when the actual threshold is exceeded due to the accidental smallness of the single sampling value), thereby ensuring the necessity and accuracy of the calibration action.

[0141] Furthermore, after S3, it also includes:

[0142] Based on the device identifier of the target device, the end timestamp of the current sampling and statistical period, and the time offset, a clock drift compensation table is generated, wherein the end timestamp of the current sampling and statistical period is the reference time value corresponding to the Nth group of sampling data;

[0143] The clock drift compensation table is written into a timing database to form historical drift data of the target device; the historical drift data is a sequence of multiple time offsets.

[0144] Specifically, the reference time value corresponding to the Nth sampling (i.e., the last sampling) is determined as the end timestamp of the current sampling and statistical period. The protocol conversion gateway encapsulates the information related to this calculation task into a structured clock drift compensation record (clock drift compensation table). This clock drift compensation record includes at least the device identifier, the end timestamp of the current sampling and statistical period, and the corresponding time offset.

[0145] Clock drift compensation records are written to a time-series database for storage. Multiple clock drift compensation records written for the same device identifier naturally form a time-sorted sequence in the time-series database, which is the historical drift data corresponding to the device identifier. This historical drift data records the complete trajectory of the time offset corresponding to the device clock as it evolves over time.

[0146] Furthermore, following S3, the following is also included:

[0147] The actual frequency and nominal frequency of the crystal oscillator of the target device are obtained, and the relative frequency deviation Δf is calculated.

[0148] Obtain the temperature coefficient c and temperature change ΔS of the target device;

[0149] Based on the relative frequency deviation Δf, the temperature coefficient c, and the temperature change ΔS, calculate the cumulative clock drift:

[0150] T represents the total duration of the current sampling and statistical period.

[0151] The accumulated clock drift is compared with the total drift within the statistical period to obtain a first deviation value, and it is determined whether the absolute value of the first deviation value is greater than a preset deviation threshold; wherein, the total drift is the sum of N time offsets;

[0152] If the value is greater than the specified value, shorten the sampling time interval and update the mapping table.

[0153] If the sampling time interval is less than or equal to the specified time interval, maintain or increase the sampling time interval and update the mapping table.

[0154] Specifically, the protocol conversion gateway obtains the actual crystal oscillator frequency f of the target device from the initial list of all devices on the site or by reading it through a proprietary protocol. actual Crystal oscillator nominal frequency f nominal And the temperature coefficient c; at the same time, the temperature change ΔS within the current statistical period is obtained from the equipment temperature sensor or environmental monitoring system.

[0155] Calculate the relative frequency deviation: Δf = (f actual -f nominal ) / f nominal This relative frequency deviation characterizes the inherent deviation of the crystal oscillator itself.

[0156] The total duration of the current statistical period is the actual time taken to complete N samplings. The total duration of the current statistical period is: T = Tt sample *(N-1).

[0157] Based on the classical physical model, the theoretical clock drift relative to the reference time caused solely by crystal oscillator deviation and temperature changes within the current statistical period T is calculated, i.e., the cumulative clock drift:

[0158] Δt drift (T)=Δf*T+c*ΔS*T.

[0159] Calculate the total drift Δt within the current statistical period based on N single clock drift values. total (T); Δt total (T) and Δtdrift (T) is compared, and the first deviation value δ2 is calculated:

[0160] Δ2=Δt total -Δt drift (T).

[0161] By comparing Δt drift (T) and Δt total (T) can be used to evaluate the accuracy of the physical model under the current environment. If Δt drift (T), Δt total (T) is close, indicating that the target device’s behavior is in line with expectations and is mainly driven by known physical laws (crystal oscillator deviation and temperature change); if the difference is significant, it suggests that there may be factors not covered by the classical physical model (such as strong interference, equipment abnormality, inaccurate model parameters) at play, or that the sampled data itself is too noisy.

[0162] Calculate the absolute value of δ2, |δ2|, and compare |δ2| with a preset deviation threshold ε, including:

[0163] If |δ²| > ε, the behavior causing the time shift in the target device deviates significantly from the physical model predictions (crystal oscillator deviation and temperature change). This may mean the device clock is in an unstable state, experiencing unknown interference, or the current sampling frequency is insufficient to accurately capture its rapid changes. Therefore, the sampling time interval t corresponding to the target device in the mapping table should be shortened. sample (For example, reducing the original 5 minutes to 2 minutes). Shortening the sampling interval means increasing the sampling frequency to monitor device status more intensively and detect anomalies in a timely manner.

[0164] If |δ2|≤ε, the behavior causing the time offset of the target device is determined to be basically consistent with the physical model prediction (crystal oscillator deviation and temperature change), and the device clock behavior is relatively stable and meets expectations. In this case, the current sampling frequency of the target device can be considered sufficient or even potentially excessive. Therefore, the current sampling interval can be maintained, or the sampling interval can be increased (e.g., from 5 minutes to 10 minutes) to reduce the operating load of the protocol conversion gateway.

[0165] When it is necessary to shorten or increase the sampling time interval, the protocol conversion gateway updates the corresponding record for the target device in the mapping table with the new sampling time interval value. The next time the clock is sampled for the target device, the new sampling time interval value will be used directly.

[0166] Furthermore, the device clock calibration method based on the protocol conversion gateway further includes: predicting the next calibration time of the target device according to the time series database, including:

[0167] The historical drift data of the target device is obtained based on the time-series database;

[0168] Based on linear regression analysis and least squares fitting, the historical drift data is analyzed and fitted to establish a relationship model between the drift amount of the target device and time. The relationship model is as follows:

[0169] Δt(T) = a × T + b;

[0170] Δt(T) is the predicted cumulative drift amount after time T since the last calibration; a is the drift rate coefficient of the target device, b is the initial drift amount of the target device, and T is the time variable;

[0171] The predicted clock drift of the target device at future times is obtained based on the relationship model.

[0172] Based on the predicted clock drift amount and the preset drift threshold, determine the theoretical critical moment when the predicted clock drift amount reaches the preset drift threshold;

[0173] The next calibration time corresponding to the target device is determined based on the theoretical critical time, and the next calibration time is updated in the mapping table; the next calibration time is earlier than the theoretical critical time.

[0174] Typically, protocol conversion gateways select historical drift data from a recent period (such as the past week or month) for analysis to ensure the timeliness of the relationship model. Linear regression analysis is applied to the acquired historical drift data, and the least squares method is used for fitting to establish a relationship model with time T as the independent variable and the cumulative drift Δt(T) as the dependent variable:

[0175] Δt(T) = a × T + b; where a is the drift rate coefficient corresponding to the target device; and b is the initial drift, representing the existing deviation of the device clock at the starting point of the relational model (T=0). T=0 is usually associated with the moment of the last successful calibration, as this calibration action resets the deviation to zero, after which the drift begins to accumulate again. Calculating a and b using the least squares method based on historical drift data is existing technology and will not be elaborated upon here.

[0176] Substituting the preset drift threshold δ1 into the relational model, the theoretical critical duration is calculated. This theoretical critical duration represents the time required for the predicted drift amount to reach δ1, calculated from the last calibration time (T=0).

[0177] The theoretical critical time is calculated based on the theoretical critical duration and the last calibration time (T=0). This theoretical critical time is the "alarm moment" predicted by the relational model when the time deviation between the device clock and the master clock will reach the safety boundary of the target device.

[0178] Based on this theoretical critical moment, the next calibration time is calculated, and the next calibration time must be earlier than the theoretical critical moment. Specifically, a safety time margin Δt is set for the target device. safe (e.g., 10% of T, or a fixed value such as 1 hour), based on t next =T-Δt safe Calculate the next calibration time t next .

[0179] The next calibration time is updated as scheduling information in the mapping table to the record corresponding to the target device. The scheduler of the protocol conversion gateway continuously checks the current time. When the reference time of the master clock reaches or exceeds the next calibration time recorded in the mapping table, the protocol conversion gateway will actively trigger the clock sampling and calibration process for the target device (i.e., execute steps S1-S4) to complete the calibration of the target device. After calibration, the previous calibration time of the target device is updated to the current time, and a new round of relational model prediction calculation is triggered to determine the next T. next This process is repeated, enabling the protocol conversion gateway to self-plan and control the rhythm of comparing the clock calibration of the target device. Example 2

[0180] like Figure 2 As shown, based on the device clock calibration method based on a protocol conversion gateway provided in Embodiment 1, this Embodiment 3 provides a device clock calibration device based on a protocol conversion gateway. Figure 2 As shown, the device includes a reference time module 100, a device clock module 200, a calculation module 300, and a time calibration module 400.

[0181] The reference time module 100 is used by the protocol conversion gateway to receive the reference time value of the current moment output by the master clock through the precision time protocol interface.

[0182] The device clock module 200 is used to query a preset mapping table based on the device identifier of the target device to obtain the communication protocol type and time data object address of the target device; generate a clock read request based on the communication protocol type, and send the read request to the time data object address of the target device to obtain the device clock value of the target device at the current time; the target device is one of multiple heterogeneous devices in the photovoltaic-storage-charging integrated power station that need to be clocked; the mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address.

[0183] The calculation module 300 is used to calculate the time offset based on the deviation between the device clock value and the reference time value.

[0184] The time calibration module 400 is used to convert the time offset into a corresponding clock adjustment instruction according to the clock adjustment instruction format specified by the communication protocol type, and send the clock adjustment instruction to the time data object address to calibrate the device clock of the target device. The clock adjustment instruction includes the time data object address and adjustment parameters.

[0185] The heterogeneous devices are devices in the integrated photovoltaic-storage-charging power station that use different communication protocols. The heterogeneous devices include photovoltaic inverters, energy storage converters, charging piles, and power metering devices. Each of the heterogeneous devices communicates with the protocol conversion gateway based on its corresponding communication protocol.

[0186] Furthermore, the time calibration module 400 is also used to determine whether the absolute value of the time offset is greater than a preset drift threshold;

[0187] If the value is greater than the specified value, the time offset is converted into the corresponding clock adjustment command based on the communication protocol type and sent to the target device.

[0188] If the value is less than or equal to the time offset, the device identifier, the time offset, and the corresponding sampling time are written into the time series database.

[0189] If the value is greater than the specified value, the time offset is converted into the corresponding clock adjustment command based on the communication protocol type and sent to the target device, including:

[0190] The time offset Δt(t) is divided into M sub-correction adjustment amounts, where M is the preset number of corrections (e.g., M=5). The sub-correction adjustment amount is:

[0191] Δt adjust =Δt(t) / M.

[0192] Based on the communication protocol type, a corresponding sub-clock adjustment instruction is generated for each of the sub-correction adjustment amounts.

[0193] The sub-clock adjustment command is sent to the target device sequentially according to the calibration interval to calibrate the device clock of the target device until M calibrations are completed;

[0194] Wherein, the sub-correction interval Δt interval satisfy:

[0195] Δt interval ≥2×Δt adjust / a, where the Δt adjust'a' represents the sub-correction adjustment amount; 'a' represents the drift rate coefficient of the target device.

[0196] Furthermore, this device also includes a mapping table module, used to obtain an initial list of all equipment in the integrated photovoltaic-storage-charging power station. The initial list of all equipment includes at least the equipment identifier and equipment model of each heterogeneous device. The device model is matched with a pre-set photovoltaic-storage-charging device feature library to determine the device type corresponding to each equipment identifier. The communication protocol type corresponding to the heterogeneous device is determined according to the device type. The time data object address corresponding to the heterogeneous device is determined according to the communication protocol type. A mapping relationship is established based on the equipment identifier, the communication protocol type, and the time data object address to obtain the mapping table corresponding to the heterogeneous device.

[0197] Furthermore, the computing module 300 is also used for:

[0198] The mapping table is queried based on the device identifier of the target device to determine the corresponding sampling time interval and the number of sampling N;

[0199] Based on the sampling time interval, the device clock value and the reference time value are obtained sequentially at N sampling times to obtain N sets of sampling data;

[0200] Based on the deviation between the device clock value and the reference time value in each set of sampled data, N single clock drift values ​​are calculated;

[0201] The time offset is obtained by calculating the average of the N single clock drifts.

[0202] Furthermore, the device also includes a time-series database module, used for:

[0203] Based on the device identifier of the target device, the end timestamp of the current sampling and statistical period, and the time offset, a clock drift compensation table is generated, wherein the end timestamp of the current sampling and statistical period is the reference time value corresponding to the Nth group of sampling data;

[0204] The clock drift compensation table is written into a timing database to form historical drift data of the target device; the historical drift data is a sequence of multiple time offsets.

[0205] Furthermore, the device also includes a verification module for:

[0206] The actual frequency and nominal frequency of the crystal oscillator of the target device are obtained, and the relative frequency deviation Δf is calculated.

[0207] Obtain the temperature coefficient c and temperature change ΔS of the target device;

[0208] Based on the relative frequency deviation Δf, the temperature coefficient c, and the temperature change ΔS, calculate the cumulative clock drift:

[0209] Δt drift (T) = Δf*T + c*ΔS*T; T represents the total duration of the current sampling and statistical period;

[0210] The accumulated clock drift is compared with the total drift within the statistical period to obtain a first deviation value, and it is determined whether the absolute value of the first deviation value is greater than a preset deviation threshold; wherein, the total drift is the sum of N time offsets;

[0211] If the value is greater than the specified value, shorten the sampling time interval and update the mapping table.

[0212] If the sampling time interval is less than or equal to the specified time interval, maintain or increase the sampling time interval and update the mapping table.

[0213] The device provided in this invention establishes communication connections with the master clock and different heterogeneous devices in a photovoltaic-storage-charging integrated power station through a protocol conversion gateway. Based on a built-in mapping table, it automatically reads the device clock values ​​of each heterogeneous device in the power station and the reference time value of the master clock. This invention can initiate clock information acquisition requests to heterogeneous devices such as photovoltaic inverters, energy storage converters, charging piles, and energy metering devices using different communication protocols, based on a preset mapping table. It obtains the device clock values ​​of the heterogeneous devices, compares them with the reference time of the high-precision master clock, calculates the corresponding time offset, and finally generates clock adjustment instructions conforming to the communication protocol specifications of each heterogeneous device and issues them for execution. It fundamentally solves the problem of difficulty in uniformly collecting and accurately correcting clock information in integrated photovoltaic-storage-charging power stations due to the diverse equipment types and different communication protocols. It can provide a unified and high-precision time reference for all heterogeneous equipment in the power station, thereby generating multi-source equipment operation data that is strictly aligned on the time axis. This provides a consistent time information basis for subsequent energy collaborative management, status assessment and optimized scheduling models in integrated photovoltaic-storage-charging power stations, and greatly improves the data quality of the entire station's data analysis and decision-making. Example 3

[0214] Figure 3 The diagram shows a structural schematic of a computer device provided in Embodiment 3 of the present invention. The specific embodiments of the present invention do not limit the specific implementation of the computer device.

[0215] like Figure 3As shown, the computer device may include: a processor 402, a communications interface 404, a memory 406, and a communications bus 408.

[0216] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408. Communication interface 404 is used to communicate with other network elements such as clients or other servers. Processor 402 executes program 410, specifically performing the relevant steps in any of the device clock calibration methods based on protocol conversion gateways provided in Embodiment 1.

[0217] Specifically, program 410 may include program code, which includes computer-executable instructions.

[0218] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The device may include one or more processors of the same type, such as one or more CPUs; or it may include processors of different types, such as one or more CPUs and one or more ASICs.

[0219] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0220] Specifically, program 410 can be called by processor 402 to cause the computer device to perform the following operations:

[0221] This invention provides a computer-readable storage medium storing at least one executable instruction that, when executed on a computer device, causes the computer device to perform the device clock calibration method based on a protocol conversion gateway in any of the above method embodiments.

[0222] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of the present invention are not directed to any particular programming language. It should be understood that the content of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0223] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0224] Similarly, it should be understood that, in order to streamline the invention and aid in understanding one or more of the various aspects of the invention, features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.

[0225] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0226] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

Claims

1. A device clock calibration method based on a protocol conversion gateway, characterized in that, The equipment is a heterogeneous device using different communication protocols in a photovoltaic-storage-charging integrated power station. The heterogeneous device includes a photovoltaic inverter, an energy storage converter, a charging pile, and an energy metering device. Each of the heterogeneous devices communicates with the protocol conversion gateway based on its corresponding communication protocol; The method is implemented based on the protocol conversion gateway, and the method includes: Receive the reference time value of the current moment from the master clock through the precision time protocol interface; The target device is queried from a pre-set mapping table based on its device identifier to obtain its communication protocol type and time data object address. A clock read request is generated based on the communication protocol type and sent to the time data object address of the target device to obtain the device clock value of the target device at the current moment. The target device is one of the multiple heterogeneous devices awaiting clock calibration in the integrated photovoltaic-storage-charging power station. The mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address. Calculate the time offset based on the deviation between the device clock value and the reference time value; According to the clock adjustment instruction format specified by the communication protocol type, the time offset is converted into a corresponding clock adjustment instruction, and the clock adjustment instruction is sent to the time data object address to calibrate the device clock of the target device. The clock adjustment instruction includes the time data object address and adjustment parameters.

2. The device clock calibration method based on a protocol conversion gateway according to claim 1, characterized in that, The creation of the mapping table includes: Obtain an initial list of all equipment for the photovoltaic-storage-charging integrated power station. The initial list of all equipment shall include at least the equipment identifier and equipment model of each heterogeneous device. The device model is matched with a pre-set feature library of optical storage and charging devices to determine the device type corresponding to each device identifier; Determine the communication protocol type corresponding to the heterogeneous device based on the device type; The address of the time data object corresponding to the heterogeneous device is determined according to the communication protocol type; A mapping relationship is established based on the device identifier, the communication protocol type, and the time data object address to obtain the mapping table corresponding to the heterogeneous device.

3. The device clock calibration method based on a protocol conversion gateway according to claim 1, characterized in that, The mapping table also includes the sampling time interval and the number of samplings N; The protocol conversion gateway calculates the time offset based on the deviation between the device clock value and the reference time value, including: The mapping table is queried based on the device identifier of the target device to determine the corresponding sampling time interval and the number of sampling N; Based on the sampling time interval, the device clock value and the reference time value are obtained sequentially at N sampling times to obtain N sets of sampling data; Based on the deviation between the device clock value and the reference time value in each set of sampled data, N single clock drift values ​​are calculated; The time offset is obtained by calculating the average of the N single clock drifts.

4. The device clock calibration method based on a protocol conversion gateway according to claim 3, characterized in that, The protocol conversion gateway, after calculating the time offset based on the deviation between the device clock value and the reference time value, further includes: Based on the device identifier of the target device, the end timestamp of the current sampling and statistical period, and the time offset, a clock drift compensation table is generated, wherein the end timestamp of the current sampling and statistical period is the reference time value corresponding to the Nth group of sampling data; The clock drift compensation table is written into a timing database to form historical drift data of the target device; the historical drift data is a sequence of multiple time offsets.

5. The device clock calibration method based on a protocol conversion gateway according to claim 4, characterized in that, After the protocol conversion gateway calculates the time offset based on the deviation between the device clock value and the reference time value, it further includes: The actual frequency and nominal frequency of the crystal oscillator of the target device are obtained, and the relative frequency deviation Δf is calculated. Obtain the temperature coefficient c and temperature change ΔS of the target device; Based on the relative frequency deviation Δf, the temperature coefficient c, and the temperature change ΔS, calculate the cumulative clock drift: T represents the total duration of the current sampling and statistical period. The accumulated clock drift is compared with the total drift within the statistical period to obtain a first deviation value, and it is determined whether the absolute value of the first deviation value is greater than a preset deviation threshold; wherein, the total drift is the sum of N time offsets; If the value is greater than the specified value, shorten the sampling time interval and update the mapping table. If the sampling time interval is less than or equal to the specified time interval, maintain or increase the sampling time interval and update the mapping table.

6. The device clock calibration method based on a protocol conversion gateway according to claim 4, characterized in that, The method further includes predicting the next calibration time of the target device based on the time series database, including: The historical drift data of the target device is obtained based on the time-series database; Based on linear regression analysis and least squares fitting, the historical drift data is analyzed and fitted to establish a relationship model between the drift amount of the target device and time. The relationship model is as follows: ; Δt(T) is the predicted cumulative drift amount after a time T since the last calibration; a is the drift rate coefficient of the target device, b is the initial drift amount of the target device, and T is the time variable; The predicted clock drift of the target device at future times is obtained based on the relationship model. Based on the predicted clock drift amount and the preset drift threshold, determine the theoretical critical moment when the predicted clock drift amount reaches the preset drift threshold; The next calibration time corresponding to the target device is determined based on the theoretical critical time, and the next calibration time is updated in the mapping table; the next calibration time is earlier than the theoretical critical time.

7. The device clock calibration method based on a protocol conversion gateway according to claim 1, characterized in that, The protocol conversion gateway converts the time offset into a corresponding clock adjustment instruction according to the clock adjustment instruction format specified by the communication protocol type, and sends the clock adjustment instruction to the time data object address to calibrate the device clock of the target device, including: Determine whether the absolute value of the time offset is greater than a preset drift threshold; If the value is greater than the specified value, the time offset is converted into the corresponding clock adjustment command based on the communication protocol type and sent to the target device. If the value is less than or equal to the time offset, the device identifier, the time offset, and the corresponding sampling time are written into the time series database.

8. The device clock calibration method based on a protocol conversion gateway according to claim 7, characterized in that, If the value is greater than the specified value, the time offset is converted into a corresponding clock adjustment command based on the communication protocol type and sent to the target device, including: The time offset is divided into M-component correction adjustment amounts, where M is the preset number of corrections; Based on the communication protocol type, generate a corresponding sub-clock adjustment instruction for each of the sub-correction adjustment amounts; The sub-clock adjustment command is sent to the target device sequentially according to the calibration interval to calibrate the device clock of the target device until M calibrations are completed; Wherein, the correction interval Δt interval satisfy: , where Δt adjust The sub-correction adjustment amount is denoted as 'a', where 'a' is the drift rate coefficient of the target device.

9. A device clock calibration apparatus based on a protocol conversion gateway, characterized in that, The device includes: The reference time module is used by the protocol conversion gateway to receive the reference time value of the current moment output by the master clock through the precision time protocol interface. The device clock module is used to query a preset mapping table based on the device identifier of the target device to obtain the communication protocol type and time data object address of the target device; generate a clock read request based on the communication protocol type, and send the read request to the time data object address of the target device to obtain the device clock value of the target device at the current time; the target device is one of multiple heterogeneous devices in the photovoltaic-storage-charging integrated power station that need to be clocked; the mapping table contains the mapping relationship between the device identifier, the communication protocol type, and the time data object address; The calculation module is used to calculate the time offset based on the deviation between the device clock value and the reference time value; The time calibration module is used to convert the time offset into a corresponding clock adjustment instruction according to the clock adjustment instruction format specified by the communication protocol type, and send the clock adjustment instruction to the time data object address to calibrate the device clock of the target device, wherein the clock adjustment instruction includes the time data object address and adjustment parameters; The heterogeneous devices are those that use different communication protocols in the integrated photovoltaic-storage-charging power station. The heterogeneous devices include photovoltaic inverters, energy storage converters, charging piles, and power metering devices. Each of the heterogeneous devices communicates with the protocol conversion gateway based on its corresponding communication protocol.

10. A computer device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation of the device clock calibration method based on the protocol conversion gateway as described in any one of claims 1-8.