Analog quantity data adaptive sampling method and system based on sliding window
Through the sliding window adaptive sampling method, the sampling rate and window size are dynamically adjusted, and the problem of waste and redundant data of simulated data acquisition is solved, and efficient data storage and power consumption optimization is achieved. It is suitable for scenarios such as power supply protocol testing, Internet of Things and medical monitoring.
Patent Information
- Application Number
- CN202510584966.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art has problems such as low parsing efficiency, high storage usage and large power consumption in analog data acquisition. Especially in PC host computers and embedded devices, it is difficult to balance the data change rate and real-time requirements, resulting in waste of resources and redundant data generation.
Adaptive sampling method based on sliding windows is adopted to dynamically adjust the sampling rate and window size, and optimize data acquisition and storage by calculating the data change rate and mean standard deviation, including data acquisition, window setting, sliding window module and sampling decision module, adapting to the real-time and frequency of change in different scenarios.
It significantly reduces data storage volume by 70%-80%, reduces power consumption by 60%-70%, and reduces parsing overhead by 70%, achieving efficient resource utilization and real-time adaptation.
Smart Images

Figure CN120447383A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data acquisition technology, and specifically to a sliding window-based analog data adaptive sampling method and system. The method is suitable for scenarios where analog data acquisition is required in PC host computers or resource-constrained embedded devices (such as MCUs, Internet of Things sensors, industrial controllers, and medical monitoring equipment). The method is widely used in power supply protocol testing, the Internet of Things, industrial control, and medical monitoring, and optimizes analysis efficiency, storage, and power consumption. Background Art
[0002] Analog data acquisition is widely used in power supply protocol testing, the Internet of Things, industrial control, and medical monitoring, involving signals such as voltage, current, and temperature. High-speed or variable-speed acquisition generates large amounts of data, resulting in high PC analysis overhead, high storage requirements for embedded devices, and increased power consumption. For example, in power supply protocol testing, transient data requires a high sampling rate, while stable data accounts for 70% of the time and has minimal fluctuations. Repeated sampling wastes resources.
[0003] Existing technologies include: ●Fixed sampling: The PC host computer analyzes frequently (100 times / second), with high CPU usage; the embedded device fills up the Flash (8.64MB / hour). ● Downsampling: Loses transients (such as voltage 5.0V to 5.5V, blood oxygen mutation), which is not suitable for real-time scenarios. ●General compression (such as Huffman): Decoding takes a long time and is not suitable for MCU real-time performance.
[0004] Existing technologies use fixed sampling rates that cannot adapt to data changes and are prone to generating redundant data. Compression methods require additional computation, increasing the burden on embedded devices. Periodic sampling ignores real-time requirements and struggles to balance efficiency and accuracy. Existing methods lack a universal adaptive sampling solution.
[0005] Since data parsing efficiency is low, storage occupancy is high, and power consumption is high in PC host computers and embedded devices, an adaptive sampling solution is urgently needed to dynamically adjust the window size, optimize parsing, storage, and power consumption, while meeting real-time requirements. Summary of the Invention
[0006] This invention proposes a sliding window-based adaptive sampling method and system for analog data to solve the PC host computer analysis overhead and embedded device resource bottlenecks. It includes: ●Data acquisition: Collect analog data at high frequency or variable frequency. ●Window setting: Dynamically adjust the window size (50–200ms, Default 100ms). ● Sliding window: Calculates the mean and standard deviation of each EWMA according to the weight coefficient, with a step size of a single sample interval. ●Sampling adjustment: If the standard deviation is <0.01, the sampling rate is reduced to 10% (such as 10Hz); otherwise, the high sampling rate is maintained. ●Storage: PC host computer stores to disk, embedded device stores to Flash.
[0007] Data acquisition: Collect one channel or analog data (such as voltage, current, temperature), obtain data at an initial sampling rate (such as 100Hz) through a specific module (such as ADC), and store it in a buffer, with a memory occupation of less than 100 bytes.
[0008] Window size setting: The sliding window size is dynamically set based on the frequency of data changes and real-time requirements. When the frequency of changes is high (e.g., voltage transients > ±0.01V / 10ms) or real-time requirements are high (e.g., power supply protocol testing), the window size is shortened to 50ms. When the frequency of changes is low (e.g., temperature < ±0.01°C / 10ms) or real-time requirements are low (e.g., IoT monitoring), the window size is extended.
[0009] Rate of change analysis: Calculate the rate of change of data within a sliding window and calculate the standard deviation based on the EWMA mean.
[0010] Sampling rate adjustment: The rate of change is compared to a preset threshold (0.01, based on typical analog fluctuations). If the rate of change is above the threshold, the sampling rate is maintained at a high level (e.g., 1000Hz); if it is below the threshold, the sampling rate is reduced to 10% of the original rate (e.g., 100Hz).
[0011] Data Storage and Transmission: Sampled data is stored locally (on embedded devices) or sent to a host PC. The storage module optimizes data formats, reducing storage requirements by 70%–80%. Transmitted data is timestamped and checksummed, reducing parsing overhead by 70%.
[0012] System module relationship: The data acquisition module provides raw data, the window setting module outputs the window size according to the change frequency and real-time performance, the sliding window module calculates the change rate based on the window size, the sampling decision module adjusts the sampling rate, and the data storage module saves or sends data.
[0013] Technical Advantages: This method reduces storage requirements by 70%–80%, power consumption by 60%–70%, and parsing overhead by 70%. The system supports single-channel or data acquisition and is suitable for power supply protocol testing, the Internet of Things, industrial control, and medical monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1Demonstrates the adaptive sampling method workflow, from data acquisition to window setting, rate of change calculation, sampling rate adjustment, and data storage or transmission to a host computer. The window size is dynamically adjusted based on the rate of change, optimizing sampling efficiency.
[0015] Figure 2 Displays the process of adaptive window size. DETAILED DESCRIPTION
[0016] Example: Adaptive sampling of analog data
[0017] Scenario Description: A slave computer (Cortex-M3, 72MHz, 128KB SRAM) or a PC host computer collects single-channel or analog data for power supply protocol testing, IoT, industrial control, and medical monitoring. The method uses a dynamic sliding window to adjust the sampling rate to optimize efficiency, storage, and power consumption. This supports single-channel (e.g., temperature sensor) or analog (e.g., voltage and current) scenarios.
[0018] Data Acquisition: The data acquisition module collects data using an ADC at an initial sampling rate of 1000 Hz. The real-time operating system schedules the acquisition tasks.
[0019] Window Setting: The window setting module records the frequency of statistical changes every 10ms. Based on real-time requirements, set the window size. Single-channel temperature monitoring (low frequency of change) uses a 200ms window; power supply testing (high frequency of change) uses a 50ms window.
[0020] Rate of Change Calculation: The sliding window module calculates the rate of change of the data within the window, quantifies the degree of fluctuation using the standard deviation, and smoothes the rate of change using EWMA. For example, the standard deviation of voltage within a 50ms window is 0.015 (transient), and the smoothed value is 0.014 after EWMA; the standard deviation of temperature within a 200ms window is 0.005 (stable), and the smoothed value is 0.0048. EWMA uses a weighting factor (α = 0.2) and the calculation formula is as follows: μ t =α·x t +(1-α)·μ t-1 where μ t is the smoothed value at the current moment, x t is the current sampling value, α is the weight factor, 0<α≤1. The standard deviation formula is Where σ is the standard deviation; μ is the data mean; x_i represents the i-th data point; and n represents the total number of data points.
[0021] Sampling rate adjustment: The sampling decision module compares the rate of change with a threshold of 0.01 (based on ±0.01V fluctuations). If the voltage rate of change is 0.015 > 0.01, the sampling rate is maintained at 1000Hz; if the temperature rate of change is 0.005 < 0.01, the sampling rate is reduced to 100Hz. This is to accommodate the resource limitations of the Cortex-M3.
[0022] Data storage and transmission: The data storage module saves the sampled data (storage capacity reduced by 70%–80%) or sends it to the PC via DMA, with additional CRC checksum and 70% reduction in analysis overhead.
[0023] Results: This method reduces storage requirements by 70%–80%, power consumption by 60%–70%, and parsing overhead by 70%. It is suitable for single-channel IoT sensor (low power consumption) or data upload power supply protocol testing (high real-time performance).
Claims
1. A method and system for adaptive sampling of multi-channel analog data based on sliding windows includes: Data acquisition module, collecting multi-channel analog data; Window setting module, dynamically setting the window size according to the frequency of changes and real-time requirements; Sliding window module, calculates the rate of change within the window; Sampling decision module, which adjusts the sampling rate according to the rate of change; high rate of change maintains high sampling rate, low rate of change reduces sampling rate; Data storage module: stores sampling data locally or sends it to the host computer for analysis.
2. The method according to claim 1, characterized in that The size of the sliding window is proportional to the current sampling rate, where: When the frequency of analog data changes exceeds the first threshold or real-time requirements are high, the sampling rate is increased and the sliding window size is proportionally reduced, preferably set to 2 to 5 times the current sampling period to quickly respond to data fluctuations; When the frequency of analog data changes is lower than the second threshold or the real-time requirement is low, the sampling rate is reduced and the sliding window size is proportionally expanded, preferably to 10 to 20 times the current sampling period, to reduce the computational burden and power consumption.
3. The method according to claim 1, characterized in that The rate of change can be evaluated after smoothing using an exponentially weighted moving average (EWMA). The EWMA calculation formula is as follows: m t =α·x t +(1-a)·m t-1 where μ t is the smoothed value at the current moment, x t is the current sampling value, α is the weight factor, 0<α≤1.
4. The method according to claim 1, wherein The rate of change is calculated by the standard deviation of the data in the window. The preset threshold is 0.
01. When the threshold is lower than the threshold, the sampling rate is reduced to 10% of the first sampling rate. The standard deviation formula is: Where σ is the standard deviation; μ is the data mean; x i represents the i-th data point; n represents the total number of data points.
5. The method according to claim 1, wherein Sampling rate adjustment and window size setting are performed in real time with low decision latency.
Citation Information
Cited By
Temperature control system and control method for energy storage system
CN122086155A