Electric energy metering box monitoring system based on intelligent sensor
By introducing a lightweight anomaly screening model and a dual-mode communication stack into the power metering box monitoring system, flexible sampling and transmission protocol switching under normal and abnormal conditions are realized, solving the problems of data transmission delay and conflict under large-scale deployment, and improving fault diagnosis efficiency and sensor node energy efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Filing Date
- 2026-04-24
- Publication Date
- 2026-07-14
AI Technical Summary
When existing power metering box monitoring systems are deployed on a large scale, the low-value data generated under normal operating conditions consumes communication channel bandwidth resources, resulting in high-frequency sampling data transmission delays and bus conflicts during fault diagnosis under abnormal conditions.
The smart sensor node incorporates a lightweight anomaly screening model and a dual-mode communication stack. By determining the state confidence level, it switches to high-frequency sampling and CoAP block transmission protocol in abnormal states. Combined with analog-to-digital converter sampling mode switching and memory resource isolation management, it achieves efficient fault diagnosis data transmission.
It effectively suppressed invalid data flow under normal conditions, shortened the data acquisition and transmission delay under abnormal conditions, reduced the average power consumption of sensor nodes, and ensured the timing continuity of high-frequency sampling data and the stability of memory writes.
Smart Images

Figure CN122385995A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of measuring electrical variables, digital information transmission and edge computing, and discloses an energy metering box monitoring system based on intelligent sensors. Background Technology
[0002] Currently, smart sensor-based power metering box monitoring systems typically employ fixed data acquisition strategies and a single communication protocol for data transmission. In conventional implementations, various sensor nodes deployed within the power metering box continuously collect physical quantities according to a fixed sampling frequency configured in the initial system configuration. The sensor nodes package the collected voltage, current, and temperature time-series data into status data packets and continuously send them to the edge control unit via a fixed communication protocol (such as a message queue telemetry transmission protocol). Upon receiving these status data packets, the edge control unit directly stores the data or forwards it to the upper-layer server. Throughout the entire operating cycle, regardless of whether the power metering box is in a normal, stable operating state or an abnormal state in the early stages of a fault, the analog-to-digital converters of the sensor nodes maintain a constant operating frequency, and the transmission channel and message encapsulation format of the communication protocol stack remain unchanged.
[0003] Under the existing fixed data acquisition and transmission mechanism, when the number of electricity metering boxes connected to the distribution network reaches a certain scale, the large amount of low-value routine data generated by all sensor nodes under normal operation will continuously occupy the bandwidth resources of the communication channel. When a sudden anomaly occurs inside an individual electricity metering box and high-frequency sampling data needs to be retrieved immediately for fault diagnosis, the communication channel is already congested by massive amounts of routine data. The process of the edge control unit issuing sampling rate increase commands and the sensor nodes transmitting high-frequency sampling data back will encounter severe queuing delays and bus conflicts, resulting in delayed end-to-end data transmission and response under abnormal conditions. Summary of the Invention
[0004] The purpose of this invention is to provide an energy metering box monitoring system based on intelligent sensors, which can effectively solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] The power metering box monitoring system based on smart sensors includes smart sensor nodes and an edge control unit. The smart sensor nodes have a built-in lightweight anomaly screening model and a dual-mode communication stack. Under normal operation, the edge control unit polls the smart sensor nodes according to a basic sampling period. The smart sensor nodes report a state vector through the MQTT protocol in the dual-mode communication stack. The edge control unit inputs the state vector into the lightweight anomaly screening model to output a state confidence level. When the state confidence level is within a preset transition range, the edge control unit sends a sampling rate increase command and a protocol switching signaling to the smart sensor nodes. The smart sensor nodes respond to the protocol switching signaling by switching the sampling mode of the analog-to-digital converter to a high-frequency mode and switching the dual-mode communication stack from the MQTT protocol to a UDP-based CoAP block transmission protocol. The high-frequency sampling data is then transmitted in blocks to the edge control unit for fault diagnosis via the UDP-based CoAP block transmission protocol.
[0007] Preferably, the intelligent sensor node includes a voltage transformer, a current transformer, and a temperature sensor. The state vector is formed by aligning and splicing the voltage time sequence segment collected by the voltage transformer, the current time sequence segment collected by the current transformer, and the temperature time sequence segment collected by the temperature sensor on the time axis. After receiving the polling command from the edge control unit, the intelligent sensor node extracts the voltage time sequence segment, the current time sequence segment, and the temperature time sequence segment within a preset length time window before the current moment, and arranges them in a fixed channel order of voltage, current, and temperature to generate the state vector.
[0008] Preferably, the lightweight anomaly screening model includes a one-dimensional convolutional layer, a batch normalization layer, an activation function layer, and a global average pooling layer connected in sequence. The convolutional kernel of the one-dimensional convolutional layer slides to extract spatial feature maps along the channel dimension of the state vector. The batch normalization layer standardizes the spatial feature maps. The activation function layer performs nonlinear mapping on the standardized spatial feature maps to output an activation feature matrix. The global average pooling layer performs mean compression on the activation feature matrix along the time dimension to generate a one-dimensional feature vector. The one-dimensional feature vector is then input into the Sigmoid function to calculate the state confidence.
[0009] Preferably, the dual-mode communication stack includes a first memory region and a second memory region deployed independently. The first memory region stores the publish topic mapping table and connection handle of the MQTT protocol, and the second memory region stores the Uniform Resource Identifier routing table and UDP socket descriptor of the CoAP block transport protocol based on UDP. During the initialization phase, the smart sensor node establishes a mutex lock between the first memory region and the second memory region. When the protocol switching signaling is received, the smart sensor node acquires the mutex lock, closes the connection handle in the first memory region, and releases the first memory region, while simultaneously waking up the UDP socket descriptor in the second memory region.
[0010] Preferably, the sampling mode switching of the analog-to-digital converter to the high-frequency mode includes the following steps: after parsing the sampling rate boosting instruction, the smart sensor node triggers a hardware interrupt signal to pause the low-frequency conversion task of the analog-to-digital converter, reads the oversampling rate configuration parameter and gain configuration parameter in the control register of the analog-to-digital converter, modifies the oversampling rate configuration parameter from a first value to a second value, modifies the gain configuration parameter from a third value to a fourth value, writes the modified oversampling rate configuration parameter and gain configuration parameter into the control register, and sends a reset instruction to the analog-to-digital converter to restart the conversion clock and enter the high-frequency mode.
[0011] Preferably, transmitting high-frequency sampled data in blocks using the UDP-based CoAP block transmission protocol includes: the smart sensor node dividing the high-frequency sampled data into multiple data blocks according to a preset single transmission byte length in the high-frequency mode; assigning an incrementing block number to each data block; embedding the block number into the block option between the Token field and the Payload field in the CoAP protocol header; encapsulating the data block carrying the block number into the payload area of a UDP datagram; and sending the UDP datagram to the edge control unit via the smart sensor node's radio frequency antenna in ascending order of the block number.
[0012] Preferably, after receiving the state vector, the edge control unit inputs the state vector into a sliding window queue, and extracts the voltage time series segment, the current time series segment, and the temperature time series segment corresponding to the target time window from the sliding window queue according to a preset step size. The extracted voltage time series segment, current time series segment, and temperature time series segment are subjected to maximum and minimum value normalization processing, and the normalized voltage time series segment, current time series segment, and temperature time series segment are re-concatenated in the channel dimension to generate a preprocessed state vector. The preprocessed state vector is then input into the lightweight anomaly screening model.
[0013] Preferably, the width of the convolution kernel of the one-dimensional convolutional layer is an integer multiple of the time step size of the voltage time series segment, the current time series segment, and the temperature time series segment after normalization in the preprocessed state vector. When the one-dimensional convolutional layer performs a sliding convolution operation with a stride of one on the time dimension of the preprocessed state vector, a single convolution calculation covers the data points corresponding to consecutive time steps in the preprocessed state vector. The feature mapping values obtained from each convolution calculation are stacked along the channel dimension to generate the spatial feature map. The batch normalization layer independently calculates the mean and variance of each channel feature slice in the spatial feature map according to the channel dimension.
[0014] Preferably, after waking up the UDP socket descriptor, the smart sensor node reads the first sequence number corresponding to the last successfully sent MQTT message in the first memory area, increments the first sequence number by one as the starting block number of the first data block in the CoAP protocol header, and after the smart sensor node sends each data block carrying the block sequence number under the UDP-based CoAP block transmission protocol, it writes the block sequence number and the corresponding sending timestamp into the sending record queue in the second memory area. When it receives a retransmission request message returned by the edge control unit for a specific block sequence number, it repackages the data block corresponding to the retransmission request message according to the sending timestamp in the sending record queue.
[0015] Preferably, after receiving the UDP datagram, the edge control unit parses the block options in the CoAP protocol header to extract the block sequence number, calculates the offset of the currently received data block in the complete high-frequency sampling time-series data stream based on the difference between the block sequence number and the starting block sequence number, uses the offset as a write address pointer, and writes the high-frequency sampling data in the data block into a pre-allocated circular buffer inside the edge control unit. When the write address pointer points to the end address of the circular buffer, the write address pointer is reset to the start address of the circular buffer to continue writing the subsequently received data blocks.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0017] 1. This invention integrates a lightweight anomaly screening model and a dual-mode communication stack into intelligent sensor nodes. The edge control unit calculates state confidence based on state vectors. When the state confidence is within a transition range, it triggers a sampling rate increase command and a protocol switching signal. This allows the sensor node to maintain low-frequency sampling and report state vectors using a message queue telemetry transmission protocol during normal operation. In the event of an anomaly, the analog-to-digital converter switches to high-frequency mode, and the communication stack switches to a restricted application protocol block transmission protocol based on User Datagram Protocol (UDP) for high-frequency sampled data block transmission. This method of coordinating the control of underlying hardware sampling behavior and network layer transmission protocols based on state confidence suppresses invalid data traffic generated by the sensor network during normal operation, avoids bus conflicts caused by sudden large amounts of high-frequency data during fault occurrences, and shortens data acquisition and transmission delays in abnormal states.
[0018] 2. This invention sets up independent first and second memory regions in the dual-mode communication stack and configures mutex locks. By acquiring the mutex lock, the message queue telemetry transmission protocol connection handle is closed and the first memory region is released. Simultaneously, the user datagram protocol socket descriptor in the second memory region is awakened, achieving seamless switching of the communication protocol stack and isolated management of memory resources. During protocol switching, the starting block number of the restricted application protocol is generated by reading the sequence number of the last successfully sent message of the previous protocol and adding one. The block number and the sending timestamp are recorded in the sending record queue. Combined with the edge control unit calculating the offset based on the block number and the starting block number and writing the high-frequency sampling data into the circular buffer, the timing continuity and memory writing stability during the block transmission of high-frequency sampling data are ensured, and the average power consumption of the smart sensor node under normal operation is reduced. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the overall workflow of the intelligent sensor-based power metering box monitoring system of the present invention.
[0020] Figure 2 This is a flowchart of the state vector generation process of the present invention;
[0021] Figure 3 This is a flowchart of the reasoning process for the lightweight anomaly screening model of the present invention;
[0022] Figure 4 This is a flowchart of the dual-mode communication stack switching process of the present invention;
[0023] Figure 5 This is a flowchart of the high-frequency mode switching process of the analog-to-digital converter of the present invention;
[0024] Figure 6 This is a flowchart illustrating the high-frequency sampling data block transmission and circular buffer writing process of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] Please refer to Figure 1 This embodiment provides a power metering box monitoring system based on smart sensors, including smart sensor nodes and edge control units. The smart sensor nodes are deployed inside the power metering boxes within the distribution network area, and the edge control units are deployed on the transformer side of the distribution network area, establishing wireless communication connections with all smart sensor nodes within the area. The smart sensor nodes incorporate a lightweight anomaly screening model and a dual-mode communication stack. The lightweight anomaly screening model is stored in the non-volatile storage medium of the smart sensor node, while the dual-mode communication stack is deployed in the running memory space of the smart sensor node, enabling independent operation and switching of the two communication protocols.
[0027] Under normal operating conditions, the edge control unit polls the smart sensor nodes according to a configurable sampling period. The edge control unit sends polling commands sequentially based on the unique identifiers of the smart sensor nodes within the distribution area. Each polling command targets only one corresponding smart sensor node, avoiding communication conflicts caused by multiple nodes responding simultaneously. Upon receiving the corresponding polling command, the smart sensor node reports its state vector via the MQTT protocol in the dual-mode communication stack. The MQTT protocol operates based on a connection-oriented transmission control protocol, employing a publish-subscribe communication mode. The smart sensor node acts as the communication client, and the edge control unit acts as the communication server. The smart sensor node encapsulates its state vector into a publish message conforming to the MQTT protocol specification and reports it to the edge control unit through a pre-established long connection.
[0028] After receiving the state vector, the edge control unit inputs it into the lightweight anomaly screening model, and outputs the state confidence score through model inference. The state confidence score characterizes the probability that the current operating state of the energy metering box is within the stable operating range, and its value ranges from 0 to 1. The edge control unit is pre-configured with interval division rules for the state confidence score, including normal interval, transition interval, and abnormal interval, with different system actions corresponding to different intervals.
[0029] Table 1. Mapping Table of State Confidence Interval Division and System Execution Action
[0030]
[0031] In this embodiment, the upper and lower thresholds of the transition interval can be dynamically adjusted according to the operating environment of the distribution network area, the service life of the power metering box, and the load fluctuation characteristics. The granularity of the interval division can be configured according to the monitoring accuracy requirements to ensure accurate identification and timely response to the nascent state of anomalies.
[0032] When the state confidence level is within a preset transition range, the edge control unit sends a sampling rate increase command and a protocol switching signaling to the corresponding smart sensor node. The sampling rate increase command carries the configuration parameters corresponding to the target sampling mode, and the protocol switching signaling carries the trigger identifier and checksum for the protocol switching. The edge control unit sends the command and signaling through the currently established MQTT long connection to ensure reliable delivery of the command and signaling.
[0033] Upon receiving the sampling rate increase command and protocol switching signaling, the smart sensor node first verifies the validity of the command and signaling. If the verification is successful, it responds to the protocol switching signaling by switching the analog-to-digital converter's sampling mode to high-frequency mode, and simultaneously switches the dual-mode communication stack from the MQTT protocol to the UDP-based CoAP block transmission protocol. In high-frequency mode, the analog-to-digital converter's sampling frequency is several times higher than the normal low-frequency mode, enabling it to capture transient signal details under abnormal conditions in the energy metering box. The UDP-based CoAP block transmission protocol uses a connectionless transmission mode, reducing the overhead of connection establishment and maintenance, and improving the real-time performance of high-frequency sampling data transmission.
[0034] The intelligent sensor node transmits high-frequency sampling data in blocks to the edge control unit via the CoAP block transmission protocol based on UDP. After receiving the complete high-frequency sampling data, the edge control unit performs transient feature extraction, harmonic analysis, abnormal feature matching and fault type identification on the high-frequency sampling data to complete the fault diagnosis of the power metering box.
[0035] In this embodiment, the coordinated control of sampling mode and communication protocol is realized by judging the interval of state confidence. In normal operation, low-frequency sampling and low-bandwidth occupancy MQTT protocol communication are maintained. In the transition interval of anomaly emergence, it quickly switches to high-frequency sampling and high-transmission efficiency CoAP block transmission protocol, suppressing invalid data traffic under normal conditions and avoiding bus conflicts and transmission delays in fault conditions.
[0036] In a preferred embodiment, reference Figure 2The intelligent sensor nodes include voltage transformers, current transformers, and temperature sensors. Voltage and current transformers are deployed in the incoming and outgoing circuits of the energy metering box, respectively collecting voltage and current timing data. Temperature sensors are deployed inside the energy metering box at key heat-generating locations such as busbars, circuit breaker terminals, and reactive power compensation capacitors, collecting temperature timing data at those locations. The local clocks of the voltage transformers, current transformers, and temperature sensors are synchronized via clock synchronization messages sent by the edge control unit, ensuring that the timing data collected by each sensor has a unified time reference and that the synchronization accuracy meets the requirements for timing data alignment.
[0037] The state vector is constructed by aligning and stitching together voltage time-series segments collected by voltage transformers, current time-series segments collected by current transformers, and temperature time-series segments collected by temperature sensors along the time axis. Upon receiving a polling command from the edge control unit, the intelligent sensor node extracts the voltage, current, and temperature time-series segments within a preset time window preceding the current moment. The length of the time window is a configurable time span, corresponding to an integer number of power frequency cycles in the power grid, ensuring that the time-series segments completely cover the full cyclic characteristics of the power frequency signal. The intelligent sensor node performs time axis alignment processing on the three extracted time-series segments, using a unified time reference to remove time-off data and fill in missing sampling points, ensuring that the start and end times of the three time-series segments are completely consistent in the time dimension.
[0038] The smart sensor nodes are arranged in a fixed channel order of voltage, current, and temperature. The aligned voltage time series segments, current time series segments, and temperature time series segments are concatenated to generate a state vector. The concatenation process of the state vector is implemented using the following formula:
[0039] in, For the generated state vector, The aligned voltage timing segment has a dimension of , The aligned current timing segment has a dimension of , The aligned temperature time series segment has a dimension of , This represents the time step corresponding to a single time segment, i.e., the number of sampling points within a single time window. Setting a fixed channel order ensures consistency in the channel dimension arrangement of the state vector, avoiding subsequent data processing errors caused by disordered channel order.
[0040] After receiving the state vector, the edge control unit inputs it into a sliding window queue. The depth of the sliding window queue is the number of configurable time windows, used to store continuously reported state vectors, enabling continuous storage and backtracking of time-series data. The edge control unit extracts voltage, current, and temperature time-series segments corresponding to the target time window from the sliding window queue according to a preset step size. The preset step size can be configured as a single time step or a value smaller than the time window length, achieving non-overlapping or overlapping extraction of the sliding window, improving the ability to capture abnormal features.
[0041] The edge control unit performs maximum and minimum value normalization on the extracted voltage, current, and temperature time segments to eliminate the dimensional differences between different physical quantities. The normalization process is achieved through the following formula:
[0042] in, This is a time sequence segment after normalization. This is the extracted original time sequence segment. This represents the minimum value of the corresponding time segment within the target time window. This represents the maximum value of the corresponding time series segment within the target time window. After normalization, the numerical range of all time series segments is mapped to the [0,1] interval, ensuring that the time series data of different channels have a uniform numerical distribution range.
[0043] The edge control unit reassembles the normalized voltage, current, and temperature time series segments along the channel dimension to generate a preprocessed state vector. The dimension of the preprocessed state vector is consistent with that of the original state vector. The edge control unit inputs the preprocessed state vector into the lightweight anomaly screening model for inference calculation.
[0044] Table 2. Configuration of Time Series Data Acquisition and Preprocessing Parameters
[0045]
[0046] In this embodiment, when the sampling frequency of the temperature channel is lower than that of the voltage and current channels, the number of sampling points in the corresponding time window can be supplemented to the same time step N as the voltage and current channels by linear interpolation, so as to ensure that the time segments of the three channels have the same length in the time dimension and meet the requirements of channel dimension splicing.
[0047] In this embodiment, a state vector with a unified structure is generated by aligning the time axis of multi-sensor time-series data and splicing them in a fixed channel order. Combined with the time-series data storage of the sliding window queue and the preprocessing of maximum and minimum value normalization, the dimensional differences of different physical quantities are eliminated, ensuring the consistency and stability of the preprocessed state vector input to the lightweight anomaly screening model and improving the accuracy of state confidence calculation.
[0048] In a preferred embodiment, reference Figure 3 The lightweight anomaly screening model comprises sequentially connected one-dimensional convolutional layers, batch normalization layers, activation function layers, and global average pooling layers. The model's input is a preprocessed state vector, and its output is the state confidence score. The model's weight file and structure file are simultaneously stored in non-volatile storage media on both the smart sensor node and the edge control unit, ensuring consistency in inference results between the edge control unit and the smart sensor node. All model weight parameters are quantized using integers to reduce storage footprint and computational load, adapting to the limited computing resources of the smart sensor node.
[0049] The convolutional kernel of a one-dimensional convolutional layer slides along the channel dimension of the preprocessed state vector to extract the spatial feature map of the input data. The kernel of a one-dimensional convolutional layer is a multi-channel kernel, with the number of input channels matching the number of channels in the preprocessed state vector, ensuring that the convolution operation covers temporal data from all input channels. The one-dimensional convolution operation is implemented using the following formula:
[0050] in, The feature value corresponding to the c-th output channel and the t-th time step in the output spatial feature map. The width of the convolution kernel. Input the number of channels. Let be the weight parameters of the c'-th input channel at the k-th width position in the convolution kernel corresponding to the c-th output channel. Let c be the value corresponding to the c'-th input channel and the (t+k)-th time step in the preprocessed state vector. This is the bias parameter corresponding to the c-th output channel.
[0051] The width of the convolution kernel in the one-dimensional convolutional layer is an integer multiple of the time step size of the normalized voltage, current, and temperature time series segments in the preprocessed state vector. This ensures that the convolution operation can completely cover an integer number of time steps of the input time series segments, avoiding data truncation during feature extraction. The one-dimensional convolutional layer performs a sliding convolution operation with a stride of one along the time dimension of the preprocessed state vector. Each convolution calculation covers data points corresponding to consecutive time steps in the preprocessed state vector. The feature mapping values obtained from each convolution calculation are stacked along the channel dimension to generate a spatial feature map.
[0052] The batch normalization layer standardizes the spatial feature map output by the one-dimensional convolutional layer, eliminating the impact of feature data distribution differences on subsequent processing. The batch normalization layer independently calculates the mean and variance for each channel feature slice in the spatial feature map according to the channel dimension, and standardizes the feature data for each channel separately. The processing is implemented using the following formula:
[0053] in, These are the feature values after batch normalization. For scaling parameters, For offset parameters, This represents the mean of all time-step feature values for the c-th channel in the spatial feature map. Let V be the variance of all time-step eigenvalues of the c-th channel in the spatial feature map. To prevent smoothing terms with a denominator of zero, the batch normalization layer calculates the moving mean and moving variance for each channel using batch data from the training set during the model training phase. During the model inference phase, the trained moving mean and moving variance are used to standardize the input spatial feature map, improving the stability of model inference.
[0054] The activation function layer performs a non-linear mapping on the batch-normalized spatial feature map, outputting an activation feature matrix to improve the model's ability to fit complex non-linear features. The activation function layer uses the ReLU activation function, and the processing is implemented using the following formula:
[0055] in, This refers to the eigenvalue corresponding to the c-th channel and t-th time step in the activation feature matrix output by the activation function layer. The ReLU activation function achieves non-linear mapping of features by setting negative eigenvalues to zero, while reducing the computational cost of model inference and adapting to the limited computing resources of smart sensor nodes.
[0056] The global average pooling layer performs mean compression on the activation feature matrix along the time dimension, generating a one-dimensional feature vector. The global average pooling layer averages the feature values across all time steps for each channel, compressing the feature dimension and transforming the two-dimensional activation feature matrix into a one-dimensional feature vector. This process is achieved through the following formula:
[0057] in, Let c be the eigenvalue corresponding to the c-th channel in the one-dimensional eigenvector. The activation feature matrix is defined by its length in the time dimension, i.e., the number of time steps. The dimensionality compression design of the global average pooling layer avoids the large number of parameters and overfitting risks associated with fully connected layers, further reducing the model's parameter count and computational cost, thus achieving a lightweight model.
[0058] The one-dimensional feature vector output from the global average pooling layer is input into the fully connected layer, and the state confidence is calculated using the Sigmoid function. The calculation process is implemented using the following formula:
[0059] in, The output state confidence score has a value range of (0,1). This represents the weight vector of the fully connected layer, with the same dimension as the one-dimensional feature vector. These are the bias parameters for the fully connected layer. This is the dot product operation between the weight vector and the one-dimensional feature vector.
[0060] Table 3. Structural parameters of each layer in the initial screening model for lightweight anomalies.
[0061]
[0062] In this embodiment, the number of convolution kernels in the one-dimensional convolutional layer can be adjusted according to the computing power resources of the smart sensor node. The more convolution kernels there are, the stronger the feature extraction capability of the model, and the greater the corresponding number of parameters and computational load. It can be flexibly configured according to the computing power and storage resources of the actual deployment environment.
[0063] In this embodiment, a lightweight structure design consisting of a one-dimensional convolutional layer, a batch normalization layer, an activation function layer, and a global average pooling layer is used to achieve feature extraction and state confidence calculation of the input state vector. The design of associating the convolutional kernel width with an integer multiple of the time step ensures the integrity of feature extraction. The channel-dimension-independent batch normalization process improves the stability of model inference. The dimensionality compression design of global average pooling achieves the lightweighting of the model, making it suitable for deployment environments of intelligent sensor nodes and edge control units.
[0064] In a preferred embodiment, reference Figures 4 to 6The dual-mode communication stack comprises two independently deployed memory regions: a first memory region and a second memory region. Both regions are pre-allocated contiguous physical address spaces within the running memory of the intelligent sensor node, with no overlap in their address ranges, achieving physical isolation of memory resources. The first memory region stores the MQTT protocol's publish topic mapping table and connection handles. The publish topic mapping table stores the mapping relationship between MQTT publish topics and corresponding message types and quality of service levels. The connection handle stores relevant parameters, connection status, and timeout configurations for MQTT transmission connections. The second memory region stores the UDP-based CoAP block transport protocol's Uniform Resource Identifier (URI) routing table and UDP socket descriptors. The URI routing table stores the mapping relationship between the URI of CoAP requests and their corresponding processing functions. The UDP socket descriptors store relevant configuration parameters and communication status for UDP communication.
[0065] During the initialization phase, the intelligent sensor node establishes a mutex lock between a first memory region and a second memory region. The mutex lock ensures that only one memory region is accessible and operational at a time, preventing memory access conflicts and resource contention caused by simultaneous operation of two memory regions. Upon receiving a protocol switching signaling message, the intelligent sensor node first acquires the mutex lock, closes the connection handle in the first memory region, and releases the first memory region. Simultaneously, it wakes up the UDP socket descriptor in the second memory region. Specifically, after acquiring the mutex lock, the intelligent sensor node first sends a disconnect message to the communication peer, closing the current transmission connection and releasing the memory resources occupied by the connection handle. Then, it marks all memory space in the first memory region as reclaimable, completing memory release. Simultaneously, it initializes the UDP socket descriptor in the second memory region, binding the communication port, setting the peer address and port parameters, waking up and preparing the UDP socket, and then releases the mutex lock, completing the protocol switching.
[0066] Table 4. Dual-mode communication stack memory area and mutex configuration table
[0067]
[0068] In this embodiment, the sizes of the first memory region and the second memory region can be adjusted according to the functional expansion requirements of the protocol stack, and the timeout for acquiring the mutex lock can be configured according to the hardware performance of the smart sensor node to ensure the stability and real-time performance of the protocol switching process.
[0069] After parsing the sampling rate boost instruction, the smart sensor node triggers a hardware interrupt signal to pause the low-frequency conversion task of the analog-to-digital converter (ADC). It then reads the oversampling rate configuration parameter and gain configuration parameter from the ADC's control register, modifies the oversampling rate configuration parameter from the first value to the second value, and modifies the gain configuration parameter from the third value to the fourth value. The modified oversampling rate configuration parameter and gain configuration parameter are written back to the control register, and a reset command is sent to the ADC to restart the conversion clock, entering high-frequency mode. The relationship between the actual sampling frequency of the ADC and the oversampling rate configuration parameter is achieved through the following formula:
[0070] in, This is the actual sampling frequency of the analog-to-digital converter. This is the reference conversion clock frequency for the analog-to-digital converter. Configure parameters for the oversampling rate. This represents the frequency division factor. In low-frequency mode, the oversampling rate configuration parameter is the first value, corresponding to a lower sampling frequency; in high-frequency mode, the oversampling rate configuration parameter is the second value, which is less than the first value, corresponding to a higher sampling frequency, thus increasing the sampling frequency. Adjusting the gain configuration parameter is used to adapt to the dynamic range of the input signal under high-frequency sampling, ensuring the conversion accuracy of the sampled data.
[0071] In high-frequency mode, the intelligent sensor node segments the high-frequency sampling data into multiple data blocks according to a preset single-transmission byte length. The preset single-transmission byte length is less than the maximum transmission unit (VU) of the wireless communication link to avoid fragmentation and reassembly overhead caused by a single transmission message exceeding the VU. The total number of data blocks is calculated using the following formula:
[0072] in, The total number of data blocks generated by the splitting. The total length of the high-frequency sampled data in a single transmission in bytes. The preset single-transmission byte length, i.e., the maximum byte length of a single data block. This is for rounding up.
[0073] The smart sensor node assigns an incrementing block number to each data block, embeds the block number in the block option between the Token field and the Payload field in the CoAP protocol header, encapsulates the data block carrying the block number into the payload area of the UDP datagram, and sends the UDP datagram to the edge control unit in ascending order of the block number through the radio frequency antenna of the smart sensor node.
[0074] After waking up the UDP socket descriptor, the smart sensor node reads the first sequence number corresponding to the last successfully sent MQTT message in the first memory area, increments the first sequence number by one, and uses it as the starting block number of the first data block in the CoAP protocol header. The calculation process of the starting block number is implemented by the following formula:
[0075] in, This is the starting block number of the first data block in the CoAP protocol. This is the first sequence number corresponding to the last successfully sent MQTT message in the first memory area. This method ensures the continuity of sequence numbers between the MQTT and CoAP protocols, guaranteeing the timing consistency of data transmission and avoiding sequence number confusion and data timing misalignment caused by protocol switching.
[0076] After sending each data block carrying a block sequence number using the UDP-based CoAP block transmission protocol, the smart sensor node writes the block sequence number and the corresponding sending timestamp into a sending record queue in a second memory area. This sending record queue is a first-in, first-out circular queue with a configurable depth equal to the total number of data blocks, used to store the block sequence numbers and sending timestamps of all sent data blocks. When a retransmission request message for a specific block sequence number is received from the edge control unit, the smart sensor node repackages the corresponding data block according to the record in the sending record queue and retransmits it to the edge control unit via UDP, ensuring that lost data blocks can be quickly retransmitted and improving the reliability of high-frequency sampling data transmission.
[0077] After receiving a UDP datagram, the edge control unit parses the block options in the CoAP protocol header to extract the block sequence number. Based on the difference between the block sequence number and the starting block sequence number, it calculates the offset of the currently received data block in the complete high-frequency sampling time-series data stream. The offset calculation process is implemented using the following formula:
[0078] in, This represents the byte offset of the current data block within the complete high-frequency sampling time-series data stream. This is the block sequence number corresponding to the currently received data block.
[0079] The edge control unit uses the offset as the write address pointer to write high-frequency sampled data from the data block into an internally pre-allocated circular buffer. The circular buffer is a pre-divided contiguous physical address space within the edge control unit's memory, used to continuously store the high-frequency sampled timing data stream. When the write address pointer points to the end of the circular buffer, it is reset to the beginning of the circular buffer, and subsequent received data blocks are written. The update process of the write address pointer is implemented using the following formula:
[0080] in, This is the write address pointer for the current data block. This is the starting base address of the circular buffer. The total length of the circular buffer in bytes. This involves modulo operations. By using modulo operations, the write address pointer can be circumvented within the circular buffer. When the write address pointer reaches the end of the buffer, it is automatically reset to the beginning address of the buffer, thus avoiding memory address out-of-bounds errors and improving the stability of high-frequency sampled data writing.
[0081] In this embodiment, the independent memory region and mutex lock design of the dual-mode communication stack enable seamless switching between the MQTT and CoAP protocols and isolated management of memory resources. The modification of the oversampling rate and gain configuration parameters enables rapid switching of the analog-to-digital converter sampling mode. The CoAP block transmission with block sequence number and the circular buffer writing mechanism ensure the timing continuity and writing stability of high-frequency sampling data transmission and reduce the average power consumption of the smart sensor node under normal operation.
Claims
1. A power metering box monitoring system based on intelligent sensors, characterized in that, The system includes intelligent sensor nodes and an edge control unit. The intelligent sensor nodes have a built-in lightweight anomaly screening model and a dual-mode communication stack. Under normal operating conditions, the edge control unit polls the intelligent sensor nodes according to a basic sampling period. The intelligent sensor nodes report a state vector through the MQTT protocol in the dual-mode communication stack. The edge control unit inputs the state vector into the lightweight anomaly screening model to output a state confidence score. When the state confidence score is within a preset transition range, the edge control unit sends a sampling rate increase command and a protocol switching signaling to the intelligent sensor nodes. The intelligent sensor nodes respond to the protocol switching signaling by switching the sampling mode of the analog-to-digital converter to a high-frequency mode and switching the dual-mode communication stack from the MQTT protocol to a UDP-based CoAP block transmission protocol. The high-frequency sampled data is then transmitted in blocks to the edge control unit for fault diagnosis via the UDP-based CoAP block transmission protocol.
2. The power metering box monitoring system based on intelligent sensors according to claim 1, characterized in that, The intelligent sensor node includes a voltage transformer, a current transformer, and a temperature sensor. The state vector is formed by aligning and splicing the voltage time-series segments collected by the voltage transformer, the current time-series segments collected by the current transformer, and the temperature time-series segments collected by the temperature sensor on the time axis. After receiving the polling command from the edge control unit, the intelligent sensor node extracts the voltage time-series segments, the current time-series segments, and the temperature time-series segments within a preset time window before the current moment, and arranges them in a fixed channel order of voltage, current, and temperature to generate the state vector.
3. The power metering box monitoring system based on intelligent sensors according to claim 2, characterized in that, The lightweight anomaly screening model comprises a one-dimensional convolutional layer, a batch normalization layer, an activation function layer, and a global average pooling layer connected in sequence. The convolutional kernel of the one-dimensional convolutional layer slides along the channel dimension of the state vector to extract a spatial feature map. The batch normalization layer standardizes the spatial feature map. The activation function layer performs nonlinear mapping on the standardized spatial feature map to output an activation feature matrix. The global average pooling layer performs mean compression on the activation feature matrix along the time dimension to generate a one-dimensional feature vector. The one-dimensional feature vector is then input into the Sigmoid function to calculate the state confidence.
4. The power metering box monitoring system based on intelligent sensors according to claim 3, characterized in that, The dual-mode communication stack includes a first memory region and a second memory region deployed independently. The first memory region stores the publish topic mapping table and connection handle of the MQTT protocol, and the second memory region stores the Uniform Resource Identifier routing table and UDP socket descriptor of the CoAP block transport protocol based on UDP. During the initialization phase, the smart sensor node establishes a mutex lock between the first memory region and the second memory region. When the protocol switching signaling is received, the smart sensor node acquires the mutex lock, closes the connection handle in the first memory region and releases the first memory region, and at the same time wakes up the UDP socket descriptor in the second memory region.
5. The power metering box monitoring system based on intelligent sensors according to claim 4, characterized in that, Switching the sampling mode of the analog-to-digital converter to the high-frequency mode includes the following steps: After parsing the sampling rate boost instruction, the smart sensor node triggers a hardware interrupt signal to pause the low-frequency conversion task of the analog-to-digital converter, reads the oversampling rate configuration parameter and gain configuration parameter in the control register of the analog-to-digital converter, modifies the oversampling rate configuration parameter from a first value to a second value, modifies the gain configuration parameter from a third value to a fourth value, writes the modified oversampling rate configuration parameter and gain configuration parameter into the control register, and sends a reset instruction to the analog-to-digital converter to restart the conversion clock and enter the high-frequency mode.
6. The power metering box monitoring system based on intelligent sensors according to claim 5, characterized in that, The high-frequency sampling data is transmitted in blocks using the UDP-based CoAP block transmission protocol, which includes: the smart sensor node dividing the high-frequency sampling data into multiple data blocks according to a preset single transmission byte length in the high-frequency mode; assigning an incrementing block number to each data block; embedding the block number into the block option between the Token field and the Payload field in the CoAP protocol header; encapsulating the data block carrying the block number into the payload area of a UDP datagram; and sending the UDP datagram to the edge control unit through the radio frequency antenna of the smart sensor node in ascending order of the block number.
7. The power metering box monitoring system based on intelligent sensors according to claim 6, characterized in that, After receiving the state vector, the edge control unit inputs the state vector into a sliding window queue. It then extracts the voltage, current, and temperature time series segments corresponding to the target time window from the sliding window queue according to a preset step size. The extracted voltage, current, and temperature time series segments are then subjected to maximum and minimum value normalization processing. The normalized voltage, current, and temperature time series segments are then reassembled along the channel dimension to generate a preprocessed state vector. This preprocessed state vector is then input into the lightweight anomaly screening model.
8. The power metering box monitoring system based on intelligent sensors according to claim 7, characterized in that, The width of the convolution kernel of the one-dimensional convolutional layer is an integer multiple of the time step of the voltage time series segment, the current time series segment, and the temperature time series segment after normalization in the preprocessed state vector. When the one-dimensional convolutional layer performs a sliding convolution operation with a stride of one on the time dimension of the preprocessed state vector, a single convolution calculation covers the data points corresponding to the consecutive time steps in the preprocessed state vector. The feature mapping values obtained from each convolution calculation are stacked along the channel dimension to generate the spatial feature map. The batch normalization layer independently calculates the mean and variance of each channel feature slice in the spatial feature map according to the channel dimension.
9. The power metering box monitoring system based on intelligent sensors according to claim 8, characterized in that, After waking up the UDP socket descriptor, the smart sensor node reads the first sequence number corresponding to the last successfully sent MQTT message in the first memory area, increments the first sequence number by one as the starting block number of the first data block in the CoAP protocol header, and after the smart sensor node sends each data block carrying the block sequence number under the UDP-based CoAP block transmission protocol, it writes the block sequence number and the corresponding sending timestamp into the sending record queue in the second memory area. When it receives a retransmission request message returned by the edge control unit for a specific block sequence number, it repackages the data block corresponding to the retransmission request message according to the sending timestamp in the sending record queue.
10. The power metering box monitoring system based on intelligent sensors according to claim 9, characterized in that, After receiving the UDP datagram, the edge control unit parses the block options in the CoAP protocol header to extract the block sequence number. Based on the difference between the block sequence number and the starting block sequence number, it calculates the offset of the currently received data block in the complete high-frequency sampling time-series data stream. Using the offset as a write address pointer, it writes the high-frequency sampling data in the data block into a pre-allocated circular buffer inside the edge control unit. When the write address pointer points to the end address of the circular buffer, it resets the write address pointer to the start address of the circular buffer and continues writing subsequent received data blocks.