METHOD AND APPARATUS FOR RAPIDLY CHANGING A MAGNETIC FIELD PRODUCED BY ELECTROMAGNETS
BACKGROUND OF THE INVENTION
1. Field of the invention
This invention relates to a method of controlling electromagnets, and more specifically to a method of controlling current changes in, and thus magnetic fields produced by, electromagnets by using a patterned rate of current change in a manner to cause the electromagnets to function faster, more efficiently, more safely, or more economically, or in a manner in which a combination of these advantages accrue.
2. Description of Related Art
Electromagnets of various types have been used for such diverse purposes as the magnetic suspension of wind- tunnel models and the guiding of implant placement in living tissue to deliver therapy to a patient. In these and in many other applications, it has proven useful to control the power source of the electromagnet with
feedback systems having characteristics designed to satisfy load requirements or system requirements, or both. Often, it would be advantageous to allow these power sources to provide rapid current changes in response to conditions imposed by or on the system that is influenced by the magnetic field of the electromagnet.
Superconducting magnets made of coils of superconducting material (especially the new, high- temperature type of superconductors) present special problems when rapid current change is required.
Superconducting coils have zero resistance, except for parasitic resistance that includes their external leads and connections to the powering device. Therefore, these coils have a long time constant for the increase of current, given by the value of L/R, where L is coil inductance and R is the effective value of the various sources of parasitic resistance. Because R is very low, superconducting coils act as almost pure inductors, and have very long time constants. In a typical prior art use of superconducting magnets (such as described in McNeil et al . , "Characteristics of an Improved Magnet-Implant Guidance System," pp. 802-808, IEEE Trans. Biomed. Eng . , Vol. 42, No. 8, Aug. 1995, which is hereby incorporated by reference in its entirety) , a constant voltage V is applied to the superconducting coil. Thus, a good approximation of the ramping rate of current through the coil is given by assuming the coil acts as a pure inductance, i.e., dl/ dt = V/L. Unless the applied voltage V is very large, or L is very small, the rate of current increase is low. Large coils can thus require hours, or even days, to power up, which is at least inconvenient and may be intolerable in some applications. Attempts to increase the ramping rate by using moderately high values of constant voltage V can result in quenching (i.e., loss of conductivity) of the superconducting coil, which can be hazardous to equipment. In addition, a high voltage could
be established in the coil in some transient circumstances, possibly exceeding the breakdown voltage of the coolant (such as helium, or helium gas bubbles, which may also be present) and causing serious coil damage. Coils can quench as a result of a combination of two factors: (a) an excessively high magnetic field resulting from excessive current in the coil, and (b) eddy-current heating resulting from current changes being applied to the coil too rapidly. (High fields and eddy current heating can result either from current in the coil itself, or from nearby sources of magnetic fields. The effect of nearby sources of magnetic fields is not hereafter explicitly taken into account, because these effects are of secondary significance in most applications. There are also other factors that are difficult to model mathematically that are known to contribute to the tendency of a coil to quench -- e.g., liquid helium proximity to the coil, and the thermal capacity and conductivity of the coil bobbin and support structure. Thus, the quenching behavior of any particular coil can usually only be determined by experimentation and modeled approximately.) It is well-known that a given superconducting coil will quench at a lower current if the ramping rate (i.e., first derivative of the current) is high, and also that it will quench at some lower ramping rate if the field (i.e., the current itself) is high. Taken together, these effects combine so that there is a tendency for quenching to occur at a roughly constant value of the magnitude of the product of the current and its rate of change (i.e., the first derivative of the current) . It would be desirable to provide a faster method of ramping current in superconducting coils that avoids the problem of quenching.
It would also be desirable if a high voltage magnitude, when used to ramp the coil, could be maintained only up to the arcing limit of the coil while the magnitude of current in the coil is low, and a lower
magnitude of voltage applied as the magnitude of current increases. Such a method would allow rapid ramping of current while avoiding the risk of damage caused by insulator breakdown. The limitations of superconducting coils when used with most present current ramping methods are so severe as to prevent the use of such coils in traditional servo systems or in manners in which limited ramp time is important. In other applications, designers have been forced to limit the rate of change of current to a value found to avoid quenching in worst case conditions, and to limit the current itself to a value found to avoid quenching. Alternately, if faster ramping is needed, coil designers have had to undertake heroic steps to make the coil less vulnerable to ramp-time quench, although these steps can never completely avoid the possibility of quench. Consequently, the use of superconducting coils in dynamic devices has been almost completely ruled out .
More specifically, the temperature T and field Hc at which a superconducting wire will change phase is given approximately by the equation
Hc = H I - ( T/ Tc) 2 ] (1) for an especially simple superconducting material, and by modified versions of the equation for others. Here, Hc is the critical field above which the material will change phase, H0 is the critical field at absolute zero temperature, and Tc is the critical temperature above which the material will not be superconducting at any field value. Thus, the tendency of a coil to quench will depend on its own current (an J-dependence) , in addition to fields created by external sources. In summary, coils can quench from high field effects or eddy-current heating from ramping too fast. The high field effects or eddy- current heating can be caused by the coil itself, or by other nearby sources.
As described above, power supplies of fixed voltage have been used in the prior art to provide linear ramping
of a single superconducting coil . Standard servo methods have been used for ramping non-superconducting coils. In the less common case of multi-coil systems, special temporal relationships have been used in more complex ramping systems, such as in U.S. Patent No. 5,654,864
(incorporated herein by reference), and in pending U.S. Pat. App. No. 08/682,867, filed July 8, 1996 (incorporated herein by reference) . The specifications of both of these patent applications are incorporated herein in their entirety. In one use of superconducting electromagnets, a six-coil helmet (such as described in McNeil et al . , "Functional Design Features and Initial Performance Characteristics of a Magnetic- Implant Guidance System for Stereotactic Neurosurgery, " pp. 793-801, IEEE Trans. Biomed. Eng . , Vol. 42, No. 8, Aug. 1995 which is hereby incorporated by reference in its entirety) was designed to move a magnetic implant object ("seed") around within a human brain (or some other part of a human body) to deliver therapies such as selective hyperthermia, radioactivity, chemicals, or other substances.
A control method described in McNeil et al . , "Characteristics of an Improved Magnetic -Implant Guidance System," pp. 802-808, IEEE Trans. Biomed, Eng., Vol. 42, No. 8, Aug. 1995 (which is hereby incorporated by reference in its entirety) partially avoided the usual limitations encountered in ramping a superconducting coil by controlling coils in pairs in which the two members of each coil pair operate in a different dynamic manner to provide stepwise, impulsive forces on the seed. The current through a main, pulling coil is kept at a subthreshold level (i.e., below a value required to move a seed in a brain, in the disclosed application) throughout each step. Current in a much closer partner coil (a "boost" or "push-pull" coil) is then ramped up a small amount to apply an opposite field by additive gradient (of magnetic field) on the seed. Because it is closer to the seed, the gradient caused by the closer coil can be much
greater without reversing the seed direction, so a large pushing impulsive force could be applied. The push-pull coil then has its gradient reversed to pull, for a short time, against the main pulling coil to halt the seed movement and reestablish a stable position at rest. The gradient of the push-pull coil falls off rapidly with distance from the coil, approximately as the fourth power of the distance. Therefore, the close coil can effect great changes in force at the seed position with small changes in a small current. Modifications to this technique can be used in cases in which the main, pulling coil is not at a much greater distance from the seed than the partner coil . This technique and its modifications can be accomplished with constant voltage ramping in accordance with the prior art, but limitations inherent in constant voltage ramping considerably restrict the speed of the motion of the seed. These limitations come about because the maximum voltage magnitude that can be applied can be no greater than that which results in quenching when applied simultaneously with the maximum allowable current in the coil. By restricting the maximum voltage magnitude, the rate at which coil current changes can be accomplished, and hence the rate at which changes in the resulting magnetic field can be made that effect movement of the seed, is limited.
It would therefore be advantageous if a ramping method were available for coils that could minimize ramping time between two current levels, while avoiding quenching and arcing. It would be particularly advantageous if this system were applicable to systems employing multiple coils to apply force and/or direction to a magnetic seed.
SUMMARY OF THE INVENTION One embodiment of the invention is a method of rapidly changing a magnetic field produced by an electromagnetic coil (usually, but not necessarily, a coil
having a winding comprising a superconducting material, herein referred to as a superconducting coil or magnet) comprising the steps of (a) applying a first current Ix (which may be zero current) to the coil, (b) transitioning to a second current I2 (which may be zero, but which is different from Ix in that it has a magnitude or direction, or both, different from T1;- i.e., I ≠I2) applied to the electromagnetic coil, and (c) during a transition period between the application of I1 and I2 , changing the current applied to the coil in a manner in which, during at least a portion of the transition period, the first derivative of the current varies, so that the coil is ramped from Jx to I2 more rapidly than would be the case with constant voltage ramping, which produces a current having a constant first derivative. This is achieved by controlling the time-varying current during the transition period so that the magnitude of dl ( t) /dt varies in a direction opposite to that in which the magnitude of T(t) varies; i.e., when T(t) is large, dT(t)/dt is small, and vice versa. More preferably, during at least a portion of the transition period, d2T ( t) /dt2 has a sign opposite to that of I1 when J(t) has the same sign as Ix , and d2I(t)/dt2 has a sign opposite to that of J2 when I(t) has the same sign as I2 . Also, the sign of dT(t)/dt is the same as the sign of the quantity (T2 - Ix) , and the magnitude of the first derivative of I (t) is, during the transition period, at least sometimes greater than |Vmaxj/L, and preferably (but not necessarily) never less than |Vraax|/L, and even more preferably, always greater than ]V"raax|/L. The invention is sufficiently general to encompass ramping methods in which initial and final currents may have arbitrary signs. The complexity of the explanation of the invention is necessarily increased to encompass the generality of the invention. However, the inventive methods do not require the initial and final currents to have arbitrary signs. It will be recognized by those skilled in the art upon studying the description of these
methods that the methods can be practiced in any ramping application, irrespective of any other constraints placed on the initial and final currents. Thus, the inventive methods can be applied, for example, to applications that require coil currents to vary only between zero and some positive value (i.e., current flow in the coil is only in one direction) .
The restriction on the sign of the second derivative need not apply during the entire transition period between X- and J2, because a rapid "head start" or "leap forward" can occur with this method of ramping, as will be described in the detailed explanation that follows .
As an example of the inventive ramping method, let us assume that a small, positive (or zero) constant current I is first applied to the coil, and that the desired final current is J2, a larger positive current. The second derivative of T(t) (i.e., d2I { t) / dt2 ) is negative during at least a portion of the transition from J-L to J2, in accordance with the invention. Also, between the application of current Iλ and the subsequent application of the larger, positive current I2 , current in the coil first undergoes a relatively rapid change. As the current in the coil approaches J2, the magnitude of the rate of change decreases. When I2 is reached, the current is again held constant. It will be recognized that the first derivative of the coil current need not be, and generally will not be continuous at the moment the coil current is increased from I1; and it should be understood that it also need not be continuous at the moment the coil current reaches I2, i.e., when the ramping stops.
Other embodiments of the invention provide ramping in accordance with the more general embodiment described above, but with more specific ramping conditions that meet various constraints selected to approach a maximum safe ramping rate while minimizing risk of producing quenching conditions in a superconducting coil. For example, in
accordance with one variation of the invention, a changing amount of current is supplied to a coil in a manner that maintains a constant flow of power into (or out of) the magnetic field of the magnet. (For notational convenience, a flow of power "into" the magnetic field, unless otherwise noted, should hereafter be construed, for description convenience, as encompassing a flow "out of" the field, as well.) A second variation more optimally minimizes heat losses within the electromagnet that may otherwise cause it to quench, while at the same time minimizes the time required to change the current in the magnet by a given amount. This second variation also advantageously compensates for both self -generated eddy current losses and self -generated high field effects. Other variations are also provided that more closely take into account empirically observed limitations of particular superconducting or nonsuperconducting coils.
Another embodiment of the invention comprises, in its most general form, a device for rapidly changing a magnetic field having a controlled magnitude, in which the device comprises (a) an electromagnetic, preferably superconducting, coil; (b) means for applying a first current of T1# Amperes to the coil; (c) means for transitioning to a second current of J2 Amperes applied to the coil; and (d) means for applying a time-varying current T(t) to the coil between application of I1 to the coil and application of I2 to the coil, where dJ(t)/dt varies as a function of time t, and the magnitude of dl ( ) / t varies in a direction opposite to that in which the magnitude of J(t) varies.
It is thus an object of the invention to provide a method of ramping current in a coil and thus change its magnetic field more rapidly than the prior art constant voltage method. It is another object of the invention to provide a rapid current ramping method for a superconducting coil that avoids arcing and quenching of the coil .
It is yet another object of the invention to provide a current ramping method that can be used to rapidly guide a seed with a system of multiple electromagnetic coils, especially when the coils are superconducting coils.
It is still another object of the invention to provide an apparatus for rapidly ramping current in electromagnetic coils.
These and other objects of the invention will become evident to those skilled in the art upon review of the detailed description of the invention and the accompanying figures.
Also of interest is the disclosure of U.S. Patent Application Serial No. 08/920,446, filed August 29, 1998, incorporated herein by reference.
BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a small magnitude positive current to a larger magnitude positive current;
Fig. 2 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a large magnitude positive current to a smaller magnitude positive current; Fig. 3 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a small magnitude negative current to a larger magnitude negative current;
Fig. 4 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a large magnitude negative current to a smaller magnitude negative current;
Fig. 5 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a negative current to a positive current;
Fig. 6 is a graph comparing constant-voltage and constant-power current ramping in an electromagnetic coil from a positive current to a negative current;
Fig. 7 is a graph of coil current as a function of time for constant power ramping from zero amperes to 100 amperes with P = 3 kW, as compared to constant voltage ramping with V=28.5 volts, for a particular superconducting coil having a measured inductance of 20 Henries ; Fig. 8 is a graph of the ramping rates dl/ dt corresponding to the graph of Fig. 7;
Fig. 9 is a graph of coil current as a function of time for the same coil as Figs. 7-8 for another embodiment of the invention in which ramping is controlled to minimize heat losses;
Fig. 10 is a representation of an application of the inventive current ramping methods described herein to control coil pairs operated in force opposition to deliver medication or therapy to a patient; Fig. 11 is a schematic block diagram of a hardware system capable of implementing the inventive methods of current ramping described herein;
Fig. 12 is a schematic block diagram of a hardware system having two electromagnetic coils operating on a single magnetic seed; and
Fig. 13 is a schematic block diagram of a hardware system comprising a plurality of controlled, synchronized coils operating in orthogonal directions on a single magnetic seed. Figs. 1-6 and 10 are intended to provide only indications of relative magnitudes, slopes and directions rather than precise numerical values of the indicated quantities, and are therefore drawn to an arbitrary scale.
DESCRIPTION OF THE PREFERRED EMBODIMENTS In accordance with the invention, quenching of a superconducting coil is avoided by controlling the amount
of current X through the coil, its rate of change dl/ dt , and the second derivative of the current d2T/dt2, during a period of transition from one current level to another. In one embodiment of the invention, during the transition period between the application of a first coil current Iλ (which may be zero current) and a second coil current T2, the current applied to the coil is changed (i.e., "ramped") in a manner in which, during a transition period between the application of J1 and J2, changing the current applied to the coil in a manner in which, during at least a portion of the transition period: i) if Ji and I2 are both positive, the second derivative of X(t) is negative; ii) if I1 and J2 are both negative, the second derivative of T(t) is positive; iii) I-L is negative and J2 is positive, the second derivative of X(t) is positive until I(t) itself reaches zero, following which the second derivative of J(t) is negative; iv) I is positive and J2 is negative, the second derivative of T(t) is negative until I(t) itself reaches zero, following which the second derivative of I(t) is positive ; in addition to which: v) if J2 is greater than I1 , the first derivative of T(t) is positive; vi) if I is greater than I2, the first derivative of T(t) is negative; and also in addition to which: vii) the magnitude of the first derivative of X(t) is, during the transition period, not less than, and at least sometimes greater than |Vraax|/L; where X(t) is the current as a function of time t during the transition period, l^max! is a maximum voltage magnitude that can be applied to the coil at a current |Xmax| without quenching
if the coil is a superconducting coil (where Xmax may be a rated maximum current of the coil) ,
L is the inductance of the coil, and j Xmax j at least equal to the greater of \ l1 \ and c I T I
=> I 2 I / so that the change from X. to X2 is accomplished more rapidly than would occur if a constant voltage limited to be within a range that does not cause the coil to quench when the constant voltage is applied at the 0 coil's maximum rated current were applied to the coil to produce the same current change .
The restriction on the sign of the second derivative need not apply during the entire transition period between Iτ and X2, because a rapid "head start" or 5 "leap forward" can occur with this method of ramping, as will be described below.
Ensuring that the above conditions are met allows the average value of dl/dt to be greater in magnitude during the transition than would otherwise be possible 0 without quenching superconducting coils if the transition were controlled by stepping a voltage source between two voltages, in accordance with a prior art method of ramping coils. This advantage accrues because the power that goes into raising the coil temperature is a smaller fraction of 5 the power that is being put into (or taken out of) the magnetic field than is the case with prior art methods. Furthermore, as can be seen from the relationship of dl/dt to voltage, a high voltage magnitude need only be applied to the coil while the current magnitude is low, and a 0 lower voltage magnitude is applied as the current magnitude increases, avoiding the risk of damage caused by insulation breakdown.
It should be noted that the inventive techniques are equally applicable to both superconducting and 5 nonsuperconducting coils. In the case of a nonsuperconducting coil that is not subject to quenching, the same inventive methods disclosed herein may be used to
maintain and/or control other operating characteristics of the coil. By way of example only, and not to limit the invention in any way, the inventive methods may be used to prevent undesirable overheating of a nonsuperconducting coil, or to avoid operating modes that might cause insulation breakdown or make such breakdown more likely to occur. Typically, quenching limits described herein are interchangeable with many nonsuperconducting coil limitations for purposes of this invention. For example, the limits on |Vmax| and |Xmax| for a nonsuperconducting coil may be set at levels that avoid overheating of the coil, or arcing.
In another variation of the inventive method, an increasing amount of current is supplied to a coil in a manner that maintains a constant flow of power into (or out of) the magnetic field of the magnet. To accomplish this, current is controlled so that it rises proportionately to the square root of elapsed time (assuming that the initial current is zero) . This method, which we call the "constant power ramp" or more simply the "constant power" method, is particularly amenable to systems having multiple coils and requiring complex synchronization of the fields of the coils.
According to the constant power ramp method, a time-varying current X(t) is applied to an electromagnet coil, the magnitude of the current varying in accordance with the expression
X2(t) = X0 2 + ( 2P L) (t - t , (2) where X0 is the current at a starting time ϋ0, P„ is a selected constant value of power (which may be determined in accordance with a procedure described below) , and L is the self-inductance of the electromagnet. If X0 is zero at time t0, then the magnitude of the time-varying current applied to the coil increases as the square root of elapsed time until it reaches a desired value (which may be a required value dictated by the application) , and then it is kept constant until another change is desired.
Those skilled in the art will observe that eq. 2 implicitly requires taking square roots to solve for X(t) : X(t) = ±[X0 2 + (2P0/L)(t - t ]12. (3)
(Note that P0 is taken as positive when power is being delivered to the coil, and negative when power is being extracted from the coil.) In each of Figs. 1 to 6 , curve A represents a qualitative graph of current vs. time for the constant-power ramping method. Also shown in each of these figures, for comparison purposes, is a curve B (actually, a straight line) showing current vs. time for constant-voltage ramping.
Fig. 1 is a graph of coil current vs. time for a case in which both the starting current X, and the final current X2 are positive values, and X2 > X,. In this case, P0 is positive, because power is being supplied to the coil. It can also be seen that the second derivative of the current with respect to time is negative, i.e., the rate of change of current decreases with respect to time. Fig. 2 is a graph of coil current vs. time for a case in which both the starting current X, and the final current X2 are positive values, and X2 < Iτ . In this case, power is being extracted from the coil, so P0 is taken to be negative . The second derivative of the current is also negative in this case, although the magni tude of the current change increases with respect to time.
Fig. 3 is a graph of coil current vs. time for a case in which both the starting current I1 and the final current X2 are negative values, and | X2 j > j Ix j . In this case, P0 is positive, because power is being delivered to the coil. The second derivative of the current is posi tive in this case, because the rate at which the current becomes increasingly negative decreases with increasing time.
Fig. 4 is a graph of coil current vs. time for a case in which both the starting current I1 and the final current X2 are negative values, and X2 > I . In this case, power is being extracted from the coil, so P0 is taken to
be negative. The second derivative of the current is posi tive in this case, because the rate at which the current becomes increasingly negative decreases with increasing time. Fig. 5 is a graph of coil current vs. time for a case in which the starting current I1 is negative and the final current X2 is positive. In this case, power is initially extracted from the coil until zero current is reached, and then power is applied to the coil. For this reason, P0 is taken to be negative while the current in the coil is negative, and positive while the current in the coil is positive. Until the current reaches zero, this case is identical to that of Fig. 4. After the current reaches zero, this case is identical to that of Fig. 1. Fig. 6 is a graph of coil current vs. time for a case in which the starting current Ix is positive and the final current X2 is negative. In this case, power is initially extracted from the coil until zero current is reached, and then power is applied to the coil. For this reason, P0 is taken to be negative while the current in the coil is positive, and positive while the current in the coil is negative. Until the current reaches zero, this case is identical to that of Fig. 2. After the current reaches zero, this case is identical to that of Fig. 3. Figs. 1-6 show d2X/dt2 having the same sign for the entire period between application of current I1 and X2 (at least until X(t) itself changes sign or passes through zero) . In accordance with the invention, it is required that this relationship hold for at least a portion of this period sufficient to cause the current to change from l1 to X2 in less time than would otherwise be necessary for ramping to occur using a constant applied voltage limited to a range within which quenching does not occur throughout the rated (or maximum safe) current range of the coil.
To show how eq. 2 is derived, it is first noted that the energy contained in the field from current flowing in a coil at time t is
W( I) - % LI2 ( t ) , (4) where W{ t) is the energy present in a coil undergoing ramping at time t. The power delivered to the field of a non-dissipative electromagnet as a function of time is
P(t) = dW/dt . (5)
Using the relationship dW/ dt = ( dW/ dl) x { dl/ dt ) , (6) it can be shown that
P(t) = LI ( t ) ( dl/ dt ) , (7) or alternately,
X(t)dX = [P(t)/L]dt. (8) Integrating this equation from starting time t0 to t, at which times the current is X0 and X(t), respectively, the equation for X(t) as a function of elapsed time t - tQ is
X2(t) = X0 2 + (2P(t)/L) ( t - ϋ . (9)
Thus, if the power P(t) that is delivered to the field of the electromagnet is to be kept at a constant value P0, and the initial current X0 = 0 at time t0, the current to be delivered to the coil, in accordance with the first embodiment of the invention (eq. 2), should rise in proportion to the square root of elapsed time t . Of course, if the current X0 is nonzero at the time selected as t0, the current delivered to the coil should rise in accordance with the more general equation for X2(t) .
For best results in employing this embodiment of the invention, it is desirable to select P0 to be as large as possible. However, for a superconducting coil, if too large a value of P0 is selected, there is a risk that the coil will quench. An experimental procedure may be used to determine a maximum safe value of P0 as follows. A power supply having a current limiter is connected to the coil, and a maximum magnitude of coil current is selected. (Of course, the coil's maximum rated current limit should
be at or above the selected maximum magnitude of coil current . )
(For the purpose of explaining the remainder of the procedure for determining P0, we shall assume, without loss of generality, that all of the currents and voltages have positive values, so that we need not continually refer to their "magnitudes . " )
Let us assume, for example, that the coil is rated at 80 amperes, and the maximum current selected is 70 amperes. The power supply is connected to the coil and the current limit is set for the selected maximum coil current, which for this example, is 70 amperes. Then, the output of the power supply is set at a fixed voltage (typically, but not necessarily, 10 volts) . The coil current will ramp up linearly with time, and the total power will reach 700 watts just before the stabilization point. This process is repeated, with a voltage increased to a value higher than the originally applied voltage - e.g., 15 volts for the purpose of this example. At 15 volts, the coil will ramp to the 70 ampere current limit
(or whatever value of current limit was selected) at a 50% faster rate. Ramping at successively higher voltages is performed, until the coil is observed to quench before the coil draws the full amperage (i.e., the set limit) from the power supply. The presence of quenching is made evident by a dramatic drop in the current flowing through the coil. The maximum power P0 is computed as the current through the coil at the quench point multiplied by the applied voltage. Alternately, the current and ramp rate of a coil used with other ramping systems can be observed while the coil is in use with the other ramping system. Inevitably, the coil will be observed to quench while in use. The value of current and voltage at the quench point can simply be noted when this occurs. The maximum power P0 can be computed from the product of these quantities.
A dramatic and unexpected decrease in time required to reach a final selected current X accrues when superconducting coils are ramped in accordance with the first embodiment of the invention. Comparison of the time required for this method versus the time required for prior art constant-voltage ramping is illustrated generally in Figs. 1-6, which show current as a function of time for constant-power ramping curves A and constant- voltage ramping curves B. A more specific example is shown in Fig. 7, which is a graph of current as a function of time in a particular superconducting coil having an inductance of 20 Henries. Constant power ramping (curve A) from zero amperes to 100 amperes was accomplished in approximately 32 seconds with P = 3 kW. On the other hand, constant voltage ramping (curve B) with V=28.5 volts did not reach this level of current after 60 seconds. (The voltage selected for this example was that which provided the maximum ramp rate for constant voltage ramping without quenching the coil.) Fig. 8 is a graph of the corresponding ramping rates dl/dt for constant-power ramping A and constant-voltage ramping B for the coil used to obtain the corresponding curves A and B in Fig. 7. As illustrated in Figs. 7 and 8, constant power ramping can be particularly effective at producing rapid changes in coil current at relatively low current levels, where the rate of current change is greatest. Fig. 8 shows that the rate of current change for constant power ramping eventually falls below that of constant voltage ramping. However, Fig. 7 shows that constant power ramping can achieve such a large "jump start" that an advantage over constant voltage ramping could be maintained, if required, for a substantial period beyond the time at which the magnitudes of the first derivatives of curves A and B in Fig. 8 cross. Experimentally, it has been shown that constant power ramping in accordance with this aspect of the invention is effective, and that larger currents can be reached in a
given coil much earlier than by the constant voltage method.
However, the constant-power ramping method tends to produce more conservative ramping than might otherwise be achievable. Thus, in accordance with another embodiment of the invention, a charging rate is provided to produce even more rapid ramping of current in accordance with the equation
X(t) = [(2/3) ( Q/kt) ( t - t0) + X0 (3/2)] (23>, (10) where Q is a quench factor (which is treated as a constant), kt is an experimentally determined constant, and X0 is an initial value of current at time t0 = 0. Providing current in accordance with this equation more optimally minimizes heat losses within an electromagnet that may otherwise cause it to quench, while at the same time also minimizing the time required to change the current in the magnet by a given amount. This method of charging an electromagnet also advantageously compensates for both self -generated eddy current losses and self -generated high field effects.
For the purposes of this embodiment of the invention, it is necessary to determine only the ratio Q/kt in eq. 10, not the individual values Q and kt . This can be done by direct comparison with the equation X2(t) = X0 2 + (2P(t)/L)(t - t0) (11) by setting both t0 and X0 2 to zero to give:
X2(t) = 2P0t/L. (12)
(In eq. 12, we have substituted a fixed value P0 for P(t) , the fixed value being determined in the same manner as for the preceding embodiment of the invention.) Both P0 and L are known. Several different values of X are selected, preferably equally spaced between zero amperes and the maximum required coil current (which should be the same as the current used to determine P0) , but excluding zero. For example, if the maximum required current is 70 amperes, four different currents X(t) are selected: 17.5, 35, 52.5, and 70 amperes. The equation
X2(t) = 2P0t/L (13) is then solved to obtain the values of t that correspond to the selected values of J(t) . Then, the values of X(t) and t are substituted into the eq. 10, where, without loss of generality, X0 and t0 are again set to zero. Eq. 10 can then be rearranged to:
Q/kf = (3/2)X(3/2)(t)/t, (14) from which several different values of Q/kf are determined corresponding to different pairs of I (t) and t. One of the values of Q/kt is selected for use in this embodiment of the invention, depending upon the level of performance required. Higher values of Q/kt correspond to higher performance (more rapid ramping) , but may result in occasional quenching. Lower values will result in lower performance, but less likelihood of quenching. Thus, some degree of flexibility is provided in this embodiment of the invention, and it is possible to operate in a range closer to the physical limits of the coil.
The different values of Q/kt are obtained because the equation for Q/kt is an approximation, rather than an exact description, of the quenching behavior of the coil.
Individual values of Q/kt will have significant errors.
Thus, either one of the experimentally-derived values is selected (as described above) or a statistical best fit can be used. Although data could be fitted to a more complex model for quenching, fitting large numbers of experimental values into a model is usually not advisable, because of the hazards associated with repeated quenching of coils. From Faraday's Law of Induction, it can be shown that the magnitude of the eddy current density _7e in a coil and its surroundings is given by
J
e = k x ( dl/ dt) , (15) where X is the total current flow, and k is a constant that depends upon the materials and geometry of structures around the coil. The power density per unit volume for eddy current dissipation is thus given by
where p is the resistivity of the material. (The bobbin and support structures are not superconducting and will have a finite value of p.) Therefore, the total power P
d dissipated in the material surrounding the coil due to eddy currents will be
Pd = k' ( dl/ dt) 2 , (17) where J' is a constant that depends upon the structure, materials, geometry, and other physical characteristics of the electromagnet.
The immersion field of any single wire in a coil is caused both by its own current and by the current in the other turns in the same coil. Typically, these will each be proportional to the total current X in the coil. Determining current levels and current change rates that may cause a superconducting coil to quench is generally very difficult, because not all turns of a coil are likely to have the same thermal conductivity to a cold reservoir, nor will materials in their vicinity be likely to have the same thermal capacities. Therefore, it is common practice, in superconducting coil design, to use finite- element programs to calculate the fields present, at least for single coils having a standard geometry or for simple arrays of coils. For another embodiment of the invention (See Eq. 10), we have chosen to use a quench factor Q having a simple linear dependence on the coil current X, representing the high field effect. When this is combined with the eddy current effect, the total dependence of Q can be given either by adding or by multiplying the two effects. An approximation sufficient for purposes of this invention can be obtained by using a model in which the effects are multiplied. The quench factor is then given by the equation :
Q = k x k ' Pd x X
= kε x X x ( dl/ dt) 2 , ( 18 )
where Jcf is an overall empirically-determined constant. If it is assumed that Q and kt are approximately constant, this equation can be rearranged into the equation
X1/2 dX = ( Q/kf ) 1/2 dt (19) and integrated from time t0 to t to give the ramping equation given above (Eq. 10) for this embodiment of the invention.
A plot of X ramped in accordance with this embodiment of the invention is shown in Fig. 9. The plotted example A is for the same coil described in conjunction with Figs. 7-8, i.e., a 20 Henry superconducting coil with a maximum ramp rate without quenching of 1.5 A/s at 100 A.
Particular values of the constant quantity Q/kf were chosen to meet the expected quench conditions for this coil. Different values for this constant would be chosen (based on experimental values) for other coils, depending upon their size and construction, which would result in a different ramp rate for each different coil.
For comparison, Fig. 9 also shows, plotted on the same scale, a constant power ramping curve C and a constant voltage ramping curve B. In the plotted examples, the power law for the rise of current with time is 2/3 for this embodiment of the invention, as compared with 1/2 for the constant power case and 1 for the constant voltage case. In practice, the experimental determination of Q/kt allows higher scaling and therefore more rapid approach to maximum current to be achieved for many coils with ramping provided in accordance with eq. 10.
It is not necessary to assume that the quench dependence is linear either in X or as a product with ( dl/dt) 2 . Additional powers of the factors X and dl/dt could be included in the ramping model and/or used in
different terms, with coefficients determined by finite element calculations and/or fitting coefficients to the observed behavior of a given system. One such equation might be determined, for example, from a quench function Q where the k coefficients are taken as constants, and Q is given in the form of a differential equation in X(t) : Q=k1xl ( t) + k2xl2 ( t) + k3x ( dl ( t) /dt) + k^x ( dl ( t) / dt) 2 (20) More terms can be added in increasing powers of X and dl ( t) / dt (as well as terms involving products of powers of I and dl/dt) , to obtain increasingly efficient ramping. However, a simpler ramping rate such as described in conjunction with the other embodiments of the invention is usually satisfactory and preferred, for reasons of simplicity and practical applicability. Some other equations can be derived for special cases. For example, it is well-known that common superconductors obey the intrinsic equation stated above as eq. 1, which relates the critical magnetic field Hc at a temperature T, to a critical temperature Tc above which the material will not be a superconductor. It can be shown that a current ramping rate given by
X(t) = A1 - ( B, t + C2 i/3 (21) will more closely match this superconducting behavior, where A1# _31# and C1 are constants. However, the applicability of the intrinsic equation for Hc must first be determined before it can be assured that this ramping rate is advantageous for a given coil system.
Any of the foregoing embodiments may be used in conjunction in a complementary synchronization technique in which one coil pulls and a second coil pushes a magnetic object between the coils. Much faster ramping of current for complementary synchronization is made possible by the use of constant power ramping (or of one of the other inventive methods) than with constant voltage ramping. This increased speed is possible because the push-pull coil (also called a boost, supplementary, or subsidiary coil) is used with a much smaller current than
the partner coil on the same axis. One coil, the main coil, always pulls the "seed" or implant. The subsidiary coil functions in two different ways at two different times in a step - - as a boost coil, helping the main coil by pushing in the direct it pulls, and secondly as a halt coil, opposing the main coil by pulling back on the implant. With the inventive methods of ramping the coils (and especially with constant-power ramping) , the coils can operate in a low current, high ramp rate mode, making control much faster than with constant voltage ramping and much safer and more suitable for servo control, while at the same time avoiding quenching of the coils.
To explain how the inventive ramping methods may be employed in another practical system, two or more coils provided in pairs can be operated in force opposition to control a magnetic "seed" that can be used to deliver medication or therapy to a selected portion of body tissue in a patient. After motion of the seed is started, the push-pull coil, through which small currents flow, is changed from opposition force to addition force relative to the main pulling coil. Fig. 10 depicts such operation, and illustrates that great changes in force on a seed can occur very rapidly. At time a , the main coil has a current generating a magnetic field that pulls on the magnetic object, while the subsidiary (push-pull) coil has a current generating a magnetic field that opposes this pull. At time b, the currents in the coils are ramped slightly to readjust from the previous step, and to prepare for another ramp of current that starts at time c. (When moving a magnetic seed from one place to another, current adjustment provides magnetic fields that define a proper starting direction for the next motion of the magnetic seed without actually causing motion of the seed. Such adjustments are already explained in our other previously mentioned patent applications.) In this ramp, the main coil remains at the same current X from time c to time f, while the subsidiary coil ramps rapidly in
constant power mode (i.e., in accordance with eq. 2) through zero from its value at time c to a value at time d where it is assisting the pull of the main coil. Since this ramp occurs at low currents, it can be done extremely rapidly in constant power mode. At time e, the previous ramping step is reversed, and the two coils are quickly brought into opposition again. If the prior art constant voltage ramping is used, instead, the subsidiary coil current would ramp at a constant slope limited by the maximum safe value of voltage that can be applied to the coil at maximum current. This prior art usage would result in much slower changes to the forces on the magnetic object .
The operation described in the coil pair case above can be compared to having two opposing springs acting on an object. The closest, push-pull coil can be compared to a spring that can change its spring constant rapidly, because of the large force change associated with a small current change. The coil pair system is "loaded," and then the current in the push-pull coil is rapidly changed and reversed in direction. Because of the "preload," it is possible to safely have the main current much closer to the threshold value for seed movement, so that the force impulse can be effectuated very rapidly. Implementation of the inventive ramping methods may be achieved with a combination of software and/or firmware and hardware, in which the software and/or firmware include constants for the ramp equation or equations and current values are calculated in accordance with the equation or equations. The hardware converts the calculated current values into actual electric currents. For superconducting magnet control, it is necessary in some applications (such as the seed application described above) to be able to apply both positive and negative currents to the coil at different times. The software functions provided in Appendix A, which are written in the C++ programming language and which are self-documenting,
provide a solution to this problem. (These routines are copyrighted by Stereotaxis, Inc. All rights under the copyright are reserved, except that copying and republication of Appendix A solely in conjunction with the publication and dissemination of this patent is expressly permitted. )
A multiple coil system comprising multiple superconducting magnets may require temporal synchronization of the ensemble's magnet coil currents. A method of multiple coil control has been developed in our previously mentioned patent applications that scales the rate at which ramp time is accrued for an individual coil. A scaling is implemented such that the current ratios for the coils in the system are maintained throughout any ramping activity. To implement coil current control in a multiple superconducting magnet system in which positive and negative currents are required, a system of multiple, remote computer processing systems can be provided, where one system is dedicated to controlling the ramping of a single coil or pair of coils, which change currents (or
"charge") in unison or in synchronization. These computer systems can communicate via a bidirectional communications interface and share a clock generated either by one of the processing systems or by a host system. The shared clock ensures that synchronization will be maintained as the various coils are charged under control of their separate systems, so that the coils reach their final, steady-state values of current simultaneously.
The basic hardware needed to implement the inventive ramping methods described herein is shown in Fig. 11. A computer or other processor 10 having any desired input, output, and/or display devices (not separately shown) may be used to calculate values of X(t) to be applied to coil 40. (It will be understood by those skilled in the art that the values calculated need not actually be X(t), but may instead be a related quantity that can conveniently be processed by the hardware to provide the required analog
X(t) value.) The calculated values may be based upon commands and/or data input by a user, upon pre-programmed instructions, or upon data from remote sensors, or any combination thereof. The numerical values of X(t) (or the related calculated quantity) are communicated at appropriate times to digital-to-analog converter (D/A) 20, which supplies an analog signal to a (preferably pulse- width modulated) current source and amplifier 30, which, in turn, converts the analog signal into the required coil current X(t) and applies this current to coil 40.
When operated in a coil pair configuration to control a seed 50 as shown schematically in Fig. 12, a pair of coils 40, 70 may be used. At least one of the coils (the push-pull coil 40) may be operated in accordance with the system that was described in conjunction with Fig. 10.
The other coil (main coil 70) is operated by a system 60 supplying current to it, which is also preferably a system such as that described in conjunction with Fig. 10. The control apparatus 80 is defined, for convenience, to be those components within the dashed box in Fig. 12. The two coils 40, 70 are axially aligned, and exert a magnetic force on a magnetic seed 50 disposed between the coils. (The seed is illustrated on the axis X, but need not be so positioned.) Fig. 13 shows schematically how a plurality of coils 40, 70 may be located, preferably on orthogonal axes X, Y and Z, to control the orientation of a magnetic seed 50 in three dimensions. A processor 90 is used to synchronize the control apparatuses 80 so that the changing currents in the coils are synchronized to provide a desired trajectory and rate of movement of seed 50. It will be observed that the inventive ramping methods can be used in numerous applications in addition to those described above .
It will be understood that the above description is intended for exemplary purposes only, and that many modifications to the inventive methods will be readily apparent to one skilled in the art without departing from
the spirit of the invention. Therefore, the scope of the invention should be determined by reference to the claims below, including the full range of equivalents permitted under applicable law.
APPENDIX A Copyright Stereotaxis, Inc.
Purpose : This routine is the constructor for a coil object.
Error conditions :
If the servoamp status is detected to be bad, the coil status is set to fault which disables coil ramping.
Notes :
Base classes of the coil class are servoamp (control and monitoring of the actual hardware servoamplifler ) and ramp_model (mathematical description of coil current ramp characteristics). coil:: coil ( //f coil class constructor helmet_coιls anpid //ι id of this amp
)
: servoamp (ampid) , //b base class constructor call ranp_model ( ) //b base class constructor call { target_current = 0.0; // initialize object values ... if (servoamp: : get_actual_current (current_now) == AMP_FAULT) // Check for current already on the coil current_now = 0.0; total_ramp_tιme = 0.0; net_event_tιme = 0.0; ramp_scale = 1.0; ranp_dιr = RAMP JP; coil:: status = COIL_OK; // Init coil status }
Purpose : .
The routine is used to set the private value of the ramp scale. The ramp s~cale is used to scale the rate of increase of coil current.
Error conditions: Acceptable ramp scale values are greater than or equal to zero and less than or equal to one. If the value passed in is not within these bounds, a fault value is returned. nt I I T returns coil status coil : : set_ramp_scale ( l i t set the ramp scale double scale //ι value to use for ramp_scale if ( ' CHECK_RAMP_SCALE (scale)) // check if value is in bounds
{
Log: : rite (INVPARAM, "WARNING :: set_ramp_scale - Ramp scale %d.%.03d out of bounds .Setting to valid value . /n",
(mt) scale, (int) (scale*1000.0) ) ; if (scale < MIN_RAMP_SCALE) ramp_scale = MIN_RAMP_SCALE; else if (scale > MAX_RAMP_SCALE) ranp_scale = MAX_RAMP_SCALE; return (COIL_FAULT) ; ) ramp_scale = scale; // Passed the conditionals, so set
// the ramp_scale. return (COIL_OK) ; }
Purpose :
Th s function initiates a charge sequence to ramp the co l to a given target current using the given ramp scale. Any previous charging request is over-written.
Error conditions :
If the coil is in a Fault state, nothing is done and a fault value returned. int //r return coil status coil: : start_charge ( 111 initiate a charge event double current, //ι target current to ramp to double scale // 1 scale to ramp to target current with ) { if (coil: : status & COIL_FAULT) { Log:::Wrιte (INVPARAM, "WnWARNING: Attempt to start charging coil with COIL_FAULT set") ; return (COIL_FAULT) ; // return COIL_FAULT
} stop_charqe ( ) ; // stop present charge set_ramp_, scale (scale) ; set_target_current (current) ; if (target__current < current_now) // set ramp direction ramp_dιr = RAMP_DOWN; else ramp_dιr = RAMP_UP; tιme_last,_update.set (THE_ PRESENT); // reset charge start time to now coιl::status | = COIL _CHARGING; // set coil state return (COIL_OK) ;
Purpose :
This function turns off coil charging. Current already on the coil is maintained as steady state. void //r return type void, no return coil: : stop_charge (void) l i t stops coil charging
{ coil:: status & ~COIL_CHARGING; // set coil status to not charging return;
}
Purpose : This function updates the coil current while the coil is in a charging state. Coil current is calculated using the ramp vodel base class methods .
Error conditions:
1. The ramp_model base class used to calculate coil current can return a fault which causes the charge to stop and a fault return value.
2. If the current step from the previous move is greater than a predefined maximum value (MAX_CURRENT_STEP) , the charge is stopped and a coil fault status is returned.
3. Calling this routine when not charging will print a warning message, and is a no-operation condition. int I IT return coil status value
coil: :uρdate_current (void) 111 update the current programmed
{ double tιme_val-0.0; double new_current-0.0; iff1 (coil: : status & COIL_CHARGING) ) // Are we supposed to be charging ?
{ Log: : Write (INVPARAM, "/nWARNING: Attempt to update current when not charging") ;
Return (COIL_OK) ; // return, no harm done.
} tιve_class tιme_now (THE_PRESENT) ; tιmMe_class delta_tιme - tιme_now - tιme_last_update;
// Calculate the change in time from // the last update_current ( ) call double delta_sec; if (scale_ramp_tιme (delta_tιme . get (TC_SEC) , ramp_scale, delta_sec) - RAMP_MODEL_FAULT ) {
Log: Write (INFORMATIONAL, "update_current : scale_ramp_tιme failedW); Stop__charge ( ) ; Return (COIL_FAULT) ; { ιf(ramp_dιr == RAMP_UP) tιme__val = (total_ramp_tιme + delta_sec) ; else tιme_val = ( total_ramp_tιme - delta_sec) ;
(calculate_ramp_value (tιme_val, new_current ) ==RAMP_MODEL_FAULT )
{
Log: : Write (INFORMATIONAL, "update_current : calculate_ramρ_value faιled\n"); stop__charge ( ) ; return (COIL_FAULT) ;
}
Double delta_I - (new_current - current_now) ;
// Calculate change m current from // present settings and scale it if (fabs (delta_I) > MAX__CURRENT_STEP) {
Log: : Write (INVPARAM, ERROR: ooil : : update_current ( ) - MAX_CURRENT_STEP exceeded while chargmgXn") ; stop_charge ( ) ; return (COIL_FAULT) ; } if (ramρ_dιr == RAMP_UP) // Check for ramping up
{ if (new__current >= target_current) // Have we reached tsrget_current? { set_current (target_current ) ; // If so, set current=target current current_now = target_current ; // Update private copy of current stop_charge ( ) ; // Stop the charging. calc_ramp_tιme (target_current, 1.0, // Set total ramp time for target current
Total_ramp_tιme) ; } else // Otherwise, set current to what
{ set current (new current); // was calculated and update
current_now = new_current; // current_now and ramp_tιme. total_ramp time = time val // Update total ramp time
}else { if (new_current <= target_current ) // Have we reacned target_current?
{ set_current (target_current) ; // If so, set curent=target current current_now = target_current ; // Update private copy of current stop_charge ( ) ; // Stop the charging. calc__ramp_tιme (target_current , 1.0, // Set total ramp time for target current total_ramp_tιme ) ; else // Otherwise, set current to what
{ set_current (new_current ) ; // was calculated and update current_now = new_current // current_ncw and ramp_tιme. total_ramp__tιme = tιme_val; // Update total ramp time
tιme_last_update = tιme_now; // Upαate ramp clock time return (C0IL_OK) ;
} ********** .ι.*+ *+_* + + + ***.ι.++...-*..*.,,ι._* + +„
Purpose :
Sets the value of the tarσet current *~o ramp to during tne next cnargmg sequence . Error conditions:
1. If the target current is not wιtn__.n tne predefined coil current limits, a message is printed ana a coil fault raiue is returned. _■ + * + ***_+ + + * + * + **** + + + + **-****** + ** int I I T retαrns co l status coil : : set_target_current ( 1 / 1 sets the value of the target current double current //ι value to ramp coil current to
if (IS_CURRENT_IN_BOUNDS (current) target_current = current; else
{
Log: : Write (INVPARAM, "WARNING: Attempt to set target current to out-of- bounds value\n") ;
Log: : rite (INVPARAM, " Target curent was NOT changed'");
Return(COIL_FAULT) ; }
Return (C0IL_OK) ; }
*
Purpose :
This routine provides a method of reading the actual (not programmed) Coil current on the coils Error conditions:
1. If the servoamp returns an error status, the corresponding coil status is returned.
******************************************** *******************************
** int I IT Coil status is returned coil : : get_coιl_current ( 111 Get and return actual coil current doubles current //o Set to value of current read
)
{ if (servoamp: :get_actual_current (current) == AMP_FAULT) return (COIL_FAULT) ; else return (COIL_OK) ;
} /********************************************************************+*****
* * Purpose: This routine returns the status of the coil. The coil's status is held in the private member status. Error conditions:
None . ***************************************************************************
** nt I IT coil status is returned coil : get_coιl_status ( 111 return coil status void)
{ return ( coil : : status ) ;
(C)opyπght Stereotaxis, Inc.
/******+********************************************************
Purpose:
This source file implements the ramp_model class used for calculating coil currents and ramp times. It allows the user to set equation coefficients and exponents to describe the relationship between time and current mathematically .
Version: 1.10 Date:
Hazard Related:
Yes
Notes :
1. In its present form, the class WORKS ONLY for equations with exponents of a single power or zero. This avoids the need to solve a non-linear equation to find the ramp time given a current value. **********************************************************************/
/*********************************************************************
Purpose :
Ramp_model ( ) function is a constructor for a ramp_model object. It is called with no arguments. Initialization of class members must be performed using other member functions.
Error conditions:
None ********************************************************************** ramp_model : : ramp_model ( ) 111 Creates an empty instance of the ramp_model class
{ ramp_coef = 0.0; // Initialize values to zero ramp_exp = 0.0;
}
/**********************************************************************
Purpose:
Set_ramp_coef function sets the coefficient values the ramp equation
Error conditions :
Negative coefficient values are not allowed, they may cause problems when used in the po () math library function which uses these values for calculations . ********************************************************************** int I IT return status flag ramp_model: :set_ramp_coef ( 111 sets ramp equation coefficient double coef I Ii coefficient of ramp model term
{ if (coef<= 0.0) {
Log: -.Write (INVPARAM, "ERROR: ramp_model : : set_ramp_coef ( ) - Coefficient Value
MUST be positive \n"); ramp_coef = 0.0; return (RAMP_MODEL_FAULT ) ;
} else ramp_coef = coef; return (RAMP_MODEL_OK) ;
} /**************************************************************************
* *
Purpose : get_ramp_coef ( ) function returns a pointer to a copy of the present ramp equation coefficient values.
Error conditions:
Memory allocation for the new array could fail, in which case the pointer returned is set to NULL. ***************************************************************************
**double I IT return the coefficient value ramp_model : : get_ramp_coef ( 111 gets ramp equation coefficient
{ return (ramp_coef) ;
} /***************************************+**********************************
Purpose :
Set_ramp_exp function sets the exponent value of the ramp equation. Error conditions:
Negative values for exponents are not allowed. This ensures that some error conditions will not arise when using these values in pow ( ) calls. *************************************************************************** int I IT return success or unsuccess ramp_model : : set_ramp_exp ( 111 set ramp equation exponent double exp //i exponent value to use if (exp <= 0.0)
Log:: Write (INVPARAM, "ERROR: ramp model : : set-ramp_exps ( ) - Negative exponent values are NOT allowed\n") ; ramp_exp = 0.0; return ( RAMP_MODEL_FAULT ) ; } else ramp_exp = exp; return (RAMP_MODEL_OK) ; /******************************★*******************************************
Purpose : Get_ramp_exp ( ) function returns a pointer to a copy of the present
ramp equation exponent values.
Error conditions:
Memory allocation for the new array could fail, in which case the pointer returned is set to NULL. *************************************************************************** double I IT return a pointer to a copy of the exponents ramp_model : : get_ramp_exp ( 111 return present ramp exponents void)
{ return (ramp_exp) ;
} /*************************************************************************
Purpose :
This function calculates a current value for for a time using the ramp model equation defined by the ramp exponents and coefficients.
Error conditions :
None .
The possibility of the pow function causing an error is eliminated by checking the values of the exponent when it s set in set_ramp_exps ( ) .
NULL variable pointers or bad values are trapped by checking the status of the exponent and coefficient. *************************************************************************** int I I T return value, fault if error calculation ramp_model : : calculate_ramp_yalue ( 111 calculate a current value double tιme_val, 111 time for which calc doubles ramp_val I Im calculated current value
)
{ if ( (ramp_coef <= 0.0) | | (ramp_exp <= 0 - 0))
Log: : Write (INVPARAM, "ERROR: ramp_model : : calculate_ramp_yalue - coefficient or exponent is BAD\n"); return ( RAMP_MODEL_FAULT ) ; } int value_sιgn; ιf(tιme_val < 0.0) //This method of stripping tne sign the value value_sιgn = -1; // is used to avoid errors for functions that are else // undefined for values <0. This allows the ramp value_sιgn = 1; // functions to be symmetric about zero. tιme_val = fabs (tιme_val) ; // Make sure value is positive ramp_val = ramp_coef *pow (tιme_val, ramp_exp) ; ramp_val *= value_sιgn; // account fok original value return (RAMP_MODEL_OK) ;
} /**************************************************************************
Purpose : This function calculates a ramp time value for a current using the ramp
model equation defined by the ramp exponent and coefficient.
Error conditions: None. The possibility of the pow function causing an error checking the-values of the exponents and coeficients *************************************************************************** int I IT fault if exps or coeffs are not set ramp_model : : calc_ramp_tιme ( 111 cals a ramp time for a
// current and ramp scale double current, I I T current to calc time for double tιme_scale, I I T ramp scale double Sramptime //o time to ramp to current at ramp_scale
}
{
Log: :Wrιte (INVPARAM, "ERROR: ramp_model : : calculate_ramp_tιme - coefficient or exponent is BAD\n"); return (RAMP-MODEL-FAULT) ;
} if (tιme_scale < MIN_RAMP_SCALE) time-scale = MIN_RAMP_SCALE; double isign; if (current < 0) isign = -1.0; else isign - 1.0; ramptime = pow ( fabs (current ) /ramp__coef, 1/ramp-exp) / tιme_scale * isign; return (RAMP-MODEL-OK) ;
} **************************+***+**********++********************************
Purpose :
This function calculates the ramp time between two currents using the ramp model equation defined by the ramc exponent and coefficient. Error conditions :
An error from calc_ramp_tιme () is cnecked for and a fault condition returned if detectud. int I I T fault if exps or coefs are not set ramp__model : : calc_ramp_tιme ( 1 / 1 calc ramp time between two currents doub] e start_current , I I T starting current double end_current, //ι ending current double tιme_scale, I I T ramp scale to charge with double -ramptime) //o time it takes to go from start
// to end current if ( (ramp_coef <= 0-0) || (ramp-exp <= 0.0))
Log: : Write (INVPARAM, "ERROR: ramp_model : : calculate__ramp_tιme - coefficient or exponent is BAD\n"); return (RAMP-MODEL-FAULT) ; } double tl , t2 ; f (tιme_scale==0 . 0 / /Trap for zero conditions ramptime = 0 . 0 ; //that would cause bad return values else { int statusl = calc_ramp_tιme ( start_current , 1 . 0 , tl ) ; int status2 = calc_ramp_tιme ( end_current , 1 . 0 , t2 ) ;
if (statusl I I status2) return (RAMP-MODEL-FAULT) ;
} ramptime = fabs (t2 - tl) / tιme_scale;
} return (RAMP-MODEL-OK) ;
} /*************************************************************************
Purpose :
This routine scales a ramp time according to the scale pa~qped n and the ramp model equation. Error conditions:
If the ramp equation is not valid, an error is returned and scaled_ time is set to zero. Notes :
The time-scale input is based on the following general equation type: I(t) is proportional to (t*tιme-scale) (ramp_exp)
********************************************************************+*****/ int I IT return fault if equation is not valid ramp_model : : scale_ramp_tιme ( 111 Scale a given ramp time double time, I I T The time to scale, double tιme_scale, I I T the time scale value double &scaled_tιme //o the scaled time value scaled _tιme 0.0; if ( (ramp_coef <=0.0) | | (ramp_exp <=0.0))
{
Log: : Write (INVPARAM, "ERROR: ramp_model :: scale_ramp_tιme - coefficient or exponent s BAD\n) ; return (RAMP_MODEL_FAULT) ; } scaled-time = time * time-scale ; return (RAMP-MODEL-OK) ;