[ 0048 ] fig2 a shows mechanical ventilation apparatus 10 embodying the invention . the subject / patient wears a nose mask 12 of any known type . the subject equally could wear a face mask or nasal prongs / pillows , or alternatively have a endotracheal tube or tracheostomy tube in place . a turbine / blower 14 , operated by a mechanically coupled electrical motor 16 , receives air or breathable gas at an inlet 18 thereof , and supplies the breathable gas at a delivery pressure to a delivery tube / hose 20 having connection at the other end thereof with the nose mask 12 . breathable gas thus is provided to the subject &# 39 ; s airway for the purpose of providing assisted respiration , with the subject &# 39 ; s expired breath passing to atmosphere by an exhaust 22 in the delivery tube 20 , typically located proximate to the mask 12 . a pneumotachograph 24 is placed in the delivery tube 20 between the mask 12 and the exhaust 22 to provide two pressure signals . p 2 and p 1 , across the pneumotachograph , each passed by hoses 28 , 30 to a differential pressure sensor 32 . a determination of the flow of gas in the mask 12 is made the differential pressure . p 2 - p 1 , resulting in a flow signal f d . the mask pressure , p 2 , also is passed to a pressure sensor 34 by a tapped line 36 taken from the respective hose 28 , to generate a delivery pressure signal , p m , output from the pressure sensor 34 . both the flow signal f d , and the pressure signal , p m , are passed to a microcontroller 38 where they are sampled for subsequent signal processing , typically at a rate of 50 hz . the microcontroller 38 is programmed to process the flow and pressure signals ( f d , p m ) to produce an output control signal , y o , provided to an electronic motor servo - controller 42 that , in turn , produces a motor speed control output signal , v o . this signal is provided to the motor 16 to control the rotational speed of the turbine 14 and provide the desired treatment pressure , p 2 , at the nose mask 12 . the motor servo - controller 42 employs a negative feedback control technique that compares the actual delivery pressure , in the form of the signal p m , with the control signal y o . for convenience , this control stratagem may be independent of operation of the microcontroller 38 . operation of the controlling of the microcontroller 38 , so far as a calculation of respiratory airflow is concerned , broadly is as follows . in a sampled manner , the conductance of any mask leak is calculated , then the instantaneous flow through the leak is calculated . the flow through the leak is subtracted from the total mask flow to calculate the true instantaneous respiratory airflow . [ 0055 ] fig2 b shows an alternative embodiment of a system for determining true respiratory airflow during mechanical ventilation . the mechanical ventilation system 10 ′ of fig1 b differs from that of fig1 a firstly in that the microcontroller 38 plays no part in control of the ventilator 50 , rather only receives and data processes the electrically transduced mask pressure and flow signals p m , f d to determine and generate the instantaneous respiratory flow f resp . the ventilator 50 has an internal drive signal provided by an oscillator 44 . the motor servo controller also may or may not receive the mask pressure signal p m as a form of feedback control . indeed , the ventilator 50 can be relised by any convenient form of known generic ventilation device . the controlling software resident within the microcontroller 38 performs the following steps in determining the respiratory airflow as broadly described above , as also shown in the flow diagram of fig3 . the word “ average ” is used herein in the most general sense of the result of a low pass filtering step , and is not confined to an arithmetic mean . 1 . repeatedly sample the mask airflow f d to give a sampled signal f mask , and the mask pressure p m to give a sampled signal p mask , for example at intervals of t = 20 milliseconds . ( steps 50 , 52 ). 2 . calculate the average leak , lp ( l ), as being the result of low pass filtering the airflow , f mask , with a time constant of 10 seconds . ( step 54 ). 3 . calculate the average of the square root of the mask pressure , lp ({ square root }{ square root over ( p )} mask ), as being the result of low pass filtering the square root of the mask pressure , p mask , with a time constant of 10 seconds . ( step 56 ). 4 . calculate the conductance , g , of any leak ( step 58 ), from the equation : g = lp ( l )/ lp ({ square root }{ square root over ( p )} mask ) 5 . calculate the instantaneous leak flow , f leak , throught he leak ( step 60 ), from the equation : f leak = g { square root }{ square root over ( p mask )} if there is no leak flow , the value of lp ( l ) will be equal to zero , as will g and hence f leak . thus the methodology is valid also where leak is equal to zero — no leak . at this juncture the leak flow has been determined , such as would be desired for a leak flow detector . if desired , the instantaneous respiratory airflow can be subsequently determined by the following step . 6 . calculate the instantaneous respiratory airflow , f resp , by subtracting the instantaneous leak from the mask flow ( step 62 ): [ 0066 ] fig4 a - 4 h illustrate the methodology of the embodiment described above with reference to fig2 b . at time , t = 21 sec . a continuing leak of approximately 1 l / sec is introduced . fig4 e shows the mean mask flow . fig4 f represents the calculated conductance g , from which the mask leak flow can be estimated as shown in fig4 g . finally , fig4 h shows how the calculated respiratory airflow recovers within approximately 30 seconds , and , importantly , gives the correctly scaled ( true ) magnitude of airflow . with regard to setting the instantaneous output signal y o , the microcontroller broadly executes the following steps : 7 . if the calculated true respiratory airflow f resp is above a threshold , for example 0 . 05 l / sec , y o is set to a value corresponding to an inspiratory pressure , p insp . otherwise y o is set to a value corresponding to an expiratory pressure , p exp . in general , p insp is higher than p exp , but in the case of continuous positive airways pressure , p exp may be equal to p insp . ( step 66 ). it is to be understood that many other methods of determining y o from f mask may be used in step 7 , for example as described in the text principles and practice of mechanical ventilation , edited by martin j . tobin ( mcgraw hill inc , 1994 ). in order to control ventilation , it is necessary to measure the subject &# 39 ; s ventilation . in the presence of a leak , the ventilation delivered by the assisted entilation apparatus is greater than the ventilation delivered to the subject . known devices which servo - control ventilation cope with this by collecting the exhaled air stream with a complex system of valves , and then measuring the exhaled ventilation . this is inappropriate for devices for use in a domestic setting during sleep , because of the attendant weight , complexity , and expense . the embodiment described compensates for the leak by continuously measuring the nonlinear conductance of the leak , and allowing for the instantaneous flow through the leak as a function of pressure . [ 0071 ] fig5 shows an alternate arrangement for ventilatory assistance apparatus 10 ′ embodying the invention . in this arrangement , the pneumotachograph 24 ′ is interposed between the turbine 14 and the delivery hose 20 . this arrangement removes the pressure sensing hoses and pneumotachograph from the region of the mask 12 . the pressure at the mask . p mask , is calculated from the delivery pressure at the turbine 14 , and from the pressure drop down the air delivery hose 20 , which for any particular delivery hose is a known function of the flow at the pneumotachograph 24 . further , the microcontroller 38 must also calculate the flow through the mask from the flow at the turbine 14 less the flow through the exhaust 22 , which for any particular exhaust is a known function of the pressure at the mask 12 . in more detail , this involves the steps of , firstly measuring the pressure p 3 at the turbine 14 with the pressure sensor 34 to produce an electrical signal p t . next the differential pressure p 4 - p 3 is measured across the pneumotachograph 24 ′ by the differential pressure sensor 32 to produce an electrical signal f t . in a sampled manner , p t and f t are digitized to yield the sampled turbine pressure and flow signals p turbine and f turbine . the pressure at the mask p mask and the sampled airflow at the mask f mask 12 are calculated from the turbine pressure p turbine and the flow at the outlet of the turbine f turbine as follows : 1 . calculate the pressure drop δp tube down the air delivery tube 20 , from the flow at the outlet of the turbine f turbine : δp tube = sign ( f turbine )× k 1 ( f turbine ) 2 + k 2 f turbine where k 1 and k 2 are empirically determined constants , and sign ( x ) is 1 for x ≧ 0 and − 1 otherwise . 2 . calculate the pressure at the mask , p mask , as the pressure at the turbine p turbine less the pressure drop δp tube down the air delivery tube 20 : 3 . calculate the flow , f exhaust , through the exhaust 22 , from the pressure at the mask p mask : f exhaust = sign ( p mask )× k 3 { square root }{ square root over ( abs ( p mask ))} 4 . calculate the flow , f mask , into the mask 12 as the flow at the turbine 14 less the flow through the exhaust 22 : the foregoing embodiments describe low - pass filtering of both the instantaneous airflow and the square root of the instantaneous pressure with a time constant τ of 10 seconds . this time constant , τ , can be advantageously dynamically adjustable . if the conductance of the leak suddenly changes , then the calculated conductance will initially be incorrect , and will gradually approach the correct value at a rate which will be slow if the time constant of the low pass filters is long , and fast if the time constant is short . conversely , if the impedance of the leak is steady , the longer the time constant the more accurate the calculation of the instantaneous leak . therefore , it is desirable to lengthen the time constant if it is certain that the leak is steady , reduce the time constant if it is certain that the leak has suddenly changed , and to use intermediately longer or shorter time constants if it is intermediately certain that the leak is steady . if there is a large and sudden increase in the conductance of the leak , then the calculated respiratory airflow will be incorrect . in particular during apparent inspiration , the calculated respiratory airflow will be large positive for a time that is large compared with the expected duration of a normal inspiration . conversely , if there is a sudden decrease in conductance of the leak , then during apparent expiration the calculated respiratory airflow will be large negative for a time that is large compared with the duration of normal expiration . therefore , an index of the degree of certainty that the leak has suddenly changed is derived , such that the longer the airflow has been away from zero , and by a larger amount , the larger the index ; and the time constant for the low pass filters is adjusted to vary inversely with the index . in operation , if there is a sudden and large change in the leak , the index will be large , and the time constant for the calculation of the conductance of the leak will be small , allowing rapid convergence on the new value of the leakage conductance . conversely , if the leak is steady for a long time , the index will be small , and the time constant for calculation of the leakage conductance will be large , enabling accurate calculation of the instantaneous respiratory airflow . in the spectrum of intermediate situations , where the calculated instantaneous respiratory airflow is larger and for longer periods , the index will be progressively larger , and the time constant for the calculation of the leak will progressively reduce . for example , at a moment in time where it is uncertain whether the leak is in fact constant , and the subject merely commenced a large sigh , or whether in fact there has been a sudden increase in the leak , the index will be of an intermediate value , and the time constant for calculation of the impedance of the leak will also be of an intermediate value . one advantage is that some corrective action will occur very early . another advantage is that there is never a moment where the leak correction algorithm is “ out of control ” and needs to be restarted , as described for prior art european patent publication no . 0 714 670 a2 . in a preferred embodiment , the above index is derived using fuzzy logic . the fuzzy extent a l to which the airflow has been positive for longer than expected is calculated from the time t zt since the last positive - going zero crossing of the calculated respiratory airflow signal , and the expected duration t i of a normal inspiration for the particular subject , using the fuzzy membership function shown in fig6 . the fuzzy extent b j to which the airflow is large and positive is calculated from the instantaneous respiratory airflow using the fuzzy membership function shown in fig7 . the instantaneous index i t of the degree of certainty that the leak has suddenly increased is calculated as the fuzzy intersection ( lesser ) of a l and b i . comparable calculations are performed for expiration as follows . the fuzzy extent a e to which the airflow has been negative for longer than expected is calculated from the time t ze since the last negative - going zero crossing of the calculated respiratory airflow signal , and t e , the expected duration of a typical expiration for the particular subject , using the membership function shown in fig8 . the fuzzy extent b e to which the airflow is large negative is calculated from the instantaneous respiratory airflow using the fuzzy membership function shown in fig9 . the instantaneous index i e of the degree of certainty that the leak has suddenly decreased is calculated as the fuzzy intersection of a e and b e . the instantaneous index i of the extent to which there has been a sudden change in the leak ( either an increase or a decrease ) is calculated as the fuzzy union ( larger ) of indices i l and i e . the instantaneous index i is then passed through a peak detector followed by a low pass filter with a time constant of , for example 2 seconds , to yield the desired index j . thus if index i becomes momentarily large , index j will be initially large and remain so for a few seconds . the time constant τ for the low pass filters used in the calculation of the conductance of the leak is then adjusted to vary inversely with the index j , as shown in fig1 . for example , if the expected duration of a normal respiratory cycle were 4 seconds the time constant is set to 10 seconds if the index j is zero , ( corresponding to complete certainty that the leak is steady ), and to 1 second if the index j is unity ( corresponding to complete certainty that the leak is suddenly changing ), and to intermediate values for intermediate cases . the embodiments described refer to apparatus for the provision of ventilatory assistance , however , it is to be understood that the invention is applicable to all forms of mechanical ventilation and apparatus for the provision of continuous positive airway pressure treatment . the apparatus can be for the provision of a constant treatment pressure , multi - level ( ipap and epap ) treatment or autosetting ( adjusting ) treatment or other forms of mechanical ventilation , including proportional assist ventilation ( pav ) as taught by m younes in the above - noted text . the methodology described can be implemented in the form of a computer program that is executed by the microcontroller described , or by discrete combinational logic elements , or by analog hardware .
methods and apparatus for determining leak and respiratory airflow are disclosed . a pressure sensor and a differential pressure sensor have connection with a pneumotach to derive instantaneous mask pressure and airflow respectively . a microcontroller estimates a non - linear conductance of any leak path occurring at a mask as being the low pass filtered instantaneous airflow divided by the low pass filtered square root of the instantaneous pressure . the instantaneous leak flow is then the conductance multipled by the square root of the instantaneous pressure , and the respiratory airflow is calculated as being the instantaneous airflow minus the instantaneous leak flow . the time constants for the low pass filtering performed by the microcontroller can be dynamically adjusted dependent upon sudden changes in the instantaneous leak flow .