A method and system for adjusting sampling frequency
By acquiring the time error of the continuous analyte monitoring equipment and making gradual fine adjustments to its sampling frequency, the problem of inaccurate data caused by equipment timing errors was solved, and adaptive calibration of the equipment and stability of monitoring data were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-04-03
AI Technical Summary
Existing continuous analyte monitoring equipment suffers from accumulated time errors due to factors such as internal clock crystal deviation and changes in ambient temperature, which affects the clinical reliability of monitoring data and user experience.
By obtaining the time error between the internal clock and the external clock, the sampling period adjustment is calculated, and the sampling frequency is adjusted in a progressive fine-tuning manner to calibrate the internal timing of the device. Closed-loop adjustment is performed using a preset external clock as a reference.
The internal timing of the device was effectively calibrated, avoiding data stream jitter caused by sudden changes in the sampling period, and ensuring the continuity and reliability of the monitoring data.
Smart Images

Figure CN121265036B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of analyte monitoring technology, and in particular to a method and system for adjusting sampling frequency. Background Technology
[0002] Continuous analyte monitoring (CIM) devices are medical or health monitoring equipment capable of real-time or near-real-time dynamic monitoring of the concentration of specific analytes (such as blood glucose, blood ketones, lactic acid, uric acid, blood lipids, creatinine, blood urea nitrogen, bilirubin, hemoglobin, cortisol, and alcohol) in the body or body fluids, and continuously outputting monitoring data. The monitoring data from CIM devices can be sent to smart terminals (such as mobile apps) for users and doctors to perform trend analysis.
[0003] Existing continuous analytical substance monitoring (CMS) devices typically employ a fixed internal sampling period (e.g., sampling every 5 minutes). However, due to inherent deviations in the device's internal clock crystal, environmental temperature variations, or software scheduling delays, cumulative time errors can occur between the CMS device's internal timing and the accurate timing recorded by the mobile app. That is, the "5 minutes" recorded by the CMS device may actually be 4.9 minutes or 5.1 minutes. This time error can easily lead to distorted trend analysis, misaligned alarm timing, and a degraded calibration experience, severely impacting the clinical reliability of monitoring data and user experience.
[0004] Therefore, how to calibrate the internal timing of a continuous analyte monitoring device and achieve adaptive calibration of the sampling frequency of the continuous analyte monitoring device is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a method for adjusting the sampling frequency, which can calibrate the internal timing of a continuous analyte monitoring device and achieve adaptive calibration of the sampling frequency of the continuous analyte monitoring device. This application also provides a system for adjusting the sampling frequency, which has the same technical effect.
[0006] The first objective of this application is to provide a method for adjusting the sampling frequency.
[0007] The aforementioned objective of this application is achieved through the following technical solution:
[0008] A method for adjusting the sampling frequency, applied to a continuous analyte monitoring device, comprising:
[0009] Acquire the time error between the internal clock of the continuous analyte monitoring device and the preset external clock;
[0010] Determine whether the absolute value of the time error is greater than a preset error threshold. If so, then:
[0011] Based on the time error, the sampling period adjustment is calculated, wherein the absolute value of the sampling period adjustment is less than the absolute value of the time error;
[0012] Based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring device, the adjusted sampling period is calculated, and the sampling frequency of the continuous analyte monitoring device is adjusted according to the adjusted sampling period.
[0013] Based on the sampling period adjustment amount, update the time error. Based on the updated time error and the number of times the current sampling frequency has been adjusted, determine whether the preset calibration conditions are met. If not, based on the updated time error, return to and re-execute the step of calculating the sampling period adjustment amount based on the time error. If yes, end the process.
[0014] Preferably, in the method for adjusting the sampling frequency, the value of the preset error threshold is dynamically set, specifically by: obtaining the power level of the continuous analyte monitoring device, determining whether the power level is greater than or equal to the preset power level, and if so, lowering or maintaining the preset error threshold; otherwise, raising the preset error threshold.
[0015] Preferably, in the method for adjusting the sampling frequency, calculating the sampling period adjustment amount based on the time error includes:
[0016] The ratio of the time error to the absolute value of the time error is calculated and multiplied by a preset fixed step size to obtain the sampling period adjustment amount.
[0017] Preferably, in the method for adjusting the sampling frequency, calculating the sampling period adjustment amount based on the time error includes:
[0018] The sampling period adjustment amount is obtained by multiplying the time error by a preset proportional coefficient.
[0019] Preferably, in the method for adjusting the sampling frequency, calculating the sampling period adjustment amount based on the time error includes:
[0020] Determine whether the difference between the absolute value of the time error and the preset error threshold is less than the set threshold. If so, calculate the ratio of the time error to the absolute value of the time error, multiply it by a preset fixed step size to obtain the sampling period adjustment amount. If not, calculate the product of the time error and a preset proportional coefficient to obtain the sampling period adjustment amount.
[0021] Preferably, in the method for adjusting the sampling frequency, updating the time error according to the sampling period adjustment amount includes:
[0022] The updated time error is obtained by subtracting the sampling period adjustment from the absolute value of the time error.
[0023] Preferably, in the method for adjusting the sampling frequency, determining whether a preset calibration condition is met based on the updated time error and the number of adjustments to the current sampling frequency includes:
[0024] Determine whether the absolute value of the updated time error is less than or equal to the preset error threshold, and determine whether the number of adjustments to the current sampling frequency has reached the preset maximum number of adjustments;
[0025] If the absolute value of the updated time error is less than or equal to the preset error threshold, or if the number of adjustments to the current sampling frequency has reached the preset maximum number of adjustments, then the preset calibration condition is considered to be met.
[0026] If the absolute value of the updated time error is greater than the preset error threshold, and the number of times the current sampling frequency is adjusted has not reached the preset maximum number of adjustments, then the preset calibration condition is considered not met.
[0027] Preferably, in the method for adjusting the sampling frequency, before each execution of the step of calculating the sampling period adjustment amount based on the time error, the method further includes:
[0028] The time error is compensated based on a pre-built clock drift model to obtain the compensated time error. The clock drift model is used to quantify and compensate the time error according to the inherent drift rate of the internal clock of the continuous analyte monitoring device.
[0029] Before the step of obtaining the time error between the internal clock of the continuous analyte monitoring device and the preset external clock, the method further includes:
[0030] Obtain a pre-built state machine model, wherein the state machine model includes at least a detection state, a calibration state, and a hold state.
[0031] Preferably, in the method of adjusting the sampling frequency, the step of obtaining the time error between the internal clock of the continuous analyte monitoring device and the preset external clock includes: controlling the state machine model to enter the detection state in order to obtain the time error between the internal clock of the continuous analyte monitoring device and the preset external clock;
[0032] The step of determining whether the absolute value of the time error is greater than a preset error threshold, and if so, calculating the sampling period adjustment amount based on the time error, includes:
[0033] Determine whether the absolute value of the time error is greater than a preset error threshold. If so, control the state machine model to enter the calibration state so as to calculate the sampling period adjustment amount based on the time error.
[0034] The process of determining whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency, and if so, ending the process, includes:
[0035] Based on the updated time error and the number of times the current sampling frequency has been adjusted, it is determined whether the preset calibration conditions are met. If so, the state machine model is controlled to enter the hold state, and the process ends.
[0036] The second objective of this application is to provide a system for adjusting the sampling frequency.
[0037] The second objective of this application is achieved through the following technical solution:
[0038] A system for adjusting the sampling frequency, applied to a continuous analyte monitoring device, comprising:
[0039] The acquisition unit is used to acquire the time error between the internal clock of the continuous analyte monitoring device and a preset external clock.
[0040] The first judgment unit is used to determine whether the absolute value of the time error is greater than a preset error threshold.
[0041] The calculation unit is used to calculate the sampling period adjustment amount based on the time error when the first judgment unit determines that the absolute value of the time error is greater than a preset error threshold, wherein the absolute value of the sampling period adjustment amount is less than the absolute value of the time error.
[0042] The adjustment unit is used to calculate the adjusted sampling period based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring device, and to adjust the sampling frequency of the continuous analyte monitoring device based on the adjusted sampling period.
[0043] The second judgment unit is used to update the time error according to the sampling period adjustment amount, and to determine whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency.
[0044] The calculation unit is further configured to calculate the sampling period adjustment amount based on the updated time error when the second judgment unit determines that the preset calibration conditions are not met.
[0045] The above technical solution involves acquiring the time error between the internal clock of the continuous analytical monitoring device and a preset external clock; determining whether the absolute value of the time error exceeds a preset error threshold; if so, calculating the sampling period adjustment based on the time error, where the absolute value of the sampling period adjustment is less than the absolute value of the time error; calculating the adjusted sampling period based on the sampling period adjustment and the current sampling period of the continuous analytical monitoring device; adjusting the sampling frequency of the continuous analytical monitoring device based on the adjusted sampling period; updating the time error based on the sampling period adjustment; and determining whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency. If not, the process returns to re-execute the calculation of the sampling period adjustment based on the time error; if so, the process ends. This technical solution, using a preset external clock as a reference and the sampling frequency of the continuous analytical monitoring device as the control object, performs a closed-loop adjustment of the sampling frequency of the continuous analytical monitoring device through gradual fine-tuning and calculation of the sampling period adjustment. This ensures accurate calibration of the time error while effectively avoiding data stream jitter caused by sudden changes in the sampling period, guaranteeing the continuity and reliability of clinical monitoring data.
[0046] In summary, the above technical solution can calibrate the internal timing of continuous analyte monitoring equipment and achieve adaptive calibration of the sampling frequency of the continuous analyte monitoring equipment. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating a method for adjusting the sampling frequency according to an embodiment of this application;
[0049] Figure 2 This is a schematic diagram of the structure of a system for adjusting the sampling frequency according to an embodiment of this application. Detailed Implementation
[0050] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] In the embodiments provided in this application, it should be understood that the disclosed methods and systems can be implemented in other ways. The system embodiments described below are merely illustrative. For example, the division of units and modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or modules can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, and can be electrical, mechanical, or other forms.
[0052] In addition, each functional unit in the various embodiments of this application can be integrated into a single processor, or each unit can be a separate device, or two or more units can be integrated into a single device; each functional unit in the various embodiments of this application can be implemented in hardware or in the form of hardware plus software functional units.
[0053] Those skilled in the art will understand that all or part of the steps of the following method embodiments can be implemented by program instructions and related hardware. The aforementioned program instructions can be stored in a computer-readable storage medium. When the program instructions are executed, they perform the steps of the following method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0054] It should be understood that the use of terms such as "system," "device," "unit," and / or "module" in this application is merely one method of distinguishing different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.
[0055] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "a plurality of" or "several" means two or more, unless otherwise explicitly specified.
[0056] If a flowchart is used in this application, it is used to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0057] It should also be noted that, in this document, terms such as “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase “comprising one…” does not exclude the presence of other identical elements in the article or device that includes the aforementioned element.
[0058] The embodiments in this application are written in a progressive manner.
[0059] like Figure 1 As shown, this application provides a method for adjusting the sampling frequency, applied to a continuous analyte monitoring device, including:
[0060] S101. Obtain the time error between the internal clock of the continuous analyte monitoring device and the preset external clock;
[0061] In S101, specifically, the preset external clock can be the system clock of the smart terminal that interacts with the continuous analytical substance monitoring device. During any valid data communication with the smart terminal, the continuous analytical substance monitoring device actively acquires and records the standard timestamp sent by the smart terminal based on its high-precision system clock. Simultaneously, the internal clock of the continuous analytical substance monitoring device records the device timestamp of the current event. Subtracting the device timestamp from the standard timestamp yields the time error between the internal clock of the continuous analytical substance monitoring device and the preset external clock, denoted as Δt. This mechanism uses the smart terminal as a "time server," providing a reliable external time reference for the resource-constrained continuous analytical substance monitoring device. In a specific embodiment, the continuous analytical substance monitoring device can be a continuous glucose monitoring (CGM) device. The CGM device continuously monitors the glucose level in interstitial fluid through a subcutaneous sensor. The CGM device needs to periodically send the blood glucose value and corresponding timestamp to the smart terminal (such as a mobile app). During any valid data communication between the CGM device and the smart terminal, the standard timestamp of the system clock sent by the smart terminal can be acquired, and then the device timestamp recorded by the internal clock of the CGM device can be subtracted to obtain the time error. The continuous analyte monitoring device can also be used to monitor other analytes (such as blood ketones, lactic acid, uric acid, blood lipids, creatinine, urea nitrogen, bilirubin, hemoglobin, cortisol, alcohol, etc.), but this application is not limited to this.
[0062] S102. Determine whether the absolute value of the time error is greater than the preset error threshold. If so, execute S103.
[0063] In S102, specifically, the preset error threshold can be set based on actual needs. Let the preset error threshold be δ. When it is determined that the absolute value of the time error |Δt| is greater than the preset error threshold δ, the next step is executed.
[0064] In some embodiments, in the above method for adjusting the sampling frequency, the value of the preset error threshold is dynamically set, specifically: obtaining the power level of the continuous analyte monitoring device, determining whether the power level is greater than or equal to the preset power level, if so, lowering or maintaining the preset error threshold, if not, raising the preset error threshold.
[0065] Specifically, the preset power level can be set based on actual needs. The power level of the continuous analytical substance monitoring (CIST) device can be acquired in real time and compared with the preset power level. When the CIST device's power level is greater than or equal to the preset power level, the CIST device is in good condition and can maintain the current preset error threshold δ, or adopt a stricter preset error threshold δ, i.e., lower the value of the preset error threshold δ (e.g., lower it by 1 second) to pursue higher accuracy. When the CIST device's power level is less than the preset power level, the CIST device is in poor condition. In this case, the preset error threshold δ can be relaxed, i.e., increased by the value of the preset error threshold δ (e.g., increased by 3 seconds) to ensure stable operation of the CIST device. In this embodiment, through dynamic threshold management, the CIST device can adjust its calibration accuracy according to its own status to achieve the best balance between resource consumption and calibration accuracy.
[0066] S103. Based on the time error, calculate the sampling period adjustment amount, wherein the absolute value of the sampling period adjustment amount is less than the absolute value of the time error;
[0067] In S103, specifically, when it is determined that the absolute value of the time error |Δt| is greater than the preset error threshold δ, the sampling period of the continuous analyte monitoring device is not directly adjusted to T1±Δt, where T1 is the standard sampling period of the continuous analyte monitoring device. Instead, the sampling period adjustment amount is calculated through gradual fine-tuning based on the time error. The absolute value of the sampling period adjustment amount is less than the absolute value of the time error, so as to effectively avoid data stream jitter caused by sudden changes in the sampling period.
[0068] In some embodiments, one implementation of this step specifically includes: calculating the ratio of the time error to the absolute value of the time error, multiplying it by a preset fixed step size to obtain the sampling period adjustment amount. The specific calculation formula is as follows:
[0069] ΔT = (Δt / |Δt|) × k;
[0070] Where ΔT represents the sampling period adjustment, Δt represents the time error, and k represents the preset fixed step size. The value of k can be set based on actual needs; for example, k can be a fixed step size much smaller than the standard sampling period T1 (such as 1 second). This ensures that the adjustment amplitude is very small each time, avoiding abrupt changes in the sampling interval and achieving a smooth transition of the sampling period.
[0071] In some embodiments, one implementation of this step specifically includes: calculating the product of the time error and a preset proportional coefficient to obtain the sampling period adjustment amount. The specific calculation formula is as follows:
[0072] ΔT = Kp × Δt;
[0073] Here, Kp represents the preset scaling factor. The value of Kp can be set based on actual needs. This is to further optimize convergence. By introducing the preset scaling factor, the adjustment of the sampling period is proportional to the size of the time error, which can achieve faster and more accurate calibration and effectively avoid overshoot due to an overly aggressive calibration algorithm.
[0074] In some other embodiments, one implementation of this step specifically includes: determining whether the difference between the absolute value of the time error and the preset error threshold is less than the set threshold; if so, calculating the ratio of the time error to the absolute value of the time error and multiplying it by a preset fixed step size to obtain the sampling period adjustment amount; if not, calculating the product of the time error and a preset proportional coefficient to obtain the sampling period adjustment amount.
[0075] Specifically, the threshold can be set based on actual needs. When the difference between the absolute value of the time error |Δt| and the preset error threshold δ is less than the set threshold, the time error is considered to be close to the preset error threshold. By introducing a small preset fixed step size k, the sampling period adjustment amount ΔT is calculated to avoid oscillations near the preset error threshold. When the difference between the absolute value of the time error |Δt| and the preset error threshold δ is greater than or equal to the set threshold, the time error is considered to be significantly different from the preset error threshold. By introducing a large preset proportional coefficient Kp, the sampling period adjustment amount ΔT is calculated to quickly reduce the error and achieve rapid convergence. In this embodiment, the optimal calculation method for the sampling period adjustment amount can be selected based on the magnitude of the time error, achieving the best balance between resource consumption and calibration stability.
[0076] S104. Calculate the adjusted sampling period based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring equipment, and adjust the sampling frequency of the continuous analyte monitoring equipment according to the adjusted sampling period;
[0077] In S104, specifically, the sampling period adjustment is added to the current sampling period of the continuous analyte monitoring equipment to obtain the adjusted sampling period. The specific calculation formula is as follows:
[0078] T_new = T + ΔT;
[0079] Where T_new represents the adjusted sampling period, and T represents the current sampling period;
[0080] Then, according to the conversion formula between sampling period and sampling frequency: sampling frequency = 1 / sampling period, based on the adjusted sampling period T_new, the sampling frequency of the continuous analyte monitoring device is adjusted to control the continuous analyte monitoring device to sample according to the sampling frequency 1 / T_new. Each time step S104 is executed, the number of times the sampling frequency has been adjusted is incremented by 1.
[0081] S105. Based on the adjustment amount of the sampling period, update the time error. Based on the updated time error and the number of adjustments to the current sampling frequency, determine whether the preset calibration conditions are met. If not, return to re-execute S103 based on the updated time error. If yes, end the process.
[0082] In S105, specifically, after each calibration of the sampling period, the absolute value of the time error is subtracted from the sampling period adjustment to obtain the updated time error. The specific calculation formula is as follows:
[0083] Δt_new = |Δt| - ΔT;
[0084] Where Δt_new represents the updated time error.
[0085] Then, based on the updated time error Δt_new and the number of times the current sampling frequency has been adjusted, i.e., the number of execution rounds accumulated in step S104 above, it is determined whether the preset calibration conditions are met. If it is determined that the preset calibration conditions are not met, then based on the updated time error Δt_new, return to step S103, and recalculate the new sampling period adjustment amount ΔT according to the calculation method set in step S103 (for example, replacing Δt in the calculation formula of sampling period adjustment amount ΔT in step S103 with Δt_new). Then continue to execute the calculations in steps S104 and S105. When the preset calibration conditions are directly met, it is determined that the calibration has been completed and the process ends.
[0086] The preset calibration conditions can be set based on actual calibration requirements and computational efficiency needs. In some embodiments, one implementation of the step of determining whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency specifically includes:
[0087] The system determines whether the absolute value of the updated time error is less than or equal to a preset error threshold, and whether the number of adjustments to the current sampling frequency has reached a preset maximum number of adjustments. If the absolute value of the updated time error is less than or equal to the preset error threshold, or the number of adjustments to the current sampling frequency has reached a preset maximum number of adjustments, then the preset calibration conditions are considered met. If the absolute value of the updated time error is greater than the preset error threshold, and the number of adjustments to the current sampling frequency has not reached a preset maximum number of adjustments, then the preset calibration conditions are considered not met.
[0088] Specifically, the preset maximum number of adjustments can be set based on actual needs. Let N be the number of adjustments for the current sampling frequency, and Nmax be the preset maximum number of adjustments. When it is determined that the absolute value of the updated time error |Δt_new| is greater than the preset error threshold δ and the number of adjustments for the current sampling frequency N has not reached the preset maximum number of adjustments Nmax, it is considered that the preset calibration condition has not been met. Then, based on the updated time error Δt_new, S103 is re-executed. When it is determined that the absolute value of the updated time error |Δt_new| is less than or equal to the preset error threshold δ, or the number of adjustments for the current sampling frequency N has reached the preset maximum number of adjustments Nmax, it is considered that the preset calibration condition has been met, and the process ends.
[0089] In the above embodiment, the time error between the internal clock of the continuous analytical substance monitoring device and a preset external clock is obtained; it is determined whether the absolute value of the time error is greater than a preset error threshold. If so, the sampling period adjustment amount is calculated based on the time error, wherein the absolute value of the sampling period adjustment amount is less than the absolute value of the time error; the adjusted sampling period is calculated based on the sampling period adjustment amount and the current sampling period of the continuous analytical substance monitoring device, and the sampling frequency of the continuous analytical substance monitoring device is adjusted based on the adjusted sampling period; the time error is updated based on the sampling period adjustment amount; based on the updated time error and the number of adjustments to the current sampling frequency, it is determined whether the preset calibration conditions are met. If not, the process returns to re-execute the calculation of the sampling period adjustment amount based on the time error based on the updated time error; if so, the process ends. In this embodiment, using a preset external clock as a reference and the sampling frequency of the continuous analytical substance monitoring device as the control object, the sampling period adjustment amount is calculated through progressive fine-tuning, and the sampling frequency of the continuous analytical substance monitoring device is adjusted in a closed loop. While the time error is accurately calibrated, data stream jitter caused by sudden changes in the sampling period is effectively avoided, ensuring the continuity and reliability of clinical monitoring data. In summary, the above embodiments can calibrate the internal timing of the continuous analyte monitoring device and achieve adaptive calibration of the sampling frequency of the continuous analyte monitoring device.
[0090] In other embodiments of this application, the method for adjusting the sampling frequency described above further includes, before each execution of step S103:
[0091] S201. Based on a pre-built clock drift model, time error is compensated to obtain the compensated time error, wherein the clock drift model is used to quantify and compensate for the time error according to the inherent drift rate of the internal clock of the continuous analyte monitoring device.
[0092] Specifically, in S201, the inherent drift rate of the internal clock of the continuous analyte monitoring device can be predetermined (e.g., 2 seconds fast per day). When calculating the sampling period adjustment ΔT each time, in addition to the feedback term based on the current time error, a feedforward compensation term based on this inherent drift rate is added. This allows for "predicting" the clock drift trend and performing early compensation, significantly improving long-term synchronization accuracy. The time error sequence can be periodically stored in non-volatile memory. By analyzing this historical data, the correlation between clock drift and ambient temperature and battery voltage can be identified, thereby establishing an accurate clock drift model. This model is used to quantify and compensate for time errors based on the inherent drift rate of the internal clock of the continuous analyte monitoring device, optimizing the feedforward compensation parameters and achieving self-learning and adaptive calibration capabilities. The clock drift model is a mathematical model describing how clock reading errors accumulate over time, and its specific expression is:
[0093] Δt_c=Δ0+d×t
[0094] Where Δt_c represents the compensated time error, i.e., the total time error after time t, Δ0 represents the initial time offset, and d represents the inherent drift rate. Then, based on the compensated time error Δt_c, step S103 continues, and the sampling period adjustment ΔT is calculated according to the calculation method set in step S103 (for example, replacing Δt in the calculation formula of sampling period adjustment ΔT in step S103 with Δt_c), and then steps S104 and S105 are executed.
[0095] In this embodiment, by pre-establishing a clock drift model, future time errors can be predicted and compensated in advance, rather than correcting them only after they occur. This can greatly improve the accuracy and stability of time synchronization of continuous analyte monitoring equipment.
[0096] In other embodiments of this application, the method for adjusting the sampling frequency described above further includes, before step S101:
[0097] S301. Obtain a pre-built state machine model, wherein the state machine model includes at least a detection state, a calibration state, and a hold state;
[0098] Specifically, the method for adjusting the sampling frequency described above is modeled as a defined state machine model to effectively ensure the controllability and predictability of the method, and its adaptability to complex operating environments. Within the pre-built state machine model, at least the detection state, calibration state, and hold state are defined.
[0099] During the sampling process, the state machine model enters the detection state and begins dual-time-source error detection. Accordingly, one implementation of the step of obtaining the time error between the internal clock of the continuous analyte monitoring device and a preset external clock specifically includes: controlling the state machine model to enter the detection state to obtain the time error between the internal clock of the continuous analyte monitoring device and the preset external clock;
[0100] Among them, when the error detection condition is met (i.e., when the absolute value of the time error |Δt| is greater than the preset error threshold δ), the state machine model enters the calibration state. Accordingly, one implementation of the step of determining whether the absolute value of the time error is greater than the preset error threshold, and if so, calculating the sampling period adjustment amount based on the time error, specifically includes: determining whether the absolute value of the time error is greater than the preset error threshold, and if so, controlling the state machine model to enter the calibration state to calculate the sampling period adjustment amount based on the time error;
[0101] One implementation of the step of determining whether the preset calibration conditions are met when the preset calibration conditions are met, and then ending the process, based on the updated time error and the number of times the current sampling frequency has been adjusted, specifically includes: determining whether the preset calibration conditions are met based on the updated time error and the number of times the current sampling frequency has been adjusted; if so, controlling the state machine model to enter the hold state and ending the process.
[0102] In other embodiments, the state machine model also includes a ready state, in which the continuous analyte monitoring device samples at a standard sampling period T1 (i.e., collects monitoring data at a standard sampling period T1) when the state machine model is in the ready state by default.
[0103] Software Implementation: In the main controller firmware of the continuous analyte monitoring device, a main loop function is used in conjunction with a state variable (e.g., enum system_state {READY, DETECTION, CALIBRATION, HOLDING}) to implement the aforementioned state machine model. A switch-case statement is used to execute the corresponding code module based on the current state, and the state variable is updated when specific transition conditions are met.
[0104] Event-driven: The state transitions of the state machine model are triggered by specific events, including but not limited to: timed events (e.g., entering the detection state every 5 minutes); data events (e.g., user input of finger blood value, triggering the detection state); internal flags (e.g., the result of condition judgment in the detection state); timeout events (e.g., if an operation times out in any state, it will force a jump back to the ready state or the hold state to ensure that the system does not deadlock).
[0105] In other embodiments of this application, in the above-described method for adjusting the sampling frequency, the continuous analyte monitoring device simultaneously employs interrupt service context processing and a non-blocking task scheduling mechanism to invoke the above method.
[0106] Specifically, to achieve the precise control defined by the aforementioned state machine model and meet the real-time and low-power requirements of the continuous analyte monitoring device, an interrupt service context handling and non-blocking task scheduling mechanism are used in the continuous analyte monitoring device to invoke the steps in the method for adjusting the sampling frequency, ensuring system real-time performance and low power consumption. In the interrupt service context handling mechanism, the continuous analyte monitoring device not only triggers new sampling but also, when the calibration status flag is valid, directly reloads the timer's period register, immediately updating the interval of the next interrupt to the adjusted sampling period T_new. This mechanism, which directly operates the timer at the hardware interrupt level, ensures precise hardware-level timing for period switching, completely avoiding additional errors caused by software scheduling delays, and is a core technical means to achieve high precision. In the non-blocking task scheduling mechanism: the relatively complex error calculation, state machine transition, ΔT calculation, and other logic in the above steps are all executed asynchronously as low-priority tasks in the main loop. These tasks are triggered by "time synchronization events" and placed in the event queue. The main loop uses cooperative scheduling to process the events in the queue sequentially in a non-blocking manner. Once all events have been processed, the system kernel immediately enters a low-power sleep mode, waiting for the next interrupt (timer interrupt or Bluetooth event interrupt) to wake it up. This architecture minimizes CPU activity time, perfectly meeting the stringent power consumption requirements of continuous analyte monitoring devices.
[0107] like Figure 2 As shown, in another embodiment of this application, a system for adjusting the sampling frequency is also provided, applied to a continuous analyte monitoring device, comprising:
[0108] Acquisition unit 10 is used to acquire the time error between the internal clock of the continuous analyte monitoring device and a preset external clock;
[0109] The first judgment unit 11 is used to judge whether the absolute value of the time error is greater than the preset error threshold.
[0110] The calculation unit 12 is used to calculate the sampling period adjustment amount based on the time error when the first judgment unit 11 determines that the absolute value of the time error is greater than the preset error threshold, wherein the absolute value of the sampling period adjustment amount is less than the absolute value of the time error.
[0111] The adjustment unit 13 is used to calculate the adjusted sampling period based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring equipment, and to adjust the sampling frequency of the continuous analyte monitoring equipment based on the adjusted sampling period.
[0112] The second judgment unit 14 is used to update the time error according to the sampling period adjustment amount, and to determine whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency.
[0113] The calculation unit 12 is also used to calculate the sampling period adjustment amount based on the updated time error when the second judgment unit 14 determines that the preset calibration conditions are not met.
[0114] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for adjusting the sampling frequency, characterized in that, Applications in continuous analyte monitoring equipment include: Acquire the time error between the internal clock of the continuous analyte monitoring device and the preset external clock; Determine whether the absolute value of the time error is greater than a preset error threshold. If so, then: Based on the time error, the sampling period adjustment is calculated, wherein the absolute value of the sampling period adjustment is less than the absolute value of the time error; Based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring device, the adjusted sampling period is calculated, and the sampling frequency of the continuous analyte monitoring device is adjusted according to the adjusted sampling period. Based on the sampling period adjustment amount, update the time error. Based on the updated time error and the number of times the current sampling frequency has been adjusted, determine whether the preset calibration conditions are met. If not, based on the updated time error, return to and re-execute the step of calculating the sampling period adjustment amount based on the time error. If yes, end the process.
2. The method as described in claim 1, characterized in that, The value of the preset error threshold is dynamically set, specifically as follows: The device power of the continuous analyte monitoring device is obtained, and it is determined whether the device power is greater than or equal to a preset power. If so, the preset error threshold is lowered or maintained; if not, the preset error threshold is raised.
3. The method as described in claim 1, characterized in that, The step of calculating the sampling period adjustment based on the time error includes: The ratio of the time error to the absolute value of the time error is calculated and multiplied by a preset fixed step size to obtain the sampling period adjustment amount.
4. The method as described in claim 1, characterized in that, The step of calculating the sampling period adjustment based on the time error includes: The sampling period adjustment amount is obtained by multiplying the time error by a preset proportional coefficient.
5. The method as described in claim 1, characterized in that, The step of calculating the sampling period adjustment based on the time error includes: Determine whether the difference between the absolute value of the time error and the preset error threshold is less than the set threshold. If so, calculate the ratio of the time error to the absolute value of the time error, multiply it by a preset fixed step size to obtain the sampling period adjustment amount. If not, calculate the product of the time error and a preset proportional coefficient to obtain the sampling period adjustment amount.
6. The method as described in claim 1, characterized in that, The step of updating the time error based on the adjustment amount of the sampling period includes: The updated time error is obtained by subtracting the sampling period adjustment from the absolute value of the time error.
7. The method as described in claim 6, characterized in that, Based on the updated time error and the number of adjustments to the current sampling frequency, determine whether the preset calibration conditions are met, including: Determine whether the absolute value of the updated time error is less than or equal to the preset error threshold, and determine whether the number of adjustments to the current sampling frequency has reached the preset maximum number of adjustments; If the absolute value of the updated time error is less than or equal to the preset error threshold, or if the number of adjustments to the current sampling frequency has reached the preset maximum number of adjustments, then the preset calibration condition is considered to be met. If the absolute value of the updated time error is greater than the preset error threshold, and the number of times the current sampling frequency is adjusted has not reached the preset maximum number of adjustments, then the preset calibration condition is considered not met.
8. The method according to any one of claims 1 to 7, characterized in that, Before each step of calculating the sampling period adjustment based on the time error, the method further includes: The time error is compensated based on a pre-built clock drift model to obtain the compensated time error. The clock drift model is used to quantify and compensate the time error according to the inherent drift rate of the internal clock of the continuous analyte monitoring device. Before the step of obtaining the time error between the internal clock of the continuous analyte monitoring device and the preset external clock, the method further includes: Obtain a pre-built state machine model, wherein the state machine model includes at least a detection state, a calibration state, and a hold state.
9. The method as described in claim 8, characterized in that, The time error between the internal clock of the continuous analyte monitoring device and the preset external clock includes: The state machine model is controlled to enter the detection state in order to obtain the time error between the internal clock of the continuous analyte monitoring device and a preset external clock. The step of determining whether the absolute value of the time error is greater than a preset error threshold, and if so, calculating the sampling period adjustment amount based on the time error, includes: Determine whether the absolute value of the time error is greater than a preset error threshold. If so, control the state machine model to enter the calibration state so as to calculate the sampling period adjustment amount based on the time error. The process of determining whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency, and if so, ending the process, includes: Based on the updated time error and the number of times the current sampling frequency has been adjusted, it is determined whether the preset calibration conditions are met. If so, the state machine model is controlled to enter the hold state, and the process ends.
10. A system for adjusting the sampling frequency, characterized in that, Applications in continuous analyte monitoring equipment include: The acquisition unit is used to acquire the time error between the internal clock of the continuous analyte monitoring device and a preset external clock. The first judgment unit is used to determine whether the absolute value of the time error is greater than a preset error threshold. The calculation unit is used to calculate the sampling period adjustment amount based on the time error when the first judgment unit determines that the absolute value of the time error is greater than a preset error threshold, wherein the absolute value of the sampling period adjustment amount is less than the absolute value of the time error. The adjustment unit is used to calculate the adjusted sampling period based on the sampling period adjustment amount and the current sampling period of the continuous analyte monitoring device, and to adjust the sampling frequency of the continuous analyte monitoring device based on the adjusted sampling period. The second judgment unit is used to update the time error according to the sampling period adjustment amount, and to determine whether the preset calibration conditions are met based on the updated time error and the number of adjustments to the current sampling frequency. The calculation unit is further configured to calculate the sampling period adjustment amount based on the updated time error when the second judgment unit determines that the preset calibration conditions are not met.
Citation Information
Patent Citations
Recognition method of special state of intelligent wearable equipment and intelligent wearable equipment
CN105534527A
Calibration method and system for data sampling
CN109428598A