Unified time base construction method and system for low-power consumption pension sensing device

CN122994895APending Publication Date: 2026-10-27SHANGHAI XIEYING INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611108856.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0003]然而,现有NTP对时、常规最小二乘拟合两类主流同步方案适配性差,NTP依赖稳定双向链路,仅能粗同步,无法消除晶振长期累积偏差,常规最小二乘拟合需积累足量样本才能生效,设备新上线存在长时间校准盲区,易产生告警误判

Benefits of technology

其一,本发明可消除设备冷启动校准盲区,解决传统拟合方案上线无可靠时间基准的痛点。通过建立按设备型号索引的先验知识库,批量标定各型号晶振基准漂移参数与温度系数,设备首次上报报文即可结合实时温度完成初始时间校准,无需等待多组样本积累,冷启动阶段时间校准误差降低,从根源消除新设备部署初期的误告警、漏告警问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122994895A_ABST
    Figure CN122994895A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of Internet of Things smart endowment, and particularly discloses a unified time base construction method and system for low-power endowment sensing devices, which first analyzes heterogeneous device original messages to generate standard event message objects, maintains independent sliding windows for each device to generate time sample pairs, calls a device model prior knowledge base at a cold start, completes instant time calibration through temperature correction, adopts least square to solve measured parameters after the device accumulates sufficient samples, smoothes and switches calibration parameters through progressive weighted fusion, removes network abnormal samples based on a 3sigma criterion, sends calibration messages into a lock-free ring queue to realize high concurrency peak clipping, maintains cross-thread link tracking identification integrity with the aid of context snapshots, and distributes the calibration messages to business units according to channel states. The application can solve the problems of device cold start calibration blind area, crystal oscillator temperature drift and time sequence disorder, can construct a unified standard time axis, can accurately complete multi-device behavior time sequence determination, and can reduce endowment monitoring false alarm rates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of IoT smart elderly care technology, and in particular to a method and system for constructing a unified time base for low-power elderly care sensing devices. Background Technology

[0002] In the context of an aging population, smart elderly care monitoring systems in homes and institutions commonly deploy a large number of heterogeneous low-power sensing devices. Typical devices include NB-IoT door sensors, smart mattresses, millimeter-wave human body radar, infrared sensors, and wearable devices for the elderly. Due to hardware cost constraints, these devices all use low-cost civilian-grade quartz crystal oscillators. These crystal oscillators themselves have manufacturing tolerances, and their clock drift changes continuously with environmental temperature and long-term aging. At the same time, to save battery power, low-power devices generally adopt event-triggered intermittent reporting mechanisms, lacking a continuous real-time synchronization link, resulting in random fluctuations in message transmission delays between different terminals and different network channels.

[0003] However, the existing mainstream synchronization schemes, namely NTP time synchronization and conventional least squares fitting, have poor adaptability. NTP relies on a stable bidirectional link and can only achieve coarse synchronization, failing to eliminate long-term accumulated deviations of the crystal oscillator. Conventional least squares fitting requires a sufficient number of samples to be effective, and newly deployed equipment has a long calibration blind zone, which can easily lead to false alarms. At the same time, existing schemes do not take into account the device model and temperature characteristics for differentiated compensation, resulting in slow convergence speed. The message queue uses a mutex lock architecture, which is insufficient for throughput under tens of thousands of concurrent devices. Cross-thread tracing links are prone to breakage, and there is a lack of a globally unified time axis. The timing analysis accuracy of multi-device linkage behavior is low. Overall, they cannot meet the timing calibration requirements of large-scale elderly care monitoring.

[0004] Therefore, there is an urgent need for a unified time base construction method and system for low-power elderly care sensing devices to solve the above problems. Summary of the Invention

[0005] The purpose of this invention is to provide a unified time base construction method for low-power elderly care sensing devices, comprising the following steps: Obtain the original messages reported by each heterogeneous elderly care sensing device, perform protocol parsing on the original messages, extract the device model identifier, device local timestamp, event type and ambient temperature, and generate a standard event message object; The prior knowledge base is queried based on the device model identifier to determine whether the current device is in a cold start state. If it is in a cold start state, the prior calibration parameters corresponding to the device model are loaded, initial time calibration based on temperature compensation is performed, and the standard timestamp after initial calibration is output. If it is not in a cold start state, the accumulated time sample pairs are read from the sliding window maintained for the device, the least squares fitting is performed to obtain the measured calibration parameters, and the fused calibration parameters are calculated through progressive weighted fusion, and the standard timestamp after fused calibration is output. The calibrated standard event message object and its corresponding standard timestamp are pushed to a lock-free circular queue, and peak smoothing and buffering are performed by concurrent enqueuing by multiple producer threads and batch dequeuing by consumer threads. Each standard event message object entering the lock-free circular queue is assigned a globally unique tracing identifier, and when the message processing flow crosses a thread boundary, a context snapshot of the current thread is captured, and the context snapshot is restored in the target thread to maintain the continuity of the tracing identifier. Based on the preset routing rules and the real-time feedback status of each distribution channel, the standard event message object, after calibration and buffering, is distributed to the corresponding business processing unit.

[0006] Furthermore, this invention also discloses a unified time-based platform construction system for low-power elderly care sensing devices, comprising: The acquisition module is used to acquire the original messages reported by various heterogeneous elderly care sensing devices, perform protocol parsing on the original messages, extract the device model identifier, device local timestamp, event type and ambient temperature, and generate a standard event message object. The judgment module is used to query the prior knowledge base based on the device model identifier to determine whether the current device is in a cold start state: if it is in a cold start state, it loads the prior calibration parameters corresponding to the device model, performs initial time calibration based on temperature compensation, and outputs the standard timestamp after initial calibration; if it is not in a cold start state, it reads the accumulated time sample pairs from the sliding window maintained for the device, performs least squares fitting to obtain the measured calibration parameters, calculates the fused calibration parameters through progressive weighted fusion, and outputs the standard timestamp after fused calibration. The processing module is used to push the calibrated standard event message object and its corresponding standard timestamp to a lock-free circular queue, and perform peak smoothing and buffering processing by having multiple producer threads concurrently enqueue and consumer threads batch dequeue. The allocation module is used to assign a globally unique tracing identifier to each standard event message object entering the lockless circular queue, and to capture a context snapshot of the current thread when the message processing flow crosses the thread boundary, and restore the context snapshot in the target thread to maintain the continuity of the tracing identifier. The distribution module is used to distribute the calibrated and buffered standard event message objects to the corresponding business processing units according to preset routing rules and the real-time receipt status of each distribution channel.

[0007] The beneficial effects of this application are as follows: Firstly, this invention eliminates the blind spot in cold start calibration of equipment, solving the pain point of traditional fitting schemes lacking a reliable time reference. By establishing a prior knowledge base indexed by equipment model, the drift parameters and temperature coefficients of crystal oscillators for each model are calibrated in batches. The initial time calibration can be completed by combining the real-time temperature with the first report message from the equipment, without waiting for the accumulation of multiple sets of samples. The time calibration error during the cold start phase is reduced, eliminating the problem of false alarms and missed alarms in the early stage of new equipment deployment from the root.

[0008] Secondly, this invention enables seamless and smooth iteration of calibration parameters, avoiding time axis jumps caused by direct switching between prior and measured parameters. By designing a piecewise linear fusion weight calculation logic, the proportion of measured fitting parameters is gradually increased as the number of samples grows, smoothly transitioning from group calibration characteristics to individual device drift characteristics, with no sudden changes in the time base throughout the process, ensuring stable and uninterrupted temporal analysis of the elderly's continuous behavior.

[0009] Third, this invention can improve the anti-interference capability of the time calibration model and offset the sample distortion caused by instantaneous jitter in the NB-IoT network. By embedding an abnormal sample rejection mechanism based on the Raida criterion into the calibration process, the time sample with abnormal transmission delay is automatically identified and discarded. The compensation parameters are refitted based on the valid samples, and the stability of the time axis is significantly improved in complex fluctuating network environments.

[0010] Fourth, this invention balances short-term temperature compensation with long-term crystal oscillator aging tracking, continuously maintaining a high-precision time reference over the long term. On one hand, it calculates a comprehensive frequency compensation factor based on a linear temperature drift model to offset the crystal oscillator frequency deviation caused by changes in ambient temperature in real time. On the other hand, it sets up a slow tracking mechanism to periodically monitor the long-term aging drift of the crystal oscillator, automatically attenuating and reducing the weight of old samples, while writing the updated model parameters back to the knowledge base. Subsequent new equipment can reuse historical calibration experience, and the convergence speed of batch deployment is continuously improved. Attached Figure Description

[0011] Figure 1 This is a schematic diagram of the method flow proposed in Embodiment 1 of this application.

[0012] Figure 2 This is a schematic diagram of the method flow proposed in Embodiment 2 of this application.

[0013] Figure 3 This is a schematic diagram of the method flow proposed in Embodiment 3 of this application.

[0014] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0015] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0016] This invention discloses a unified time base construction method for low-power elderly care sensing devices, primarily applied to scenarios such as smart home-based elderly care and centralized monitoring in elderly care institutions. It addresses industry pain points such as clock drift, inconsistent time bases, cold start calibration blind spots, message concurrency processing lag, cross-device behavior timing errors, and high alarm false alarm rates among various types of heterogeneous low-power sensing devices. The core of this invention achieves blind-spot-free cold start calibration through a prior knowledge base of device models. It combines sliding window sample iteration, least squares fitting, progressive weighted fusion, and anomaly sample removal mechanisms to achieve high-precision time calibration throughout the entire lifecycle. Coupled with lock-free circular queue high-concurrency message buffering, end-to-end thread mirroring, and dynamic business routing distribution, it constructs a unified time base adaptable to the access of tens of thousands of heterogeneous elderly care devices, accurately reproducing the daily behavior timing of the elderly and reducing the probability of false alarms and missed detections in elderly care monitoring.

[0017] The heterogeneous elderly care sensing devices applicable to this invention mainly include NB-IoT door magnetic devices, millimeter-wave radar human body monitoring devices, smart mattress leave-bed monitoring devices, infrared human body sensing devices, and low-power wearable elderly care devices. These devices all employ low-cost hardware crystal oscillators and low-power event-triggered reporting mechanisms, and generally suffer from clock drift and unstable reporting delays. The following, in conjunction with the optimal embodiment of this invention, along with typical device models, complete parameter sources, detailed calculations, and scenario-based operating logic, provides a complete, clear, and reproducible explanation of the technical solution of this invention. Those skilled in the art can fully implement this invention without creative effort.

[0018] To facilitate understanding by those skilled in the art, the NB-Door-200 NB-IoT door magnetic device, the core device of this embodiment, will be described in detail first. This device is the core calibration device of the prior knowledge base of this invention, and is a heterogeneous low-power sensing device that is frequently deployed in elderly care scenarios. It serves as the hardware carrier for all subsequent embodiments.

[0019] Front-end device introduction: NB-Door-200 NB-IoT door magnetic device.

[0020] The NB-Door-200 is a low-power NB-IoT narrowband Internet of Things door magnetic sensor device customized for smart elderly care scenarios. It does not require a gateway and can be directly connected to the elderly care IoT cloud platform. It is mainly deployed in the bathroom doors, bedroom doors, and entrance doors of elderly care homes to monitor the opening and closing status of doors and windows. It is a core basic device for sensing the behavior trajectory and home activity status of the elderly.

[0021] The device adopts a split structure, consisting of a main sensing unit and a passive permanent magnet strip assembly, allowing for drill-free adhesive installation and adapting to home renovation needs in elderly care scenarios. Core hardware components include: a low-power NB-IoT communication module, a low-cost civilian-grade quartz crystal oscillator, a high-precision patch temperature sensor, a reed switch sensing component, a battery power supply unit, and a data storage and reporting control unit. This device is an event-triggered reporting device, without a timed polling mechanism. It actively uploads raw messages only when the door / window opening / closing state changes. Each raw message carries four core fields that perfectly match the parsing parameters required by the method of this invention: a unique device model identifier (NB-Door-200), a local timestamp (the real-time event occurrence time recorded by the device's crystal oscillator), an event type (door magnetic open / door magnetic closed), and an ambient temperature (the real-time ambient temperature collected by the device's built-in temperature sensor).

[0022] Due to hardware cost constraints, the device uses a low-cost civilian crystal oscillator, which has inherent manufacturing tolerances and temperature sensitivity issues. Under standard 25°C room temperature conditions, the device's clock drifts by an average of about 0.36 seconds per day. After long-term operation, it will cause a time deviation of several seconds to tens of seconds compared with other elderly care devices such as millimeter-wave radar and smart mattresses. At the same time, the NB-IoT cellular network has random jitter, and the device reporting delay is not fixed, which causes the timing of the server receiving messages to be out of sync with the timing of actual events.

[0023] More importantly, during the cold start phase of newly deployed equipment, there is no time-based calibration basis. Traditional calibration schemes require accumulating more than 30 sets of samples to complete the fitting calibration, resulting in a calibration blind spot of several hours to several days, which can easily lead to misjudgments of elderly behavior and incorrect risk alarms. Therefore, this equipment is a typical adaptable device for the cold start temperature compensation calibration, progressive parameter fusion, and abnormal sample rejection mechanism of this invention, and it is also the core calibration sample device for the prior knowledge base of this invention.

[0024] In the cloud-based prior knowledge base of this invention, all prior fixed parameters of the NB-Door-200 device are obtained through batch sampling calibration tests, possessing engineering universality: 100 brand-new devices of the same model are selected and continuously monitored for 7 days at a standard ambient temperature of 25℃. The deviation data between the device's local clock and the server's standard clock are recorded. The initial values ​​of the typical frequency compensation factor and the typical fixed offset at the standard temperature are obtained through linear regression fitting. At the same time, the test is repeated at three typical temperature nodes in elderly care scenarios: 10℃, 25℃, and 40℃. The crystal oscillator temperature sensitivity coefficient is obtained through fitting. Finally, the device's exclusive prior parameters are formed and entered into the knowledge base. The parameters are authentic, reliable, and adapted to the temperature environment of elderly care scenarios.

[0025] This invention's embodiments have the following preset global fixed parameters (all engineering optimal values, adaptable to all types of low-power elderly care sensing devices): minimum effective fitted sample number N=30, additional sample number required for complete switching N=50, maximum sample number threshold for sliding window N=200, standard reference temperature T=25℃, abnormal sample judgment threshold is 3 times the residual standard deviation, crystal oscillator aging slow tracking detection cycle is 100 samples, aging judgment consecutive exceedance number K=3, and aging deviation threshold. =1×10.

[0026] Example 1 like Figure 1 As shown, the specific implementation example of the device cold start full-process calibration and message distribution is as follows: This embodiment uses a newly deployed NB-Door-200 NB-IoT door magnetic device that has never been connected to a system as a carrier to fully reproduce the entire execution process of the method of the present invention under cold start state. It focuses on explaining the complete logic of device cold start determination, prior parameter loading, temperature compensation calibration, sliding window initialization, lockless queue buffering, full-link tracing, and dynamic service routing. It details the method of obtaining all parameters and the derivation process of calculation formulas, and solves the problem of blind spots in cold start calibration of traditional solutions.

[0027] like Figure 1 As shown, this application provides a unified time base construction method for low-power elderly care sensing devices, including the following steps: S1: Raw message reception and standard event message object generation.

[0028] The new NB-Door-200 door sensor device is initially powered on and deployed on the door frame of the bathroom in the senior living room. After the device completes its self-test, if the user goes to the toilet at night and the bathroom door is opened, the device triggers an event report and reports the original message to the senior living monitoring server through the NB-IoT private protocol.

[0029] The server message access layer listens to the device's reported messages in real time, and completes the identification of private protocol features, message parsing and field extraction. The core parameters extracted in this case (all are raw data reported by the device in real time, without manual assignment) are: device model identifier = NB-Door-200, device local timestamp T = 1640995200.000 seconds, event type = bathroom door magnetic sensor open, ambient temperature T = 28℃.

[0030] Based on the above four core fields, the access layer encapsulates and generates standardized event message objects according to the system's preset unified data format, completing the standardized conversion of the raw data and providing a unified data carrier for subsequent time calibration and message processing.

[0031] S2: New sliding window creation, generation of time sample pairs, and cold start status determination.

[0032] This step involves maintaining a dedicated data cache for each heterogeneous elderly care sensing device. The core function is to isolate time data for a single device, avoiding cross-interference between data from multiple devices. All parameters are collected in real time and automatically matched without manual intervention.

[0033] First, the server accurately records the system standard clock time at the moment the message is received, generating a server receiving timestamp T=1640995200.520 seconds. This timestamp is the system's global standard time and serves as the benchmark for time calibration of all devices, with an accuracy down to the millisecond level.

[0034] The device's local timestamp is then paired with the server's received timestamp to generate a unique time sample pair corresponding to this event, s=(1640995200.000,1640995200.520). This sample pair is the core basic data for subsequent fitting and calibration.

[0035] The system retrieves local cached device lists by device model identifier. Finding no cached data or sliding window for the NB-Door-200 device, it automatically creates a new independent sliding window for this device. The window is initially blank, with a current sample count of 0. Based on the judgment rules, the system accurately determines that the device is in a cold start state when the current sample count is zero, triggering the cold start-specific calibration logic.

[0036] S3: Sliding window capacity initialization management.

[0037] The system retrieves global preset parameters and obtains the maximum number of samples threshold for the sliding window as 200. This threshold is the optimal value for engineering, which can balance the sample fitting accuracy and system memory usage, and avoid the problems of redundant computing power caused by too much window data and fitting distortion caused by too little data.

[0038] The current number of samples in the sliding window is 0, which is below the maximum sample count threshold. Therefore, there is no need to clear historical data; the newly generated time sample pairs will be directly appended to the end of the sliding window. After the data is stored, the system automatically updates the current sample count in the sliding window to 1, and simultaneously updates the window status identifier in the device's calibration parameter record, marking it as "Cold Start Status, Valid Sample Count 1, Fitting Threshold Not Reached," thus completing window initialization and status recording.

[0039] S4: Initial time calibration for cold start temperature compensation.

[0040] This step is the core improvement to address the lack of calibration blind spots in traditional cold-start solutions. It eliminates the need to accumulate sufficient samples, relying on prior parameters calibrated in batches using the same model of equipment, and combining them with real-time ambient temperature to complete accurate calibration. All parameter sources and calculation processes are completely reproducible.

[0041] S41, Prior Parameter Loading; The system uses the device model identifier NB-Door-200 as the search index, queries the cloud-based prior knowledge base, and accurately matches the calibration parameter set for this device model. These parameters are all obtained from batch device testing and fitting, specifically: the initial value of the typical frequency compensation factor. =1.0000042, Typical fixed offset initial value = -0.15 seconds, typical temperature coefficient =0.035× / ℃. If an unknown device model is subsequently connected or the knowledge base is not hit, the system will automatically assign a default value. =1、 =0、 =0, ensuring the universality of the solution.

[0042] S42, Reference Time Lock; The system locks the device's local timestamp of the first event reported by the device and records it as the reference time. =1640995200.000 seconds. This parameter is permanently bound to the device calibration record and used for all subsequent temperature compensation and duration accumulation calculations. It serves as the starting point of the time base for the entire life cycle operation of the device and extracts the local timestamp of the device corresponding to this report. Equipment ambient temperature .

[0043] S43, Temperature compensation offset calculation; Based on the prior temperature coefficient, the difference between the real-time ambient temperature and the 25℃ standard reference temperature, a comprehensive frequency compensation factor is calculated. This factor uniformly incorporates the inherent crystal oscillator deviation at the equipment's factory and the frequency drift caused by temperature. The calculation formula is as follows: in, As a comprehensive frequency compensation factor, The system is preset with a standard reference temperature, which is fixed at 25℃. For example, when the first report is of the cumulative operating time of no equipment, the temperature compensation offset is 0, which is consistent with the physical logic.

[0044] S44, Standard timestamp calibration calculation; Combining the comprehensive frequency compensation factor, the local timestamp, and the initial value of a typical fixed offset, the calibrated standard timestamp is calculated using the following formula: ; Among them, the This represents the calibrated standard timestamp. This represents the initial value of a typical fixed offset.

[0045] The system binds the calibrated standard timestamp to the current standard event message object, completing the first high-precision time calibration during the device's cold start phase. This completely solves the technical blind spot of no calibration during cold start in traditional solutions, and reduces the initial time error compared to uncalibrated solutions.

[0046] S5: Lock-free circular queue peak-shaving and buffering processing; To adapt to message scenarios with tens of thousands of devices reporting concurrently, the system adopts a lock-free circular queue architecture to replace the traditional lock mechanism queue, eliminating thread lock waiting overhead and achieving high throughput and low latency message buffering. The specific execution logic is as follows: The server memory automatically allocates a circular buffer with contiguous addresses and a fixed size per slot. It initializes the producer head pointer, producer tail pointer, consumer head pointer, and consumer tail pointer, setting all pointers to 0 initially, and the buffer is empty.

[0047] In this process, the message receiving thread acts as an independent producer thread. It achieves lock-free concurrent operation by atomically comparing and exchanging CAS instructions, atomically updating the producer's tail pointer, accurately obtaining empty slots, writing standard event message objects bound to standard timestamps into the corresponding slots, and atomically updating the producer's head pointer after writing. This completes the lock-free enqueueing of a single message, with no thread blocking and no data conflicts throughout the entire process.

[0048] The consumer thread polls the buffer pointer status in real time to identify messages to be consumed. It then reads messages in batches according to the system's preset batch consumption rules (maximum 10 messages per batch), but in this instance, only a single message is read directly. After reading, the consumer header pointer is atomically updated using a CAS instruction, marking the read slot as idle to achieve buffer reuse. Finally, the calibrated standard event message object is forwarded to the tracing protection module.

[0049] S6: Cross-thread context snapshot tracing; To ensure the traceability of message processing across threads and modules, the system maintains the continuity of the tracking identifier through a context mirroring recovery mechanism, thus resolving the issue of tracking link breaks caused by multi-threaded processing. The moment a standard event message object enters the lock-free circular queue, the current producer thread automatically assigns a globally unique trace ID, TraceID=TRACE-20260521-00001, and encapsulates this ID into the thread call context object, uniquely associating it with the message.

[0050] When a message flows from the producer thread to the consumer thread, the system triggers a context capture mechanism to extract the complete context information of the current thread containing the TraceID, generate a static context snapshot, and pass the snapshot as an entry parameter to the consumer thread.

[0051] Before starting a task, the consumer thread automatically parses the context snapshot, restores and injects the TraceID into its own call context, retaining a unique trace identifier throughout the process. This identifier is carried throughout the entire process of message routing, analysis, storage, and alerting, enabling observability and traceability of the entire message lifecycle from access to delivery.

[0052] S7: Dynamic service routing distribution; The dynamic business routing layer reads the event type, device type, and scene tag of the standard event message object in real time, matches it with the preset business routing rules, and at the same time monitors the network receipt status, online status, and load status of each distribution channel in real time.

[0053] This event involved the opening of the bathroom door magnetic sensor. The system determined that the data needed to be pushed to the multi-device behavior correlation analysis unit (for verifying the timing of elderly people's toilet use behavior) and the data persistence storage unit (for retaining historical data). Currently, both business channels are online, have no load anomalies, and have normal delivery receipts. The system directly distributed the calibrated standard event message object to the corresponding business unit, completing the cold start full-process message processing.

[0054] Example 2 like Figure 2 As shown, the specific implementation examples of steady-state sample iteration, least squares fitting, and outlier removal are as follows: This embodiment is based on the continuous operation scenario of the NB-Door-200 door magnetic device deployed in Embodiment 1. After the device is running stably, it triggers an event report once per hour and continuously accumulates time sample pairs, gradually transitioning from the cold start prior calibration stage to the steady-state measured calibration stage. This embodiment focuses on refining the sample statistical logic of least squares fitting, the residual calculation principle, and the criteria for judging the removal of abnormal samples, solving the problems of sample distortion and calibration parameter deviation caused by network jitter, and further improving the accuracy of the time base.

[0055] S1: Dynamic capacity update of the sliding window.

[0056] The device continuously and stably reports event messages, and the number of time sample pairs within the sliding window continues to accumulate. When the number of samples reaches the preset maximum sample number threshold of 200, the system activates a dynamic capacity management mechanism to achieve rolling updates: after a new sample is generated, the oldest historical sample pair stored at the head of the sliding window is automatically removed, and the new time sample pair is appended to the tail of the window, always keeping only the latest 200 sets of valid samples in the window, ensuring that the fitted data fits the current real-time operating status of the device, and avoiding interference from old historical data with the current calibration accuracy.

[0057] S2: Non-cold start determination and least squares fitting parameter solution.

[0058] After the device has reported a total of 60 messages, the number of valid samples in the sliding window is n=60. Since the number of samples is greater than 0, the system determines that the device is not in a cold start state, exits the pure prior calibration mode, and starts the least squares fitting algorithm to solve for the measured calibration parameters of the device. This fitting is based on all 60 valid time sample pairs within the window. All samples are data collected in real time during device operation, which truly reflects the current crystal oscillator drift state of the device.

[0059] S21, Calculation of sample mean; Calculate the first sample mean of the local timestamps of all devices within the window and the second sample mean of the timestamps received by the server. The mean is the basic statistic for the fitting calculation, and the calculation formula is as follows: ; ; In the formula: n=60 is the current number of valid samples. The device local timestamp representing the i-th sample group, the This represents the server receiving timestamp of the i-th sample group. The first sample mean (device local timestamp mean) represents the mean of the first sample. Let T represent the mean of the second sample (the mean of the server received timestamps), T be the device local timestamp of the i-th sample, and T be the server received timestamp of the i-th sample.

[0060] S22, Calculation of measured frequency compensation factor; Based on the covariance and variance ratio of the sample differences, the current true crystal oscillator frequency drift coefficient of the device is calculated using the following formula: ; in, α̂ represents the measured frequency compensation factor, and n represents the total number of valid samples in the sliding window. Substituting 60 sets of measured sample data, the measured frequency compensation factor α̂ = 1.0000057 is finally obtained. This value truly reflects the actual crystal oscillator drift after long-term operation of the equipment. Compared with fixed prior parameters, the individual adaptation accuracy is higher.

[0061] S23, Calculation of measured fixed offset; Combining the mean and frequency compensation factor, the inherent fixed time deviation of the equipment hardware is calculated using the following formula: ; Among them, the This represents the measured fixed offset, used to accurately correct fixed time deviations caused by initial equipment installation and inherent hardware limitations.

[0062] S3: Fitting residual calculation and outlier removal.

[0063] In elderly care settings, NB-IoT networks are prone to momentary congestion and signal fluctuations, resulting in a small number of abnormal delay samples that interfere with fitting accuracy. This invention uses residual analysis and the 3σ Laida criterion to accurately remove outlier data, improving calibration robustness. The specific process is as follows: S31, Calculation of single-sample fitting residuals; The residual characterizes the deviation between the actual value and the fitted predicted value of a single sample, and is the core basis for anomaly detection. The calculation formula is as follows: ; in, This represents the fitting residual for the i-th sample group. In this fitting calculation, the 37th sample group experienced an abnormally increased transmission delay due to momentary congestion in the NB-IoT network, resulting in a different fitting residual. =0.85 seconds, and the residuals of the remaining 59 groups of samples were evenly distributed in the range of ±0.15 seconds, with no obvious abnormalities.

[0064] S32, Calculation of residual statistical parameters; The mean and standard deviation of the residuals for all samples are used to define the outlier threshold. The calculation formula is as follows: ; ; Among them, the This represents the mean of the residuals. This represents the sample standard deviation of the residuals.

[0065] S33, Anomaly detection and quadratic fitting; Anomaly detection rule: When the absolute value of a single sample residual is greater than 3 times the standard deviation of the residual, it is determined to be an abnormal sample caused by network jitter and is removed.

[0066] After removing outlier samples, 59 valid samples remain in the window. The system re-executes least squares fitting based on the valid samples to obtain updated accurate parameters: updated measured frequency compensation factor = 1.0000056, updated measured fixed offset = -0.31 seconds, completely eliminating the impact of instantaneous network disturbances on time calibration accuracy and ensuring the stability of steady-state calibration.

[0067] Example 3 like Figure 3 As shown, the specific implementation of the gradual weighted fusion parameter smooth transition is as follows: Based on the steady-state fitting in Example 2, this embodiment elaborates on the progressive weighted fusion logic of prior parameters and measured parameters, solving the problems of time axis jumps and behavioral timing disorder caused by direct switching between prior parameters and measured parameters in traditional schemes. It achieves seamless and smooth iteration of calibration parameters, and all weight calculations and parameter fusion processes are completely traceable.

[0068] S1: Calculation of fusion weights.

[0069] The system retrieves globally preset parameters: minimum number of effective fitted samples N=30, additional samples required for complete switching N=50, and dynamically calculates the fusion weight based on the current number of samples in the sliding window. The weight calculation formula is as follows: ; Among them, the The progressive fusion weights are represented by the following: The minimum number of valid fitted samples is represented by the following. This indicates the number of additional samples required for a complete switch.

[0070] Weighting logic: when n≤30, w=0, completely dependent on prior parameters; when 30<n<80, the weights increase linearly; when n≥80, w=1, completely switching to measured parameters.

[0071] When the number of samples n=30: w=0, the system fully uses the prior parameters of the knowledge base to ensure the calibration stability during the insufficient sample stage; When the number of samples n=60: w=(60-30) / 50=0.6, the smooth transition stage begins; When the sample size n=80: w=1, the parameters are completely switched to the actual measured fitting parameters of each individual device.

[0072] S2: Weighted fusion calculation of calibration parameters.

[0073] Based on dynamic weights, the prior typical parameters and the measured fitted parameters are linearly weighted and fused to avoid abrupt parameter changes. The fusion calculation formula is as follows: ; ; Among them, the The frequency compensation factor after fusion is represented by the following. This represents the fixed offset after merging.

[0074] Taking n=60 and w=0.6 as an example, substitute the parameters to calculate: ; .

[0075] After calculation, the system persistently stores the fused frequency compensation factor and fixed offset in the device-specific calibration parameter record, replacing the old parameters in real time for subsequent time calibration. As the number of samples continues to increase, the weight of the measured parameters gradually increases, eventually completely covering the prior parameters, achieving a seamless transition from "general group calibration" to "precise individual adaptation," with no timeline jumps or behavioral timing errors throughout the process.

[0076] Evidence of the overall beneficial effects of the technical solution of this invention As can be seen from the above multi-stage complete implementation, compared with traditional time calibration schemes for elderly care equipment, the present invention has strong engineering practicality and technological advancement: First, it completely fills the blind spot of cold start calibration, enabling high-precision time calibration immediately upon the launch of new equipment without waiting for sample accumulation; second, it achieves smooth parameter iteration through a progressive fusion mechanism, avoiding disturbances caused by system parameter switching; third, it resists network environment interference through an abnormal sample removal mechanism, improving adaptability to complex scenarios; fourth, it supports high-concurrency access of tens of thousands of devices based on lock-free queues and link tracing mechanisms; and fifth, it accurately unifies the time benchmark of multiple heterogeneous devices, completely solving the industry pain points of disordered behavior timing and misjudgment or omission of risks, greatly improving the accuracy and stability of the smart elderly care monitoring system.

[0077] This invention also discloses a unified time-based base construction system for low-power elderly care sensing devices, comprising: The acquisition module is used to acquire the original messages reported by various heterogeneous elderly care sensing devices, perform protocol parsing on the original messages, extract the device model identifier, device local timestamp, event type and ambient temperature, and generate a standard event message object. The judgment module is used to query the prior knowledge base based on the device model identifier to determine whether the current device is in a cold start state: if it is in a cold start state, it loads the prior calibration parameters corresponding to the device model, performs initial time calibration based on temperature compensation, and outputs the standard timestamp after initial calibration; if it is not in a cold start state, it reads the accumulated time sample pairs from the sliding window maintained for the device, performs least squares fitting to obtain the measured calibration parameters, calculates the fused calibration parameters through progressive weighted fusion, and outputs the standard timestamp after fused calibration. The processing module is used to push the calibrated standard event message object and its corresponding standard timestamp to a lock-free circular queue, and perform peak smoothing and buffering processing by having multiple producer threads concurrently enqueue and consumer threads batch dequeue. The allocation module is used to assign a globally unique tracing identifier to each standard event message object entering the lockless circular queue, and to capture a context snapshot of the current thread when the message processing flow crosses the thread boundary, and restore the context snapshot in the target thread to maintain the continuity of the tracing identifier. The distribution module is used to distribute the calibrated and buffered standard event message objects to the corresponding business processing units according to preset routing rules and the real-time receipt status of each distribution channel.

[0078] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in this application and in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0079] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0080] The above description is merely a preferred embodiment of the present invention and does not limit the scope of this application. Any equivalent results or equivalent process transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.

Claims

1. A method for constructing a unified time base for low-power elderly care sensing devices, characterized in that, Includes the following steps: Obtain the original messages reported by each heterogeneous elderly care sensing device, perform protocol parsing on the original messages, extract the device model identifier, device local timestamp, event type and ambient temperature, and generate a standard event message object; The prior knowledge base is queried based on the device model identifier to determine whether the current device is in a cold start state. If it is in a cold start state, the prior calibration parameters corresponding to the device model are loaded, the initial time calibration based on temperature compensation is performed, and the standard timestamp after the initial calibration is output. If it is not a cold start state, the accumulated time sample pairs are read from the sliding window maintained for the device, the least squares fitting is performed to obtain the measured calibration parameters, and the fused calibration parameters are calculated by progressive weighted fusion, and the fused calibration standard timestamp is output. The calibrated standard event message object and its corresponding standard timestamp are pushed to a lock-free circular queue, and peak smoothing and buffering are performed by concurrent enqueueing by multiple producer threads and batch dequeueing by consumer threads. Assign a globally unique tracing identifier to each standard event message object entering the lock-free circular queue, and capture a context snapshot of the current thread when the message processing flow crosses a thread boundary, and restore the context snapshot in the target thread to maintain the continuity of the tracing identifier; Based on the preset routing rules and the real-time feedback status of each distribution channel, the standard event message object, after calibration and buffering, is distributed to the corresponding business processing unit.

2. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, Before determining whether the current device is in a cold start state by querying the prior knowledge base based on the device model identifier, the process also includes the step of establishing and maintaining independent sliding windows for each heterogeneous elderly care sensing device: Obtain the device model identifier and the device local timestamp from the standard event message object, and record the server receiving timestamp using the system clock when the server receives the original message; The device's local timestamp is paired with the timestamp received by the server to form a time sample pair; The sliding window corresponding to the device is located according to the device model identifier. The current number of samples in the sliding window is obtained. The current number of samples is used to determine whether the current device is in a cold start state: if the current number of samples is zero or less than the preset minimum number of effective fitted samples, it is determined to be in a cold start state; otherwise, it is determined to be in a non-cold start state. The time sample pairs are stored at the end of the sliding window, and the current sample count is updated after storage.

3. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 2, characterized in that, Before storing the time sample pairs at the end of the sliding window, the method further includes a step of managing the capacity of the sliding window: Obtain the current number of samples in the sliding window and the preset maximum number of samples threshold; Determine whether the current number of samples has reached the maximum number of samples threshold. If it has, remove the first time sample pair stored at the head of the sliding window, and then append the current time sample pair to be stored to the tail of the sliding window. If the target is not reached, the current time sample pair to be stored is directly appended to the end of the sliding window; After the storage operation is completed, update the current number of samples in the sliding window.

4. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, The initial time calibration based on temperature compensation includes the following steps: The prior knowledge base is queried according to the device model identifier to obtain the initial value of the typical frequency compensation factor, the initial value of the typical fixed offset, and the typical temperature coefficient corresponding to the device model. If the query does not find a match, the initial value of the typical frequency compensation factor, the initial value of the typical fixed offset, and the typical temperature coefficient are set to the default values. Record the device's local timestamp when the device first reports as a reference time, and obtain the device's local timestamp and the ambient temperature for the current report; The temperature compensation offset is calculated based on the typical temperature coefficient, the difference between the ambient temperature and the preset standard reference temperature, and the difference between the device's local timestamp and the reference time. Based on the initial value of the typical frequency compensation factor and the temperature compensation offset, a comprehensive frequency compensation factor is calculated, and based on the comprehensive frequency compensation factor, the device local timestamp, and the initial value of the typical fixed offset, the standard timestamp after initial calibration is calculated.

5. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, The process of reading accumulated time sample pairs from a sliding window maintained for the device and performing least-squares fitting to obtain measured calibration parameters includes the following steps: Read all current time sample pairs from the sliding window and obtain the device local timestamp and server received timestamp from each time sample pair; Calculate the first sample mean of the local timestamps of all devices in the sliding window, and the second sample mean of the timestamps received by all servers; The measured frequency compensation factor is calculated based on the first difference between the local timestamp of each device and the mean of the first sample, and the second difference between the received timestamp of each server and the mean of the second sample. The measured fixed offset is calculated based on the measured frequency compensation factor, the mean of the second sample, and the mean of the first sample.

6. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, The calculation of the fused calibration parameters through progressive weighted fusion includes the following steps: Obtain the current number of samples in the sliding window, the preset minimum number of effective fitted samples, and the preset number of additional samples required for a complete switch; The fusion weight is calculated based on the difference between the current number of samples and the minimum effective fitted sample number, as well as the additional number of samples required for the complete switch. The fusion weight is 0 when the current number of samples is less than or equal to the minimum effective fitted sample number, the fusion weight is 1 when the current number of samples is greater than or equal to the sum of the minimum effective fitted sample number and the additional number of samples required for the complete switch, and the fusion weight increases linearly between 0 and 1 when the current number of samples is between the two. Obtain the initial values ​​of typical frequency compensation factors and typical fixed offsets stored in the prior knowledge base, and combine them with the measured frequency compensation factors and the measured fixed offsets. According to the fusion weight, the initial values ​​of typical frequency compensation factors and the measured frequency compensation factors are weighted and summed to obtain the fused frequency compensation factors. The initial values ​​of typical fixed offsets and the measured fixed offsets are weighted and summed to obtain the fused fixed offsets. The calculated fused frequency compensation factor and the fused fixed offset are stored in the calibration parameter record of the device.

7. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, After obtaining the measured calibration parameters by performing least-squares fitting, the process also includes an outlier removal step: The fitting residual for each time sample pair is calculated based on the device local timestamp and the server received timestamp in each time sample pair, as well as the measured frequency compensation factor and the measured fixed offset. Calculate the mean residual and standard deviation of the residuals for all time sample pairs in the sliding window; Determine whether the absolute value of the fitting residual for each time sample pair is greater than three times the standard deviation of the residual samples. If it is greater, then the time sample pair is determined to be an abnormal sample pair and removed from the sliding window. If it is less than or equal to, then retain the time sample pair; After removing all abnormal sample pairs, the least squares fitting is re-executed based on the remaining sample pairs in the sliding window to obtain the updated measured frequency compensation factor and the updated measured fixed offset.

8. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, The process of pushing the calibrated standard event message object and its corresponding standard timestamp to a lock-free circular queue, and performing peak-shaving buffering through concurrent enqueueing by multiple producer threads and batch dequeueing by consumer threads, includes the following steps: A circular buffer with contiguous addresses is allocated in memory. The circular buffer is configured with producer pointers and consumer pointers. Each storage unit is used to store one calibrated standard event message object. When multiple producer threads concurrently perform enqueue operations on the circular buffer, each producer thread updates the producer pointer through atomic operations, atomically obtains an available empty storage unit, and writes the calibrated standard event message object into the empty storage unit. When the consumer thread performs a dequeue operation from the circular buffer, the consumer thread determines whether there are messages to be consumed in the circular buffer based on the consumer pointer and the producer pointer. If there are, it reads a preset number of standard event message objects in batches from the storage unit pointed to by the consumer pointer, and updates the consumer pointer through atomic operations to mark the read storage unit as idle in an atomic manner. The consumer thread forwards the standard event message objects read in batches to the dynamic business routing layer for distribution processing in the order they are read.

9. The method for constructing a unified time base for low-power elderly care sensing devices according to claim 1, characterized in that, The step of capturing a context snapshot of the current thread when the message processing flow crosses a thread boundary and restoring the context snapshot in the target thread includes the following steps: When the calibrated standard event message object enters the lock-free circular queue, the current processing thread assigns a globally unique tracing identifier to the standard event message object and encapsulates the tracing identifier in the call context object; When the processing flow of the standard event message object needs to switch from the current thread to the target thread, a context capture operation is performed in the current thread to extract context information containing the link tracing identifier from the call context object and generate a context snapshot; The context snapshot is passed to the target thread. Before the target thread starts executing the processing task of the standard event message object, the tracing identifier is parsed from the context snapshot and injected into the call context object of the target thread. Throughout the process of processing the standard event message object, the target thread transmits the tracing identifier along with the standard event message object to each subsequent processing stage until the standard event message object is completely processed.

10. A unified time base construction system for low-power elderly care sensing devices, characterized in that, include: The acquisition module is used to acquire the original messages reported by various heterogeneous elderly care sensing devices, perform protocol parsing on the original messages, extract the device model identifier, device local timestamp, event type and ambient temperature, and generate a standard event message object. The judgment module is used to query the prior knowledge base based on the device model identifier to determine whether the current device is in a cold start state. If it is in a cold start state, the prior calibration parameters corresponding to the device model are loaded, the initial time calibration based on temperature compensation is performed, and the standard timestamp after the initial calibration is output. If it is not a cold start state, the accumulated time sample pairs are read from the sliding window maintained for the device, the least squares fitting is performed to obtain the measured calibration parameters, and the fused calibration parameters are calculated by progressive weighted fusion, and the fused calibration standard timestamp is output. The processing module is used to push the calibrated standard event message object and its corresponding standard timestamp to a lock-free circular queue, and perform peak smoothing and buffering by having multiple producer threads concurrently enqueue and consumer threads batch dequeue. The allocation module is used to assign a globally unique tracing identifier to each standard event message object entering the lockless circular queue, and to capture a context snapshot of the current thread when the message processing flow crosses the thread boundary, and restore the context snapshot in the target thread to maintain the continuity of the tracing identifier. The distribution module is used to distribute the calibrated and buffered standard event message objects to the corresponding business processing units according to preset routing rules and the real-time receipt status of each distribution channel.