Method and apparatus for battery-power management using load-compensation monitoring of battery discharge
INTRODUCTION 
     This invention relates to a method and apparatus for improved battery-power management using load-compensation monitoring of battery discharge. 
     The invention is particularly adapted to monitor battery-energy discharge in laptop computers with greater accuracy by compensating for most types of error-inducing variations which would otherwise cause the monitoring process to produce a false output control function with a possible loss of data. If such an erroneous control permits the battery power supply to discharge completely, the operating life of the battery can also be shortened due to a phenomenon known as polarity reversal in the first battery cell to reach zero potential. 
     Accordingly, this invention maximizes battery life by accurately calculating the point at which the useful charge of a battery power supply has been nearly depleted, providing a series of warnings to the user of this fact, and subsequently performing a system shutdown before complete discharge occurs. If the invention is applied to a battery power supply used by a computer, the series of warnings enable the computer operator to transfer data from a temporary memory to permanent storage in the time interval between a warning signal and computer shutdown. 
     BACKGROUND OF THE INVENTION 
     A rechargeable nickel-cadmium battery stores electrical energy and makes this stored electrical energy available during discharge. The energy discharge performance characteristic may vary from one battery to another due to application-related factors, differences in the design of the cell, differences in its internal construction, and the condition of actual use of the battery. In all these cases of variable discharge performance, the nickel-cadmium battery maintains its charge (load-carrying capacity) until very near the end of its useful charge period, then discharges rapidly to a completely discharged level within a few minutes. Detecting the point at which the battery is about to discharge completely in all of the varying situations presents a formidable but important challenge, as complete discharge of a battery greatly shortens its useful life. 
     Traditional approaches to monitoring the rechargeable battery-energy discharge have been to either use fixed voltage levels to indicate the battery&#39;s useful charge period, or to use the rate of change of voltage (slope) as an indicator of the rate of discharge of energy. In applications, such as computer systems, these traditional approaches to battery power monitoring become impractical and unreliable because a rapidly declining rate of change of voltage often occurs long before a battery&#39;s useful output is about to be dissipated. 
     In particular, large negative slopes, which simulate the negative slope values that occur shortly before complete battery discharge, can be caused by 1) varying load conditions on the battery, for example, due to disk accesses, 2) cell dropout, 3) startup voltage depression, and 4) overcharge voltage depression. 
     A reliable battery power management system should be capable of distinguishing among the various causes of large battery discharge negative slopes and effect warnings and shutdown only in response to imminent complete battery discharge. 
     OBJECTS OF THE INVENTION 
     A first principal object of this invention is to enable an operator of a battery powered computer to have a sufficient and reliable warning that computer shutdown is imminent due to loss of battery power so that data can be transferred from temporary memory to permanent storage. 
     A second principal object of the invention is to maximize the useful life of a battery by improved monitoring of battery discharge so as to prevent cell reversal. 
     Another object is to improve the monitoring of battery discharge by compensating for certain irrelevant variations in battery output voltage which would otherwise cause a false output control function, such as premature system shutdown. 
     Another object is to reliably shut down a battery powered computer to remove all load before any of the cells making the battery becomes completely drained. 
     Another object is to provide reliable warnings that battery power is progressively becoming low. 
     Another object is to provide a reliable warning that a battery power supply has entered into a state of overcharge voltage depression. 
     SUMMARY OF THE INVENTION 
     The invention is designed to monitor the voltage-discharge curve of a battery cell, particularly the nickel-cadmium cell. 
     The ideal voltage-discharge characteristic curve (voltage vs. both capacity and run time) of a rechargeable single cell battery which is fully charged under fixed load conditions consists of three distinctly defined sections. These sections in time sequence are an initial Startup Voltage Depression (Section 1 in drawings), an intermediate Stable Section (Section 2), and a final Knee Section (Section 3). 
     During the startup phase, the voltage drops off rapidly for a short duration. At the end of this initial section, the voltage drops off more slowly, by entering into an intermediate relatively-flat stable section of relatively long time duration. The stable section terminates by leading into a knee section in which the voltage drops off rapidly to full discharge. 
     A reliable battery power management system must be able to distinguish the large negative voltage-discharge slopes which are characteristic of a Section 3 knee from similar negative slope values which may occur long before a Section 3 knee appears. Without such an ability in a battery power management system, the monitoring circuitry might erroneously respond prematurely to a large negative slope value caused by, for example, a startup voltage depression, an overcharge voltage depression, momentary application of a heavy load, poor voltage regulation, or cell dropout. 
     Accordingly, the structure of this invention is designed to detect and distinguish all such different negative slopes, and to respond with warnings and computer shutdown only upon the occurrence of a negative voltage-discharge slope identifying a Section 3 discharge knee, that is the knee immediately preceding complete discharge of a partially charged battery. This design objective is attained by use of a synthetic empirically-determined factor herein termed &#34;compensation factor&#34; (CF). The compensation factor has a dynamic changing value throughout most of the Startup Voltage Depression (Section 1) with its actual values being established by an analysis of the voltage-discharge slope values of the discharge curve specified by the battery manufacturer. 
     In general, the startup compensation factor value (SCF) established at computer powerup, is several times larger than the largest negative slope encountered during the initial period of the startup voltage depression. For example, the actual startup slope may be a -4 (all numerical values are arbitrarily selected throughout this specification to simplify and clarify the explanation of the underlying theory of operation) but the compensation factor is a +20. 
     The following preferred battery power management equation is employed in the algorithm of this invention, namely 
     
         Current CSAV=Previous Adjusted CSAV±|New SS|-CF . 
    
     The values of the term &#34;Current CSAV&#34; determine in general whether warnings followed by computer shutdown ensue. A numerical value is calculated for Current CSAV every 30 seconds. Current CSAV (compensated slope accumulator value) must equal or exceed +2, equal or exceed +22, and equal or exceed +56 for a first warning, a second warning and computer shutdown trigger levels to be attained, respectively. Any Current CSAV equal to or greater than +2 will start a warning counter having a time period of 180 seconds. The Current CSAV value calculated at the end of this 180 second time period determines the state of the circuitry. If the battery discharge is at the Knee Section 3 of the discharge curve, the then Current CSAV will be +2 or more. If between +2 and less than +22, a Level 1 warning will be generated. If between +22 and less than +56 a Level 2 warning will be generated; and if + 56 or over, computer shutdown will be effected. 
     If the computer battery supply is fully charged at computer powerup, a Level 1 warning will be generated 180 seconds after a warning counter is started after a Current CSAV of +2 and less than +22 is calculated Thereafter voltage-discharge slope samples (SS) are calculated every 30 seconds, and when the ever larger negative slopes generate a Current CSAV of between 22 and less than 56 a Level 2 warning is immediately generated. This Level 2 warning may occur at one or more integral multiples of 30 seconds after a Level 1 warning is rendered. Similarly, when the Current CSAV attains a +56 or more value, computer shutdown is immediately effected. 
     If after the warning level counter is started in response to a Current CSAV of +2 or more, the Current CSAV drops below a +2 at the warning counter timeout period of 180 seconds, then the circuitry is returned to its pre-warning state. The circuit requirement that the Current CSAV be at +2 or more both at the beginning and the end of a 180 second time period prevents erroneous warnings being generated in response to negative voltage-discharge slope values generated in response to the application of heavy computer loads, which produce current CSAV(s) of +2 or more for a time period of substantially less than 180 seconds, such as disk drives. However, if the Current CSAV is at +2 or more even after the 180 seconds time period but is gradually declining, which would be the case for voltage depression due to successive overcharge or cell dropout, a Level 1 warning is triggered to make the user aware of the condition. A Level 2 warning is not subsequently triggered, however, because the circuitry is returned to its prewarning state after the Current CSAV value declines below +2. Thus, false warnings of impending complete battery discharge and premature computer shutdowns are prevented. 
     False warnings and premature shutdowns are also prevented during Startup Voltage Depression-Section 1 because the large negative voltage-discharge slopes during the initial period of Section 1 are overwhelmed numerically and thus masked by a startup compensation factor (SCF) of +20. Voltage discharge slopes of over -20 are required to start generating positive Current CSAV&#39;s during this initial period rather than the typical values of -4 normally encountered. 
     As the negative voltage-discharge slopes decline normally in value as battery discharge progresses timewise through the voltage depression of Section 1, the startup compensation factor (SCF) of +20 is periodically reduced by 25 percent of its then current value until a fixed compensation factor (FCF) of +1 is reached. This +1 value is approximately equal to the voltage discharge slope values which appear during the terminal portion of Section 1 of the discharge curve and throughout Stable Section 2 of the discharge curve and the initial portions of Knee Section 3. 
     This fixed compensation factor (FCF) of +1 and the coinciding voltage-discharge slopes (SS) of between approximately -1 and zero prevent the CSAV(s) from attaining the +2 values required to start the warning counter so as to possibly start the warning and shutdown sequence. 
    
    
     DESCRIPTION OF THE DRAWINGS 
     In order that all of the structural and method features for attaining the objects of this invention may be readily understood, reference is made to the accompanying drawings wherein: 
     FIG. 1 shows the general shape of an ideal discharge curve of a constantly-loaded nickel-cadmium cell (or a battery of such cells) in which voltage is plotted as a function of capacity (or time); 
     FIG. 2 shows the general shape of the discharge curve of a single nickel-cadmium cell which has undergone polarity reversal due to excessive discharge; 
     FIG. 3 shows the general shape of the discharge curve of a nickel-cadmium cell (or a battery of such cells) which has been subjected to long-term overcharge at elevated temperatures; 
     FIG. 4 is a block diagram of a preferred embodiment of the battery discharge management circuitry of this invention; 
     FIG. 5 shows the general shape of the discharge curve of a nickel-cadmium cell (or a battery of such cells) which has been subjected to increased momentary loading, for example, caused by the connection of a disk drive; 
     FIG. 6 is a diagram of assistance which shows the manner of assembly of FIG. 6a through FIG. 6d to form the composite discharge curves of FIG. 6, and 
     FIG. 7 is a diagram of assistance which shows the manner of assembly of FIG. 7a through FIG. 7d to form a flow chart of the invention. 
    
    
     Pertinent Characteristics of the Nickel-Cadmium Cell 
     Before describing the structure and process of the preferred embodiment of the invention, a brief description of certain pertinent charge and discharge characteristics of the nickel-cadmium cell is set forth. This explanation will facilitate in understanding the invention. 
     The nickel-cadmium cell is used to store electrical energy, and its basic function is to make that energy available during discharge. The electrical discharge performance characteristics of a cell performing this work are voltage and capacity (the integral of current multiplied by time). The values of these two discharge parameters are functions of a number of application-related factors and this dependence is briefly described in this specification. A more detailed study of nickel-cadmium battery characteristics appear in &#34;Nickel-Cadmium Battery&#34; (Third Ed: 1986) published by the General Electric Company. 
     The general shape of the discharge curve voltage as a function of capacity (or time), is shown in FIG. 1. As noted in this Figure, after an initial Startup-Voltage Depression Section 1 the discharge voltage of the nickel-cadmium cell typically remains relatively constant during a Stable Section 2 until most of its capacity is discharged, and then drops off rather sharply during a Knee-Section 3. This curve, when adjusted by considering the effects of all the application variables, provides a complete description of the functional performance of a battery. 
     Cell Discharge to Polarity Reversal 
     A principal object of this invention is to prevent cell discharge to the point of polarity reversal (FIG. 2) because of the adverse effects of polarity reversal upon battery life. 
     Although it may be convenient to think of multicell battery voltage in terms of mean voltage for each cell, the mathematics of the cell polarity reversal phenomenon illustrated in FIG. 2 result in a fundamental difference from this convenient and simple relationship. 
     When a multicell battery is discharged completely, even small differences in the actual capacity of individual cells inherently cause one cell to reach complete discharge sooner than the rest. It is the actual capacity of this lowest capacity cell, the minimum capacity cell of the battery, which thus determines the actual battery capacity. 
     Continuation of the discharge after this lowest capacity cell has reached zero volts will cause reversal of the terminal voltage of that cell, because the cells of the battery are connected in series. As the cell polarity is reversed beyond a negative 0.2 volts it begins to generate gas internally. Generally, in a sealed nickel-cadmium cell the electrode which is reversed first will be the nickel electrode, in which case hydrogen will be generated. The sealed nickel-cadmium cell is capable of only very slow dissipation of hydrogen gas. It also has a very limited amount of gas storage volume. Thus, frequent and/or extensive reversal will lead to elevated cell pressure sufficient to open a resealable safety vent. This is the reason for avoiding or minimizing application conditions which lead to repetitive or extensive cell reversal. Such applications may lead to venting which, if repeated and/or extensive, will eventually degrade the performance of the sealed cell. 
     The general shape of the cell voltage curve during discharge into polarity reversal is shown in FIG. 2. The magnitude of the negative voltage appearing on the polarity reversed cell is dependent on the discharge rate as well as cell design and manufacturing process parameters. 
     Many nickel-cadmium cells are designed and manufactured to resist adverse effects of cell reversal caused by the deep discharging of a multi-cell battery. Batteries of low cell count that are fully charged between cycles normally possess insufficient capacity differences to generate any significant permanent damage resulting from extending the discharge of the battery to a low end-of-discharge voltage. 
     The important point, relative to the detrimental effects of cell reversal, is that these are cumulative effects. They are dependent on both the depth (Ah) in reverse and the frequency of cell reversal. The depth of reversal is in turn dependent on the end-of-discharge voltage (EODV) and the actual capacity differences between the cells in the battery. The long-range detrimental effects on voltage and capacity performance increase with both these factors. 
     The detrimental effects of reversal are the least when the rates of discharge during the reversal ar the highest. This apparent paradox results from the fact that cells which experience terminal voltage reversal during high rate discharge still have significant amounts of charge remaining in the electrodes. 
     Voltage Depression Due to Cell Overcharge 
     Cells exposed to overcharge for very extended periods of time, particularly at elevated cell temperatures, may develop an additional shortcoming called voltage depression (FIG. 3). This phenomenon is one in which the cell voltage is depressed approximately 150 mV below the normally expected values. This depression affects the cell output voltage and is independent of discharge rate. 
     This depression effect initially appears on the discharge voltage curve near the end of discharge. With extension of the overcharge time (non-discharge) of the cell, this depression progresses slowly toward the mid-point and beyond. Accompanying this effect of depression in the voltage dimension of the curve is an actual slight increase in the capacity dimension as illustrated in FIG. 3. This depressed voltage effect is an electrically reversible condition and disappears when the cell is completely discharged and charged (sometimes called conditioning). It thus appears only on the first discharge following a very extended overcharge. It will reappear if the extended overcharge is repeated. 
     The phenomenon which causes this depressed voltage is continuous overcharging of the active material of the electrode. The effect is erased by discharging and recharging that portion of the active material which has experienced the extensive overcharge. For this reason the depressed voltage effect in the discharged portion of the curve is erased by the very act of observing it, when the discharge is carried beyond the first knee of the depressed curve. Complete discharge, and subsequent full charge, essentially restores the curve to its normal form. 
     The reversibility of this effect is probably the very characteristic that gives rise to the misnomer Memory. When cells are subjected to continuous charge/overcharge, with only modest discharges (repetitive or otherwise), the reversibility of the effect actually prevents the voltage depression from occurring in that portion of the electrode active material which is cycled. The voltage depression phenomenon is, however, not erased from that portion of the electrode material which has been subjected to continuous overcharge but NOT discharged. In this situation, whenever the cell is discharged deeper than recent previous discharges and reaches the beginning of the previously uncycled material, the voltage may decrease 150 mV per cell. This misleads the observer into believing that the discharge is at the knee of the normal discharge curve and erroneously concluding that the cell remembers and, thus, delivers only the amount of capacity previously repetitively used. Instead, the phenomenon is actually related only to extended overcharging and incomplete discharging, not repetitive shallow cycling. This is because that portion of the electrode material which has experienced overcharge and not been discharged for an extended period of time slowly shifts to a more inaccessible form. 
     The depressed voltage effect can of course cause loss of useful capacity in those application cases where a high cutoff voltage prevents complete discharge of the minimum capacity cell in the battery. If voltage depression has occurred, complete discharge requires continuation down through the depressed knee to that voltage level which keeps all the electrode material active. An end-of-discharge voltage (EODV) on the minimum cell of, for example, 75 percent of its MPV or less will accomplish that restoration with each discharge. 
     THE STRUCTURE OF THE PREFERRED EMBODIMENT 
     A simplified block diagram of a preferred embodiment of the battery-discharge monitoring and warning circuitry of this invention, as applied to a laptop computer, is shown in FIG. 4. 
     Some Basic Definitions 
     The following set of definitions will facilitate an understanding of the mode of operation of the circuitry of FIG. 4: 
     VOLTAGE SAMPLE (VS)--is the instantaneous peak amplitude of the voltage pulse appearing at the output of the analog-to-digital converter (A/D) 12. 
     AVERAGED VOLTAGE SAMPLE (AVS)--is the average voltage of a series of 256 consecutive voltage samples, which is also expressed mathematically as: AVS=(VS1+VS2+VS3+. . . . . . VS256)/256. 
     PREVIOUS AVERAGED VOLTAGE SAMPLE (PAVS)--is the averaged voltage sample taken one AVS time period prior to a realtime AVS. 
     SLOPE SAMPLE (SS)--is a value proportional to the slope of the battery discharge curve where the slope is that of a straight line drawn through two consecutive AVS(s) values; and which relationship is expressed mathematically as SS=(AVS `Y`-AVS `X`)/Time Period of an AVS. 
     NOTE: `X` and `Y` are two consecutive AVS(s) with `X` being the PAVS and thus the first AVS in time. And as the time period of the Voltage-Sample Counter-Timer 17 is the Time Period of an AVS and is always constant throughout battery discharge, this time period can be eliminated from all calculations with the varying SS(s) being proportionally correct. A declining discharge curve has a negative slope, and an ascending discharge curve will have a positive slope. 
     COMPENSATION FACTOR (CF)--is a term used in determining the Compensated Slope Accumulator Value (CSAV) and it is represented by a dynamic value. The CF is adjusted throughout the Startup Voltage Depression-Section 1 of the battery discharge curve, from an initial or startup 20 CF, to a 1 CF. During Stable Section 2 and Knee Section 3, CF remains a constant 1 value. The above CF values are arbitrary values employed in this detailed description to facilitate understanding of the invention. 
     STARTUP COMPENSATION FACTOR (SCF)--is the CF value at startup, or 20. 
     FlXED COMPENSATION FACTOR (FCF)--is the constant CF value (+1) during part of Sections 1 and all of Sections 2 and 3 of the discharge curve. 
     COMPENSATED SLOPE ACCUMULATOR VALUE (CSAV)--is an end-result value located in RAM 13 which is the result of processing in accordance with the equation: 
     
         Current CSAV=Previous Adjusted CSAV±|New SS|-CF. 
    
      Current CSAV is a value of fundamental importance to the battery power management process as it enables the circuitry to render warning alarms and computer shutdown only in response to a battery discharge in Knee Section 3 of the normal battery discharge curve, or in response to a very large negative slope in the terminal knee portion of partially charged battery discharge curve. 
     NOTE 1: In the equation for CSAV, if the new SS is a negative slope, then the absolute value of New SS is added in the equation. However, if the new SS is a positive slope, then the absolute of New SS is subtracted in the equation. 
     NOTE 2: Previous CSAV and the New SS (New SS is the current SS) are values determined timewise at a time separation of two consecutive SS(s), which is 256 times the time period of the voltage-sample counter-timer (i.e.≃30 seconds). The CF value is that determined at the same time the New SS is calculated. Thus Current CSAV, New SS and CF are real-time values. 
     NOTE 3: The Previous CSAV is adjusted to zero if its value is less than zero. Accordingly, only a positive Previous CSAV contributes to the numerical value of a Current CSAV. The equation for Current CSAV may also be written and simplified as follows: Current CSAV=Previous Adjusted CSAV-New SS-CF. 
     STARTUP COMPENSATED SLOPE ACCUMULATOR VALUE (SCSAV)--is the CSAV at powerup of the computer, and is set to 0. 
     Simplified Circuit Explanation 
     A simplified block diagram of a preferred embodiment of the battery-discharge monitoring and warning circuitry of this invention, as applied to a laptop computer, is shown in FIG. 4. 
     The principal components of the circuitry and their generalized functions are as follows: 
     Central processing unit (CPU) 10 and its associated circuitry monitor the discharge curve of battery power supply 11, and CPU 10 may also perform the usual CPU functions. 
     Battery 11 comprises a plurality of nickel-cadmium cells which serve as a power supply for the laptop computer. 
     Analog-to-digital converter (A/D) 12 converts the analog output voltage of battery 11 into a series of digital pulses which are ultimately sampled at a repetition period of ≃0.11 seconds and which establish VS values. 
     The VS values are averaged by CPU 10 in a group of 256 VS pulses to obtain a series of AVS values having a repetition period of 30 seconds. These AVS pulses are processed to determine SS values in accordance with the equation SS=AVS `Y`-AVS `X`. 
     RAM 13 contains memory sections 14, 15 and 16 which are peculiar to this invention. 
     Compensated slope accumulator memory section 14 is a dedicated memory section located within RAM 13 which contains the values which comprise the Previous CSAV as adjusted, the New SS used in determining the Current CSAV, and the Current CSAV. 
     Compensation factor (CF) memory section 15 is a dedicated memory section located within RAM 13, which contains the dynamic CF values (that is, CF as adjusted during battery discharge, and fixed (FCF) ) used in determining the Current CSAV; 
     Previous averaged voltage sample memory section 16 is a dedicated memory section located within RAM 13 which contains the PAVS value used in determining a SS value. 
     Voltage sample counter-timer 17 is a timer preset to the repetition sampling period of 0.11 seconds for the voltage pulses appearing at the output of A/D 12 so that VS measurements can be made every 0.11 seconds by CPU 10. As previously noted, these VS values are used to determine AVS values, and then using two consecutive AVS values to calculate a SS value. 
     Startup compensation counter 18 is a timer preset to a time period which is approximately equal to 1/16 of the time over which startup voltage depression (Section 1 of the discharge curve) occurs for the particular cells of battery 11 when fully charged. This time period is determined from the manufacturer&#39;s specifications and battery discharge curve for those cells and is used in the decrementing process of adjusting CF. Startup compensation counter 18 is restarted every fourth SS until CF equals 1. 
     Warning counter 19 is a timer preset to a time period over which an overcharge voltage depression (Section 2 of the discharge curve) may occur in battery 11 because of an overcharge condition or memory effect. In a typical battery powered computer this time period may be ≃6 SS repetition periods. Warning counter 19 also establishes the operate times for Warning Level 1, Warning Level 2, and Computer Shutdown occurring during Knee Section 3 of the battery-discharge curve. 
     Warning Level 1 (WL-1) trigger line 20 goes high to activate an alarm when the output voltage of battery 11 is reduced through discharge to a Level 1 preliminary warning point representing the approximate start of Knee Section 3 of the battery discharge curve. The warning operating point of Level 1 is a preset value WL-1 specified by the statement: 
     WL-1≃(absolute value of the average of all SS(s) over the initial 36% of Knee Section 3). 
     WL-1 ≃2 in the preferred embodiment of this invention shown in the drawings. 
     Warning Level 2 (WL-2) trigger line 21 goes high to activate a second alarm, which warns that computer shutdown is imminent, when the output voltage of battery 11 is further reduced through discharge to a Level 2 final warning point representing substantial entry into the rapidly-declining knee of Knee-Section 3 of the battery discharge curve. The warning operating point of Level 2is a preset value WL-2 specified by the statement: 
     WL-2≃(absolute value of the sum of SS(s) over the initial 81% of Knee Section 3)/2. 
     WL-2≃22 in the preferred embodiment of this invention shown in the drawings. 
     Shutdown trigger line 22 goes high at a Computer Shutdown point located on a terminal portion of the rapidly-declining knee of Knee Section 3 having a relatively large negative slope and occurring a short time interval before battery 11 would otherwise reach complete discharge. The shutdown value (SDV) is specified by the statement: 
     SDV≃(absolute value of the sum of the SS(s) over the last 19% of Knee Section 3). 
     SDV≃is approximately 56 in the preferred embodiment of the invention shown in the drawings. 
     Read-only-memory (ROM) 23 contains all the following preset times and values: 
     1. Counter times 
     a) VS counter-timer 17≃(1 VS repetition period) which is ≃0.11 second. 
     b) Startup compensation counter 18≃(1/16 of Section 1 of the discharge curve). 
     c) Warning counter 19≃(6 SS repetition periods) which is≃180 seconds. 
     2. Preset values 
     a) Startup compensation factor (SCF)≃(1/2 absolute value of the sum of SS(s) occurring during the first 1/4 of the time period of Section 1 of the discharge curve); which is ≃+20 for a normal discharge curve in the preferred embodiment described. 
     b) Fixed compensation factor (FCF)≃(absolute SS value at any point on Section 2 of the discharge ×4; which is≃1 for the preferred embodiment described. 
     c) Startup compensated slope accumulator value (SCSAV) is 0 for the preferred embodiment described. 
     d) Warning Level 1 (WL-1)≃(absolute value of the average of SS(s) over the initial 36% of Knee Section 3 of a normal discharge curve); which is approximately +2 for the preferred embodiment described. 
     e) Warning Level 2 (WL-2)≃(absolute value of the sum of SS(s) over 81% of Knee Section 3)/2; which is approximately +22 for the preferred embodiment described. 
     f) Shutdown Value (SDV)≃(absolute value of the sum of the SS(s) over the last 19% of Knee Section 3); which is approximately +56 for the preferred embodiment described. 
     Voltage-divider and filter 24 reduces and filters the direct-current output voltage of battery 11 for suitable application to the input of A/D 12. 
     THE MODE OF OPERATION OF THE PREFERRED EMBODIMENT 
     The operation of the battery power management circuitry of this invention shown in FIG. 4 is now described with reference to the composite flow chart of FIG. 7 (FIGS. 7a-d) and the composite battery-discharge curve of FIG. 6 (FIGS. 6a-d) (including also the alternate curve for overcharge voltage depression (FIG. 6c), the alternate insert curve for a partially charged battery (FIG. 6b), and the fragmentary discharge curve of FIG. 6d which shows the change in the discharge curve caused by a momentary increase in load). 
     In order to understand fully the operation of the circuitry, the detailed description is divided into the following four principal operational modes of battery discharge monitoring and management: 
     1) operation during discharge of a fully charged battery; 
     2) operation during discharge of a partially charged battery; and 
     3) operation during a momentarily applied increase in load. 
     4) operation during discharge of a battery subject to overcharge voltage depression; 
     The following is a summary of the alphabetic letter references used throughout the following operational description: 
     VS voltage sample 
     AVS averaged voltage sample 
     PAVS previous averaged voltage sample 
     SS slope sample 
     CF compensation factor 
     SCF startup compensation factor 
     FCF fixed compensation factor 
     CSAV compensated slope accumulator value 
     SCSAV startup compensated slope accumulator value 
     WL-1 warning level 1 
     WL-2 warning level 2 
     SDV computer shutdown value 
     The Mode of Operation During Discharge of a Fully Charged Battery 
     Referring now to the flow chart of composite FIG. 7, the various preset times and values are set forth in blocks A and B. The states of the circuitry of FIG. 4, are set forth in blocks C through Z, and AA through AF. 
     The counter values set forth in block A are factory preset in ROM 23 so as to provide proper circuit operation for the particular nickel-cadmium cells used in battery 11. In particular, voltage sample counter-timer 17 is set to the time period to take 1 VS, or approximately 0.11 seconds; startup compensation counter 18 is set to approximately 1/16 of the time period of the Startup Voltage Depression-Section 1 of the discharge curve, or approximately 90 seconds; and warning counter 19 is set to a time period approximately or equal to 6 SS(s) times or approximately 180 seconds. 
     The values set forth in block B are also factory preset in ROM 23. In particular, SCF is approximately or equal to +20 for a normal discharge curve; SCSAV equals 0; FCF is approximately or equal to +1; WL-1 is approximately or equal to +2; WL-2 is approximately or equal to +22; SDV is approximately or equal to +56. 
     At computer power-up, CPU 10 sets all values in RAM 13 to zero. 
     In state C, CPU 10 takes its initial VS from battery 11. Since CPU 10 has to take 256 VS(s) (to filter voltage noise) to get a single AVS, the following sequence of operations are performed by CPU 10 to get a single AVS: 
     In state D, a check is made by CPU 10 to determine if 256 VS(s) have been taken. 
     If not, state E is entered wherein voltage sample counter-timer 17 is started and control is then passed to state F. 
     In state F, CPU 10 is made to wait by voltage sample counter-timer 17 for the period specified in counter-timer 17 (i.e. ≃0.11 seconds). At the end of this period, control is passed back to state C to get the next VS. 
     States C, D, E and F are successively repeated by CPU 10 until the 256 VS(s) are taken by CPU 10. Having obtained 256 VS(s), CPU 10 then calculates in state G an AVS in accordance with the AVS formula set forth in the &#34;Some Basic Definitions Section&#34;. The time period for CPU 10 to calculate each AVS is approximately 30 seconds (0.11 second ×256). The first AVS is calculated 30 seconds after computer powerup. 
     If the AVS thus calculated is determined in state H not to be the first AVS calculated by CPU 10, then control is passed to state J. However, if the AVS is the first AVS calculated by CPU 10, and since CPU 10 has no PAVS from which to calculate the slope (SS), state I is entered. In state I, CPU 10 sets the PAVS in RAM section 16 to the first calculated AVS value. Control is then passed back to state C so that CPU 10 can calculate the next (the second) AVS. 
     Having calculated two successive AVS(s), CPU 10 in state J then calculates a single SS in accordance with the SS formula set forth in the &#34;Some Basic Definitions Section&#34;. The first SS is calculated 60 seconds after computer powerup and has a value of -4. 
     In state K, CPU 10 determines if the SS calculated in state J is positive or negative, and upon which determination control is passed either to state L (+) or to state M (-). In state L or M, a preliminary arithmetic calculation for the quantity (Previous Adjusted CSAV±|New SS|) is made which is ultimately used to determine the Current CSAV (see the first two terms in the equation for Current CSAV appearing in the Some Basic Definitions Section). If SS is positive, then in state L CPU 10 subtracts the absolute value of SS from the Previous CSAV, which value is located in RAM section 14. If SS is negative, then in state M, CPU 10 adds the absolute value of SS to the Previous CSAV. The -4 SS produces a +4 value at state M. Control is then passed from either L or M to N. 
     A positive SS generally occurs only when computer load is removed from battery 11. A negative SS occurs during discharge of both a fully and partially charged battery, overcharge voltage depression, cell dropout, and application of an increased load. 
     In state N, CPU 10 provides compensation for the voltage depression caused by either the startup conditions (Startup Voltage Depression-Section 1), the overcharge battery condition appearing in broken line in Stable Section 2 of the discharge curve, cell dropout, or a momentarily applied heavier-load condition. This compensation is accomplished by subtracting the CF value appearing in RAM section 15 from the adjusted quantity (Previous adjusted CSAV±|New SS|) obtained from state L or M to obtain Current CSAV. At 60 seconds computer operate time, Current CSAV is -16 obtained by subtracting +20 CF value from +4. 
     In state 0, CPU 10 determines if the Current CSAV obtained from state N is either positive or negative. If the Current CSAV is positive then control is passed directly to state V. If the Current CSAV is negative, then this Current CSAV is set to zero by CPU 10 in state P before passing control over to state Q. The Current CSAV obtained from state N will be negative or equal to 0 if the startup voltage depression is in progress. 
     In state Q, CPU 10 examines the CF value to determine if Startup Voltage Depression-Section 1 is in progress. If the CF is greater than FCF (FCF is +1) then the startup voltage depression is in progress and control is then passed to state R; otherwise if less than FCF, control is passed back to state C. 
     In state R, CPU 10 determines if the startup compensation counter 18 is currently on--if so it passes control to state T; otherwise it starts or restarts startup compensation counter 18 in state S and then passes control to state C. Startup compensation counter 18 is started 60 seconds after computer powerup when the first SS is calculated in state J. 
     In state T, a check is made by CPU 10 to verify if the time preset (90 seconds) in startup compensation counter 18 has elapsed. If it has not elapsed, then control is passed to state C; otherwise the CF value is reduced by 25% of its current value in state U before passing the control back to state C. Startup compensation counter 18 provides a mechanism for masking the startup voltage depression of Section 1 caused by the application of the computer load at powerup. The time duration of 90 seconds is chosen empirically so that the CF can be decremented from its high initial value of +20 at the end of each counter 18 start and restart period by 25% of its previous value until CF attains a +1 value. This +1 value is closely approximate the transition slope of the discharge curve at the end of Section 1 and the entire portion of Section 2. Accordingly, the high initial SCF and the decremented values of CF prevent the Current CSAV from attaining the values required to produce warning levels and also computer shutdown when a normal battery discharge curve is monitored. 
     In state V, the startup compensation counter 18 is stopped (if previously set running during the process of reducing CF in states Q, R, S, T, U). 
     During a normal battery discharge process, state V is entered by CPU 10 if the Startup Voltage Depression-Section 1 has passed; otherwise, the CF is repeatedly adjusted in states Q, R, S, T, U during each startup compensation counter 18 time period until it reaches a FCF value of +1 at 16 1/2 minutes after computer powerup. 
     From state V onwards the task of CPU 10 is principally to accurately identify Knee Section 3 of the discharge curve by detecting increasing positive values of Current CSAV (with a threshold value of at least +2) both at the beginning and at end of the 180 second time period of the warning counter 19. To achieve this objective, the following sequence of operations are performed by CPU 10. 
     In state W, the Current CSAV obtained from state N is examined to determine if its value has reached the WL-1 value of +2. If so, state Y is entered; otherwise it implies to the CPU that the battery discharge is still in Stable Section 2. 
     If the discharge is in Stable Section 2, control is passed back to state C after assuring that warning counter 18 is stopped in state X. Also before passing control over to state C, the current AVS which was obtained from state G is saved as the PAVS in RAM section 16 and is shown in state I. 
     The above-mentioned process is successively repeated until the discharge reaches Knee Section 3. The circuitry preliminarily determines that Knee Section 3 has been reached by detecting a Current CSAV of +2 or more in state W and then confirmation is made at end of the warning counter period of 180 seconds if the then Current CSAV is +2 or more. The then Current CSAV at the end of the warning counter period must be between +2 and less than +22 to trigger WL-1 in state AC, or between +22 and less than +56 to trigger WL-2 in state AE skipping WL-1, or +56 or more to effect computer shutdown in state AF. 
     Thus, in state Y, to assure that Knee Section 3 of the discharge curve is not falsely seen by CPU 10 due to a momentarily applied load, CPU 10 waits for a time period of warning counter 18 before triggering WL-1 to the user by passing control to state AB. 
     In state AB, a check is made by CPU 10 to determine if the Current CSAV value is at or above WL-2 (or +22). If not WL-1 is triggered as in state AC; otherwise, control is passed to state AD. 
     In state AD, a check is performed by CPU 10 to determine whether the Current CSAV value has reached the SDV. If so, the system is shutdown in state AF; otherwise WL-2 is triggered in state AE indicating imminent shutdown and control is passed to C. 
     If control is passed to C, this implies to the CPU that usually a few additional minutes of computer user time remains after WL-2 is triggered; and the system carries on to collect the next SS to be processed to effect computer shutdown when and if the SDV of +56 is calculated as a Current CSAV. 
     The Mode of Operation During Discharge of a Partially Charged Battery 
     The sequence of operations performed during the discharge of a partially charged battery is identical to those described with reference to the section entitled &#34;The Mode of Operation During Discharge of a Fully Charged Battery&#34;, with the following three exceptions: 
     1) Depending upon the charged level of the battery, the CF value may or may not go through all the iterations of CF reduction in the states P, Q, R, S, T, U, until the FCF (≃1) is reached. This occurs because the Current CSAV remains positive in state 0 because of the much higher slopes (SS) than in a case of a fully charged battery. 
     2) Again depending upon the charged level of the battery, the stable section discharge may or may not exist. If there is a stable section, then the flow chart states C, . . . V, W, X are repetitively executed until a knee section is detected. 
     3) Once again depending upon the charged level of the battery the knee section of the discharge curve may be shorter than for a fully charged battery in which case the number of iterations performed by states C, . . . ., V, W, Y, AA, . . . . AD, AE may be fewer than in the case of a fully charged battery, thereby yielding shorter warning periods. 
     In the example of a partially charged battery discharge curve shown in the drawings, the states C, D, . . . ., 0, P, Q, R, S, T, U are executed only once as the Current CSAV, turns positive after the first iteration. As seen this discharge curve has no stable section of discharge. Immediately following a short startup voltage depression, the discharge merges into the knee section of the discharge. 
     In state W, the CPU detects this entry into the knee section by detecting a positive value in the Current CSAV which trips the warning counter in section Z. Very shortly afterwards WL-1 is activated in state AC and again shortly thereafter WL-2 is activated in state AE. After a very brief duration the Current CSAV reaches the SDV value and the system is shutdown in AF. 
     Referring to the &#34;Circuit Values for Partially Charged Battery&#34; shown in FIG. 6b, warning counter 19 is activated when Current CSAV reaches +3 at 150 seconds after computer powerup. (It will be recalled that warning counter 19 is started in states Y or Z whenever Current CSAV equals or exceeds a WL-1 of +2. However, a warning, either WL-1 or WL-2 is not triggered in states AC or AE, respectively, until the warning period of 6 SS times elapses (180 seconds) in order to assure that the WL-1 threshold was not caused by momentary circuit voltage variations which should be ignored. 
     At the end of the warning period which occurs 5 1/2 minutes after computer powerup, CPU 10 detects a Current CSAV of +19. Since a CSAV of +19 is above the WL-1 threshold and below the WL-2 threshold, WL-1 is triggered in state AC. 
     Since the Current CSAV(s) continue to increase in positive values after the WL-1 alarm is activated, WL-2 is triggered at 7 1/2 minutes after computer powerup when the Current CSAV at +23 first exceeds the WL-2 threshold of approximately +22. At 9 1/2 minutes after computer powerup, a Current CSAV at +63 first exceeds the SDV threshold of approximately 56 and so the computer is shut down. 
     In the example shown in the drawings, both the Wl-1 and the Wl-2 alarms are activated before computer shutdown because the Current CSAV(s) pass through the WL-1, WL-2 and SDV threshold values in sequence as the discharge of a partially charged battery progresses. However, if the negative SS(s) of the discharge curve for a partially charged battery increase rapidly timewise, then WL-1, or even both WL-1 and WL-2, could be skipped with the circuitry proceeding directly to shutdown. 
     In particular, in cases where the battery is charged for only a brief period (for example, 5 minutes), the knee section of the discharge curve is so steep negatively, that WL-2 is turned on instead of first turning on WL-1. This occurs because the Current CSAV reached the WL-2 threshold after the warning counter period by virtue of the steep negative knee section. However, if the knee section is almost absent, as is the case where the battery is fully discharged and never charged, the circuitry will reach the SDV threshold by the end of the warning counter period. 
     The Mode of Operation During Momentary Increase in Load Due to Disk Access 
     The monitoring circuitry of this invention is able to detect and ignore positive CSAV(s) which momentarily exceed a WL-1 threshold of approximately +2, or for that matter even the larger thresholds of WL-2 and SDV. These positive CSAV(s) are usually generated by momentary increases in load caused by a computer disk access or a short lived steep negative slope caused by cell dropout. Since warning counter 19 is started immediately upon the calculation of an approximately +2 Current CSAV, the circuit mechanism for activating WL-1, WL-2 and even computer shutdown is initiated. However, since it is the Current CSAV that is calculated at the end of the warning period of 180 seconds that produces the warnings of WL-1 and WL-2, and the then Current CSAV is at a value below the WL-1 threshold, no warnings are issued. Thus, the circuitry is returned to its normal state where New SS(s) are calculated which produce Current CSAV(s) having a value of zero or less. 
     As is seen in FIG. 6d, which shows an enlarged view of the negative &#34;spike&#34; produced at about 178 minutes into Stable Section 2 of the discharge curve, a SS of -3 is calculated at 178 1/2 minutes. This -3 SS value produces a Current CSAV at 178 1/2 minutes of +2, which is at the threshold for triggering warning counter 19. However, at the end of the warning counter period occurring at 181 1/2 minutes, the Current CSAV has returned to a +1 value which is below the WL-1 threshold. At 182 minutes the then current CSAV returns to a still lower zero value. Accordingly, the momentary negative spike produced by disk access produces no alarms or shutdowns. 
     The Mode of Operation During Discharge of a Battery Subject to Overcharge Voltage Depression 
     An overcharge voltage depression is characterized by a discharge knee which is separated both timewise and capacitywise from complete battery discharge. Accordingly, useful battery capacity exists to continue computer operation until a Section 3 knee is reached. The circuitry of this invention distinguishes between the two knees-usually by returning Current CSAV to a value below +2 after a WL-1 warning is generated in the case of the overcharge voltage depression knee. 
     In the case of a Section 3 knee the CSAV(s) continue to build up, so that a WL-1 warning is followed by a WL-2 warning and ultimately computer shutdown. 
     As is shown in FIG. 6c, the knee of the particular overcharge voltage depression shown is characterized by SS values of -5 lasting for approximately ninety seconds. Thereafter, the discharge curve enters a stable section having SS(s) of -0.25. 
     With these values and time conditions characterizing an overcharge voltage depression knee, warning counter 19 is started at 3 minutes and 30 seconds when the Current CSAV reaches a +4 value. At the end of the warning counter time period of 180 seconds (6 minutes and 30 seconds) Current CSAV is a +9, thus triggering a WL-1 warning. This gives the computer operator notice that some type of knee has been detected. However, a WL-2 warning is never issued because the declining SS values produce a reduction in the CSAV(s). The actuation of only a single warning confirms to the operator that a Section 3 knee was not the cause of the WL-1 warning. 
     If the stable portion of the voltage depression curve lasts long enough, Current CSAV will ultimately go to zero. 
     CONCEPTS EMPLOYED IN THE CALCULATION OF CURRENT CSAV 
     The following equation for Current CSAV is designed to improve the monitoring of the voltage discharge curve and to produce warnings and system (computer) shutdown only in response to a knee section immediately preceding complete battery discharge: 
     
         Current CSAV=Previous Adjusted CSAV±|New SS|-CF, or its equivalent 
    
     
         Current CSAV=Previous Adjusted CSAV-New SS-CF. 
    
     These equations introduce the terms Previous Adjusted CSAV, New SS and CF. And the circuitry embodying the algorithm for effecting the equation introduces time periods for taking a voltage sample (VS; 0.11 seconds), for taking a slope sample (SS; 30 seconds), for decrementing compensation factor (CF; 90 seconds), and for a warning period (180 seconds) the beginning and end of which a positive CSAV must be calculated at least equal to the WL-1 threshold before a warning and shutdown sequence can be initiated. 
     Each of the foregoing terms and times contributes to the monitoring efficiency and reliability of this invention. Although, if a loss of efficiency and reliability can be tolerated, certain steps could be eliminated from the algorithm, for example, the steps involving Previous Adjusted CSAV. 
     The principal concepts which underlie the above terms and times are briefly summarized as follows: 
     The Principal Underlying Compensation Factor (CF) and Slope Sample (SS) 
     As the system is unaware of the state of the battery at system powerup, compensation factor (CF) is a mechanism used to allow the system to ignore essentially the Startup Voltage Depression-Section 1 for the fully charged battery discharge curve by overwhelming numerically the actual slope of the discharge curve represented by the slope samples (SS). In particular, an examination of the numerical values for CF range between 20 and 8 and for SS a generally constant -4 during the first 5 minutes after powerup. Accordingly, the quantity (±|New SS|-CF), or its equivalent (-New SS-CF), yields negative values each time SS is calculated which in turn do not produce a positive Current CSAV of at least +2 required to trigger warning counter 19 so as to possibly enter the warning and shutdown sequence. 
     The term CF having performed its principal function during the initial portion of the startup voltage depression is decremented every 120 seconds until CF reaches a fixed value of +1 (FCF=+1) for the remaining portion of the normal discharge curve. The quantity (±|New SS|-CF) thus hovers at a value near zero, and in so doing places the system during Stable Section 2 and Knee Section 3 responsive to significantly large changes in SS which may be indicative of arrival of the voltage discharge at the negative knee of Knee Section 3 immediately preceding complete battery discharge. 
     Thus, CF at the outset masks SS so that the circuitry is not responsive to the fairly large negative slope values during the initial voltage depression at startup; but thereafter as CF is decremented to +1 (FCF) the values of the SS(s) are significant. 
     With respect to a partially charged battery, while SCF and CF ranges between +20 and +15 for the first 5 minutes, the relatively large SS(s) of -18 produce a positive Current CSAV at 2 1/2 minutes after powerup thus activating warning counter 19 and leading into the warning and shutdown sequence. 
     Without the use of CF monitoring of the discharge curve slope, the system could not reliably distinguish between the range of voltage discharge slopes encountered during the initial startup voltage depression and those produced by the wide range of partially change batteries. 
     The Principal Underlying Current CSAV and Adjusted CSAV 
     The current CSAV provides a mechanism for the CPU to accurately track the knee sections immediately preceding complete battery discharge, characterized by large negative slopes, of both fully and partially charged batteries. If the Current CSAV exceeds the WL-1 threshold value then the CPU knows that the knee section immediately preceding complete discharge is probably approached. Thereafter, upon the expiration of the warning counter time period, if the Current CSAV(s) go to the higher levels required to exceed the WL-2 and SDV thresholds, the CPU knows that complete battery discharge is immiment. 
     While the use of the values represented by the term Previous Adjusted CSAV may be optional in a given battery discharge management system, it serves the purpose of amplifying at an earlier time in the monitoring process the positive values of the Current CSAV. Current CSAV is a real time value acted upon immediately, and Previous Adjusted CSAV is zero and is therefore nonconsequential in the system until a positive Current CSAV is detected in state 0. The Current CSAV becomes positive during 1) Knee Section 3 of a fully charged battery discharge curve, 2) the knee portion of a partially charged battery, 3) voltage depression due to battery overcharge, 4) cell dropout, and 5) negatively directed voltage aberrations caused by disk access and other momentarily applied loads. 
     With the dual requirement that positive Current CSAV(s) appear at both the start and end of the warning counter time period of 180 seconds, the circuitry responds by entering into the warning and possibly the shutdown sequence for conditions 1 and 2 above but rejects condition 3, 4 and 5 because they do not produce positive Current CSAV(s) at the end of the warning counter time period. 
     Accordingly, an inspection of both Current CSAV and Previous Adjusted CSAV values shows that during conditions 1 and above the term Previous Adjusted CSAV contributes a large positive number to the numerical values which collectively determine Current CSAV. 
     It should be understood that the above described apparatus and method ar merely illustrative of the principals and structural features of this invention and modifications can be made without departing from the scope of the invention.