VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping

The VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping collects and processes respiratory signals in real time, drives interactive actions in VR scenes, and solves the problems of low quantitative accuracy, lack of personalization and poor compliance in traditional respiratory rehabilitation training methods through integral models and difficulty adaptation mechanisms, achieving precise, personalized and fun respiratory training effects.

CN122141210APending Publication Date: 2026-06-05ZHEJIANG CANCER HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610270076.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-06
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Traditional respiratory rehabilitation training methods suffer from low quantitative accuracy, lack of personalization, and poor compliance, which can easily lead to user boredom and low training completion rates.

Method used

A VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping is adopted. The system collects respiratory signals in real time through a flow sensing module, and performs signal processing and individualized calibration in combination with a BLE communication module and WeChat mini program to generate individualized calibration parameters, drive interactive actions in the VR scene, and improve the training effect through an integral model and difficulty adaptive mechanism.

Benefits of technology

It achieves precise quantification and personalized adaptive breathing training, improving user compliance and training completion rate, enhancing the fun and social motivation of training, and ensuring privacy and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122141210A_ABST
    Figure CN122141210A_ABST
Patent Text Reader

Abstract

The application provides a VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping, adopts a BLE peripheral to collect nose / mouth-inhale / exhale flow signals (including a special detection device, and a reminder is triggered when the nose / mouth-inhale / exhale is not used) and mouth-exhale flow signals in real time, generates individualized inhale relative indexes and drives the water absorption and water spraying actions of the VR scene through filtering and dynamic calibration. The system supports two fire extinguishing scene modes, inhale and exhale detection is enabled and the user is guided to master the correct method of 'nose / mouth-inhale / exhale + mouth-exhale' during the initial training, and the training time is strictly controlled within 10 minutes. The training amount is quantified and visual feedback is realized through an integral model, the difficulty is automatically adjusted according to the historical performance, and an integral ranking function is newly added. The data only retains feature abstract, integral statistics and desensitization ranking information, and the privacy safety is ensured. The scheme has the advantages of low contact, portability and interesting, and is suitable for children or adult lung function rehabilitation and home training scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rehabilitation training technology, and in particular to a VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping. Background Technology

[0002] Traditional respiratory rehabilitation training methods often employ monotonous, repetitive breathing exercises (such as blowing up balloons or using breathing machines). The technical drawbacks include: 1. Low quantification accuracy: It relies on subjective feelings or simple counting, and cannot accurately measure key indicators such as respiratory flow and intensity; 2. Lack of personalization: The training difficulty is fixed and cannot be adapted to the breathing abilities of different users; Poor compliance: The monotonous environment can easily lead to user boredom and low training completion rate. Summary of the Invention

[0003] To address the technical problems existing in the prior art, the present invention provides the following technical solution: A VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping, the system comprising: (1) Flow sensing module: used to collect the flow signal of inhalation / exhalation at the user's nose / mouth in real time, including a dedicated detection device for inhalation / exhalation at the nose / mouth, and triggering a visual or audio reminder when it is detected that no inhalation / exhalation is being performed at the nose / mouth; the module includes a Venturi structure differential pressure flow meter or a dual thermistor array flow meter with a range of 0-100L / min. (2) BLE communication module: used to transmit the traffic signal to the terminal device; (3) Terminal device: running on WeChat mini program, used to perform signal preprocessing, individualized calibration, signal normalization, feature extraction, VR interactive mapping, integral calculation, difficulty adaptation, and privacy management; during the first training, inhalation and exhalation detection are enabled and users are guided to master the correct training method of "nose / mouth - inhalation / exhalation + mouth exhalation"; the training time is controlled to not exceed 10 minutes; and the integral ranking function is implemented (supporting comparison with one's own historical performance and other users). (4) VR display device: supports WebVR / Three.js rendering, used to present virtual scenes and respond to user breathing behavior in real time. The device includes AI glasses with built-in gyroscope and accelerometer to obtain the head direction θ value; provides two fire extinguishing scene modes: head rotation fire extinguishing mode (adjusting the water spray direction using the head direction θ) and fixed forward non-rotation mode (the water spray direction remains unchanged). The system generates individualized calibration parameters (Q0, Q_max) through the terminal device and calculates the relative inhalation index Q_rel=(Q-Q0) / (Q_max-Q0) (where Q is the real-time nasal / mouth inhalation / exhalation flow rate). The system uses a baseline flow rate (Q_max is the upper limit of respiratory flow rate) to drive the character's movements in the VR scene; it triggers visual or audio prompts when it detects that the user is not breathing through their nose / mouth; it enables inhalation and exhalation detection during the initial training phase and guides the user to master the correct breathing method; the training time is strictly controlled within 10 minutes; the training volume is quantified through an integral model, and the difficulty coefficient is dynamically adjusted based on the continuous training completion rate; it supports the anonymized storage and display of score ranking data (which can be compared with its own history and other users); the system only locally encrypts and stores feature summaries, score statistics, calibration parameters, and anonymized ranking information, and uploads the anonymized data to the cloud after user authorization; the fire extinguishing action in the VR scene supports two modes: in the head-turning fire extinguishing mode, the water spray direction is synchronized with the head direction θ, and in the fixed forward non-rotation mode, the water spray direction remains unchanged.

[0004] Preferably, signal preprocessing includes adaptive Kalman filtering, zero-point calibration, and temperature and humidity compensation; The initial covariance matrix of the adaptive Kalman filter is P0=diag([0.1,0.1]), the process noise is Q=0.01, and the measurement noise is R=0.1; The individualized calibration includes: during the initial training, only guiding the user to complete the exhalation test and master the correct training method of "nose / mouth - inhale / exhale + mouth exhale"; subsequent training guides the user to complete 30 seconds of calm breathing to collect baseline flow rate Q0 and 3 maximum deep inhalation or exhalation to collect reference upper limit Q_max.

[0005] Preferably, the feature extraction includes at least 12 features from inspiratory duration, stability, peak flow rate, and expiratory interval, for rehabilitation assessment and difficulty adjustment.

[0006] Preferably, the VR interaction mapping includes: Map Q_rel to the water absorption speed v=v0Q_rel of the virtual character or the water spraying action, where v0 is the base speed; Exhalation triggers a water spraying animation, and the spraying direction adjusts according to the scene mode: in the head-turning fire extinguishing mode, it is synchronized with the head direction θ, and in the fixed forward non-rotation mode, the direction remains unchanged. The anomaly detection mechanism includes detection of missed inhalation / exhalation, overinhalation / exhalation, or pauses, and triggers visual or audio cues.

[0007] Preferably, the integral model expression is as follows: S(t) = S(t-1) + kQ_relcosθΔt, Where S(t) is the inhalation integral at time t; S(t-1) is the cumulative integral at time t-1; k is the integral mapping coefficient (default 0.8, controlling the integral growth rate); θ is the angle between the VR glasses head direction and the virtual target; Δt is the time step (default 0.1s); cosθ is the direction weight (ensuring the integral is linked to the user's aiming behavior); ΔS is the extra integral for hitting the target during exhalation; Q_rel_exp is the exhalation relative index (calculated in the same way as Q_rel).

[0008] Preferably, the difficulty adaptation is based on the completion rate R of N consecutive training sessions, which is used to calculate the adjustment coefficient k_adj. When R > 0.9, k_adj = 1.1; When R < 0.6, k_adj = 0.8; Otherwise, k_adj = 1.0; Difficulty adjustments include changes to the target water volume, flow mapping coefficient, or virtual target movement speed.

[0009] Preferably, the privacy management uses the AES-256 encryption algorithm to locally store feature summaries, scores, calibration parameters, and desensitized score ranking information. The data uploaded to the cloud is the desensitized feature vector and ranking statistics, and requires active user authorization.

[0010] Preferably, the system supports adaptation for children and elderly users: The scenario for children is cartoon-style, the training time is shortened to 10 minutes / session, and the calibration process is simplified to 15 seconds of calm breathing and 2 maximum deep inhalations or exhalations. The scenario for elderly users features a simplified style, with the initial training difficulty reduced by 20%, abnormal prompts enhanced with voice broadcasts, and a fixed forward-facing fire extinguishing scenario mode enabled by default.

[0011] Preferably, the terminal device adopts a thread-sharing architecture: The main thread is responsible for VR rendering, with a frame rate of ≥30fps; The worker thread is responsible for BLE data reception, signal preprocessing, and feature extraction. Inter-thread communication is achieved through Worker.postMessage(). The message queue length is ≤10 messages and the delay is ≤50ms.

[0012] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: This invention discloses a virtual reality respiratory rehabilitation training system based on an external flow sensor and a WeChat mini-program. It uses a BLE peripheral to collect real-time nasal / mouth inhalation / exhalation flow signals (including a dedicated detection device and a reminder mechanism for unused nasal / mouth inhalation / exhalation) and oral exhalation flow signals. The data is filtered and dynamically calibrated via the WeChat mini-program. During initial training, inhalation and exhalation detection are enabled, guiding users to master the correct training method of "nasal / mouth inhalation / exhalation + oral exhalation." Subsequently, individualized relative inhalation indices are generated to drive the "elephant sucking water" character's inhalation and spraying actions in the VR scene. The system supports two fire extinguishing scenario modes (head rotation for fire extinguishing, fixed forward without rotation), with training time strictly controlled within 10 minutes. An integral model quantifies training volume and provides visual feedback, automatically adjusting the difficulty based on historical performance, and includes a new ranking function (allowing comparison with the user's own historical performance and other users). Only feature summaries, integral statistics, calibration parameters, and anonymized ranking information are retained to ensure privacy and security. This program combines the advantages of low-contact, portable, fun, and adaptable to a wide range of populations, making it suitable for pulmonary function rehabilitation and home training scenarios for children or adults.

[0013] The technical advantages of this system are: 1. Precise quantification: Employing a Venturi differential pressure / dual thermistor array sensor, the flow measurement accuracy is ≤5%, and it features a dedicated detection and reminder mechanism for nasal / mouth inhalation / exhalation; 2. Personalized adaptation: Adjusting the difficulty based on dynamic calibration and training completion rate to match individual breathing abilities; 3. High compliance: VR virtual scenes enhance engagement, with a training completion rate ≥85%, and supporting two fire extinguishing modes to suit different users (head rotation / fixed forward without rotation); 4. Intelligent guidance: Initial training guides users to master the correct breathing method, strictly controlling training time to ≤10 minutes; 5. Social incentives: A new points ranking function is added, supporting comparison with one's own historical performance and other users; 6. Privacy and security: Local AES-256 encrypted storage, cloud data requires user authorization; 7. Portability: WeChat mini-program + BLE peripherals, installation-free cross-terminal use. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is an architecture diagram of a VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping provided by an embodiment of the present invention; Figure 2 This is a flowchart illustrating a system data processing algorithm provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a system application process provided by an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0016] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0017] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0018] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.

[0019] In this embodiment of the invention, sometimes a subscript such as W1 may be mistakenly written as a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.

[0020] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0021] This invention discloses a virtual reality respiratory rehabilitation training system based on an external flow sensor (Venturi structure differential pressure / dual thermistor array) and a WeChat mini-program. The system uses a BLE peripheral with an nRF52832 chip to collect real-time nasal / mouth inhalation / exhalation flow signals (including a dedicated detection device that triggers visual or audio alerts when nasal / mouth inhalation / exhalation is not used) and mouth exhalation flow signals. The mini-program performs preprocessing such as adaptive Kalman filtering, zero-point calibration, and temperature and humidity compensation, as well as individualized dynamic calibration (initially, the system guides the user to complete exhalation detection and master the correct training method of "nasal / mouth inhalation / exhalation + mouth exhalation"; subsequently, Q0 / Q_max is generated through 30 seconds of calm breathing followed by 3 deep inhalations). This generates the relative inhalation index Q_rel, which drives the "elephant drinking water" character in the VR scene to drink water (v=v0). Q_rel) and water spray (direction adjusted according to fire extinguishing mode: head rotation synchronizes with head θ value during fire extinguishing, direction remains unchanged when fixed forward and not rotating) action. The system uses the inhalation integral model S(t)=S(t-1)+k Q_rel cosθ Δt enables the quantification of training volume and visual feedback, with training time strictly controlled within 10 minutes. The difficulty (k_adj coefficient) is dynamically adjusted based on the completion rate of five consecutive training sessions. A new score ranking function supports comparison with one's own historical performance and that of other users. Data retains only feature summaries, scores, calibration parameters, and anonymized ranking information (locally AES-256 encrypted). Cloud reception of anonymized data requires user authorization to ensure privacy and security. This solution combines the accuracy of flow measurement (≤5%) and training completion rate (≥85%) with engaging gameplay, as well as the advantages of low-contact, portable, and multi-user adaptability, making it suitable for pulmonary function rehabilitation and home training scenarios for children and adults.

[0022] I. Introduction to Hardware and Software Systems (e.g.) Figure 1 (As shown) 1. Hardware System Design: (1) Flow sensing module: Dimensions are 50×30×20mm, weight ≤20g, made of medical-grade ABS material (compliant with ISO 13485 medical device standard), installed on the breathing mouthpiece, which is made of food-grade silicone (replaceable, high temperature resistant up to 120℃). Built-in 300mAh lithium battery (charging time ≤2 hours, battery life ≥8 hours), supports Type-C fast charging, flow measurement accuracy ±3%FS, range 0-100L / min. Includes a dedicated inhalation / exhalation detection device at the nose / mouth, which triggers visual or audio reminders when no inhalation / exhalation is detected at the nose / mouth; controlled by the main control MCU, and reports data to the terminal via BLE Bluetooth.

[0023] (2) VR display device: Supports WebVR 1.1 standard, resolution ≥1080×1920, field of view ≥100°, refresh rate ≥60Hz, end-to-end latency ≤20ms. Built-in six-axis gyroscope (accuracy ±0.5°) and three-axis accelerometer (accuracy ±0.01g), sampling rate 100Hz, used to obtain the head direction θ value in real time; supports two fire extinguishing scene modes: head rotation fire extinguishing mode (adjusting the water spray direction using the head direction θ) and fixed forward non-rotation mode (the water spray direction remains unchanged).

[0024] 2. Software System Design: (1) Mini Program Architecture: The MVVM pattern is adopted, which is divided into a view layer (WXML template and WXSS style are designed separately), a logic layer (asynchronous processing of algorithm tasks through Promise), and a data layer (dual storage of cloud development database and local cache). The view layer is responsible for VR scene rendering and user interaction, the logic layer is responsible for signal processing, algorithm calculation and difficulty adjustment, and the data layer is responsible for encrypted storage and cloud synchronization.

[0025] (2) Threaded processing: The main thread is responsible for VR rendering (frame rate ≥ 30fps, CPU utilization ≤ 30%), while the worker thread is responsible for BLE data reception (sampling rate 100Hz), signal preprocessing, and feature extraction. Message passing between threads is achieved through Worker.postMessage(), with a message queue length ≤ 10 messages and a delay ≤ 50ms.

[0026] (3) Cloud services: Utilizing Tencent Cloud Elastic Server (CVM) + Object Storage (COS) architecture, it supports 1000+ concurrent requests per second, with a storage capacity ≥10TB and a data backup cycle of 24 hours. The rehabilitation assessment model construction and application process is as follows:

Training Phase

[0027]

Building Phase

[0028]

Application Phase

[0029] 3. System interaction flow: The user wears a mouthpiece with a built-in Venturi / dual thermistor array sensor and a dedicated nose / mouth inhalation / exhalation detection device → turns on the BLE module power of the nRF52832 chip → the mini-program automatically searches for and connects to the device → completes individualized calibration: During the initial training, the user is guided to complete the exhalation detection and master the correct training method of "nose / mouth inhalation / exhalation + mouth exhalation". Subsequent training involves generating 30 seconds of calm breathing + 3 deep inhalations. / Q_max → Select a VR scene (e.g., "Elephant Sucking Water") and fire extinguishing mode (head rotation / fixed forward without rotation) → Wear AI glasses that support WebVR → Click the "Start Training" button → Enter data sampling and analysis; training time is strictly controlled within 10 minutes; after training, you can view your score ranking (compared with your own historical performance and other users):

First Layer: Signal Acquisition and Preprocessing

Fourth Layer: Difficulty Adaptation and Privacy Management

[0030] The specific details of the system interaction process are as follows: Step 1: Signal Acquisition and Preprocessing (corresponding to the first layer architecture) → ① The user wears a breathing nozzle, and the flow sensor module collects the nasal / mouth inhalation / exhalation and mouth exhalation flow signals at a sampling rate of 100Hz → ② The BLE module (nRF52832) transmits the data to the mini-program at a rate of 1Mbps → ③ The mini-program worker thread performs preprocessing: adaptive Kalman filtering (P0=diag([0.1,0.1]), Q=0.01, R=0.1) → ④ Zero-point calibration (acquiring the mean offset of 10s of no breathing state) → ⑤ Temperature and humidity compensation (polynomial fitting model: k=1.0 at T=25℃, adjusted by 0.005 every ±1℃) → ⑥ Output the preprocessed flow signal Q; if no nasal / mouth inhalation / exhalation is detected, a visual / audio reminder is triggered.

[0031] Step 2: Signal Normalization and Feature Extraction (corresponding to the second layer architecture) → ① Calculate Q_rel=(Q-Q0) / (Q_max-Q0) using individualized calibration parameters {Q0,Q_max} (Q is the real-time flow rate of nasal / mouth inhalation / exhalation) → ② Extract 12 features: inhalation duration, stability (variance / mean ratio), peak flow rate, expiratory interval, integral growth rate, number of anomalies (including the number of times nasal / mouth inhalation / exhalation was not used), training completion rate, average Q_rel, maximum Q_rel, respiratory cycle, inhalation / exhalation ratio, flow fluctuation coefficient → ③ Output feature vector F=[f1,f2,...,f12].

[0032] Step 3: VR Interaction Mapping and Integral Feedback (corresponding to the third layer architecture) → ① The WebVR / Three.js module renders at a 30fps frame rate: Q_rel is mapped to the speed at which an elephant drinks water. →② Real-time calculation of integrals (Δt=0.1s) →③ During exhalation, the direction of the airflow is detected, triggering a water spray animation (30fps, delay <50ms). The direction is adjusted according to the mode (head rotation synchronized with θ value / fixed forward). If the target is hit, then... →④ Anomaly detection (not using nose / mouth to inhale / exhale / missed inhale / overinhale / pause) triggers a prompt mechanism →⑤ Outputs real-time scores and interaction status, and records ranking data.

[0033] Step 4: Difficulty Adaptation and Privacy Management (corresponding to the fourth layer architecture) → ① Calculate the training completion rate R = actual integral / target integral → ② Adjust the difficulty coefficient k_adj: R>0.9 → k=0.88, target water volume +10%; R<0.6 → k=0.72, target water volume -10% → ③ AES-256 encrypted storage of feature summary, integral, calibration parameters, and anonymized ranking information → ④ After user authorization, upload the anonymized feature vector F and ranking statistics to the cloud → ⑤ Output the adjusted difficulty parameters, storage status, and ranking comparison results.

[0034] II. As shown in Figure 2 the system data processing algorithm steps 1. Signal acquisition and preprocessing: (1) Hardware selection principle: The flow sensing module uses a Venturi structure differential pressure flowmeter (accuracy ±3%FS, range 0 - 100L / min) or a dual thermistor array flowmeter (accuracy ±5%FS, response speed ≤10ms). The Venturi structure generates differential pressure through fluid contraction and expansion, which is converted into a flow signal and is suitable for respiratory detection with a high dynamic range; the dual thermistor array measures the bidirectional flow of inhalation / exhalation through the difference in the cooling effect of the airflow on the thermistors. The BLE communication module selects the nRF52832 chip, supports the BLE 5.0 protocol, has a transmission rate ≥1Mbps, and a power consumption ≤1mA (standby state), ensuring real-time performance and low power consumption.

[0035] (2) Preprocessing algorithm: Filtering uses an adaptive Kalman filter (initial covariance matrix P0 = diag([0.1, 0.1]), process noise Q = 0.01, measurement noise R = 0.1), combined with the periodic characteristics of the respiratory signal (the calm breathing cycle is 3 - 5s), to dynamically adjust the filtering gain and effectively suppress environmental noise (such as background conversation, device vibration); zero calibration updates the zero offset automatically by collecting the signal mean in a 10s non-breathing state; temperature and humidity compensation is based on the data of the built-in temperature and humidity sensor of the sensor, and corrects the flow value through a polynomial fitting model (compensation coefficient k = 1.0 when T = 25°C, and adjusts 0.005 for every 1°C change).

[0036] (3) Individualized calibration process: During the initial training, the system only guides the user to complete the exhalation detection and master the correct training method of "nose / mouth - inhalation / exhalation + mouth exhalation"; subsequent training guides the user to complete 30s of calm breathing (collect the baseline flow Q0, and take the mean of the stable interval) and 3 times of maximum deep inhalation or exhalation (collect the reference upper limit Q_max, and take 95% of the maximum value as the effective threshold), generating an individualized calibration parameter set {Q0, Q_max, breathing cycle T0} for subsequent normalization calculation.

[0037] 2. Signal normalization and feature extraction: (1) Normalization algorithm: The real-time flow is converted into a relative index of 0 - 1 through the formula Q_rel=(Q - Q0) / (Q_max - Q0) to eliminate individual differences in respiratory capacity (such as the difference in flow ranges between children and adults). When Q < Q0, Q_rel = 0; when Q > Q_max, Q_rel = 1, to avoid the influence of extreme values on the interaction experience.

[0038] Formula Explanation: Q_rel is the relative inspiratory index (0≤Q_rel≤1); Q is the real-time collected inspiratory flow rate; Q0 is the individually calibrated baseline flow rate for quiet breathing; Q_max is the individually calibrated maximum inspiratory flow rate. By eliminating absolute differences in individual respiratory capacity, users of different ages, genders, and lung function levels can obtain a standardized VR interactive experience, ensuring fairness in training difficulty.

[0039] (2) Feature extraction dimensions: 12 features including inhalation duration (the time interval from the start of inhalation to the peak flow rate), stability (the ratio of variance to mean of the flow rate signal, the smaller the value, the more stable), peak flow rate (the maximum value of Q_rel), and expiratory interval (the time between two inhalations), which are used for subsequent difficulty adjustment and rehabilitation assessment.

[0040] 3. VR Interaction Mapping and Incentive Feedback: (1) Virtual scene mapping logic: The WebVR / Three.js rendering module maps the Q_rel of nose / mouth inhalation / exhalation to the action parameters of the "elephant sucking water" character: water inhalation speed v=v0*Q_rel (v0 is the base speed, default 1m / s), water volume V=V0*∫Q_rel dt (V0 is the base water volume coefficient, default 0.5L / s); when exhaling, a water spraying animation is triggered, and the direction is adjusted according to the fire extinguishing mode (the head rotates to extinguish the fire and synchronizes the head θ value, and if it is fixed forward and does not rotate, the direction remains unchanged). The abstract breathing flow signal is transformed into intuitive action parameters of the VR character, realizing real-time and precise linkage between breathing behavior and virtual scene, and improving the user's immersion.

[0041] During exhalation, the system detects the exhalation flow signal from the mouth (determined by the flow direction) and triggers a water spraying animation (30fps frame rate, <50ms latency). The water spraying speed is positively correlated with the exhalation flow. The water spraying direction is adjusted according to the fire extinguishing scenario mode: in the head-turning fire extinguishing mode, it is consistent with the head direction θ of the VR glasses (θ value is obtained through the device gyroscope, sampling rate 100Hz), and in the fixed forward non-rotation mode, the direction remains unchanged.

[0042] (2) Integral model optimization: Inhalation integral Where Q_rel is the nose / mouth-inhale / exhale relative index, k is the mapping coefficient (default 0.8), and cosθ is used to adjust aiming accuracy (cosθ=1 when θ=0, full integration; cosθ=0 when θ=90°, no integration). S(t) is the inhalation integral at time t; S(t-1) is the cumulative integral at time t-1; k is the integral mapping coefficient (default 0.8, controlling the integral growth rate); θ is the angle between the VR glasses head direction and the virtual target; Δt is the time step (default 0.1s); cosθ is the direction weight (ensuring the integral is linked to the user's aiming behavior); ΔS is the extra integral for hitting the target during exhalation; Q_rel_exp is the exhalation relative index (calculated in the same way as Q_rel).

[0043] Bonus points are awarded when you hit a virtual target (such as a floating balloon) with your exhalation. (Q_rel_exp is the relative index of exhalation), enhancing feedback incentives.

[0044] By quantifying training volume through integrals and adjusting integral weights based on head orientation, users are encouraged to precisely control their breathing and aiming. The extra points for hitting the target with exhalation reinforce positive feedback and improve training adherence.

[0045] (3) Abnormal detection mechanism: No nose / mouth inhalation / exhalation detection (identified by the nose / mouth inhalation / exhalation detection device of the flow sensor module) → Missed inhalation detection (triggered by no inhalation signal for 2 consecutive seconds) → Over-inhalation detection (triggered by Q_rel>1.2 for 0.5 seconds) → Pause detection (triggered by inhalation duration <0.5s or >3s). When an anomaly occurs: ① Pause points accumulation → ② A red rounded corner prompt box (font size 24px, semi-transparent background) appears in the center of the VR scene: "Please use nose / mouth to inhale / exhale" if not using nose / mouth, "Please maintain even inhalation without interruption" if missing breath, "Please inhale with moderate force and avoid excessive force" if overinhaling, "Please maintain your breathing rhythm and do not pause for too long" if paused → ③ Play the corresponding prompt sound ("Not using nose / mouth to inhale / exhale: frequency 1900Hz, duration 0.3s; Missed breath: 1800Hz, 0.3s; Overinhalation: 2200Hz, 0.3s; Pause: 2000Hz, 0.3s) → ④ After the anomaly is resolved (1 second of normal breathing), points accumulation resumes and the prompt "Return to normal, continue training" is displayed.

[0046] 4. Difficulty Adaptation and Privacy Management: (1) Difficulty adjustment algorithm: The adjustment coefficient k_adj is calculated based on the completion rate R (R = actual integral / target integral) of N consecutive training sessions (default N=5): when R>0.9, k_adj=1.1 (increase difficulty); when R<0.6, k_adj=0.8 (decrease difficulty); otherwise k_adj=1.0. Difficulty adjustment includes increasing / decreasing the target water volume by 10%, adjusting the flow mapping coefficient k by ±0.1, and adjusting the virtual target movement speed by ±20%, etc.

[0047] R represents the training completion rate (reflecting the user's current training level and its match with the target); the actual score is the total score obtained by the user during training; the target score is the system's preset training target; and k_adj is the difficulty adjustment coefficient. The difficulty is dynamically adjusted based on the completion rate of five consecutive training sessions, ensuring that the training is challenging but not excessively difficult, achieving personalized adaptive training difficulty.

[0048] (2) Privacy Protection Mechanism: The mini-program's local storage uses the AES-256 encryption algorithm. The key is generated by the user device ID and a random salt value. Only feature summaries (such as average Q_rel, mean stability), integral data (such as cumulative integral, training duration), and calibration parameters (such as...) are stored. The original traffic signal is not stored. Cloud uploads require user authorization. The uploaded data is anonymized feature vectors (e.g., [0.75, 0.2, 120] represents average Q_rel=0.75, stability=0.2, training time=120s), and does not contain user identity information.

[0049] III. Figure 3 Detailed application steps shown 1. End-to-end user experience: (1) Registration and initialization: The user scans the device QR code to enter the WeChat mini program → completes real-name authentication (optional: ① face recognition: call the WeChat face recognition interface, bind the account after verification; ② mobile phone number verification: enter the mobile phone number → get the verification code → fill in the verification → bind the account) → bind the traffic sensor module: ① click the “bind device” button → ② the system prompts “please ensure that the device is powered on and in a pairable state” → ③ search for nearby BLE devices (display device name “VR breathing training instrument-XXX”) → ④ select the target device → ⑤ click “confirm pairing” → ⑥ pairing success prompts “device binding successful, calibration can start” (time ≤ 5s).

[0050] Before the initial training, the system guides the user to master the correct training method: ① Enable only exhalation detection and guide the user to practice the breathing pattern of "nose / mouth - inhale / exhale + mouth exhale" → ② After confirming that the user has mastered it, perform individualized calibration: calm breathing for 30 seconds (the interface displays the real-time flow curve and prompts "Please maintain even and calm breathing") → ③ Collect the baseline flow rate Q0 (take the average of the stable interval in the last 10 seconds) → ④ Take 3 maximum deep inhalations or exhalations (prompt "Please try to inhale deeply, a total of 3 times") → ⑤ Collect the reference upper limit Q_max (take 95% of the maximum value of 3 as the effective threshold) → ⑥ Confirm the parameters (the system automatically prompts "Calibration completed, Q0=XX L / min, Q_max=XX L / min").

[0051] (2) Daily training process: Users select VR scenes and fire extinguishing modes: ① Enter the scene selection interface (card-style display, each scene is accompanied by a preview image and introduction) → ② Click on the target scene → ③ Select the fire extinguishing mode (head rotation for fire extinguishing / fixed forward without rotation) → ④ Scene loading (≤2s, display "Loading..." prompt) → ⑤ Enter the scene after loading is complete; Wearing VR glasses: ① Adjust the glasses to a comfortable position → ② The system checks the stability of the gyroscope data (if unstable, it will prompt "Please adjust the glasses position to ensure normal data") → ③ Click "Start Training" → ④ 3-second voice countdown ("Ready to start → 3 → 2 → 1 → Start") → ⑤ Enter training: When inhaling, the elephant's trunk in the VR scene extends at a speed of v = 1.0 * Q_rel m / s (maximum 1.5 m / s when Q_rel = 1, the trunk color deepens with Q_rel: light blue → dark blue), and points are accumulated in real time (dynamic points are displayed in the upper right corner of the interface, flashing to indicate an increase of 10 points). During exhalation, the detection of the exhalation flow signal from the mouth triggers a water spray animation (30fps, latency <50ms), with a water spray speed of [missing information]. The water spray direction is adjusted according to the selected fire extinguishing mode: in the head-turning fire extinguishing mode, it is consistent with the head direction θ of the VR glasses (updated in real time by the gyroscope, sampling rate 100Hz); in the fixed forward non-rotation mode, the direction remains unchanged; after hitting a virtual target (such as a floating balloon), an explosion animation is triggered + text prompt "Congratulations on hitting! +5 points" + sound effect (frequency 1500Hz, duration 0.2s). After training ends (when the target score is reached, the user clicks "End", or the training time reaches 10 minutes and ends automatically), the mini-program displays a training report, including total score, score ranking (compared with the user's own historical performance and other users), inspiratory stability (numerical value + star rating), abnormal number statistics (including the number of inhalations / exhalations without using the nose / mouth), training goal completion rate, breathing rhythm score, and personalized rehabilitation suggestions. The program will automatically adjust the difficulty of the next training session (based on the completion rate of this session, it will prompt "The difficulty of the next training session has been adjusted to level XX") and prompt "The training time of this session is XX minutes, which meets the requirement of ≤10 minutes".

[0052] (3) Rehabilitation Management: Users can view historical training data (statistics by day / week / month, charts showing score trends and stability changes) and score ranking (compared with their own historical performance and other users) → the system generates a rehabilitation curve (e.g., average weekly Q_rel improvement rate: week 1 → week 2 +5%, week 2 → week 3 +3%) → recommends personalized training plans (e.g., adding "slow inhalation and slow exhalation" training, 10 minutes each time when stability <0.2). Detailed process of cloud-based rehabilitation assessment model:

Training Phase

Building Phase

Application Stage

[0053] 2. Scene expansion solution: (1) “Whale spewing water” scenario: When inhaling, the whale draws water from the sea (the greater the flow rate, the faster the volume of water drawn in, V=0.6*∫Q_reldt L increases) → When exhaling, the whale spews water into the air (speed) → Hitting a moving cloud earns points. The scoring model has been adjusted to... (θ is the angle between the whale's head and the cloud, ranging from 0 to 90°. When sinθ=1, it is a full integration, and when it is 0, it is no integration) → k=0.8, Δt=0.1s → The initial speed of the target cloud is 0.5m / s, which is ±20% when the difficulty is adjusted.

[0054] (2) "Balloon inflation" scenario: The balloon inflates when inhaling (the greater the flow rate, the faster the inflation speed), and the balloon releases colored particles when exhaling. The number of particles is positively correlated with the exhalation flow rate. Anomaly detection adds a "balloon burst" prompt (when the inhalation flow rate exceeds 120% of Q_max).

[0055] 3. Suitable for special populations: (1) Children: The scene design adopts a cartoon style (such as the elephant character is Q version), the training time is shortened to 10 minutes / session, and the points feedback adds animation effects (such as twinkling stars and applause sound effects). The calibration process is simplified to 15 seconds of calm breathing + 2 maximum deep inhalations or exhalations.

[0056] (2) Elderly users: The scene design adopts a simple style (such as large font prompts), the initial training difficulty is reduced by 20%, and abnormal prompts are accompanied by voice broadcasts (such as "please exhale slowly"). The default setting is to enable the fixed forward fire extinguishing scene mode without rotation.

[0057] IV. Summary of System Advantages (Comparison with Existing Technologies) 6. Social Incentives: A new points ranking feature has been added, which allows users to compare their own historical performance with that of other users, thereby increasing training motivation and consistency.

[0058] 1. Accuracy: Adopting individualized calibration and normalization algorithms to eliminate individual differences, the flow measurement error is ≤5%, which is better than traditional breathing training equipment (error ≥10%).

[0059] 2. Engaging: Integrating VR interaction with gamification design to enhance user compliance (training completion rate ≥85%, traditional devices ≤60%).

[0060] 3. Portability: It uses WeChat mini-program and BLE peripherals, so there is no need to install a dedicated APP. The device weighs ≤50g and is suitable for home, outdoor and other scenarios.

[0061] 4. Privacy: Local encrypted storage and anonymized upload comply with GDPR and the Personal Information Protection Act.

[0062] 5. Scalability: Supports multi-scenario expansion; new scenarios can be added via configuration files, reducing development costs by 50%.

[0063] Example 1: Whale spouting water scene 1. Product Structure: The patient wears a breathing nozzle with a built-in dual thermistor array sensor. The sensor connects to the AI ​​glasses via a BLE communication module (nRF52832). The AI ​​glasses support WebVR rendering with a resolution of 1080×1920 and a field of view of 100°.

[0064] 2. Breathing detection: During inhalation (nose / mouth - inhale / exhale), the sensor collects the flow signal, which is preprocessed by a mini-program (Kalman filtering, zero-point calibration) to calculate Q_rel; during exhalation (mouth exhalation), the flow direction is detected to trigger the water-spitting action.

[0065] 3. AI Glasses Integration: During inhalation (nose / mouth - inhale / exhale), the AI ​​glasses display an animation of a whale sucking water from the surface of the sea, showing the speed of water intake. When exhaling (through its mouth), the whale spits water into the air in the same direction as its head (θ, obtained via a gyroscope). Hitting a cloud target grants an additional integral ΔS = When an anomaly is detected (such as not inhaling / exhaling through the nose / mouth, or missed breaths), a blue prompt box will be displayed saying "Please inhale steadily through your nose".

[0066] Here is an example of an interactive scenario where a whale spits water: 1. Product Structure: The patient wears a breathing mouthpiece with a built-in dual thermistor array sensor (size 50×30×20mm, medical-grade ABS material), which is connected to AI glasses (supports WebVR 1.1, resolution 1080×1920) via a BLE 5.0 module (nRF52832).

[0067] 2. Breathing detection: During inhalation (nose / mouth - inhale / exhale), the sensor collects the flow signal, which is preprocessed by a mini-program (Kalman filtering, zero-point calibration) to calculate Q_rel; during exhalation (mouth exhale), the direction of the flow is used to determine and trigger the water expulsion action.

[0068] 3. AI Glasses Integration: Inhalation Scene (Animation A): The AI ​​glasses display a whale inhaling water from the surface (nose / mouth - inhale / exhale), with an inhalation speed of v = 0.8 m / s × Q_rel, and the water volume accumulating with ∫Q_rel dt; Exhalation Scene (Animation B): The whale exhales water into the air (mouth), the direction synchronized with the head gyroscope θ value, and hitting a cloud target yields an additional integral ΔS = 6 × Q_rel_exp. In case of an anomaly, a blue prompt box is displayed: "Please inhale smoothly through your nose."

[0069] Example 2: Balloon inflation scenario 1. Product structure: The breathing nozzle has a built-in Venturi differential pressure flow meter, and the BLE module transmits signals to the AI ​​glasses (supports Three.js rendering).

[0070] 2. Breathing detection: During inhalation (nose / mouth - inhale / exhale), flow signals are collected, normalized, and Q_rel is generated; during exhalation (mouth exhale), particle release is triggered.

[0071] 3. AI Glasses Integration: During inhalation (nose / mouth - inhale / exhale), the balloon's inflation rate is positively correlated with Q_rel (inflation radius r = r0). ∫Q_rel dt, r0=0.2m / s); During exhalation (exhaling through the mouth), the balloon releases colored particles, the number of which is proportional to the exhalation flow rate. In case of abnormality detection (such as not using nose / mouth to inhale / exhale, or overinhalation), a yellow warning box is displayed: "Please use nose / mouth to inhale / exhale" for not using nose / mouth, and "The balloon is about to burst, please slow down your inhalation" for overinhalation.

[0072] Here is an example of an interactive scenario involving inflating a balloon: 1. Product structure: The breathing nozzle has a built-in Venturi differential pressure flow meter (accuracy ±3%FS), and the BLE module transmits signals to the AI ​​glasses (Three.js rendering, field of view 100°).

[0073] 2. Breathing detection: During inhalation (nose / mouth - inhale / exhale), the flow rate signal is collected and normalized to generate Q_rel; during exhalation (mouth exhale), the flow rate is detected to trigger particle release.

[0074] 3. AI Glasses Integration: Inhalation Scene (Animation A): Balloon expansion radius r = 0.2 m / s × ∫Q_rel dt; Exhalation Scene (Animation B): Balloon releases colored particles, the number of which is positively correlated with the exhalation flow rate. In case of abnormality (overinhalation), a yellow warning box will appear: "The balloon is about to burst, please slow down your inhalation."

[0075] Therefore, this solution has the following technical advantages: 1. BLE peripheral flow detection: Solves the problem of microphone measurement noise interference and improves quantization accuracy.

[0076] 2. Dynamic calibration mechanism: Automatically matches individual breathing capacity, with strong consistency across devices.

[0077] 3. Water absorption integral model: Maps breathing behavior to VR tasks, forming a quantitative incentive closed loop.

[0078] 4. Lightweight deployment of mini-programs: no installation required, low power consumption, cross-terminal availability, and easy to promote.

[0079] 5. Privacy protection design: Feature-level storage and authorization synchronization meet health data compliance requirements.

[0080] 6. Social Incentives: A new points ranking feature has been added, which allows users to compare their own historical performance with that of other users, thereby increasing training motivation and consistency.

[0081] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 4 As shown, electronic device 410 may include a first processor 2001.

[0082] Optionally, the electronic device 410 may also include a memory 2002 and a transceiver 2003.

[0083] The first processor 2001, memory 2002, and transceiver 2003 can be connected via a communication bus.

[0084] The following is combined with Figure 4 A detailed description of each component of the electronic device 410 is provided below: The first processor 2001 is the control center of the electronic device 410. It can be a single processor or a collective term for multiple processing elements. For example, the first processor 2001 can be one or more central processing units (CPUs), application-specific integrated circuits (ASICs), or one or more integrated circuits configured to implement embodiments of the present invention, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).

[0085] Optionally, the first processor 2001 can perform various functions of the electronic device 410 by running or executing software programs stored in the memory 2002 and calling data stored in the memory 2002.

[0086] In a specific implementation, as one example, the first processor 2001 may include one or more CPUs, for example... Figure 4 CPU0 and CPU1 are shown in the diagram.

[0087] In a specific implementation, as one example, the electronic device 410 may also include multiple processors, for example... Figure 4 The first processor 2001 and the second processor 2004 are shown in the diagram. Each of these processors can be a single-core processor or a multi-core processor. Here, a processor can refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0088] The memory 2002 is used to store the software program that executes the present invention, and is controlled by the first processor 2001 to execute it. The specific implementation method can be referred to the above method embodiment, and will not be repeated here.

[0089] Optionally, the memory 2002 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory 2002 may be integrated with the first processor 2001 or may exist independently and be connected via the interface circuit of the electronic device 410. Figure 4 (Not shown in the image) is coupled to the first processor 2001, and this embodiment of the invention does not specifically limit this.

[0090] The transceiver 2003 is used to communicate with network devices or with terminal devices.

[0091] Alternatively, transceiver 2003 may include a receiver and a transmitter. Figure 4 (Not shown separately). The receiver is used to implement the receiving function, and the transmitter is used to implement the transmitting function.

[0092] Optionally, the transceiver 2003 can be integrated with the first processor 2001, or it can exist independently and be connected via the interface circuit of the electronic device 410. Figure 4 (Not shown in the image) is coupled to the first processor 2001, and this embodiment of the invention does not specifically limit this.

[0093] It should be noted that, Figure 4 The structure of the electronic device 410 shown does not constitute a limitation on the router. Actual knowledge structure identification devices may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0094] Furthermore, the technical effects of the electronic device 410 can be referenced from the technical effects of the VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping described in the above method embodiments, and will not be repeated here.

[0095] It should be understood that the first processor 2001 in the embodiments of the present invention may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0096] It should also be understood that the memory in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0097] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.

[0098] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.

[0099] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.

[0100] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0101] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0102] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0103] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0104] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0105] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0106] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0107] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A VR respiratory rehabilitation training system based on gas sensing and terminal virtual mapping, characterized in that, include: (1) Flow sensing module: used to collect the flow signal of inhalation / exhalation at the user's nose / mouth in real time, including a dedicated detection device for inhalation / exhalation at the nose / mouth, which triggers visual or audio reminders when no inhalation / exhalation is detected at the nose / mouth. (2) BLE communication module: used to transmit the traffic signal to the terminal device; (3) Terminal device: running on WeChat mini program, used to perform signal preprocessing, individualized calibration, signal normalization, feature extraction, VR interactive mapping, integral calculation, difficulty adaptation, and privacy management; during the first training, inhalation and exhalation detection are enabled and users are guided to master the correct training method of "nose / mouth - inhalation / exhalation + mouth exhalation"; the training time is controlled to not exceed 10 minutes. Implement a points ranking function (supporting comparison with one's own historical performance and other users); (4) VR display device: supports WebVR / Three.js rendering, used to present virtual scenes and respond to user breathing behavior in real time. The device includes AI glasses with built-in gyroscope and accelerometer to obtain the head direction θ value; provides two fire extinguishing scene modes: head rotation fire extinguishing mode (adjusting the water spray direction using the head direction θ value) and fixed forward non-rotation mode (the water spray direction is fixed forward). The system generates individualized calibration parameters (Q0, Q_max) through the terminal device, calculates the relative inhalation index Q_rel=(Q-Q0) / (Q_max-Q0) (Q is the real-time nasal / mouth inhalation / exhalation flow rate, Q0 is the baseline flow rate, and Q_max is the upper limit of respiratory flow rate), and drives the actions of the character in the VR scene; it triggers visual or audio reminders when it detects that no nasal / mouth inhalation / exhalation is used; it enables inhalation and exhalation detection during the initial training phase and guides users to master the correct breathing method; the training time is strictly controlled within 10 minutes; it quantifies the training volume through an integral model and dynamically adjusts the difficulty coefficient based on the continuous training completion rate; it supports the anonymized storage and display of score ranking data (which can be compared with its own history and other users); the system only encrypts and stores feature summaries, score statistics, and anonymized ranking information locally, and uploads the anonymized data to the cloud after user authorization.

2. The system according to claim 1, characterized in that, Signal preprocessing includes adaptive Kalman filtering, zero-point calibration, and temperature and humidity compensation; The initial covariance matrix of the adaptive Kalman filter is P0=diag([0.1,0.1]), the process noise is Q=0.01, and the measurement noise is R=0.1; The individualized calibration includes guiding the user to complete a 30-second calm breathing test to collect baseline flow rate Q0 and a reference upper limit Q_max for three maximum inhalations or exhalations.

3. The system according to claim 1, characterized in that, Feature extraction includes at least 12 features from inspiratory duration, stability, peak flow rate, and expiratory interval, used for rehabilitation assessment and difficulty adjustment.

4. The system according to claim 1, characterized in that, VR interactive mapping includes: Map Q_rel to the water absorption speed v=v0Q_rel of the virtual character or the water spraying action, where v0 is the base speed; Exhalation triggers a water spraying animation, and the spraying direction adjusts according to the scene mode: in the head-turning fire extinguishing mode, it is synchronized with the head direction θ, and in the fixed forward non-rotation mode, the direction remains unchanged. The anomaly detection mechanism includes detection of missed inhalation / exhalation, overinhalation / exhalation, or pauses, and triggers visual or audio cues.

5. The system according to claim 1, characterized in that, The integral model expression is as follows: S(t) = S(t-1) + kQ_relcosθΔt, Where S(t) is the inhalation integral at time t; S(t-1) is the cumulative integral at time t-1; k is the integral mapping coefficient (default 0.8, controlling the integral growth rate); θ is the angle between the VR glasses head direction and the virtual target; Δt is the time step (default 0.1s); cosθ is the direction weight (ensuring the integral is linked to the user's aiming behavior); ΔS is the extra integral for hitting the target during exhalation; Q_rel_exp is the exhalation relative index (calculated in the same way as Q_rel).

6. The system according to claim 1, characterized in that, Difficulty adaptation is based on the completion rate R of N consecutive training iterations, which is used to calculate the adjustment coefficient k_adj. When R > 0.9, k_adj = 1.1; When R < 0.6, k_adj = 0.8; Otherwise, k_adj = 1.0; Difficulty adjustments include changes to the target water volume, flow mapping coefficient, or virtual target movement speed.

7. The system according to claim 1, characterized in that, Privacy management uses the AES-256 encryption algorithm to locally store feature summaries, scores, calibration parameters, and anonymized score ranking information. The data uploaded to the cloud is the anonymized feature vector and ranking statistics, and requires active user authorization.

8. The system according to claim 1, characterized in that, The system supports adaptation for children and elderly users: The scenario for children is cartoon-style, the training time is shortened to 10 minutes / session, and the calibration process is simplified to 15 seconds of calm breathing and 2 maximum deep inhalations or exhalations. The scenario for elderly users features a simplified style, with the initial training difficulty reduced by 20%, abnormal prompts enhanced with voice broadcasts, and a fixed forward-facing fire extinguishing scenario mode enabled by default.

9. The system according to claim 1, characterized in that, The terminal device adopts a thread-sharing architecture: The main thread is responsible for VR rendering, with a frame rate of ≥30fps; The worker thread is responsible for BLE data reception, signal preprocessing, and feature extraction. Inter-thread communication is achieved through Worker.postMessage(). The message queue length is ≤10 messages and the delay is ≤50ms.

10. The system according to claim 1, characterized in that, The flow sensing module includes a venturi differential pressure flow meter or a dual thermistor array flow meter with a range of 0-100 L / min.