Cloud-edge collaborative intelligent gateway
By employing high-frequency data acquisition, multi-mode transmission layer decoupling design, and lightweight convolutional neural network model through cloud-edge collaborative intelligent gateways, the problems of insufficient high-frequency harmonic capture capability, poor protocol compatibility, and weak edge anomaly feature recognition capability in existing power distribution monitoring systems have been solved, achieving efficient power system data capture and equipment identification.
Patent Information
- Application Number
- CN202511480539.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-10-16
AI Technical Summary
Existing power distribution monitoring systems have significant technical bottlenecks in high-frequency data acquisition, protocol compatibility, and edge intelligent analysis. They are unable to fully capture high-frequency harmonic signals generated during the operation of power electronic equipment, resulting in inaccurate power quality analysis. Furthermore, they have poor multi-protocol compatibility, making it difficult to achieve universality and rapid deployment. Edge computing algorithms also pose a risk of misjudgment when identifying complex spectral features.
The cloud-edge collaborative intelligent gateway adopts dual-cycle sampling through a high-frequency data acquisition and encapsulation unit, and decouples the multi-mode transmission layer through a device compatibility and data interoperability unit. The edge intelligent analysis unit uses FFT transformation and a lightweight convolutional neural network model to identify spectral features, and performs data compression and encrypted uploading through a data compression and transmission unit.
It significantly improves the ability to capture high-frequency harmonics and transient disturbances, supports flexible connection of multi-brand and multi-protocol electrical equipment, achieves plug-and-play functionality, improves device identification accuracy and response speed, reduces storage and transmission overhead, and enhances edge intelligent analysis capabilities.
Smart Images

Figure CN121000555B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power internet of things, in particular to a cloud-edge collaborative intelligent gateway. BACKGROUND
[0002] The existing power distribution monitoring system has significant technical bottlenecks in high-frequency data acquisition, protocol compatibility and edge intelligent analysis. The current mainstream sampling scheme is difficult to capture the high-frequency harmonic signals generated in the operation of power electronic devices due to the limitation of sampling frequency and single file waveform point number. The fixed cycle data uploading method used by the system is prone to miss the transient characteristics in the operation process, and the high data compression ratio leads to serious loss of original waveform details, thereby affecting the accuracy of power quality analysis. In terms of multi-protocol compatibility, the existing scheme often relies on specific middleware for protocol conversion, and the physical layer structure is rigid. When adding a new communication method, an independent driver module needs to be developed, which is difficult to expand. In addition, some systems require the access devices to open the underlying protocol interface, which makes the connection success rate low and makes it difficult to achieve universality and rapid deployment. In terms of edge computing algorithms, the current analysis method based on fast Fourier transform is limited by sampling accuracy and feature library size, and it is difficult to effectively identify complex or sudden changes in frequency spectrum characteristics in power systems. Especially in dealing with complex scenarios such as wideband oscillation caused by new power electronic devices, there is a risk of feature omission or misjudgment, which limits the adaptability of the system to modern complex load environments. Therefore, a cloud-edge collaborative intelligent gateway is designed. SUMMARY
[0003] The purpose of the present application is to provide a cloud-edge collaborative intelligent gateway to solve the problems of insufficient high-frequency harmonic capture ability, poor protocol compatibility and weak edge abnormal feature recognition ability of the existing system as mentioned in the background.
[0004] To achieve the above purpose, the present application provides a cloud-edge collaborative intelligent gateway, which comprises:
[0005] A high-frequency data acquisition and packaging unit acquires voltage and current waveform data.
[0006] A device compatibility and data intercommunication unit adopts a multi-mode transmission layer decoupling design, and performs protocol conversion and data standardization through interfacing with electrical devices.
[0007] An edge intelligent analysis unit uses FFT transformation to extract the frequency spectrum characteristics of the original voltage and current waveform data at the gateway end, introduces a lightweight convolutional neural network model to identify the operating state and abnormal characteristics of electrical devices, and determines the type of electrical devices in combination with a load feature library.
[0008] Data compression and transmission unit, which compresses, packages, encrypts and uploads voltage and current waveform data to the cloud after adding CRC32 check.
[0009] As a further improvement of the technical solution, the high-frequency data acquisition and packaging unit includes a waveform acquisition module and a packaging module.
[0010] The waveform acquisition module continuously samples voltage and current waveform signals at a fixed sampling frequency through a double-cycle sampling mechanism.
[0011] The packaging module stores waveform signals to generate original waveform data files and names the original waveform data files using a unique identification rule.
[0012] As a further improvement of the technical solution, the device compatibility and data intercommunication unit includes a protocol adaptation module and a data intercommunication module.
[0013] The protocol adaptation module connects electrical appliances through a physical interface and uses API interface to adapt communication protocols to obtain communication data.
[0014] The data intercommunication module sends operating parameters to connected electrical appliances through online configuration as needed.
[0015] As a further improvement of the technical solution, the protocol adaptation module connects electrical appliances through a physical interface and uses API interface to adapt communication protocols to obtain communication data, including the following steps:
[0016] S1.1, connect electrical appliances through a wireless communication interface and configure MQTT connection parameters of the electrical appliances;
[0017] S1.2, initialize the MQTT client by calling API to establish a network connection with the configured MQTT Broker;
[0018] S1.3, subscribe to the topic published by the gateway to the electrical appliances and receive communication data uploaded by the electrical appliances in real time;
[0019] S1.4, format analyze the received original communication data packet, map the field content to a system general field format according to different device brands and field naming rules, and finally package it as JSON structured data.
[0020] As a further improvement of the technical solution, the edge intelligent analysis unit includes a waveform analysis module, a device identification module and a hierarchical alarm module.
[0021] The waveform analysis module extracts harmonic components and spectral features by performing FFT transformation on the original voltage and current waveform data at the gateway end.
[0022] The device identification module introduces a lightweight convolutional neural network model to identify the running state and abnormal features of the electrical equipment, determines the type of electrical equipment in combination with a load feature library, and marks abnormal power consumption modes.
[0023] The hierarchical alarm module manages events using a priority queue to perform different levels of alarms after detecting abnormal power consumption modes.
[0024] As a further improvement of the technical solution, the waveform analysis module extracts harmonic components and spectral features by performing FFT transformation on the original voltage and current waveform data at the gateway end, including the following steps:
[0025] S2.1, read the original waveform data file, and perform data format conversion on the original waveform data to generate a floating-point number format current sampling sequence and a floating-point number format voltage sampling sequence;
[0026] S2.2, perform transient mutation detection on the converted waveform data to identify whether there is a high amplitude gradient change caused by the start-stop behavior of the electrical appliance;
[0027] If a transient mutation is detected, perform half-cycle spectral reconstruction based on the transient mutation center position, extract the symmetric waveform segments before and after the mutation, construct a virtual complete cycle signal, and perform windowing processing to generate reconstructed waveform data;
[0028] If no mutation is detected, perform pre-processing operations on the original waveform data to generate pre-processed waveform data;
[0029] S2.3, perform FFT operation on the waveform data processed in step S2.2 to obtain a complex frequency domain spectrum vector ;
[0030] S2.4, calculate the modulus of the complex frequency domain spectrum vector based on the complex frequency domain spectrum vector to obtain the amplitude intensity of each frequency component, and construct a frequency axis according to the sampling frequency and the number of sampling points;
[0031] S2.5, based on the modulus of the complex frequency domain spectrum vector and the frequency axis, identify the fundamental frequency and extract its amplitude, while extracting the amplitude of each order harmonic component, and calculate the total harmonic distortion rate based on the extraction result;
[0032] S2.6, normalize each order harmonic component amplitude and its relative ratio, and construct a spectral feature vector.
[0033] As a further improvement of the technical solution, in S2.2, transient mutation detection is performed on the converted waveform data, including the following steps:
[0034] S2.21, for the current sampling sequence converted into a floating-point number format, the absolute difference between each sampling point and its previous sampling point is calculated in sequence to construct a difference sequence, which reflects the change rate of the waveform at each sampling point;
[0035] S2.22, the dynamic threshold of the difference sequence is set in a median adaptive manner to adapt to the fluctuation characteristics of different electrical equipment;
[0036] S2.23, a sliding window with a length of is used to traverse the difference sequence to determine whether the difference values of consecutive sampling points all exceed the set dynamic threshold ; if the difference values of consecutive sampling points all exceed the set dynamic threshold , it indicates that the waveform segment is a potential mutation interval;
[0037] S2.24, when a potential mutation interval is detected, the center position of the mutation is recorded as a reference benchmark point for half-cycle spectrum reconstruction, and a processing flag bit is set to indicate that the current waveform will enter the half-cycle spectrum reconstruction branch;
[0038] If no mutation is detected, the waveform data is preprocessed.
[0039] As a further improvement of the technical solution, the device identification module introduces a lightweight convolutional neural network model to identify the running state and abnormal features of the electrical equipment, combines the load feature library to determine the type of electrical equipment, and marks the abnormal power consumption mode, including the following steps:
[0040] S3.1, record the frequency spectrum feature change range in the equipment running mode to form a frequency spectrum feature template reflecting the state of the equipment;
[0041] S3.2, establish a ternary index relationship of device type-template feature vector-running state, and construct a standard load feature library including the template feature vector;
[0042] S3.3, receive the frequency spectrum feature vector from the waveform analysis module, input the frequency spectrum feature vector into the lightweight convolutional neural network model, and extract the high-order feature vector;
[0043] S3.4, calculate the mutual information weighted Euclidean distance between the high-order feature vector and the template feature vector in the standard load feature library;
[0044] S3.5 Sort the mutual information weighted Euclidean distances, select the device type corresponding to the smallest mutual information weighted Euclidean distance as the current recognition result, and construct a category-adaptive dynamic recognition threshold for each type of device to determine whether the higher-order feature vector belongs to the device type.
[0045] S3.6 After completing the equipment type identification, the high-order feature vector is compared with the template features of the equipment under normal operating conditions for the judgment of abnormal power consumption patterns, and the abnormal power consumption patterns are marked.
[0046] As a further improvement to this technical solution, in step S3.4, calculating the mutual information weighted Euclidean distance between the higher-order feature vector and the template features in the standard load feature library includes the following steps:
[0047] S3.41. Calculate the mutual information value between each dimension of the higher-order feature vector and the target device type;
[0048] S3.42. Normalize the mutual information values of all higher-order feature vectors to form a mutual information weight vector;
[0049] S3.43. Compare the higher-order feature vectors with the template feature vectors corresponding to each device type in the feature library, and calculate the weighted Euclidean distance.
[0050] As a further improvement to this technical solution, the data compression and transmission unit includes a data compression module and a data encryption upload module;
[0051] The data compression module uses the LZW algorithm to compress voltage and current waveform data and adds a CRC32 checksum.
[0052] The data encryption upload module uploads voltage and current waveform data to the cloud via the MQTT protocol based on TLS encryption.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] 1. This cloud-edge collaborative intelligent gateway employs a high-frequency dual-cycle sampling mechanism and high-precision encoding method, significantly improving the ability to capture high-frequency harmonics and transient disturbances in voltage and current waveforms. Through optimized spectrum analysis and dynamic data encapsulation strategies, it can more accurately identify minute changes in the power system while reducing storage and transmission overhead. Combined with error correction verification and retransmission mechanisms, it can still ensure data integrity and continuity in weak network environments, providing a stable foundation for subsequent feature analysis.
[0055] 2、The cloud edge collaborative intelligent gateway supports flexible docking of multiple brands and multiple protocol electrical equipment through protocol decoupling and unified data encapsulation, and realizes true plug and play. At the same time, the edge end deploys a light convolutional neural network, combined with an improved spectral reconstruction algorithm, which can quickly identify and locally process multiple abnormal operating states, greatly improve the equipment identification accuracy and response speed, reduce the dependence on cloud computing power and artificial annotation, and realize the overall upgrade of edge intelligent analysis capability. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 The overall flowchart of the present application is shown in the figure;
[0057] The meanings of the various labels in the figure are as follows:
[0058] 1, high-frequency data acquisition and encapsulation unit; 2, device compatibility and data intercommunication unit; 3, edge intelligent analysis unit; 4, data compression and transmission unit. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0060] Embodiment: Please refer to Figure 1 The cloud edge collaborative intelligent gateway is provided, as shown in the figure, which includes:
[0061] The high-frequency data acquisition and encapsulation unit 1 acquires voltage and current waveform data;
[0062] The high-frequency data acquisition and encapsulation unit 1 includes a waveform acquisition module and an encapsulation module;
[0063] The waveform acquisition module continuously samples voltage and current waveform signals at a fixed sampling frequency through a double-cycle sampling mechanism;
[0064] In this embodiment, the system built-in ADC chip continuously acquires voltage / current waveform at a sampling frequency of 16KHz, generating 16000 data points per second. The double-cycle sampling mechanism means that the system collects data covering two complete power cycles each time when sampling voltage and current waveform (corresponding to about 510 sampling points under the condition of 50Hz power and 16kHz sampling rate);
[0065] The encapsulation module stores the waveform signal to generate an original waveform data file, and uses a unique identification rule to name the original waveform data file;
[0066] In this embodiment, the original waveform data is stored in 20-bit signed integer format, a single file contains 510 waveform points (2040 bytes), and the file name adopts a unique identification rule: LinearID_Timestamp_SamplingType_16KHz.data, to ensure data traceability and format standardization.
[0067] The device compatibility and data intercommunication unit 2 adopts a multi-mode transmission layer decoupling design, and performs protocol conversion and data standardization on the connected electrical equipment (including Siemens, Schneider, etc.);
[0068] In this embodiment, the multi-mode transmission layer decoupling design refers to introducing a unified abstract transmission interface in the device communication architecture, modularizing and dynamically binding different communication protocols (including MQTT) in the transmission layer, so that the system can flexibly select a suitable communication mode according to the device type and network environment. This design effectively eliminates the strong coupling relationship between the protocol and the hardware, avoids the need to restructure the system or develop an independent driver for each new protocol, and thus realizes plug-and-play and cross-protocol connection of heterogeneous devices.
[0069] The device compatibility and data intercommunication unit 2 includes a protocol adaptation module and a data intercommunication module.
[0070] The protocol adaptation module connects the electrical equipment (including the company's and third-party equipment, including Siemens and Schneider) through a physical interface, and uses an API interface to adapt the communication protocol (MQTT) to obtain communication data.
[0071] In this embodiment, the pseudo code for accessing third-party devices is as follows:
[0072] def connect_third_party_device(protocol,ip,port):
[0073] if protocol=="ModbusTCP":
[0074] return ModbusClient(ip,port).read holding registers()
[0075] elif protocol=="MQTT":
[0076] return MqttClient(ip,port).subscribe("device / data");
[0077] The protocol adaptation module connects the electrical equipment through a physical interface, uses an API interface to adapt the communication protocol to obtain communication data, including the following steps:
[0078] S1.1, connect the electrical equipment through a wired or wireless communication interface (including an Ethernet port, a Wi-Fi module, a 4G communication module), the electrical equipment (including Siemens, Schneider, etc.) must be built-in MQTT communication function, or connected to the edge middleware supporting MQTT, and configure the MQTT connection parameters of the electrical equipment, the MQTT connection parameters include MQTT Broker address, port, identity authentication information (including username, password, TLS certificate);
[0079] S1.2, load the built-in MQTT driver in the gateway, initialize the MQTT client by calling the API to establish a network connection with the configured MQTT Broker, support TLS encrypted communication and automatic reconnection mechanism when disconnected;
[0080] S1.3, the gateway as an MQTT client, subscribing to the topic published by the electrical equipment, receiving real-time running status, monitoring data or alarm information and other communication data uploaded by the electrical equipment;
[0081] S1.4, format analysis is performed on the received raw communication data packet, and the field content is uniformly mapped to the system general field format according to different device brands and field naming rules, and finally encapsulated as JSON structured data as the standardized input for subsequent edge analysis and cloud processing.
[0082] The data intercommunication module sends running parameters to the connected electrical equipment through online or offline configuration as needed, the running parameters refer to the configuration information required by the device work, including APN (access point name), MQTT server address and other communication related settings;
[0083] The data intercommunication module supports dynamic parameter distribution, and realizes plug-and-play access of cross-brand devices.
[0084] The edge intelligent analysis unit 3 extracts the frequency spectrum features of the original voltage and current waveform data by using FFT transform at the gateway end, introduces a lightweight convolutional neural network model to identify the running state and abnormal features of the electrical equipment, and determines the type of the electrical equipment combined with the load feature library;
[0085] In this embodiment, the edge intelligent analysis unit 3 includes a waveform analysis module, a device identification module and a hierarchical alarm module.
[0086] The waveform analysis module performs FFT transform on the original voltage and current waveform data at the gateway end to extract harmonic components and frequency spectrum features.
[0087] The waveform analysis module performs FFT transform on the original voltage and current waveform data at the gateway end to extract harmonic components and frequency spectrum features, including the following steps:
[0088] S2.1, read the original waveform data file, the data format is 20-bit signed integer, each file contains about 510 sampling points, corresponding to two complete voltage / current cycles (suitable for 50Hz mains environment), and the original waveform data is converted (i.e. 20-bit integer to floating point number), generating a floating point number format current sampling sequence and a floating point number format voltage sampling sequence;
[0089] S2.2, perform transient mutation detection on the converted waveform data to identify whether there is a high amplitude gradient change caused by the start-stop behavior of the electrical appliance;
[0090] If a transient mutation is detected, perform half-cycle spectrum reconstruction based on the center position of the transient mutation, extract the symmetric waveform segments before and after the mutation, construct a virtual complete cycle signal, and perform windowing processing to generate reconstructed waveform data, which is used as the input for the next step of spectrum analysis;
[0091] If no mutation is detected, perform pre-processing operations on the original waveform data, including removing DC offset and applying window function (Hanning window) for windowing processing, to generate pre-processed waveform data, which is also used as the input for subsequent analysis;
[0092] Further, perform transient mutation detection on the converted waveform data, including the following steps:
[0093] In the power internet of things scenario, the start-stop of electrical equipment (such as the start of an air conditioner compressor) can cause transient mutation of the current waveform, resulting in two major defects in traditional FFT processing: spectral aliasing: the mutation point destroys the periodicity of the waveform, causing false high-frequency components in the FFT spectrum; feature distortion: the mutation interval is forced into complete cycle calculation, causing the THD (total harmonic distortion) misjudgment rate to rise;
[0094] Adopting a median adaptive dynamic threshold instead of a fixed threshold, combined with a sliding window mutation positioning, improves the sensitivity of gradient capture; half-cycle spectrum reconstruction takes the mutation point as the center, extracts the symmetric half-cycle waveform (105 points each) before and after the mutation point, and splices them into a virtual complete cycle, eliminating the interference of non-periodic mutation points from the physical layer, reducing the THD calculation error compared to the direct windowing scheme; the virtual cycle signal is superimposed with an improved Blackman window, which dynamically balances the main lobe width and side lobe suppression through adjustable parameters to effectively solve the problem of spectral leakage caused by transient state;
[0095] S2.21, for the current sampling sequence converted to floating point number format , calculate the absolute difference between each sampling point and its previous sampling point in sequence to construct a difference sequence , wherein, is the total number of sampling points of the waveform data sequence, is the gradient of the waveform at the sampling point, and the gradient suddenly increases indicates the occurrence of instantaneous switching or mutation behavior of the load;
[0096] S2.22, setting the dynamic threshold of the difference sequence in a median adaptive manner to adapt to the fluctuation characteristics of different electrical equipment;
[0097] Dynamic threshold is:
[0098] ;
[0099] , wherein, is a proportional coefficient for adjusting the sensitivity of the threshold, is the median of the difference value set from the 2nd to the sample, indicating the typical intermediate value of the difference data, which can effectively suppress the influence of abnormal values, is the difference value sequence between the 2nd and the sampling points;
[0100] S2.23, using a sliding window with a length of to traverse the difference sequence, and determining whether there are consecutive sampling points whose difference values all exceed the set dynamic threshold (the difference value refers to the absolute difference value between each sampling point and its previous sampling point), if there are consecutive sampling points whose difference values all exceed the set dynamic threshold , it indicates that the waveform segment is a potential mutation interval;
[0101] S2.24, if a potential mutation interval is detected, record the center position of the mutation as the reference benchmark point for half-cycle spectrum reconstruction, and set a processing flag to indicate that the current waveform will enter the half-cycle spectrum reconstruction branch;
[0102] If no mutation is detected, the waveform data is preprocessed, which includes removing the direct current offset of the waveform data, and applying a window function (Hanning window) to the waveform data to improve the frequency resolution;
[0103] In this embodiment, the half-cycle spectrum reconstruction is only a special preprocessing of the waveform data after detecting the mutation to construct a smooth virtual periodic signal, avoiding the spectral aliasing and harmonic feature distortion caused by the mutation point. The specific steps of the half-cycle spectrum reconstruction are: taking the center position of the mutation as the center axis, extracting a half-cycle data segment forward and backward respectively. Under the condition of 50Hz power supply and 16KHz sampling rate, one complete electrical cycle corresponds to about 210 sampling points, and a half cycle corresponds to about 105 sampling points.
[0104] The construction method is:
[0105] The waveform segment of the first half cycle is:
[0106] ;
[0107] The waveform segment of the second half cycle is:
[0108] ;
[0109] In the formula, is the sampling point index of the center position of the transient mutation;
[0110] The above two symmetrical waveform segments are spliced and combined to generate a virtual complete cycle waveform sequence for spectrum analysis :
[0111] ;
[0112] In the formula, is the time sequence splicing operation;
[0113] The virtual complete cycle waveform sequence constructed is windowed to form a reconstructed spectrum feature vector to smooth the mutation points at the splicing edge and reduce spectral leakage:
[0114] ;
[0115] In the formula, is an improved Blackman window. The improved Blackman window is based on the second-order cosine term of the traditional Blackman window, and introduces a tunable parameter to achieve the balance optimization of the main lobe width and the sidelobe attenuation; thanks to the adjustable coefficient, the window can achieve stronger sidelobe suppression, and the main lobe is narrower than the traditional Blackman window;
[0116] The improved Blackman window is:
[0117] ;
[0118] wherein, is a constant term coefficient, controlling the overall offset of the window function, and in the present embodiment has a value of 0.42, is a base coefficient of the first cosine term (not including the tunable parameter ), and in the present embodiment has a value of 0.5, is a base coefficient of the second cosine term (not including the tunable parameter ), and in the present embodiment has a value of 0.88, is the length of the modified Blackman window, is the index within the modified Blackman window;
[0119] After the above windowing operation, the processing result is taken as the input sequence for subsequent FFT operation (i.e. step S2.3) and spectral analysis;
[0120] S2.3, performing FFT (Fast Fourier Transform) operation on the waveform data processed in step S2.2 (the waveform data processed in step S2.2 is the reconstructed waveform data or the preprocessed waveform data), to obtain a complex frequency domain spectrum vector , wherein the frequency domain spectrum contains full-band information from the direct current component to the highest frequency, and covers the amplitude and phase information of the fundamental wave and each order of harmonic of the signal;
[0121] The complex frequency domain spectrum vector is:
[0122]
[0123] wherein, is the frequency index, is the total number of sampling points, is the time domain sampling point index, is the value of the time domain signal at the th sampling point (real or complex number), wherein the time domain signal refers to the original waveform data of the collected voltage or current, i.e. the sequence of electrical parameter values recorded continuously over time, is the base of the natural logarithm, is the imaginary unit;
[0124] S2.4, calculating the modulus of the complex frequency domain spectrum vector based on the complex frequency domain spectrum vector to obtain the amplitude intensity of each frequency component, and constructing a frequency axis according to the sampling frequency (the fixed sampling frequency of the waveform acquisition module, i.e. 16KHz) and the number of sampling points to realize the frequency positioning of the spectral components;
[0125] The modulus of the complex frequency domain spectrum vector is:
[0126] ;
[0127] wherein, is a real part of the complex frequency domain spectrum vector , i.e. a real component of the complex frequency domain spectrum vector, is an imaginary part of the complex frequency domain spectrum vector , i.e. an imaginary component of the complex frequency domain spectrum vector;
[0128] According to the sampling frequency and the number of sampling points, a frequency axis is constructed as:
[0129] ;
[0130] wherein, is an actual frequency corresponding to the th frequency point, i.e. the frequency axis;
[0131] S2.5, based on the length of the complex frequency domain spectrum vector and the frequency axis, identify the fundamental frequency (generally 50Hz) and extract its amplitude, and extract the amplitude of each harmonic component from 2 to 25 times , based on the extraction result, calculate the total harmonic distortion (THD);
[0132] The total harmonic distortion is:
[0133] ;
[0134] wherein, is the harmonic order, is the frequency index point of the th harmonic, is the complex spectrum value corresponding to the fundamental frequency point;
[0135] S2.6, normalize each harmonic component amplitude and its relative value (normalization is to divide each harmonic component amplitude by the sum of all selected harmonic component amplitudes), and construct a spectrum feature vector (the spectrum feature vector is composed of normalized harmonic component amplitudes).
[0136] The device recognition module introduces a lightweight convolutional neural network model to identify the running state and abnormal features of the electrical equipment, determines the type of electrical equipment in combination with the load feature library, and marks the abnormal power consumption mode;
[0137] Among them, the device recognition module introduces a lightweight convolutional neural network model to identify the running state and abnormal features of the electrical equipment, determines the type of electrical equipment in combination with the load feature library, and marks the abnormal power consumption mode, including the following steps:
[0138] S3.1, record the range of spectral feature changes in the running mode of the device (including start, steady state, and turn off), and form a spectral feature template reflecting the state of the device;
[0139] S3.2, establish a ternary index relationship between the type of the device, the template feature vector, and the running state, and construct a standard load feature library including the template feature vector (each type of device corresponds to multiple running states, and each running state is associated with a group of template feature vectors);
[0140] S3.3, receive the spectral feature vector from the waveform analysis module, input the spectral feature vector into the lightweight convolutional neural network model, and extract the high-order feature vector;
[0141] The lightweight convolutional neural network model architecture includes: the input layer receives the normalized spectral feature vector (12-dimensional harmonic energy feature), the convolutional layer extracts local patterns (1-2 1D convolutional layers are set, each layer contains 8-16 channels, and the kernel size is 3), the pooling layer reduces the dimension of the features (implemented by the maximum pooling method), the fully connected layer integrates high-order semantic information, and outputs the high-order feature vector (for subsequent matching), and finally the device type prediction or abnormal state discrimination is realized through the Softmax layer, which combines a small number of convolutional layers and pooling layers, integrates low-computational-cost operators such as depth separable convolution and 1×1 pointwise convolution, greatly reduces the number of parameters and memory occupation, enables it to realize millisecond-level inference response on edge gateway and other devices with limited computing power, while maintaining high feature extraction capability;
[0142] S3.4, calculate the mutual information weighted Euclidean distance between the high-order feature vector and the template feature vector in the standard load feature library;
[0143] Further, in traditional device identification, all feature dimensions are treated equally when using Euclidean distance for feature matching. However, different harmonic components or spectral features have significantly different discrimination abilities for device categories (the sensitivity of the 3rd harmonic to air conditioner zero line current anomalies is much higher than that of the fundamental wave). The existing method does not consider the weight distribution of feature resolution, resulting in high-discrimination features being overwhelmed by low-value features, especially in devices with similar spectral features (such as different brand variable frequency air conditioners), which are prone to misjudgment, and are sensitive to load mutations or noise interference; by introducing mutual information weight, the contribution of each dimension feature to device category discrimination is quantified (S3.41), high mutual information features (strong resolution) are given higher weight in distance calculation, significantly amplifying their influence (S3.43 formula), thereby suppressing irrelevant feature interference and improving the discrimination ability of similar devices; the weight is generated based on the statistical mutual information of the feature and the device type (cloud computing + edge delivery), without the need for manual setting, and can adapt to different power consumption scenarios and device characteristics, avoiding weight deviation caused by subjective experience; the feature resolution is quantified as weight, enhancing the result interpretability;
[0144] Computing the mutual information weighted Euclidean distance between the high-order feature vector and the template feature in the standard load feature library, including the following steps:
[0145] S3.41, Statistics of the mutual information value between each dimension of the high-order feature vector and the target device type, for measuring the importance of the feature in distinguishing different device types, the greater the mutual information, the stronger the distinguishing ability of the feature to the device type, so it should be given higher weight, this process is usually completed in the cloud, and the obtained weight vector is issued to the edge device;
[0146] S3.42, Normalize the mutual information values of all high-order feature vectors to form a mutual information weight vector , wherein each represents the mutual information between the feature and the electrical equipment type , and the mutual information is the feature resolution;
[0147] S3.43, Compare the high-order feature vector with the template feature vector corresponding to each device type in the feature library, and calculate the weighted Euclidean distance, which amplifies the influence of high-discrimination features in distance calculation and weakens the interference of low-discrimination features.
[0148] The weighted Euclidean distance is:
[0149] ;
[0150] In the formula, is the high-order feature vector, is the template feature vector of a certain device type extracted from the standard load feature library, is the dimension number of the feature vector, is the high-order feature vector of the th input, is the template feature vector of the th input, is the mutual information weight of the th high-order feature vector, indicating the importance (resolution) of the feature in distinguishing the device type;
[0151] S3.5, Sort the mutual information weighted Euclidean distance, select the device type corresponding to the smallest mutual information weighted Euclidean distance as the current recognition result, and for each device type, construct a class-adaptive dynamic recognition threshold to determine whether the high-order feature vector belongs to the device type ( , in the formula, is the electrical equipment type the average distance of the inner samples to the template, i.e. the average weighted distance of the input features to the template features of the class, for the type of electrical equipment the standard deviation of the inner sample distance (indicating the dispersion degree of the distance distribution within the class), is a coefficient for controlling the sensitivity of the threshold, and the value range is 2-3;
[0152] S3.6, after completing the equipment type identification, the high-order feature vector is compared with the template features of the equipment in the normal running state (the template features in the normal running state are extracted from the standard load feature library) for abnormal power consumption mode judgment (the abnormal power consumption mode judgment is based on the deviation between the key feature items (including the total harmonic distortion rate, the harmonic energy proportion of each order, the voltage fluctuation rate, etc.) and the template), and the abnormal power consumption mode is marked;
[0153] In this embodiment, marking the abnormal power consumption mode specifically refers to: when detecting the running state of the air conditioning equipment, if the voltage effective value fluctuation rate at the compressor starting moment exceeds 15%, the system will be marked as voltage sudden drop abnormality, prompting the risk of high supply circuit impedance or large starting current; when the air conditioner is in steady state, if the 3rd harmonic proportion continuously exceeds 40%, it is marked as zero line harmonic overload abnormality, reflecting the load imbalance or harmonic pollution problem; for the electric water heater, if the THD total harmonic distortion rate is detected to exceed 8% in the continuous heating stage, it is marked as harmonic abnormality, and in addition, the power fluctuation period is less than 2 seconds, indicating dry burning or control failure, and the system will be marked as heating abnormality;
[0154] The hierarchical alarm module uses a priority queue to manage events for different levels of alarms after detecting abnormal power consumption modes. In this embodiment, the priority queue is used to schedule and manage alarm events, and the processing order is dynamically adjusted according to the alarm level to ensure that high-risk events are processed first, and fault-level alarms (including short-circuit risk) are uploaded first, followed by warning-level (including line aging prediction), and finally regular data for reducing the processing pressure of the cloud.
[0155] The data compression and transmission unit 4 compresses, packages, encrypts and attaches CRC32 check to the voltage and current waveform data before uploading to the cloud;
[0156] In this embodiment, the data compression and transmission unit 4 includes a data compression module and a data encryption and uploading module.
[0157] The data compression module uses LZW algorithm to compress the collected voltage and current waveform data, and adds CRC32 check code to ensure the integrity and security of the data in the transmission process. The module uses advanced compression algorithm (LZW algorithm) to reduce data volume, and adds CRC32 check code to support packet retransmission (up to 3 retries) and ensure data integrity in weak network environment, and realizes error detection.
[0158] The LZW algorithm realizes encoding compression by constructing a dictionary to replace repeated data sequences with dictionary indexes. The initial dictionary contains all possible single-character items (ASCII code 0-255), and the dictionary is continuously expanded as the data is processed: when reading the input stream, the longest matching sequence is found and its dictionary code is output, then the matching sequence is added with the next character to form a new entry and added to the dictionary, and the process is repeated until the entire data sequence is processed; CRC32 is based on a standard 32-bit polynomial (0x04C11DB7), and the input data is calculated by performing XOR and left shift operations on the 32-bit CRC register. After processing all the data, 32 zeros are appended to form the final check value, and bit inversion or XOR operation can be performed according to the standard. The final CRC32 check code is attached to the tail of the compressed data to form a complete data frame, which supports up to 3 times of packet retransmission in weak network environment. The receiving end recalculates the CRC and compares the check code, if consistent, it is considered that the data is complete, effectively ensuring the safe transmission of voltage and current waveform data in unstable network environment.
[0159] The data encryption upload module uploads waveform data to the cloud through MQTT protocol based on TLS encryption, wherein the intelligent gateway acts as an MQTT client and establishes a TCP connection with the MQTT server (cloud); then, the client and the server perform TLS handshake to complete identity verification and encryption key negotiation, thereby establishing a secure encrypted channel; once the TLS secure connection is established, the gateway publishes MQTT messages containing waveform data to the preset topic through the encrypted channel; after the MQTT server receives the message, it processes and stores it, thereby realizing safe and reliable uploading of waveform data to the cloud;
[0160] In this embodiment, the cloud uses a symmetric encryption algorithm (AES-256) to decrypt data (first, receive encrypted data and the corresponding initialization vector (if IV is used); then, use the pre-shared AES-256 key and initialization vector to perform reverse calculation on the ciphertext through the AES-256 decryption algorithm; finally, restore the original voltage, current waveform data or other plaintext information), ensuring the security and confidentiality of data transmission, and then performing decompression operations (first, initialize a dictionary identical to that used during compression (usually containing all single characters); then, read the dictionary code from the compressed data stream; according to the read dictionary code, find the corresponding character sequence in the dictionary and output it; at the same time, according to the current output sequence and the character corresponding to the next input dictionary code, construct a new character sequence and add it to the dictionary; this process continues until all compressed data is processed, thereby completely restoring the original voltage, current waveform data), and the restored data is used to build a data model or implement hidden danger and load identification functions;
[0161] In this embodiment, the cloud data analysis is;
[0162] int32_t Wave_cur(uint32_t data)
[0163] {
[0164] / / Only keep the low 20 bits
[0165] data&=0xFFFFF;
[0166] / / Judge the sign bit (20th bit)
[0167] if (data&0x80000)
[0168] {
[0169] / / Negative complement to signed integer
[0170] return (int32_t)(data|0xFFF00000); / / Fill high 12 bits with 1 (sign extension)
[0171] }
[0172] else
[0173] {
[0174] return (int32_t)data;
[0175] }
[0176] }。
[0177] The above shows and describes the basic principles, main features and advantages of the present application. Those skilled in the art should understand that the present application is not limited to the above-mentioned embodiments, and the above-mentioned embodiments and descriptions in the specification are only preferred examples of the present application and are not intended to limit the present application. Without departing from the spirit and scope of the present application, various changes and improvements can be made to the present application, and these changes and improvements all fall within the scope of the claimed present application.
Claims
1. A cloud-edge collaborative intelligent gateway, characterized in that, include: High-frequency data acquisition and packaging unit (1), wherein the high-frequency data acquisition and packaging unit (1) acquires voltage and current waveform data; The device compatibility and data interoperability unit (2) adopts a multi-mode transmission layer decoupling design and performs protocol conversion and data standardization by interfacing with electrical equipment; Edge intelligent analysis unit (3) uses FFT transformation to extract the spectral features of the original voltage and current waveform data at the gateway end, introduces a lightweight convolutional neural network model to identify the operating status and abnormal features of electrical equipment, and combines the load feature library to determine the type of electrical equipment; The process of extracting the spectral features of the original voltage and current waveform data using FFT transformation at the gateway includes the following steps: S2.1 Read the original waveform data file and convert the original waveform data into a data format to generate a current sampling sequence and a voltage sampling sequence in floating-point format. S2.2 Perform transient change detection on the converted waveform data to identify whether there are high-amplitude gradient changes caused by the start-up and shutdown behavior of electrical appliances; If a transient change is detected, a half-cycle spectrum reconstruction is performed based on the center position of the transient change, symmetrical waveform segments before and after the change are extracted, a virtual complete periodic signal is constructed, and windowing processing is performed to generate the reconstructed waveform data. If no mutation is detected, preprocessing is performed on the original waveform data to generate preprocessed waveform data; The transient change detection performed on the converted waveform data includes the following steps: S2.
21. For the current sampling sequence converted to floating-point format, calculate the absolute difference between each sampling point and its previous sampling point in turn, and construct a difference sequence to reflect the rate of change of the waveform at each sampling point. S2.
22. Set the dynamic threshold of the difference sequence using a median adaptive method. To adapt to the fluctuating characteristics of different electrical equipment; S2.23, the length used is The sliding window iterates through the difference sequence to determine whether there is a continuous sequence. The difference values at each sampling point all exceeded the set dynamic threshold. If there exists a continuous The difference values at each sampling point all exceeded the set dynamic threshold. If so, it indicates that the waveform segment is a potential abrupt change region; S2.
24. If a potential mutation interval is detected, record the center position of the mutation as the reference point for half-cycle spectrum reconstruction, and set the processing flag to indicate that the current waveform will enter the half-cycle spectrum reconstruction branch. If no mutation is detected, the waveform data is preprocessed. S2.3 Perform an FFT operation on the waveform data processed in step S2.2 to obtain the complex frequency domain spectral vector. ; S2.4 Calculate the magnitude of the complex frequency domain spectral vector based on the complex frequency domain spectral vector to obtain the amplitude intensity of each frequency component, and construct the frequency axis according to the sampling frequency and the number of sampling points; S2.5 Based on the modulus and frequency axis of the complex frequency domain spectral vector, identify the fundamental frequency and extract its amplitude, and at the same time extract the amplitudes of each harmonic component. Calculate the total harmonic distortion rate based on the extraction results. S2.6 Normalize the amplitudes and relative ratios of each harmonic component and construct a spectral feature vector; The data compression and transmission unit (4) compresses, packages, encrypts, and adds CRC32 verification to the voltage and current waveform data before uploading it to the cloud.
2. The cloud-edge collaborative intelligent gateway according to claim 1, characterized in that: The high-frequency data acquisition and packaging unit (1) includes a waveform acquisition module and a packaging module; The waveform acquisition module continuously samples voltage and current waveform signals at a fixed sampling frequency using a dual-cycle sampling mechanism. The encapsulation module stores the waveform signal to generate a raw waveform data file, and names the raw waveform data file using a unique identifier rule.
3. The cloud-edge collaborative intelligent gateway according to claim 1, characterized in that: The device compatibility and data interoperability unit (2) includes a protocol adaptation module and a data interoperability module; The protocol adaptation module connects to electrical equipment through a physical interface and uses an API interface to adapt the communication protocol to obtain communication data. The data communication module sends operating parameters to the connected electrical equipment as needed through online configuration.
4. The cloud-edge collaborative intelligent gateway according to claim 3, characterized in that: The protocol adaptation module connects to electrical equipment through a physical interface and uses an API interface to adapt the communication protocol to obtain communication data, including the following steps: S1.1 Connect the electrical equipment via the wireless communication interface and configure the MQTT connection parameters of the electrical equipment; S1.
2. Initialize the MQTT client by calling the API and establish a network connection with the configured MQTT Broker; S1.3 The gateway subscribes to the topics published by the electrical devices and receives the communication data uploaded by the electrical devices in real time; S1.
4. Parse the received raw communication data packets, map the field content to the system's common field format according to different device brands and field naming rules, and finally encapsulate it into JSON structured data.
5. The cloud-edge collaborative intelligent gateway according to claim 1, characterized in that: The edge intelligent analysis unit (3) includes a waveform analysis module, a device identification module, and a hierarchical alarm module; The waveform analysis module performs FFT transformation on the original voltage and current waveform data at the gateway end to extract harmonic components and spectral characteristics; The device identification module introduces a lightweight convolutional neural network model to identify the operating status and abnormal characteristics of electrical equipment, combines the load feature library to determine the type of electrical equipment, and marks abnormal power consumption patterns. After detecting abnormal power consumption patterns, the hierarchical alarm module uses a priority queue to manage events and issue alarms of different levels.
6. The cloud-edge collaborative intelligent gateway according to claim 5, characterized in that: The device identification module introduces a lightweight convolutional neural network model to identify the operating status and abnormal characteristics of electrical equipment, determines the type of electrical equipment by combining it with a load feature database, and marks abnormal power consumption patterns, including the following steps: S3.1 Record the range of spectral characteristic changes under the equipment's operating mode to form a spectral characteristic template reflecting the equipment's status; S3.2 Establish a ternary index relationship of equipment type-template feature vector-operating status, and construct a standard load feature library including template feature vectors; S3.3 Receive the spectral feature vector from the waveform analysis module, input the spectral feature vector into the lightweight convolutional neural network model, and extract the high-order feature vector; S3.4 Calculate the mutual information weighted Euclidean distance between the higher-order feature vector and the template feature vector in the standard load feature library; S3.5 Sort the mutual information weighted Euclidean distances, select the device type corresponding to the smallest mutual information weighted Euclidean distance as the current recognition result, and construct a category-adaptive dynamic recognition threshold for each type of device to determine whether the higher-order feature vector belongs to the device type. S3.6 After completing the equipment type identification, the high-order feature vector is compared with the template features of the equipment under normal operating conditions for the judgment of abnormal power consumption patterns, and the abnormal power consumption patterns are marked.
7. The cloud-edge collaborative intelligent gateway according to claim 6, characterized in that: In step S3.4, the mutual information weighted Euclidean distance between the higher-order feature vector and the template features in the standard load feature library is calculated, including the following steps: S3.
41. Calculate the mutual information value between each dimension of the higher-order feature vector and the target device type; S3.
42. Normalize the mutual information values of all higher-order feature vectors to form a mutual information weight vector; S3.
43. Compare the higher-order feature vectors with the template feature vectors corresponding to each device type in the feature library, and calculate the weighted Euclidean distance.
8. The cloud-edge collaborative intelligent gateway according to claim 1, characterized in that: The data compression and transmission unit (4) includes a data compression module and a data encryption upload module; The data compression module uses the LZW algorithm to compress voltage and current waveform data and adds a CRC32 checksum. The data encryption upload module uploads voltage and current waveform data to the cloud via the MQTT protocol based on TLS encryption.
Citation Information
Patent Citations
Internet of Things edge gateway system and method based on MQTT, terminal and storage medium
CN118740554A
High-speed power conversion control method
CN120582431A