referring now to the drawings with more particularity , wherein like reference numerals in the separate views indicate like or corresponding elements , there is shown in fig1 a block diagram of a fluid delivery system 10 incorporating aspects of the current invention . the fluid delivery system includes a fluid source 12 supplying fluid to a patient 14 via a fluid conduit 16 and cannula 18 . in the embodiment of fig1 , a flow control device 20 controls the flow of fluid through the conduit . the flow control device may include a pump motor 22 driving a pumping mechanism 24 , which in the embodiment shown comprises a rotating cam shaft 26 coupled to the pump motor 22 and moving a series of peristaltic elements 28 . the peristaltic elements 28 operate on the conduit 16 to move fluid from the fluid source 12 , through the conduit 16 , and into the patient 14 via the cannula 18 . in the embodiment of fig1 , a user input device 30 , such as a keypad , provides operator instructions , such as flow rate selection , to a processor 32 . the processor 32 controls the operation of the pump motor 22 driving the pumping mechanism 24 . a motor position sensor ( not shown ) determines the position of the pump motor 22 and pumping mechanism 24 , and provides a position signal to the processor 32 . located along a section 36 of the fluid conduit is a sensor 34 coupled to the conduit 16 to sense agents in that particular fluid conduit section 36 . in the embodiment depicted , the sensor 34 is an air sensor that detects air in the conduit section 36 . an analog - to - digital converter 38 (“ a - to - d ”) receives the output signals from the sensor 34 and converts them to a digital format at a particular sample rate controlled by the processor 32 . the output signals indicate the amount of air in the line at a particular point in time . an age determiner , such as a volume accumulator 40 , provides an age value for the output digital signals , with the age value a function of the volume that has been introduced through the fluid line . ( a clock could also provide an age value based upon the time that the output digital signal is generated or received , depending on the particular system .) the processor 32 receives the digital signals , processes them as described in more detail below , and determines an air concentration value representing air passing through the fluid delivery system 10 . a display 42 may present an indication of the air concentration value . one or more alarms 44 are provided to indicate an unsatisfactory air concentration value . the air signals may be stored in a memory 46 , which may also provide various threshold values to the processor 32 . in one embodiment , the processor 32 applies a weighting value to each air signal , with the weighting value a function of the age of the output air signal . note that age may be determined based on elapsed time or based on the volume of fluid that has passed since the event occurred . for example , the age of an output air signal may be determined as the volume of fluid that has entered the fluid line since the particular air signal was received . as shown in fig2 , where k represents the age of the air signals , in one embodiment the weighting value is largest for the most recent output air signals , and drops off for older output air signals . ( note that the weighting values shown in fig2 and 3 , including the maximum value of 1 . 0 , are for illustrative purposes only .) in the embodiment depicted in fig2 , air signals that are older than a cutoff age v cutoff are discarded , as may occur where a limited number of memory registers are exceeded and older values are displaced by younger values . in the embodiment shown , the age of the air signal is determined as the volume pumped into the iv system , so that the volume window qwindow is the volume of fluid pumped into the iv system in the period between the present time 0 and the cutoff age v cutoff . fig3 shows another embodiment , but wherein there is no cutoff age v cutoff . instead , the older output air signals are given weightings that approach , but do not actually reach , zero . note that even though older output air signals are not discarded , their weightings eventually become so small as to be negligible , so that a volume window qwindow can be an effective representation of the volume of fluid pumped during the period in which air signals are given a significant weighting . in such embodiments , the air concentration value can be determined via a formula such as the following : airconcentration ⁢ ⁢ ( 0 ) = ∑ k = 0 n - 1 ⁢ ( airsignal ⁢ ⁢ ( k ) × b × a k ) ( 1 ) where airsignal ( 0 ) is the current ( i . e ., most recent ) air signal , airsignal ( 1 ) is the next to the most recent air signal , etc . ; n is the total number of air signals used to determine the air concentration value ; and b and a are weighting factors . if the weighting factor a is less than zero , then “ older ” airsignal values , such as where k & gt ;& gt ; 0 , will be given progressively less weight due to the shrinking of the value a k in the above formula . the above equation is only one example of such a formula — numerous other formulae are also well within the scope of the invention , so long as the effect is to give differing weights to different air signal values . in the embodiment depicted in equation 1 , the weighting factor a (“ pastweight ”) is used to vary the air signal weightings according to the age of the air signal value , represented by the value k , while the application of weighting factor b (“ currentweight ”) is unaffected by the age of the air signal value . the weighting factors may be variables that take into account operational characteristics of the system , such as fluid flow rate , desired sensitivity , etc , which may vary during pump operation . for example , a weighting factor may be a function of various parameters , such as the volume of fluid ( qsample ) pumped over the period to which the air signal value - corresponds ( which may vary depending on pump flow rate and the particular pump steps and / or groups of steps ), and the desired volume of fluid ( qwindow ) over which the air signal values are given relevant weightings . in one embodiment , the weighting factor a ( pastweight ) is a function of qwindow and qsample , as follows : airconcentration ⁢ ⁢ ( 0 ) = ∑ k = 0 n - 1 ⁢ ( airsignal ⁢ ⁢ ( k ) × b × ⅇ - k × qsample qwindow / 3 ) ( 2 ) thus the fig5 b current air sample , airsignal ( o ), is given a weighting of b ( because e 0 = 1 ). the next most recent air sample , airsignal ( 1 ), is weighted by note that equation 2 is merely one simplified example of such a formula . other formulae are also within the scope of the invention . for example , the weighting factor b may be a function of qwindow and qsample and / or of weighting factor a . for example , with a defined as set forth in equation 2 , the value b could be defined by the formula b = 1 − a . in equation 2 , k goes from 0 to n − 1 , indicating that a number n of air signals are used to determine the air concentration value . n may be a very large or infinite number , as was depicted in fig3 . however , in some circumstances , such as where only a limited number of memory registers are available to store individual sir signal values , the number n may be much smaller . in practicality , the number of air signal values received over an extended period may grow to be quite large , which may require discarding of older air signal values , as depicted in fig2 . one option for dealing with the large number of air signal values received over a long period is to store them in a memory 46 , depicted in fig1 , that may include “ volume delivered ” or time references indicating the age of the output air signal values . newer air signal values may be stored , with older values shifted downward on the register . the oldest air signal values may be discarded as the registers are filled , thus making way for newer values . fig4 is a simplified flowchart depicting a process for determining air concentration in a fluid line according to one embodiment of the invention . after system start 52 ( or a reset , such as a user - initiated manual reset ), step 54 includes receiving a new air signal value , which is added to the top of the memory register at step 56 . step 56 includes shifting existing air signal values down in the memory register , with the oldest air signal value being discarded . at step 58 , the air signals are weighted according to their age , to generate weighted air signal values . at step 60 , the processor adds the weighted air signal values together to determine an air concentration value . at step 62 , the air concentration value is compared to a primary threshold value , also known as an air density threshold . where the air concentration value exceeds the primary threshold , an alarm is sounded ( step 64 ). the system may also operate to stop further delivery of fluid through the conduit when the air density threshold is exceeded . if the threshold if not exceeded , the system prepares to repeat the cycle . the system then returns to step 54 and receives a new air signal value . in one embodiment , the system continuously updates the calculated air concentration value . for example , in the embodiment depicted in fig4 , each time a new air signal value is received by the processor , the system determines a new air concentration value and compares it to a primary threshold value . if the new air concentration value exceeds the primary threshold value , an alarm is sounded . the primary threshold value may be set through a variety of techniques . the primary threshold value may be a single fixed value that is preprogrammed into the system . the primary threshold value may also be selected by a user . the primary threshold value may vary as a function of one or more parameters such as the particular fluid , patient characteristics ( such as weight ), or the flow rate through the fluid conduit . the primary threshold may be determined from a formula with one or more variables , or may be selected from a table of several primary threshold values . comparing the air concentration value to the primary threshold value is helpful in rapidly detecting excessive air in the fluid conduit while preventing false alarms . however , the primary threshold and air concentration value comparison may not be the most desirable method for detecting all fluid flow anomalies . for example , where a fluid delivery system has had almost no air and suddenly runs out of fluid , a large air pocket will typically be introduced into the system . in such a situation , comparing the air concentration value to primary threshold value will typically cause the alarm to sound prior to a significant amount of air being introduced to the patient , but significant amounts of air may be introduced into the iv system itself ( but well upstream of the patient ) prior to alarm activation . to minimize the amount of air introduced into the iv system and reduce system downtime , it would be desirable if the alarm were sounded as rapidly as possible so that an attendant can rapidly refill or replace the fluid supply . to increase the system &# 39 ; s ability to rapidly sound an alarm in various situations , the system may include a secondary threshold value to which is compared a secondary air concentration value . the secondary air concentration value may be an air concentration value which is determined in parallel or in tandem with the primary averaged concentration value . the secondary air concentration value may be determined with a weighting system that is distinct from the weighting system used for the primary air concentration value , and may be compared to a secondary threshold value that is different from the primary threshold value . fig5 a depicts a primary weighting value curve 66 a corresponding to a relatively large window volume qwindow primary . note that the primary weighting value curve 66 a gives reduced weighting to “ older ” values . such a primary weighting value may be used to determine the primary air concentration value , which will be compared to a primary threshold value . fig5 b depicts a secondary weighting value curve 66 b corresponding to a smaller window volume qwindow secondary , which may be used to determine a secondary air concentration value for comparison to a secondary threshold value . note that smaller qwindow values correspond to a shorter period during which the air values are given relevant weightings in determining air concentration values . by having a larger qwindow value , as shown in fig5 a , the primary air concentration value may represent the amount of air in the fluid introduced into the iv system over a relatively long period of time and / or fluid volume , depending on the flow rate . such large qwindow values are useful in detecting certain fluid flow anomalies where small amounts of air are introduced into the system over a long period , possibly building up to an unacceptable level . for example , conditions may develop in an iv system where a “ train ” of very small bubbles is introduced into the iv system over an extended period . although the individual bubbles are very small and may not activate an alarm that looks at only a small period of time or volume , such a train of bubbles may , over a period of time or delivered fluid volume , introduce a significant amount of air into the system . by using a large qwindow in combination with a relatively low threshold , the current invention can activate an alarm when such bubble trains occur . the use of a large qwindow with a relatively low threshold is helpful in detecting fluid flow anomalies that involve small amounts of air that are introduced into the iv system in a large volume of fluid and / or over a long period of time . however , a large qwindow with a low threshold may not , by itself , always be the best method for detecting fluid flow anomalies . for example , where a large amount of air is introduced into the system over a very small fluid volume and / or a short period of time , but with little or no air previously introduced into the system , an air concentration value calculated with a large qwindow may not exceed even a small threshold due to the weighting value . however , an air concentration value calculated under the same circumstances , but using a smaller qwindow , will typically exceed an even larger threshold . the use of a small qwindow with a relatively high threshold is thus helpful in rapidly detecting fluid flow anomalies that involve large amounts of air introduced into the system over a very small fluid volume and / or a short period of time . the use of a primary air concentration with a large qwindow and low threshold , in combination with a secondary air concentration value with a small qwindow and a high threshold , allows the system to rapidly and efficiently detect long - term anomalies ( e . g ., trains of small bubbles ) as well as short - term anomalies ( e . g ., large air bubbles introduced suddenly into the system ). to increase a system &# 39 ; s effectiveness in rapidly detecting medium - term anomalies ( such as where a moderate amount of air is introduced into the system ), a third air concentration value , with a medium - size qwindow and a medium - size threshold , may be used . depending on the specific iv system and the desired sensitivity , additional air concentration values may be included ( i . e ., fourth , fifth , etc . air concentration values ), having differing thresholds and qwindows . note that the various air concentration calculations and threshold comparisons can be performed in parallel or tandem with each other . as discussed above , the secondary air concentration value may be determined with a small qwindow and a relatively high threshold to detect large amounts of air introduced into the system in a short period of time or in a small volume of fluid . where qwindow becomes very small , the weighting value plays less of a role in determining the air concentration value . for detecting large single bubbles that enter the iv system , such as may occur when the fluid supply reservoir becomes empty , the use of a varying weighting value may not be the most efficient approach , depending on the characteristics of the particular system . fig5 c depicts a constant weighting value 66 c that can be applied to a select set of air values over a small qwindow . in one embodiment of the invention , the secondary air concentration value is determined with a constant weighting value ( as depicted in fig5 c ), and the secondary air concentration value is compared to a single bubble threshold to detect large single bubbles . as shown in fig6 , after the newest air signal value has been added to the register at step 56 , the processor takes a limited number of the most recent air signal values to determine the secondary air concentration value , also known as a single bubble value . the most recent air signal values would typically be a subset of the air signal values used to determine the primary air concentration value . in the embodiment of fig6 , the single bubble value is determined ( at step 68 ) by merely adding the most recent air signal values , without the use of any weighting values . at step 70 , the single bubble value is compared to the single bubble threshold . if the threshold is exceeded , then the alarm is sounded ( step 64 ). otherwise , the system repeats the cycle as new air signal values are received . storing a large number of air signal values may require a relatively large amount of memory registers , which may be undesirable in some circumstances . additionally , independently multiplying large numbers of air signal values by different weighting values can be processor intensive . in one embodiment of the invention , the system uses a weighted past air concentration value , thus reducing the requirements for multiplication operations and memory . in such an embodiment the current air concentration value is determined as a function of the current air signal airsignal ( 0 ) and a weighted version of the most recently calculated air concentration value ( i . e ., a weighted past air concentration value ). in determining the current air concentration value by using a weighted past air concentration value , a formula such as the following might be used : airsignal ( 0 )= the most recent air signal value ; filterout ( 0 )= the current air concentration value that will be compared with the alarm threshold ; filterout ( 1 )= the previously calculated air concentration value ; a = a weighting factor (“ pastweight ”); and b = a weighting factor (“ currentweight ”). note that the value ( a × filterout ( 1 )) is the weighted past air concentration value . the effect of such a formula is that older air signals have a lesser impact on the current air concentration value filterout ( 0 ). that is , the older air signal values are effectively given a lesser weighting . for example , using the above - cited formula , the most recent air signal value airsignal ( 0 ) is given a fraction of its entire value by multiplying it by the weighting factor currentweight ( b ). airsignal ( 1 ), which had been used to determine filterout ( 1 ), would be effectively given a weighting value equal to pastweight × currentweight . airsignal ( 2 ), which had been used to determine filterout ( 2 ) and thus also was a factor in calculating filterout ( 1 ), would effectively be given a weighting value of ( pastweight ) 2 × currentweight . airsignal ( 3 ) would effectively be given a weighting value of ( pastweight ) 3 × currentweight , etc . in a preferred embodiment , the weighting factor pastweight ( a ) is less than 1 , so that the older air signal values will be given progressively less weight as they age . the air concentration value filterout ( 0 ) is thus calculated as a function of all of the air signal values , so that the number of air signal values that are used to calculated filterout ( 0 ) is not limited by a set number of memory registers . fig7 is a simplified flowchart depicting a process whereby the system uses a weighted past air concentration value instead of individually multiplying individual air signal values and weighting values . in the embodiment of fig7 , after initial start 72 ( or manual reset ) of the system , an initial filterout ( 1 ) value , which is below the alarm threshold , may be provided ( at step 74 ) either as an initial input value or computed as a function of various factors , such as fluid volume , delivery rate , alarm threshold value , selected sensitivity , etc . as the system operates , a current air signal value airsignal ( 0 ) is received ( at step 76 ). at step 78 , the processor determines a new air concentration value filterout ( 0 ), which is calculated as a function of airsignal ( 0 ) and filterout ( 1 ). at step 80 , the new air concentration value filterout ( 0 ) is compared to the primary threshold . if the primary threshold is exceeded , an alarm sounds ( at step 82 ). if the new air concentration value is within the threshold limit , the current filterout ( 0 ) value becomes filterout ( 1 ) ( at step 84 ), and the cycle repeats with receipt of a new air signal value ( step 76 ). note that fig7 is a simplified depiction of one embodiment of the invention . there may be numerous additional steps involved , depending on the particular embodiment . for example , the primary threshold may be set , either as a directly input value from the user or as a calculated value determined from various parameters such as fluid flow rate , patient characteristics ( weight , age , etc . ), the type of fluid involved , etc . moreover , the primary threshold may , as discussed previously , be used in conjunction with additional thresholds to which are compared additional air concentration values . the efficiency of the use of weighted past air concentration values , which is a recursive implementation referred to as an infinite impulse response ( iir ) method , is shown in fig8 , which depicts a signal flow diagram for an embodiment of such a system . the values airsignal ( 0 ), filterout ( 1 ), a , and b are used to derive each new filterout ( 0 ) value . only one memory register 85 is required , which is used to store the previous filtered air concentration value filterout ( 1 ). because the system is “ recursive ,” i . e ., uses past results to compute current results , it effectively applies weighting to all air signal values ever received , which in an iv system may be to the beginning of the infusion . for older air signals , however , the weighting will typically drop so close to zero as to be largely negligible . in a further embodiment of the invention , the system uses a combination of direct weighting of recent air signal values along with a weighted past air concentration value . for example , as set forth in the following formula , the invention may apply a first weighting factor to the two most recent air signal values , which may be stored in memory registers , while a second weighting factor is applied to the most recently calculated air concentration value filterout ( 1 ): filterout ⁢ ⁢ ( 0 ) = ( qsample qsample + 2 × qwindow 3 ) × ( airsignal ⁢ ⁢ ( 0 ) + airsignal ⁢ ⁢ ( 1 ) ) - ( qsample - 2 × qwindow 3 qsample + 2 × qwindow 3 ) × filterout ⁢ ⁢ ( 1 ) ( 5 ) airsignal ( 0 )= the current air signal value ; airsignal ( 1 )= the next most recent air signal value ; filterout ( 0 )= the current air concentration value that will be compared with the alarm threshold ; filterout ( 1 )= the most recently calculated air concentration value ; qsample = the volume of fluid moved in the sample ; and qwindow = the size of the volume window . in the particular embodiment shown in equation 5 , the weighting factor or multiplier for the current air signal value ( airsignal ( 0 )) and immediately previous air signal value ( airsignal ( 1 )) is a function of the volume of fluid moved in each sample ( qsample ) and the size of the volume window ( qwindow ). as the size of the volume window qwindow is increased , the weighting factor generally decreases , thereby placing smaller weight on each individual air signal value . as the sample volume qsample increases , the weighting generally increases to reflect the fact that the present air signal value is representing a larger volume increment . the currently calculated air concentration value , filterout ( 0 ), in equation 5 is thus determined using the immediate past air concentration value filterout ( n ), to which is applied a weighting term which is itself a function of qwindow and qsample . filterout ( 0 ) is also determined by applying a weighting factor directly to the two most recent air signal values airsignal ( 0 ) and airsignal ( 1 ). a particular embodiment of the invention is depicted in fig9 , in which a simple sensor 34 a provides a binary signal indicating air or no air in the particular section 36 a of the fluid conduit 16 . the sensor 34 a takes a sample each time that the pump mechanism 24 takes a step , so that the resulting binary air values represent either a step with air or a step without air . a clock sampler 84 provides values indicating to which pump motor step each binary air value corresponds . with many peristaltic mechanisms driven by a step motor , the fluid flow varies widely from step to step , and some steps may even generate negative flow . thus , the binary air values for various steps may have to be processed to account for the fluid that actually flowed during that step . in the embodiment shown , the motor control 86 groups the steps in each pump cycle into several packets , so that each packet includes several pump steps . the fluid volume ( qsample ) pumped in the particular packet may be of the same order of magnitude as the fluid volume pumped in the other packets . to achieve this result , the packets may have different numbers of step in them . the binary air values are provided to a packet accumulator 88 and sorted into values representing steps with air and values representing steps without air . when the packet is completed , i . e ., when the motor has stepped through all the steps in the packet , the number of steps with air are divided by the total number of steps , as shown at 90 . the resulting value is an air fraction representing the amount of air introduced into the intravenous system during the pump steps of the packet . the air fraction is used , at 92 , as an air signal value to determine the primary air concentration value . the system also uses a volume window size ( qwindow ), which is shown provided by a memory 94 , to calculate the primary air concentration value ( filterout ( 0 )), such as by using equation 5 set forth above . the output primary air concentration value is compared , at 96 , to a primary threshold provided by the memory 94 . in the embodiment depicted , the primary threshold is a bubble density threshold . the primary threshold may be selected by the user via an input device 98 such as a keyboard or similar control panel , which may also be used to input commands to the pump motor control 86 such as desired fluid flow rate , etc . the primary threshold may also be determined as a function of the selected flow rate , and / or as a function of the window volume qwindow . when the primary threshold is exceeded , an alarm 100 is activated . alarm activation may also include shutting of the pump motor 24 through the pump motor control 86 . the memory 94 may also provide a secondary threshold value , which as depicted is a single bubble threshold , to which is compared a secondary air concentration value . if the secondary threshold value is exceeded , the alarm 100 will be activated . in the embodiments depicted in fig2 and 3 , the weighting values are applied to the air signal values so as to cause older air signal values to be given decreasing weightings that follow a relatively smooth curve that gradually and exponentially tapers off . in other embodiments of the invention , however , weighting values may be used that follow non - exponential curves . for example , a simple linear decay may be used . moreover , relatively complicated non - exponential curves can be created by varying the factors a and b . thus , the “ curve ” of weighting values applied to air signal values as they age can be tailored as desired to suit varying circumstances . fig1 depicts an example of such a non - exponential curve 102 . fig1 depicts a signal flow diagram wherein the values a and b are varied as the air signal values age . a “ b ” memory register having a number j of registers stores b values from b 0 to b j - 1 . similarly , an “ a ” memory register having a number l of registers stores a values from a 1 to a l - 1 . airsignal values from the current airsignal ( 0 ) to the oldest airsignal ( l - 1 ) are stored in an air signal memory having a number j - 1 of registers . similarly , previous air concentration values , from the most recent ( airconcentration ( 1 )) to the oldest ( airconcentration ( l - 1 )), are stored in an air concentration memory having a number l - 1 of registers . as a current air signal value airsignal ( 0 ) is received , it is placed in the top ( current ) register in an air signal memory , which has j - 1 registers , while previous air signal values , airsignal ( 1 ) to airsignal ( l - 1 ), are shifted down in the register . the weighting factor b 0 is applied to airsignal ( 0 ), the factor b 1 is applied to airsignal ( 1 ), etc ., with the result used in the calculation of airconcentration ( 0 ). the earlier values of airconcentration are also used in determining the updated airconcentration value . the weighting factor a 1 is applied to airconcentration ( 1 ), the factor a 2 is applied to airconcentration ( 2 ), etc . a desired formula for the final calculation of airconcentration ( 0 ), such as a modified version of equation 1 discussed above , may be selected to suit particular applications and circumstances . thus , a final filtered output value of airconcentration ( 0 ) can be a function of numerous past airsignal values and airconcentration values , to which have been applied many different weighting factors a 1 , a 2 , . . . , b 1 , b 2 , . . . . although preferred and alternative embodiments of the invention have been described and illustrated , the invention is susceptible to modifications and adaptations within the ability of those skilled in the art and without the exercise of inventive faculty . for example , while the examples above have generally been concerned with the use of light or sound to provide an instantaneous measurement of air in the line , other methods of determining instantaneous measurements of air in the line , such as pressure - sensitive devices , are also compatible with the invention . moreover , numerous equations and formula may be used to determine air concentration values within the scope of the invention . in addition to detecting air , the invention may also be applied to the detection of other agents that might be introduced into a fluid delivery system . thus , it should be understood that various changes in form , detail , and usage of the present invention may be made without departing from the spirit and scope of the invention . accordingly , it is not intended that the invention be limited , except as by the appended claims .
the concentration of air in a fluid delivery line is determined by monitoring output signals corresponding to the amount of air detected in the fluid and processing those signals along with information as to the time or total volume of fluid dispensed since each signal was produced . the processor determines an air concentration value based on the received signal values , with the air concentration value determined by giving greater weight to more recent signal values . where the air concentration value exceeds a predetermined value , an alarm signal may be activated or fluid delivery may be stopped . the processor also may determine a secondary air concentration value , which may be determined from the raw signal values instead of the weighted signal values . where the secondary air concentration value exceeds a second predetermined threshold , an alarm signal may be activated or fluid delivery may be stopped .