A physiological parameter sequential estimation method based on multi-breathing cycle combined information

By combining information from multiple respiratory cycles and a sequential estimation algorithm with extended Kalman filtering, the problem of unstable parameter estimation in single-cycle fitting is solved, achieving higher stability, accuracy, and robustness in respiratory mechanics parameter estimation, and supporting real-time clinical trend analysis and anomaly detection.

CN123183045APending Publication Date: 2026-11-27CHINA JAPAN FRIENDSHIP HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611370457.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing methods for estimating respiratory mechanics parameters mainly rely on independent fitting of data from a single respiratory cycle, ignoring the temporal continuity of parameters between adjacent cycles. This results in unstable estimation results, difficulty in handling abnormal cycles, inability to provide a reliable assessment of parameter change trends, and high computational complexity.

Method used

By employing joint information based on multiple respiratory cycles, a state evolution model and an observation model are established, and a sequential estimation algorithm is used for parameter estimation. Combined with the extended Kalman filtering method, the time continuity of parameters and the influence of external intervention are considered, providing confidence intervals for parameters and anomaly detection.

Benefits of technology

It significantly improves the stability and accuracy of parameter estimation, provides quantitative uncertainty assessment, enhances robustness to outlier data, supports real-time trend analysis and anomaly detection, and reduces computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123183045A_ABST
    Figure CN123183045A_ABST
Patent Text Reader

Abstract

The application discloses a physiological parameter sequential estimation method based on multiple-breathing-period combined information, and belongs to the technical field of medical monitoring equipment and physiological signal processing. The method collects airflow data of multiple continuous breathing periods, establishes a state space model for describing parameter time evolution, and realizes sequential estimation of the parameters by using an extended Kalman filtering algorithm. Firstly, the collected airflow data is preprocessed, and then the parameter estimation value and uncertainty are initialized by using data of previous periods; a prediction step and an update step are sequentially executed for each subsequent period, the prediction step extrapolates parameters according to the state evolution model, the update step corrects the parameter estimation by fusing observation data of the current period, and the physiological rationality of the parameters is ensured by constraint projection; finally, the parameter estimation sequence and the confidence interval of all periods are output. The application improves the stability and precision of parameter estimation in respiratory mechanics monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles, belonging to the fields of medical monitoring equipment and physiological signal processing technology. Background Technology

[0002] In the field of intensive care, mechanical ventilation is a crucial treatment for patients with respiratory failure. Accurate monitoring of respiratory mechanics parameters plays a vital role in optimizing ventilator settings, assessing lung function, and predicting treatment outcomes. Parameters such as time constant, airway resistance, and lung compliance reflect the patient's pathophysiological characteristics, providing quantitative evidence for clinical decision-making. Especially for critically ill patients with acute respiratory distress syndrome (ARDS), the heterogeneity of lung tissue leads to different mechanical properties in different lung regions; multi-index models can more accurately describe this heterogeneity.

[0003] Existing methods for estimating respiratory mechanics parameters primarily rely on independent fitting of data from a single respiratory cycle. A typical approach involves acquiring the airflow-time curve for one expiratory cycle and using a nonlinear least squares algorithm to fit a multi-exponential decay model, thereby obtaining the time constants and weighting coefficients of each exponential component. This single-cycle method offers advantages such as simplicity, computational independence, and ease of parallel processing, but it also has significant limitations.

[0004] First, the single-cycle method ignores the temporal continuity of parameters between adjacent respiratory cycles. Under stable ventilation conditions, the patient's lung mechanical properties do not change drastically in a short period of time, and theoretically, the parameters between adjacent cycles should transition smoothly. However, single-cycle fitting treats each cycle as an independent event, failing to utilize this temporal continuity information, leading to unreasonable random fluctuations in the estimation results during the cycle.

[0005] Secondly, the parameter estimation stability of the single-cycle method is poor. Due to the limited number of sampling points per cycle, coupled with the influence of measurement noise, physiological interference (such as cardiac artifacts), and sensor drift, single-cycle fitting is prone to getting trapped in local minima. The parameter space of the multi-exponential model is high-dimensional and non-convex, and different initial values ​​may converge to different local solutions, resulting in significant uncertainty in parameter estimation. Although multi-starting-point optimization strategies can be used to improve the success rate, this significantly increases the computational cost and still cannot fundamentally solve the stability problem.

[0006] Third, single-cycle methods struggle to effectively handle abnormal cycles. In actual monitoring, external interventions such as coughing, physical movement, and suctioning can lead to decreased data quality or the appearance of abnormal patterns in certain cycles. Single-cycle methods process each cycle independently, failing to leverage information from adjacent normal cycles to correct for abnormal cycle estimates, which can easily result in erroneous parameter values ​​and consequently affect clinical judgment.

[0007] Fourth, single-cycle methods cannot provide a reliable assessment of parameter trends. Clinicians are not only concerned with parameter values ​​at a specific moment, but also with the evolution trend of parameters over time, such as whether airway resistance is increasing or lung compliance is improving. Because single-cycle estimates have large random fluctuations, it becomes difficult to identify the true physiological trend from the fluctuations, requiring additional post-processing filtering of the parameter sequence, which introduces lag and distortion.

[0008] Existing technologies also offer some improvements, such as applying moving average filtering to single-period estimation results, employing more complex nonlinear optimization algorithms, and adding regularization terms. However, these methods are essentially still just patching up the single-period framework and do not fundamentally utilize the joint information and temporal continuity constraints of multi-period data, resulting in limited improvement. Furthermore, these methods often require manual adjustment of numerous parameters (such as the filter window length and regularization coefficients), lacking a systematic theoretical framework and adaptive mechanisms.

[0009] Therefore, there is an urgent need for a respiratory mechanics parameter estimation method that can fully utilize multi-cycle combined information, consider the temporal continuity of parameters, and improve the stability and accuracy of estimation, in order to meet the needs of precise clinical monitoring. Summary of the Invention

[0010] To address the aforementioned technical problems, a sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles is provided, specifically including the following steps:

[0011] S1 Continuous Acquisition Time series data of flow rate over one respiratory cycle Each respiratory cycle is denoted as the 1st respiratory cycle. One cycle ( The flow rate data for each cycle includes There are 1 sampling point, denoted as _ . , ;

[0012] S2 models the parameters of the multi-exponential decay model of expiratory flow rate as time-varying state variables, wherein the time-varying state variables include the first... The time constant of each period and weighting coefficients ,in The number of exponential components;

[0013] S3 establishes a state evolution model to describe the variation of parameters between adjacent cycles: ;

[0014] ;in and This represents process noise, indicating random variations in parameters;

[0015] S4 establishes an observation model to describe the relationship between the flow velocity data for each cycle and the parameters of the current cycle: ;in To observe noise;

[0016] S5 employs a sequential estimation algorithm, updating the parameter estimates periodically starting from the first period: for the... Each cycle, based on the previous The parameter estimates for the nth period are used to predict the nth period using the state evolution model. Initial values ​​of parameters for each cycle;

[0017] Using the first The actual flow velocity data for each cycle is used to correct the parameter estimates by minimizing the objective function:

[0018] ;in This is a smoothness penalty term for parameter changes. These are the weighting coefficients;

[0019] S6 outputs parameter estimates for each period. and its confidence interval.

[0020] The process noise covariance matrix in step S3 is determined based on the physiological variation characteristics of the parameters: the process noise covariance matrix is ​​a diagonal matrix, and its diagonal elements correspond to the variances of each parameter; time constant. The corresponding process noise variance is ,in seconds / period; weighting coefficient The corresponding process noise variance is ,in L / / period; the variance value reflects the natural variation of the parameter without external intervention.

[0021] The state evolution model in step S3 also considers the impact of external intervention: when the PEEP setpoint is detected to be changing from... Adjust to At that time, the state evolution model is modified as follows: ;

[0022] in For PEEP to the first The influence coefficient of the time constant is increased; at the same time, the process noise covariance is increased to allow the parameters to change rapidly after intervention.

[0023] The smoothness penalty term in step S5 adopts a second-order difference form with varying parameters:

[0024] ;

[0025] The second-order difference penalty term constrains the acceleration of parameter changes, which is used to make the parameter evolution over time smoother.

[0026] The sequential estimation algorithm in step S5 employs the extended Kalman filter method: Prediction step: Calculate the first prediction step based on the state evolution model. Prior estimates and prior covariance matrix of each periodic parameter;

[0027] Calculate the Jacobian matrix of the observation model with respect to the parameters:

[0028] ;

[0029] The update steps are as follows: using the first Using the actual flow velocity data for each cycle and the Jacobian matrix, calculate the Kalman gain, and update the posterior estimates and posterior covariance matrix of the parameters.

[0030] Before step S1, there is also a period segmentation step: detecting the inhalation start point and the exhalation start point from the continuous airflow signal, and taking each exhalation phase as a period;

[0031] The parameter correction process in step S5 also needs to meet the following constraints: time constant constraint: ,and ;

[0032] Weighting coefficient constraints: ,and ;

[0033] When the parameters obtained from unconstrained optimization exceed the constraint range, they are projected onto the boundary of the constraint set using a projection algorithm. The projection algorithm uses the nearest point projection method, which finds the feasible point closest to the unconstrained solution in the constraint set.

[0034] The initial parameter estimates for the first period were determined in the following manner:

[0035] For the flow velocity data of the first cycle, parameter estimates were obtained using a single-cycle multi-exponential fitting method. ;

[0036] Single-cycle fitting was performed for the 2nd to 5th cycles, and the mean and standard deviation of the parameter estimates for each cycle were calculated.

[0037] The average value is used as the initial parameter estimate for the first period, and the standard deviation is used as the diagonal element of the initial covariance matrix.

[0038] The confidence intervals of the parameters in step S6 are calculated based on the posterior covariance matrix:

[0039] No. Period parameters ( represent or The 95% confidence interval for () is: ;

[0040] in The parameter in the posterior covariance matrix The standard deviation is the square root of the diagonal elements of the covariance matrix.

[0041] The output of step S6 also includes a time evolution trend analysis of the parameters:

[0042] For each parameter Calculate its most recent One cycle ( linear regression slope within ) ;

[0043] when When the parameter is determined to have a significant trend of change, then... The threshold for trend determination;

[0044] The direction (upward or downward) and rate of change of the output parameters.

[0045] It also includes a parameter anomaly change detection step: for the first For each period, calculate the normalized deviation of the parameter estimates relative to the predicted values: ;

[0046] in These are predictions based on the state evolution model. The standard deviation of the forecast;

[0047] when At that time, the judgment of the first Parameters for each period An abnormal change occurs, and an abnormal alarm is output.

[0048] The number of exponential components The method for determining is as follows: Perform steps S1 to S5 respectively to obtain each Sum of squared fitted residuals for all periods corresponding to the value ;

[0049] Computational Bayesian Information Criterion: ; Choose to make smallest As the optimal number of exponential components.

[0050] The present invention has the following beneficial effects:

[0051] Compared with existing technologies, the present invention has the following significant advantages:

[0052] First, it significantly improves the stability of parameter estimation. Through multi-period joint processing and temporal continuity constraints, this invention significantly reduces the random fluctuations in parameter estimation. Compared to traditional single-period methods, the standard deviation of parameters in this invention is reduced, and the parameter sequence exhibits good temporal continuity and smoothness. This high stability allows clinicians to more reliably observe the true trend of parameter changes without being disturbed by random noise. Furthermore, it improves fitting accuracy and data utilization. This invention accumulates information from multiple periods through a sequential estimation framework, effectively increasing the amount of effective data for fitting in each period.

[0053] Second, it provides a quantitative assessment of uncertainty. This invention naturally maintains the covariance matrix of the parameter estimates by extending the Kalman filtering framework, enabling the provision of confidence intervals for each parameter and quantitatively characterizing the uncertainty of the estimates. This feature is crucial for clinical decision-making, as physicians need to know the reliability of the parameter estimates. Higher uncertainty may suggest the need for further observation or a more conservative treatment strategy; lower uncertainty allows for more confident adjustments to the treatment plan. Existing single-cycle methods typically fail to provide reliable uncertainty assessments.

[0054] Third, it enhances robustness to outlier data; the sequential estimation mechanism of this invention has inherent anti-interference capabilities. When the data quality of a certain period is poor or there are anomalies, the Kalman filter automatically reduces the weight of the measurement data in that period, relying more on prior information (i.e., the estimate from the previous period). For periods containing outliers, the algorithm adaptively reduces the impact of the data in that period by decreasing the Kalman gain, avoiding large jumps in parameter estimation. This adaptive mechanism requires no manual intervention, improving the practicality of the method.

[0055] Fourth, it supports real-time trend analysis and anomaly detection. The parameter sequence output by this invention has good temporal continuity and can be directly used for trend analysis. By calculating the linear regression slope of the parameters over the most recent several periods, it is possible to identify the upward or downward trend of the parameters in real time and detect changes in the condition early. In addition, by comparing the deviation of the current parameters from the historical average, anomaly detection can be achieved, assisting in the clinical identification of sudden events (such as airway obstruction, atelectasis, etc.).

[0056] Finally, this scheme significantly reduces computational complexity; although this invention processes joint information across multiple periods, it employs sequential estimation rather than batch optimization, thus avoiding large-scale matrix operations.

[0057] In summary, this invention, by introducing a multi-cycle joint estimation and sequential filtering framework, achieves significant improvements in multiple dimensions such as parameter stability, estimation accuracy, robustness, and computational efficiency, providing a more reliable and practical technical solution for respiratory mechanics monitoring and possessing significant clinical application value. Attached Figure Description

[0058] Figure 1 This is an overall flowchart of the physiological parameter sequential estimation method based on multi-respiratory cycle joint information of the present invention;

[0059] Figure 2 This is a timing diagram of the prediction-update loop of the extended Kalman filter algorithm in the method of this invention;

[0060] Figure 3 This is a schematic diagram of the expiratory flow rate curve for a single respiratory cycle and the fitting results of a multi-exponential model. Detailed Implementation

[0061] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0062] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0063] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0064] Example 1

[0065] This embodiment provides a complete implementation process for a sequential estimation method of physiological parameters based on combined information from multiple respiratory cycles. This embodiment selects a 58-year-old male patient with moderate acute respiratory distress syndrome (ARDS) undergoing mechanical ventilation as the research subject. The patient was admitted to the intensive care unit of a tertiary hospital and diagnosed with moderate ARDS. The ratio of arterial blood oxygen partial pressure to inhaled oxygen concentration was [not specified in the original text]. The patient's blood pressure was 180 mmHg. The patient was on volume-controlled ventilation (VCV) with the following ventilator settings: tidal volume 450 ml, respiratory rate 16 breaths / min, positive end-expiratory pressure (PEEP) 10 cmH2O, and inhaled oxygen concentration... The percentage was 50%. The patient was in a state of deep sedation with no obvious spontaneous breathing activity, and respiratory mechanics parameters were measured.

[0066] The ventilator used in this embodiment is equipped with a high-precision hot-wire flow sensor. This sensor has a measurement range of -200 to +200 liters per minute, a measurement accuracy of ±2% of full scale, and a response time of less than 20 milliseconds. The flow sensor continuously outputs airflow data via a digital interface at a sampling frequency of 100 Hz. The data format is a 16-bit signed integer, with a quantization accuracy of 0.01 L / min. The ventilator's built-in microprocessor acquires the sensor data in real time and streams the data to the bedside monitoring workstation via an Ethernet interface.

[0067] The data acquisition system in this embodiment adopts a three-layer architecture. The bottom layer is the data acquisition layer, which runs on the embedded system of the ventilator and is responsible for reading raw data from the sensors and performing preliminary format conversion. Each sampling point includes a timestamp, flow rate value, and sensor status flags (used to indicate whether the sensor is working properly, whether saturation exists, etc.). This data is sent to the middle layer in the form of fixed-length data packets via the UDP protocol.

[0068] The middle layer is a data buffer and preprocessing layer, running on the bedside monitoring workstation. It uses a circular buffer data structure to store the raw data of the most recent 60 seconds. The size of the circular buffer is set to 6000 sampling points, and a lock-free queue is used to ensure real-time performance. The upper layer is the parameter estimation and analysis layer, which reads data from the middle layer and executes parameter estimation algorithms through a shared memory mechanism.

[0069] During the actual data collection, a stable period of 30 minutes was selected, during which the patient exhibited no significant body movement, suctioning procedures, or ventilator parameter adjustments. Twenty consecutive normal respiratory cycles were extracted from the 30-minute data for parameter estimation. The respiratory cycle segmentation algorithm was implemented based on the detection of sign changes in the airflow signal. Specifically, the algorithm maintains a sliding window (window length 10 sampling points, i.e., 0.1 seconds), calculating the average airflow value within the window at each moment. When the average value changes from positive (inspiration) to negative (expiration), it is determined as the start of expiration; when it changes from negative to positive, it is determined as the start of inspiration. To avoid misjudgments due to noise, the algorithm requires that the absolute value of the average value must be greater than a threshold to consider a phase transition as having occurred. Furthermore, the algorithm also checks the time interval between two adjacent phase transitions. A normal expiratory duration should be between 1 and 5 seconds, and the total respiratory cycle duration should be between 2 and 8 seconds. Cycles that do not meet these conditions are marked as abnormal and discarded.

[0070] In this embodiment, the expiratory durations of the 20 detected effective respiratory cycles were 2.3, 2.5, 2.4, 2.6, 2.3, 2.4, 2.5, 2.4, 2.3, 2.5, 2.4, 2.6, 2.5, 2.4, 2.3, 2.5, 2.4, 2.3, 2.6, and 2.4 seconds, respectively, with an average of 2.42 seconds, a standard deviation of 0.10 seconds, and a coefficient of variation of 4.1%, indicating good stability of the respiratory cycles. The number of sampling points for each cycle was calculated based on the expiratory duration; for example, the first cycle, with a duration of 2.3 seconds, corresponded to 230 sampling points. To facilitate subsequent processing, the algorithm resampled the data from each cycle to a uniform set of 240 points. The resampling was implemented using cubic spline interpolation to maintain signal smoothness. The resampled data was stored in a three-dimensional array with dimension [missing information]. ,in For the number of periods, The number of sampling points per period, This is a feature array (including traffic values ​​and timestamps). The array occupies approximately 76 KB of memory.

[0071] The data preprocessing stage includes three steps: low-pass filtering, outlier detection, and labeling. Low-pass filtering is implemented using a 4th-order Butterworth filter with a cutoff frequency set to 10 Hz. The transfer function coefficients of the Butterworth filter are calculated using MATLAB's `butter` function, and a forward-backward filtering method (using the `filtfilt` function) is used to eliminate phase distortion. The filter implementation employs a Direct Form II (SOS) structure, which cascades second-order sections (SOS), offering better numerical stability compared to traditional transfer function forms. Specifically, the 4th-order filter is decomposed into two second-order sections, with the state equation for each section being:

[0072] ;

[0073] ;

[0074] Where the coefficient , , , , Calculated using the butter function. For a cutoff frequency of 10 Hz and a sampling frequency of 100 Hz, the normalized cutoff frequency is: ( The calculated coefficients are: the first second-order section , , , , The coefficients of the second second-order section are similar. The filter's state variables (i.e....) and Initialization is required when processing each cycle. In this embodiment, zero-phase filtering is used. Therefore, the initial state of the forward filter is set to the extrapolated value of the first few points of the input signal, and the initial state of the backward filter is set to the extrapolated value of the last few points.

[0075] The quality of the filtered signal was assessed by calculating the signal-to-noise ratio (SNR). SNR is defined as the ratio of signal power to noise power, measured in decibels (dB). In this embodiment, the signal power is estimated as the variance of the filtered signal, and the noise power is estimated as the variance of the difference between the signal before and after filtering. The calculated SNR of the original signal was approximately 25 dB, which increased to approximately 35 dB after filtering, with the noise power reduced by approximately 10 times, verifying the effectiveness of the filtering. The frequency response characteristics of the filter were verified by calculating the amplitude and phase responses. In the passband (0 to 10 Hz), the amplitude response remained at 0 dB ± 0.5 dB, and the phase response was zero (due to the use of zero-phase filtering). In the stopband (above 10 Hz), the amplitude response attenuated by more than 40 dB, meeting the design requirements.

[0076] Anomaly detection is implemented based on the second-order difference method. For the flow velocity sequence of each cycle... First, calculate the second difference. ,in Second-order difference can effectively detect abrupt changes in signals, such as spikes caused by coughing, sensor malfunction, or data transmission errors. The anomaly threshold is adaptively determined using the Median Absolute Deviation (MAD) method.

[0077] MAD is defined as the median of the absolute values ​​of the deviations, i.e. For normally distributed data, the relationship between MAD and standard deviation is as follows: In this embodiment, the calculated MAD value is 0.8 L / min², therefore the estimated standard deviation is approximately 1.2 L / min². The anomaly threshold is set to... The multiplier coefficient A value of 4 means that points deviating from the median by more than 4 MADs are considered outliers.

[0078] A total of 4800 sampling points were collected over 20 cycles ( In the simulation, the algorithm detected 23 outliers, accounting for approximately 0.48%. These outliers were unevenly distributed spatially and temporally, with 7 outliers in the 3rd period (potentially corresponding to a slight cough or body movement), 5 in the 11th period, and between 0 and 2 outliers in other periods. Detected outliers were not directly deleted but marked and their weights were reduced during subsequent fitting. Specifically, the weight of normal points was set to 1.0, and the weight of outliers was set to 0.1. This preserved data continuity (avoiding distortion introduced by interpolation) while reducing the impact of outliers on parameter estimation. The weight information was stored in a... dimensional weight matrix middle, Indicates the first The first cycle The weights of each sampling point. The weight matrix is ​​used as the diagonal weight matrix in the subsequent objective function calculation, i.e., the weighted sum of squared residuals is... .

[0079] Parameter initialization is a crucial step in the sequential estimation algorithm, and the selection of initial parameters directly affects the convergence speed and final result. This embodiment uses a multi-cycle averaging method to determine the initial parameters. Specifically, single-cycle multi-exponential fitting is performed on the first five cycles to obtain five sets of parameter estimates. The average of these five sets is then calculated as the initial estimate, and the standard deviation is used as a measure of initial uncertainty. Single-cycle fitting is implemented using the nonlinear least squares method (Levenberg-Marquardt algorithm), which is called in MATLAB via the `lsqcurvefit` function. To improve the fitting success rate, the algorithm uses a multi-starting-point strategy: for each cycle, optimization is performed starting from 10 different initial points, and the result with the smallest residual is selected as the estimate for that cycle. The selection of these 10 initial points is based on the physiological range of the time constant (0.1 to 3.0 seconds) and a preliminary estimate of the weighting coefficients (allocated according to the initial expiratory flow rate). The initial point generation algorithm uses Latin Hypercube Sampling to uniformly distribute the initial points in the parameter space, avoiding overly concentrated initial points that would limit the search range.

[0080] Number of exponential components The determination is made using a model selection method. This embodiment uses... For each of the three scenarios, the model was fitted for the first five periods, and the Bayesian Information Criterion (BIC) value was calculated. The BIC criterion balances fitting accuracy and model complexity, and its formula is as follows:

[0081] ;

[0082] Where RSS is the sum of squared residuals. Although Increasing the RSS decreases (resulting in a better fit), but increases the BIC value; therefore, the value that minimizes BIC is chosen. As the optimal model, this result is consistent with the general understanding in respiratory physiology that the lungs of ARDS patients can be approximated as two main regions: a damaged region (low compliance, short time constant) and a relatively normal region (high compliance, long time constant).

[0083] The single-cycle fitting results for the first 5 cycles are as follows: Cycle 1 Second, Second, L / min, L / min, goodness of fit ; second cycle Second, Second, L / min, L / min, ; third cycle Second, Second, L / min, L / min, ; 4th cycle Second, Second, L / min, L / min, ; 5th cycle Second, Second, L / min, L / min, As can be seen, the parameters fitted in a single period exhibit significant fluctuations across different periods, for example... The range of values ​​was from 0.38 to 0.51 seconds, with a relative variation of 34%. This fluctuation was mainly caused by the instability of the fit and noise, and did not represent the actual physiological changes. The initial parameter estimates were obtained by calculating the average of these five sets of values. Second, Second, L / min, L / min. The standard deviation is calculated as follows: Second, Second, L / min, L / min. These standard deviations are used to initialize the uncertainty of the parameter estimates, specifically to construct the initial covariance matrix. for A diagonal matrix, with diagonal elements as , respectively, correspond to the squares of the aforementioned standard deviations.

[0084] The core of the sequential estimation algorithm is the Extended Kalman Filter (EKF), whose implementation involves a large number of matrix operations. To ensure computational efficiency and numerical stability, this embodiment employs several optimization measures in matrix storage and computation. First, the covariance matrix... yes Since it is a symmetric positive definite matrix, only 10 independent elements in the upper or lower triangular region need to be stored, saving approximately 40% of storage space. This embodiment uses the upper triangular storage method, storing the elements in a one-dimensional array in row-major order: Matrix index conversion is achieved through macro definitions: for upper triangular elements... (in Its index in the one-dimensional array is ,in is the matrix dimension.

[0085] Jacobian matrix The dimension is (In this embodiment) The matrix is ​​a dense matrix that needs to store 960 elements. Each iteration requires recalculation. This is because it depends on the parameter estimates for the current period. Matrix computation is one of the most computationally intensive parts of the algorithm, as it requires calculating four partial derivatives for each sampling point. This embodiment optimizes this process using vectorized computation. Specifically, the time points are... Organized into vectors ,Will The calculation is completed in one go to obtain the vector. Then, it is calculated using vector multiplication and element-wise multiplication. The columns of the matrix. The first column of the matrix (corresponding to) The calculation is as follows:

[0086] ;

[0087] in This indicates element-wise multiplication. The same applies to other columns.

[0088] Kalman gain matrix The calculation involves the new information covariance matrix Finding the inverse of the inequality is crucial for numerical stability. yes A matrix is ​​defined as follows: ,in It is the observation noise variance (scalar). yes Identity matrix. Calculated directly. The computational complexity of matrix union and inversion is O(n). ,for This would require approximately 13.8 million floating-point operations, taking about 50 milliseconds, which is unacceptable in real-time systems. This embodiment simplifies the calculation using the Woodbury matrix identity (also known as the matrix inversion lemma). According to this identity, Through one Inverse representation of a matrix:

[0089] ;

[0090] Here, only one requirement is needed. The computational complexity of matrix inverse is reduced to ,in It requires only about 64 floating-point operations. Furthermore, because... It is a positive definite matrix, and its inverse matrix can be efficiently calculated using Cholesky decomposition: ,in If it is a lower triangular matrix, then The computational complexity of Cholesky decomposition is O(n log n). ,for Only about 20 calculations are required.

[0091] After applying Woodbury's identity, the Kalman gain matrix The calculation can be written as:

[0092] ;

[0093] To further simplify, an auxiliary matrix is ​​defined. This is Symmetric positive definite matrix. Calculate. The complexity is ,for , It requires approximately 3840 calculations. Then calculate... The inverse matrix is ​​obtained using the Cholesky decomposition method. Finally, the following calculations are performed: ;

[0094] entire The computational complexity of the matrix has been reduced from the original... Reduce to The actual processing time was reduced from 50 milliseconds to about 2 milliseconds.

[0095] To ensure numerical stability, this embodiment employs additional protective measures in matrix inversion and exponent calculation. Before matrix inversion, the condition number is checked. The condition number is defined as the ratio of the largest singular value to the smallest singular value of the matrix, reflecting the ill-conditioned nature of the matrix. In this embodiment… The condition number of a matrix is ​​typically between 10 and 100, which is considered a good condition. If the condition number exceeds 1000, the matrix is ​​close to singular, and regularization is used: add small positive numbers (such as...) to the diagonal of the matrix. ),Right now This technique, called Tikhonov regularization, improves numerical stability. (Exponential calculation) exist When the value is large, underflow may occur (the result is close to 0). This embodiment sets a lower limit: when At that time, directly Set it to 0 to avoid unnecessary calculations. This will not affect accuracy because... It is already much smaller than the machine precision (the machine precision of a double-precision floating-point number is approximately...). ).

[0096] The parameter update step calculates the new parameter estimates. The residual vector yes dimensional vector, It is the actual measured flow velocity vector. The calculation is Matrix and Multiplying 12-dimensional vectors results in a 4-dimensional vector, with a computational complexity of O(n log n). The updated parameters may violate the constraints, therefore constraint projection is required. The constraints in this embodiment include three types: time constant range constraints. Seconds, time constant sorting constraints Non-negativity of weights Weight conservation constraint These constraints define a convex set, and the projection problem can be formulated as finding the point within the constraint set that is closest to the unconstrained solution. For simple box constraints (such as...), The projection operation is truncation: For sorting constraints If violated, exchange. and The values ​​were swapped accordingly. and For the weight conservation constraint, proportional scaling is used: .

[0097] The update formula for the posterior covariance matrix is:

[0098] ;

[0099] This formula is called the Joseph form, which is different from the standard form. It is more stable because it guarantees the symmetry and positive definiteness of the covariance matrix, even with rounding errors. The calculation of the Joseph form involves... Matrix multiplication has a time complexity of O(n log n). ,for Approximately 64 calculations are required. To further ensure... To ensure positive definiteness, the algorithm checks the eigenvalues ​​after the update: if there are negative eigenvalues ​​or eigenvalues ​​close to 0 (less than 0), then... ), then for Perform the projection of the nearest positive definite matrix. The projection of the nearest positive definite matrix is ​​achieved through eigenvalue decomposition: [The following text appears to be a separate, unrelated section:] ... Decomposed into ,in It is the eigenvector matrix. It is an eigenvalue diagonal matrix, and then the negative eigenvalues ​​are replaced with small positive numbers (e.g., ), and recombined to obtain .

[0100] The algorithm iterates from the first cycle, processing cycles 2 through 20 sequentially. Each cycle consists of three steps: prediction, update, and projection. The computation time for a single cycle is approximately 3 milliseconds. The total computation time for 20 cycles is approximately 60 milliseconds, much shorter than the interval of a breathing cycle, meeting real-time requirements. The algorithm's memory footprint mainly includes: the original data array, the preprocessed data array, and the Jacobian matrix. The intermediate calculation results, totaling approximately 170 KB, can be easily run in embedded systems.

[0101] To facilitate debugging and verification, this embodiment records detailed intermediate results during algorithm execution. For each cycle... The following information was recorded: predicted parameters The predicted covariance matrix Updated parameters The updated covariance matrix Norm of residual vector Frobenius norm of Kalman gain matrix Goodness of fit This information is stored in an array of structures, with one structure corresponding to each cycle.

[0102] Taking the 6th cycle as an example, the intermediate results of one iteration are explained in detail. In the prediction step, the posterior estimate is based on the 5th cycle. Predicting based on state evolution model This is because a first-order random walk model (without deterministic evolution terms) is used. The predicted covariance matrix... pass Add process noise covariance matrix Calculated. The diagonal element is , The diagonal element is ,therefore The diagonal element is .

[0103] Jacobian matrix The calculation is based on the prediction parameters The sampling time for the 6th cycle is... Seconds (240 points). Calculation We obtain a 240-dimensional vector whose first element is The last element is .calculate The first column of the matrix:

[0104] ;

[0105] The first element of the obtained vector is The last element is Similarly, calculate the other columns. The matrix is ​​stored in column-major order, consistent with MATLAB's default storage method, which facilitates the use of BLAS library functions.

[0106] Calculate the auxiliary matrix This is Symmetric matrix. First calculate... This uses the BLAS `dgemm` function (double-precision general matrix multiplication). The `dgemm` function is called in the form `dgemm('T','N',n,n,M,1.0,H,M,H,M,0.0,HtH,n)`, where 'T' represents the transpose of the first matrix, 'N' represents the matrix not being transposed, and the parameters... , They are respectively The number of rows and columns of the matrix. The `dgemm` function is highly optimized for i7 processors, achieving over 80% of its theoretical peak performance. The calculation yields... Divide by get Then calculate. . Calculations using Cholesky decomposition: First, decompose... ( (For a lower triangular matrix), use the dpotrf function of LAPACK; then calculate... inverse matrix Use the dtrtri function; finally calculate . After the matrix calculation is completed, the inverse is obtained through Cholesky decomposition. .

[0107] Kalman gain matrix The calculation uses the following formula:

[0108] ;

[0109] To avoid redundant calculations, calculate the intermediate variables first. This is It's a matrix, but you don't actually need to explicitly store it. Note that... The final form is It can be rewritten as Further observation Only need to be with the residual vector Multiplication, that is, only requires calculation Therefore, explicit construction can be avoided. Matrix. Specifically, the calculation process is as follows: (1) Calculate This is a 4-dimensional vector; (2) Calculate This is a 4-dimensional vector; (3) Calculate This is 4) Calculate the dimensional vector; (5) Calculation (6) Calculation This calculation method avoids construction. and For large matrices, the space complexity is reduced from Reduce to Actual memory usage decreased from 3.75KB to less than 1KB.

[0110] residual vector This is the actual measured value. Compared with the predicted value difference. Read from the preprocessed data. Calculated using the model: Calculate the residuals Then, its root mean square (RMS) is calculated as follows: L / min.

[0111] This RMS value reflects the model's fitting accuracy, with a relative error of 16% relative to the average flow rate (approximately 20 L / min), which is within an acceptable range. The histogram of the residual vectors exhibits an approximately normal distribution, with a mean close to 0 (-0.15 L / min), a standard deviation of 3.2 L / min, a skewness of 0.08, and a kurtosis of 2.95, close to the kurtosis of 3 in a normal distribution, thus validating the assumption of normality of observation noise.

[0112] Parameter update calculation obtained This result is relative to the predicted value. A change has occurred, the amount of change Time constant Slightly increased, Slightly reduced, weight Reduce These changes are driven by the deviation between actual measured data and predicted values. Check constraints: time constant range. Satisfy, sorting constraint The condition is satisfied, and the weights are non-negative. The sum of the weights is... The actual initial expiratory flow rate was 44.8 L / min, while the actual initial expiratory flow rate was 44.8 L / min, resulting in a relative error of 0.4%. This was adjusted using scaling. L / min, L / min, making .

[0113] Posterior covariance matrix Update using Joseph format. Calculation. First calculate This is Matrix. Then calculate , then calculate Finally add These matrix operations are all implemented using BLAS library functions. (Updated version) diagonal elements are ,and diagonal elements The values ​​have all decreased compared to the previous values, reflecting that the new measurement data reduces the uncertainty of parameter estimation. This is a fundamental characteristic of Kalman filtering: measurement updates always reduce uncertainty. The determinant of the covariance matrix... Less than This verifies the reduction in uncertainty.

[0114] After the algorithm iterates for 20 cycles, it outputs the final parameter estimation sequence. The output data is organized into a structured text file (CSV format) and includes the following: cycle index. Time constant Time constant Weight Weight , Standard deviation , Standard deviation , Standard deviation , Standard deviation Goodness of fit The standard deviation is calculated from the diagonal elements of the posterior covariance matrix: .

[0115] The parameter estimation results for 20 respiratory cycles are summarized below (partial cycle): Cycle 1: Second, Second, L / min, L / min, Period 2: Second, Second, L / min, L / min, Period 3: Second, Second, L / min, L / min, Period 4: Second, Second, L / min, L / min, Period 5: Second, Second, L / min, L / min, .

[0116] The statistical properties of the parameters are as follows: time constant The mean was 0.46 seconds, the standard deviation was 0.008 seconds, and the coefficient of variation was 1.7%; the time constant... The mean was 1.23 seconds, the standard deviation was 0.015 seconds, and the coefficient of variation was 1.2%; weighting coefficients The mean was 27.5 L / min, the standard deviation was 0.21 L / min, and the coefficient of variation was 0.8%; weighting coefficient The mean was 17.1 L / min, the standard deviation was 0.24 L / min, and the coefficient of variation was 1.4%. Goodness of fit. The value was greater than 0.96 in all cycles, indicating that the bi-exponential model can well describe the decay characteristics of expiratory flow rate.

[0117] In this embodiment, the 95% confidence intervals for each periodic parameter are calculated. Taking the 10th period as an example: seconds (confidence interval: ), seconds (confidence interval: ), L / min (confidence interval: ), L / min (confidence interval: The width of the confidence interval reflects the uncertainty of the parameter estimation; the relative uncertainty of the time constant is approximately ±17%, and the relative uncertainty of the weighting coefficients is approximately ±5%.

[0118] Perform trend analysis on the parameters and calculate the most recent The linear regression slopes of each parameter within each period (periods 11-20): slope Seconds / period (upward trend) slope Seconds / period (downward trend) slope L / min / period (downward trend) slope L / min / period (upward trend). Set trend determination threshold. Seconds / cycle (for time constant) or 0.03 L / min / cycle (for weighting coefficient), then , , , Significant trends were observed in all cases. These trends may reflect slow changes in the patient's lung mechanical properties, such as alveolar recruitment or the progression of pulmonary edema.

[0119] In addition to CSV files, the algorithm also generates structured JSON files for inter-program communication. The JSON file contains metadata (patient ID, acquisition time, algorithm version, parameter settings) and result data (complete parameters for each cycle and their uncertainties). The JSON format facilitates parsing and use by other software, such as electronic medical record systems and decision support systems. A typical JSON file snippet is shown below:

[0120] {"metadata":{"patient_id":"ICU-2023-0156","acquisition_time":"2023-10-15T14:30:00","algorithm _version":"1.0","parameters":{"N":2,"K":20,"M":240,"sampling_freq":100,"sigma_tau":0.03,"sigma _A":0.02,"lambda":0.005}},"results":[{"cycle":1,"tau1":0.44,"tau2":1.25,"A1":28.0,"A2":16.7," sigma_tau1":0.050,"sigma_tau2":0.060,"sigma_A1":0.90,"sigma_A2":0.80,"R_squared":0.962},...]};

[0121] This embodiment fully demonstrates the implementation process of the method of the present invention, including the specific implementation details of each step such as data acquisition, preprocessing, parameter initialization, sequential estimation, constraint projection, and result output. By employing multi-period joint estimation and time continuity constraints, the parameter estimates obtained by the algorithm have high stability (coefficient of variation 1-2%) and accuracy (goodness of fit). The algorithm simultaneously meets real-time requirements (3 milliseconds for a single cycle). In terms of software engineering, it employs techniques such as vectorized computation, matrix storage optimization, Woodbury identity, and Cholesky decomposition, significantly improving computational efficiency and numerical stability. This allows the method to run in real-time on bedside monitoring systems, providing an effective tool for clinical respiratory mechanics monitoring.

[0122] Example 2

[0123] To verify the superiority of the present invention's technical solution over traditional single-cycle parameter estimation methods, a set of comparative experiments was designed in this embodiment. The experiments used the same patient data as in Example 1, namely, data from 20 consecutive respiratory cycles collected from a 58-year-old male patient with moderate ARDS during mechanical ventilation. The core objective of the experiments was to quantitatively evaluate the degree of improvement of the multi-cycle joint estimation method in three dimensions: parameter stability, estimation accuracy, and computational efficiency.

[0124] Traditional single-cycle parameter estimation methods treat each respiratory cycle as an independent measurement event, performing nonlinear fitting on each cycle separately to obtain the parameter estimate for that cycle. The advantage of this method is its simplicity and computational independence, but it has a significant drawback: the number of sampling points per cycle is limited (in this embodiment). Due to the influence of measurement noise, single-period fitting is prone to getting trapped in local minima, leading to instability in parameter estimation. This is especially true for multi-parameter models (the double-exponential model in this embodiment has four parameters), where the fitting problem is highly non-convex, and different initial points may converge to different local solutions. The single-period method in this embodiment uses the Levenberg-Marquardt algorithm, a classic method for solving nonlinear least squares problems, combining the advantages of gradient descent and the Gauss-Newton method. The algorithm is implemented using the MATLAB function `lsqcurvefit`, with parameters set to: a maximum of 500 iterations and a function tolerance of [missing information]. Parameter tolerance The Jacobian matrix is ​​calculated using the finite difference method.

[0125] To improve the success rate of single-period fitting, this embodiment employs a multi-starting-point strategy. For each period, optimization is performed starting from 20 different initial points, and the result with the smallest sum of squared residuals is selected as the estimate for that period. These 20 initial points are generated using the Latin hypercube sampling method and are uniformly distributed in the parameter space. The range of the parameter space is set as follows: Second, Second, L / min, L / min. Latin hypercube sampling is implemented using the lhsdesign function, which generates a... The sampling matrix has each row corresponding to an initial point and each column corresponding to a parameter dimension. Each column of the sampling matrix is... The interval is uniformly distributed, and then mapped to the actual parameter range through a linear transformation. Specifically, for the parameters... The transformation formula is: ,in These are sampled values.

[0126] The single-cycle fitting algorithm processes each of the 20 respiratory cycles individually. For the first... The algorithm starts the optimization process from 20 initial points in each cycle. Each optimization process maintains the current parameter vector. And the objective function value (sum of squared residuals). The objective function is defined as:

[0127] ;

[0128] The Levenberg-Marquardt algorithm calculates the parameter update amount in each iteration. By solving the corrected normal equations:

[0129] ;

[0130] in yes Jacobian matrix, yes 3D residual vector These are damping parameters. Damping parameters The initial value is set to 0.01, and it is dynamically adjusted during the iteration process: if the objective function value decreases, then... If the objective function value increases, then (That is, moving in the direction of gradient descent).

[0131] The algorithm terminates under three conditions: (1) the relative change in parameter updates is less than the tolerance, i.e. (2) The relative change in the objective function value is less than the tolerance, i.e. (3) Reach the maximum number of iterations.

[0132] For the first cycle, the optimization results for the 20 initial points differed significantly. Twelve optimizations successfully converged to the sum of squared residuals. The solution for (L / min)² has the following parameters: Second, Second, L / min, L / min. The other 5 optimizations converged to the sum of squared residuals. The solution for (L / min)² has the following parameters: Second, Second, L / min, L / min. The remaining 3 optimizations converge to the sum of squared residuals. The solution for (L / min)² corresponds to parameters that significantly deviate from the physiologically reasonable range. The solution with the smallest residual is selected as the estimation result for the first cycle. Second, Second, L / min, L / min. The optimization process involved 87 iterations and took 15 milliseconds to complete.

[0133] The total computation time for optimization with 20 initial points is approximately 280 milliseconds, which is about 90 times longer than the time (3 milliseconds) for a single cycle in the multi-cycle method of Example 1. While computation time can be reduced by decreasing the number of initial points, this further reduces the success rate of the fit. In fact, even with 20 initial points, the fitting results for some cycles are still unsatisfactory. For example, in the 8th cycle, only 3 out of 20 optimizations converged to a reasonable solution, while the remaining 17 cycles got stuck in local minima or boundary solutions (the parameters reached the boundary of the search range). The final selected solution corresponds to the sum of squared residuals. (L / min)², but the parameters of this solution Seconds relative to the previous cycle The sudden change occurred within seconds, which is physiologically unreasonable because lung mechanical parameters should change continuously between adjacent respiratory cycles.

[0134] The fitting results of the single-cycle method for all 20 respiratory cycles are summarized below (a selection of cycles is shown): Cycle 1: Second, Second, L / min, L / min, Period 2: Second, Second, L / min, L / min, Period 3: Second, Second, L / min, L / min, Period 4: Second, Second, L / min, L / min, Period 5: Second, Second, L / min, L / min, .

[0135] It can be observed that the parameter estimates of adjacent periods exhibit significant random fluctuations. The statistical properties of the parameters for 20 periods are calculated as follows: The mean was 0.44 seconds, the standard deviation was 0.052 seconds, and the coefficient of variation was 11.8%. The mean was 1.24 seconds, the standard deviation was 0.098 seconds, and the coefficient of variation was 7.9%. The mean was 27.8 L / min, the standard deviation was 1.85 L / min, and the coefficient of variation was 6.7%. The mean was 16.9 L / min, the standard deviation was 1.62 L / min, and the coefficient of variation was 9.6%.

[0136] To more intuitively assess parameter stability, the root mean square (RMS) of parameter variation over adjacent periods is calculated. The RMS of variation over a period is defined as:

[0137] ;

[0138] For the single-period method, the calculation yields: Second, Second, L / min, L / min. These RMS values ​​indicate that the parameters estimated in a single period exhibit significant jumps between adjacent periods, with the average change exceeding 10% of the parameter mean.

[0139] The implementation details of the multi-period joint estimation method have been described in detail in Example 1; this example only briefly restates its core features. This method will continuously... Data from each respiratory cycle is jointly processed, and sequential parameter estimation is achieved through a state-space model and extended Kalman filtering. The state evolution model is a first-order random walk. ,in It is process noise, covariance matrix Set the diagonal elements to In this embodiment Second, L / min. The observation model is... , where the observation function For a multi-exponential model, the observation noise variance (L / min)². The smoothness penalty term is implemented by modifying the process noise covariance matrix. Taking a first-order simplified implementation as an example, it is equivalent to adding (L / min)² to the objective function. Penalty coefficient .

[0140] The results of processing the same 20 respiratory cycles using the multi-cycle method (selecting the same cycles as the single-cycle method for comparison): Cycle 1: Second, Second, L / min, L / min, Period 2: Second, Second, L / min, L / min, Period 3: Second, Second, L / min, L / min, Period 4: Second, Second, L / min, L / min, Period 5: Second, Second, L / min, L / min, Statistical properties of the parameters: The standard deviation was 0.0082 seconds, and the coefficient of variation was 1.8%. The standard deviation was 0.015 seconds, and the coefficient of variation was 1.2%. The standard deviation was 0.21 L / min, and the coefficient of variation was 0.8%. The standard deviation is 0.24 L / min, and the coefficient of variation is 1.4%. The RMS of the variation between adjacent periods is: Second, Second, L / min, L / min.

[0141] By comparing the parameter stability of the two methods, an improved ratio matrix is ​​constructed. This is based on the time constant. For example, the standard deviation of the single-period method is 0.052 seconds, while the standard deviation of the multi-period method is 0.0082 seconds, representing an improvement ratio of... The improvement rate for other parameters is calculated similarly: for times, for times, for The average improvement rate was 7.1 times, meaning the standard deviation of parameter estimation for the multi-period method was about 1 / 7 that of the single-period method, demonstrating a significant improvement in stability. In terms of the coefficient of variation, the average coefficient of variation for the single-period method was 9.0% (arithmetic mean of the four parameters), while the average coefficient of variation for the multi-period method was 1.3%, representing an improvement rate of 6.9 times, consistent with the improvement rate of the standard deviation.

[0142] The RMS of adjacent period variations is an important indicator for measuring the temporal continuity of parameters. (Single-period method) Seconds, multi-period method The improvement rate for seconds is 6.2 times. Improvement rates for other parameters: It is 6.3 times. It is 4.5 times. The improvement was 3.7 times. The average improvement rate was 5.2 times. Compared to the improvement in standard deviation (7.1 times), the improvement in RMS was slightly lower. This is because the single-period method includes some real physiological changes in addition to random fluctuations, while RMS captures both components. The multi-period method suppresses random fluctuations through smoothness constraints but retains the real slow trends, hence the relatively smaller improvement in RMS.

[0143] In terms of fitting accuracy, the average of the single-period method The average value of the multi-period method is 0.959. The value was 0.964, an improvement of 0.005. Although the improvement seems small, it warrants attention. Approaching the theoretical upper limit (determined by measurement noise), a 0.005 improvement corresponds to a reduction of approximately 10% in the residual sum of squares. Calculating the total residual sum of squares over 20 cycles: 13520 (L / min)² for the single-cycle method and 12240 (L / min)² for the multi-cycle method, representing a reduction of 1280 (L / min)², or 9.5%. This improvement primarily stems from the multi-cycle method utilizing information from adjacent cycles, effectively increasing the amount of effective data fitted in each cycle.

[0144] In terms of computational efficiency, the single-cycle method takes approximately 5.6 seconds (280 milliseconds per cycle) to process 20 cycles, including the time for 20 multi-startup optimizations. The multi-cycle method takes approximately 60 milliseconds (3 milliseconds per cycle) to process 20 cycles, resulting in a speedup of [missing information]. This significant efficiency improvement stems from two factors: first, the multi-period method uses sequential estimation instead of batch optimization, avoiding redundant computation; second, the multi-period method utilizes the estimate from the previous period as the initial value, resulting in faster convergence, while the single-period method requires searching from multiple initial points. Regarding memory usage, the single-period method requires storage for each optimization. The Jacobian matrix is ​​3.75 KB, and the total memory usage is approximately 75 KB when running in parallel with 20 initial points. The multi-period method requires additional storage for the covariance matrix (0.25 KB) and the history parameter sequence (1.6 KB), but due to the sequential processing, the total memory usage is approximately 10 KB, which is about 7 times lower than the single-period method.

[0145] To assess the statistical significance of the improvement, paired methods were used. Test methods. For parameters Define the absolute change in each cycle. There are a total of 19 pairs of data ( Single-cycle method The sequence mean was 0.053 seconds and the standard deviation was 0.038 seconds; the multi-period method... The sequence mean is 0.0086 seconds, and the standard deviation is 0.0063 seconds. Calculate the paired difference. Its mean seconds, standard deviation Second. The statistic is calculated as follows:

[0146] ;

[0147] degrees of freedom The critical value (significance level) for a two-tailed test )for .because We reject the null hypothesis, which states that there is a statistically significant difference in the parameter changes between the two methods. Similar tests yielded significant results for other parameters as well. All values ​​are less than 0.01.

[0148] Further analysis reveals the performance differences between the two methods over specific periods. The 8th period is a typical example of the poor performance of the single-period method; the parameter estimation for this period... Second relative to the 7th period Seconds happened The change in seconds reached 18.6%. The multi-period method estimated the value in the 8th period as follows: Seconds, relative to the 7th period The change in seconds is only Seconds. Examining the raw data for the 8th cycle revealed 7 outliers (detected via second-order difference), which severely hampered the convergence of the single-cycle fitting. The multi-cycle method, utilizing the estimate from the 7th cycle as prior information and naturally fusing multi-source information through the Kalman filtering framework, exhibits stronger robustness to outliers. Specifically, the Kalman gain matrix... The Frobenius norm is 0.42, which is less than 0.65 for the normal period, indicating that the algorithm assigns a lower weight to the measurement in the 8th period and relies mainly on prior information.

[0149] To quantitatively assess robustness to noise, a Monte Carlo simulation experiment was conducted in this embodiment. The parameters of the 10th period were selected from the parameter estimation sequence obtained by the multi-period method. As ground truth, theoretical flow velocity curves with 240 sampling points were generated based on a multi-exponential model, and then Gaussian noise of different levels was superimposed to generate simulation data. Noise levels were represented by signal-to-noise ratio (SNR), with five levels set: SNR = 20, 25, 30, 35, and 40 dB. For each noise level, 100 independent noise simulations were generated, and parameter estimation was performed using both single-cycle and multi-cycle methods (the multi-cycle method used real data from the previous nine cycles plus the current simulation data). The root mean square error (RMSE) of the parameter estimation error was calculated.

[0150] The results show that when SNR=25 dB, which is close to the noise level of the actual data, the RMSE parameter of the single-cycle method is: Second, Second, L / min, L / min. The RMSE for the multi-cycle method is: Second, Second, L / min, L / min. The improved ratio is: It is 6.4 times. It is 6.4 times. It is 9.1 times. The improvement was 7.2 times, with an average of 7.3 times. This result is very close to the improvement rate of the real data (7.1 times), validating the effectiveness of the comparative analysis. As the SNR increased, the RMSE of both methods decreased, but the improvement rate of the multi-cycle method remained stable at around 7 times. At low SNR (SNR=20 dB), the fitting success rate of the single-cycle method decreased significantly; 18 out of 100 simulations failed to converge to a reasonable solution, while the success rate of the multi-cycle method remained consistently 100%.

[0151] From the perspective of algorithm convergence, the single-cycle Levenberg-Marquardt algorithm may require hundreds of iterations to converge when the initial point is far from the true solution, and it is prone to getting trapped in local minima. Statistical analysis of 400 optimization processes across 20 cycles and 20 initial points showed an average of 112 iterations, a maximum of 498 iterations (close to the set upper limit of 500), and a minimum of 23 iterations. The standard deviation of the number of iterations was 85, and the coefficient of variation was 76%, indicating significant uncertainty in the convergence speed. In contrast, the multi-cycle extended Kalman filter only requires one iteration to complete the parameter update, with completely deterministic computational cost and time, and no convergence issues.

[0152] The comparative experiments in this embodiment fully verify the superiority of the technical solution of the present invention over the traditional single-cycle method. The performance difference between the two methods is... The results are significant at the horizontal level. These results demonstrate that by introducing temporal continuity constraints and a sequential estimation framework, the technical solution of this invention effectively solves the problem of parameter instability in traditional single-cycle methods, providing a more reliable tool for clinical respiratory mechanics monitoring.

[0153] Example 3

[0154] This embodiment demonstrates a complete monitoring system based on this method. The system integrates data acquisition hardware, signal processing software, and parameter estimation algorithms, achieving fully automated processing from raw airflow signals to physiological parameter estimation. The system adopts a layered modular architecture design, comprising five main layers: hardware device layer, data acquisition layer, signal processing layer, parameter estimation layer, and user interaction layer. These layers communicate through standardized interfaces, ensuring the system's scalability and maintainability.

[0155] The system's software architecture employs a multi-threaded, multi-process concurrent design. The main process is responsible for overall system coordination and the user interface; the data acquisition process interacts with hardware to read raw data; the signal processing process handles data preprocessing and feature extraction; the parameter estimation process executes the core algorithm; and the database process manages results and historical data. The processes communicate with each other via shared memory and message queues. Shared memory is used to transmit large amounts of data (such as raw sampling points), while message queues are used to transmit control commands and small data packets (such as parameter estimation results). The shared memory is implemented using Windows' File Mapping mechanism, creating a 16 MB shared memory region named "RespMon_SharedData". The message queue is implemented using named pipes, creating a pipe named "\\.\pipe\RespMon_MsgQueue", with messages in JSON structured text format for easy debugging and compatibility.

[0156] The data acquisition module is the lowest-level software component of the system. Its core functions are configuring hardware devices, initiating continuous acquisition, receiving data streams, and writing them to shared memory. Optimization options are set to maximum speed optimization. The module's entry function is DAQThread, which runs in a separate thread with a thread priority set to THREAD_PRIORITY_TIME_CRITICAL (real-time priority) to ensure timely response to hardware interrupts even under high system load. The DAQThread function first calls the NI-DAQmx API to initialize the device, create a task handle, and configure sampling parameters.

[0157] The callback function `OnDataAvailable` is called on each trigger. Its parameters include the task handle, the number of readable samples, and a callback context pointer. Internally, the function calls `DAQmxReadAnalogF64` to read data into a local buffer, then performs timestamp annotation, unit conversion, and data packing. The timestamp is obtained using `QueryPerformanceCounter`, which retrieves the current value of a high-precision timer with a resolution typically 1 microsecond on modern processors, and is converted to a Unix timestamp. The unit conversion linearly maps the ADC output voltage value to the flow rate value using the following formula:

[0158] ;

[0159] in Flow rate (L / min) This represents voltage (volts). 2.5 volts corresponds to the zero-flow point (the instant of apnea or the transition between respiratory cycles). Data packaging organizes each sampling point into a DataPoint structure, which is defined as:

[0160]

[0161] The `quality_flag` field is used to mark data quality, with values ​​including: 0x00 for normal data, 0x01 for sensor over-range, 0x02 for sensor offline, and 0x04 for ADC overflow. The packaged data is written to a shared memory circular buffer. The write position is maintained by the atomic variable `write_index`, which is incremented using the `InterlockedIncrement` atomic operation to ensure thread safety.

[0162] The signal processing module reads raw data from shared memory, performs preprocessing tasks such as filtering, period segmentation, and anomaly detection, and then passes the processed data to the parameter estimation module. This module is developed using Python 3.9 and leverages the efficient vector operations of scientific computing libraries such as NumPy and SciPy. The module's main loop runs on a 1-second cycle, processing the most recent second's worth of raw data (100 sampling points) in each iteration.

[0163] Data reading utilizes the mmap module to access shared memory, mapping it to a NumPy array for zero-copy access. The specific code logic is as follows: first, an mmap object is created to map the shared memory region; then, a NumPy structured array view is created based on the data structure definition, allowing direct access to fields such as timestamps and traffic values ​​via array indices. The read position is maintained using the `read_index` variable, which is updated after each read to ensure that the same batch of data is not processed repeatedly.

[0164] The filtering operation uses the `filtfilt` function from the `scipy.signal` module to implement zero-phase digital filtering. Filter design is completed during module initialization, calling the `butter` function to generate the second-order section coefficients (SOS format) of a 4th-order Butterworth low-pass filter. The SOS format offers better numerical stability compared to the traditional numerator and denominator coefficients (b, a format), especially for higher-order filters. The `filtfilt` function receives the SOS coefficients and the input signal, returning the filtered signal. Internally, it is implemented as a cascade of forward and backward filtering, automatically handling boundary effects. The filtered signal is stored in a sliding window buffer that maintains data from the most recent 10 seconds (1000 sampling points) for subsequent period segmentation.

[0165] The cycle segmentation algorithm identifies the boundaries between inhalation and exhalation by detecting changes in the airflow sign. The algorithm maintains a state machine with three states: INHALE (inhalation), EXHALE (exhalation), and PAUSE (pause). The state transition is triggered as follows: when the airflow changes from a positive value (inhalation) to a negative value (exhalation) for more than 0.1 seconds, the state transitions from INHALE to EXHALE, and the start of exhalation is recorded; when the airflow changes from a negative value to a positive value for more than 0.1 seconds, the state transitions from EXHALE to INHALE, and the end of exhalation is recorded. At this point, a complete exhalation cycle ends. The timestamps of the start and end points of exhalation, along with the corresponding flow data, are packaged into a CycleData object. This object contains the fields: cycle_id (cycle number), start_time (start timestamp), end_time (end timestamp), flow_data (flow array), duration (duration), and volume (expiratory volume, calculated by integrating the flow). The CycleData object is serialized into JSON format and sent to the parameter estimation module via a message queue.

[0166] Anomaly detection is performed after cycle segmentation, calculating multiple quality metrics for each detected cycle. The first metric is cycle duration; a normal expiratory duration should be between 1 and 5 seconds, and cycles exceeding this range are marked as abnormal. The second metric is peak flow rate; the peak expiratory flow rate should be between 20 and 80 L / min (depending on tidal volume and respiratory rate); abnormally high or low peak flow rates may correspond to coughing, airway obstruction, or sensor malfunction. The third metric is the smoothness of the flow curve, assessed by calculating the variance of the second-order difference; excessive variance indicates the presence of high-frequency noise or spike interference. The fourth metric is expiratory volume, calculated by numerically integrating the flow curve using the trapezoidal rule, with the formula:

[0167] ;

[0168] in Volume (liters) Flow rate (L / min) The sampling interval is 0.01 seconds. A normal expiratory volume should be close to the set tidal volume (approximately 450 ml in this system). Cycles with a deviation exceeding 30% are marked as abnormal. All quality metrics are summarized in the `quality_score` field (a continuous value from 0 to 1, where 1 represents perfect quality and 0 represents completely unusable). Cycles with a `quality_score` below 0.5 will not be sent to the parameter estimation module.

[0169] The parameter estimation module receives a CycleData object from the signal processing module, executes the extended Kalman filtering algorithm described in detail in Example 1, and outputs the parameter estimation results. This module is also developed using Python, with the core algorithm encapsulated in the RespiratoryEKF class. The constructor of the RespiratoryEKF class receives algorithm configuration parameters, including the number of exponential components. Standard deviation of process noise and Observation noise variance Smoothness penalty coefficient These parameters are stored as member variables of the class. The class provides three main methods: the `initialize` method is used to initialize the parameters and the covariance matrix, the `predict` method performs the state prediction step, and the `update` method performs the measurement update step.

[0170] The `initialize` method is called after receiving the first 5 periods of data. Internally, it performs a single-period multi-exponential fit on each period (calling `scipy.optimize.curve_fit`), and takes the average of the 5 fit results as the initial parameters. The standard deviation is used as the initial uncertainty to construct the covariance matrix. The parameters of the `curve_fit` function are set as follows: the fitting function is a multi-exponential model defined by a lambda expression, the initial guesses are generated using empirical formulas, and the parameter boundaries are... Seconds and L / min, maximum number of iterations 1000, tolerance .

[0171] The `predict` method implements the state prediction equation. Covariance prediction equation Since the state evolution is a first-order random walk (without deterministic evolution terms), the prediction steps are very simple, mainly involving matrix addition. The process noise covariance matrix... During initialization, it is constructed as a diagonal matrix with diagonal elements as follows: .

[0172] The `update` method implements the complete measurement update process, including Jacobian matrix calculation, Kalman gain calculation, parameter update, and covariance update. The calculation utilizes NumPy's broadcast mechanism to achieve vectorization, avoiding explicit loops. The specific code is as follows: First, a time vector t = np.linspace(0, duration, num_points) is generated. Then, exp_terms = [np.exp(-t / tau_i) for i in range(N)] is calculated to obtain the list of exponent terms. Finally, vector operations are used to calculate... Each column.

[0173] The Kalman gain is calculated using the Woodbury identity optimization method to avoid inverting large matrices. Specifically, it calls `numpy.linalg.solve` to solve the linear equation system instead of explicitly calculating the matrix inverse. The `solve` function internally uses LU decomposition, resulting in better numerical stability and computational efficiency than direct inversion.

[0174] After parameter and covariance updates, the algorithm performs constraint projection. Constraint projection is implemented using the `project_constraints` method, which applies various constraints sequentially: first, box constraints are applied. Use the np.clip function to truncate; then apply sorting constraints. The time constants are sorted using `np.sort` and the corresponding weight coefficients are adjusted synchronously. Finally, weight normalization constraints are applied, the weight sum is calculated, and the weights are scaled proportionally. Constraint projection may disrupt the consistency of the covariance matrix; therefore, the covariance matrix is ​​re-symmetricized after projection. It checks for positive definiteness and performs the projection of the nearest positive definite matrix if negative eigenvalues ​​exist (achieved through eigenvalue decomposition and eigenvalue truncation).

[0175] After parameter estimation is complete, the results are encapsulated as an `EstimationResult` object, containing the following fields: `cycle_id` (cycle number), `timestamp`, `parameters` (a dictionary of parameters with keys "tau1", "tau2", "A1", "A2"), `covariance` (a list of upper triangular elements), and `fit_quality` (goodness of fit). The EstimationResult object is serialized into JSON format and sent to two destinations: (1) via a message queue to the user interface module for real-time display; and (2) via the database process to be written to the SQLite database for persistent storage.

[0176] Specifically, to ensure that the estimation results conform to the physical constraints of respiratory mechanics, the algorithm performs a physical rationality verification after each cycle parameter update. This verification is based on the principle of energy conservation; drastic changes in parameters between adjacent cycles imply drastic changes in the work of breathing, while the work of breathing should remain relatively stable under steady ventilation conditions.

[0177] Definition of the first The characteristic energy storage of each lung region is This reflects the elastic potential energy of the region at the start of exhalation. This definition originates from fundamental relationships in respiratory mechanics: during exhalation, the elastic energy stored in the alveoli drives the expulsion of gas; the stored energy is directly proportional to the square of the volume and inversely proportional to the time constant. For the 6th cycle in this embodiment, the characteristic stored energy of each region is calculated: ; ;

[0178] Calculate the rate of change of parameters between adjacent periods. The rate of change of the time constant is: ;

[0179] The rate of change of weights is: ;

[0180] Similarly, the rates of change for the second region were calculated to be 0.016 and -0.012, respectively.

[0181] Calculate the cost of changes in breathing work: ;

[0182] The cost of this work is much smaller than the threshold. (This threshold was obtained from the statistical analysis of stable ventilation data from the first 50 cycles and calculated as the mean plus three times the standard deviation), indicating that the parameter changes in the 6th cycle conform to the energy conservation constraint, and the verification was successful.

[0183] In 20 cycles, the algorithm detected power costs of 3.2 and 2.8 in cycles 8 and 15, respectively, slightly exceeding the threshold. Examining the raw data for these two cycles revealed 7 outliers in cycle 8 (possibly corresponding to mild coughing) and cardiac artifacts in cycle 15. For these two cycles, the algorithm automatically increased the process noise covariance (from the original diagonal elements). Increase to This adaptive adjustment mechanism reduces the weight of current measurement data and relies more on estimates from the previous period. This avoids unreasonable parameter jumps caused by outlier data.

[0184] The work cost distribution over 20 cycles was statistically analyzed: minimum 0.38, maximum 3.2, median 0.62, mean 0.85, and standard deviation 0.58. The work cost in 18 cycles (90%) was less than the threshold of 2.5, and in 2 cycles it slightly exceeded the threshold, but reasonable parameter estimates were still obtained through adaptive adjustment of the algorithm. The relative rate of change of implied respiratory work over these 20 cycles was calculated: mean 8.3%, standard deviation 12.5%, and 95th percentile 31.2%, all within the physiologically reasonable range (<40%).

[0185] The database process manages an SQLite database file (RespMon.db), which is stored in the system's data directory. The database contains three main tables: the Patients table stores basic patient information (patient_id, name, age, diagnosis, etc.); the Sessions table stores monitoring session information (session_id, patient_id, start time, end time, ventilator settings, etc.); and the Cycles table stores parameter estimates for each respiratory cycle (cycle_id, session_id, timestamp, tau1, tau2, A1, A2, covariance, quality, etc.). The Cycles table is the core data table and is expected to accumulate a large number of records over long-term monitoring; therefore, indexes are created on the timestamp and session_id fields to accelerate queries. Database writes employ a batch commit strategy.

[0186] The statistics panel displays several real-time updated statistics, including the mean, standard deviation, coefficient of variation, parameter trend (linear regression slope), and outlier count for the most recent 20 periods. These statistics are recalculated after each new period of data is received, using an incremental update algorithm to improve efficiency. For example, the incremental update of the mean and variance uses the Welford algorithm, which avoids storing all historical data by maintaining cumulative values. The specific formula is: Let... For the front The mean of the values, For the front The sum of the squares of the values ​​is:

[0187] ; ; ;

[0188] in Let be the variance. The computational complexity of this incremental algorithm is O(n log n). Compared to recalculating all the data each time, It has a significant advantage in terms of complexity.

[0189] The system's communication protocol uses a custom message format; all messages are JSON structured text for easy debugging and expansion. Each message contains three top-level fields: `msg_type` (message type string), `timestamp` (message generation timestamp), and `payload` (message payload, structure depends on the message type). The following message types are defined: `DATA_ACQUIRED` (raw data acquisition complete), `CYCLE_DETECTED` (respiratory cycle detection complete), `ESTIMATION_DONE` (parameter estimation complete), `ALARM_TRIGGERED` (alarm triggered), `COMMAND` (control commands, such as start / stop monitoring), `STATUS_QUERY` (status query), and `STATUS_RESPONSE` (status response). For example, the `ESTIMATION_DONE` message payload contains the serialized content of an `EstimationResult` object. Message sending and receiving are implemented through a wrapped `MessagingClient` class, which provides `send` and `receive` methods. Internally, actual communication is performed via named pipes or TCP sockets (depending on configuration). Named pipes are used for inter-process communication on the same computer, while TCP sockets are used for remote communication across computers, such as sending data to a central monitoring station.

[0190] This embodiment provides a complete and deployable real-time respiratory parameter monitoring system, covering the entire process from hardware selection, software architecture design, module implementation to system integration testing. The system adopts a modular and layered architecture, with modules communicating through standardized interfaces, facilitating maintenance and expansion. The system's real-time performance, estimation accuracy, and long-term stability (72 hours of trouble-free operation) all meet the requirements of clinical applications, providing an effective decision support tool for respiratory intensive care.

Claims

1. A sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles, characterized in that, Includes the following steps: S1 Continuous Acquisition Time series data of flow rate over one respiratory cycle Each respiratory cycle is denoted as the 1st respiratory cycle. One cycle ( The flow rate data for each cycle includes There are 1 sampling point, denoted as _ . , ; S2 models the parameters of the multi-exponential decay model of expiratory flow rate as time-varying state variables, wherein the time-varying state variables include the first... The time constant of each period and weighting coefficients ,in The number of exponential components; S3 establishes a state evolution model to describe the variation of parameters between adjacent cycles: ; ;in and This represents process noise, indicating random variations in parameters; S4 establishes an observation model to describe the relationship between the flow velocity data for each cycle and the parameters of the current cycle: ;in To observe noise; S5 employs a sequential estimation algorithm, updating the parameter estimates periodically starting from the first period: for the... Each cycle, based on the previous The parameter estimates for the nth period are used to predict the nth period using the state evolution model. Initial values ​​of parameters for each cycle; Using the first The actual flow velocity data for each cycle is used to correct the parameter estimates by minimizing the objective function. ;in This is a smoothness penalty term for parameter changes. These are the weighting coefficients; S6. Output the parameter estimates for each period. and its confidence interval.

2. The method for sequential estimation of physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The state evolution model in step S3 also considers the impact of external intervention: When the PEEP setting value is detected to be... Adjust to At that time, the state evolution model is modified as follows: ; in For PEEP to the first The influence coefficient of the time constant is increased; at the same time, the process noise covariance is increased to allow the parameters to change rapidly after intervention.

3. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The smoothness penalty term in step S5 adopts a second-order difference form with varying parameters: ; The second-order difference penalty term constrains the acceleration of parameter changes, which is used to make the parameter evolution over time smoother.

4. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The sequential estimation algorithm in step S5 employs the extended Kalman filter method: Prediction step: Calculate the first prediction step based on the state evolution model. Prior estimates and prior covariance matrix of each periodic parameter; Calculate the Jacobian matrix of the observation model with respect to the parameters: ; The update steps are as follows: using the first Using the actual flow velocity data for each cycle and the Jacobian matrix, calculate the Kalman gain, and update the posterior estimates and posterior covariance matrix of the parameters.

5. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The parameter correction process in step S5 also needs to meet the following constraints: The time constant constraint is ,and ; Weighting coefficient constraints are ,and ; When the parameters obtained from unconstrained optimization exceed the constraint range, they are projected onto the boundary of the constraint set using a projection algorithm. The projection algorithm uses the nearest point projection method, which finds the feasible point closest to the unconstrained solution in the constraint set.

6. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The initial parameter estimates for the first period were determined in the following manner: For the flow velocity data of the first cycle, parameter estimates were obtained using a single-cycle multi-exponential fitting method. ; Single-cycle fitting was performed for the 2nd to 5th cycles, and the mean and standard deviation of the parameter estimates for each cycle were calculated. The average value is used as the initial parameter estimate for the first period, and the standard deviation is used as the diagonal element of the initial covariance matrix.

7. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The confidence intervals of the parameters in step S6 are calculated based on the posterior covariance matrix: No. Period parameters The 95% confidence interval is ; in The parameter in the posterior covariance matrix The standard deviation is the square root of the diagonal elements of the covariance matrix.

8. The method for sequential estimation of physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The output of step S6 also includes a time evolution trend analysis of the parameters: For each parameter Calculate its most recent One cycle ( linear regression slope within ) ; when When the parameter is determined to have a significant trend of change, then... The threshold for trend determination; The direction and rate of change of the output parameters.

9. The sequential estimation method for physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, It also includes a parameter anomaly change detection step: For the first For each period, calculate the normalized deviation of the parameter estimates relative to the predicted values: ; in These are predictions based on the state evolution model. The standard deviation of the forecast; when At that time, the judgment of the first Parameters for each period An abnormal change occurs, and an abnormal alarm is output.

10. The method for sequential estimation of physiological parameters based on combined information from multiple respiratory cycles according to claim 1, characterized in that, The number of exponential components The method for determining it is as follows: right Perform steps S1 to S5 respectively to obtain each Sum of squared fitted residuals for all periods corresponding to the value ; Computational Bayesian Information Criterion ; Choose to make smallest As the optimal number of exponential components.