The PTC temperature T(R) is very nonlinear with resistance. The Steinhart-Hart equation is a widely used third-order approximation:
There is a critical temperature Tc above which the resistance increases dramatically and hence allows a PTC resistor to be used to limit current. If we can calculate T(R) we could predict the time to trip, t_trip, which is the time it takes the PTC to start from its present temperature T_init and reach Tc. Here, R would be high enough to shut down the circuit hence creating a thermal fuse. The specifications for PTCs have t_trip as a function of PTC current assuming you start at T_init = T_0 = 23 C where T_0 is the ambient temperature. This is easy to curve fit, but it doesn’t help us if the ambient temperature T_0 is different or we have previously heated up the PTC by running at high currents for a while and T_init > T_0. It is possible to model the thermal response of the PTC to take into account the variation in initial conditions and ambient temperature.
This figure shows a close model match to published t_trip for a Bourne (.9, 1.8) (I_hold, I_trip) PTC similar to the Vex PTC. This is calculated at the standard T_0 with T_init = T0.
So I have a technique to model PTC currents and t_trip . Given some more lab tests with actual PTC installations I am fairly certain a working RobotC model can be synthesised for management of current . Test data would be needed for the Cortex PTC which is the most likely fuse to trip when running 4 393 motors.
It is not clear exactly how we could use t_trip but it can be estimated in real-time by software with some TBD accuracy.
Software monitors could have the following functions:
i_amps =Compute motor current (Vb,speed,duty)
T = Compute PTC Temp (i_amps, T_0=ambient temperature)
t_trip = Compute time to trip(T, Tc = critical temperature)
duty_out = Current limiter( duty_in, i_amps, speed , t_trip)
The current limiter would look at t_trip… if it was shorter than say 4 seconds, it would reduce the command duty_in to a safe value of duty_out for the motors. When t_trip increased to say 10 seconds, the limit would be lifted. This creates a hysteresis to allow some cooling before max commands are allowed.
Note: the i_amps calculation assumes that PTC resistance is constant. As R rises with temperature, its effects should be included in i_amps. This can be done by having changing i_amps function to include a last temperature, T_last, input:
i_amps = Compute motor current (Vb,speed, duty, T_last=last PTC temperature )
The equation for PTC R can be included in the Hbridge formulas. It essentially has two effects: 1) decreases the voltage across the motor coil and also decreases the ON phase time constant speeding up the rise of current.
2) Calculating T(R)
Before going on, you might want to review some tutorials on PTC:
Tyco (I got R vs Temperature from Fig 7)
In addition here are the spec sheets for the PTCs
A quick review of Wikipedia on Thermistors suggests that Newton’s law of cooling can be used to compute the power flowing out of a resistor. This power is proportional to the temperature difference between the ambient temperature T0 and the resistor temperature T(R).
P_out = K*(T(R) – T0) where the temperatures are in degrees Rankine and K is the dissipation constant in watts per deg C.
The power coming into the PTC P_in = I_ptc*V_ptc where I_ptc is the current and V_ptc is the voltage drop across the PTC respectively. In general we do not have a measure of the voltage across the PTC but we can calculate the voltage using ohms law or V_ptc = I_ptc*R . So
PTC P_in = I_ptc^2*R
If we know the specific heat of the PTC at constant pressure ,C_p = delta Q/delta T , then the rate of change in temperature can be given by the equation
C_p*dT/dt = P_in – P_out
Here we have used the approximation that the heat absorbed = delta Q = dt*(P_in-P_out) and delta T = dT.
dT/dt = 1/C_p*(I_ptc^2*R – K*(T – T0)) .
This is a first-order non-linear differential equation because R changes with T. This can be solved with numerical integration but a closed form can be used if the equation is linearized. Normally, R = R_0*exp(beta*(T-T_ref). We can use a Taylor approximation to linearize this.
3. Linearization of R with T
Assume that R is linear function of T in the following form:
R = R_0* (1+m*(T -T_ref)) where m = the slope of a best fit line to a nonlinear R(T) curve vs T-Tref. T_ref and R_0 are the reference T that R_0 is specified at. Figure 7 of this Tyco tutorial gives a typical curve of R vs T.
dT/dt = 1/C_p*(I_ptc^2*R_0*(1+m*(T -T_ref)) – K*(T – T_0)) .
expanding and collecting terms gives
dT/dt = 1/C_p*( I_ptc^2*R_o*(1-m*T_ref )+ K*T_0 – (K -I_ptc^2*R_0*m )*T)
Writing this in a simpler form gives the first order linear form:
***************** Linear now******************
dT/dt = (T_ss – T)/tau’
Where T_ss = ( I_ptc^2*R_o*(1-m*T_ref) + K*T_0) *tau’/C_p
and tau’ =tau/(1 -I_ptc^2*R_0*m *tau/C_p)
and tau = C_p/K
4. Finding t_trip
Getting T_trip is easy once we have a linear differential equation and know T_ss and our current temperature T_init
The closed form solution of the differential equation is
T = T_ss + (I_init – T_ss)*exp(-t/tau’)
When T = Tc then t = T_trip .
Tc = T_ss +(T_init – T_ss)*exp(-t_trip/tau’)
Solving for t_trip
t_trip = -tau’*ln( Tc -T_ss)/(T_init-T_ss) )
This is simple to calculate in RobotC. If we used the nonlinear equation we would have had to do a time prediction t_trip using numerical integration. This would be computationally expensive since we might have to do say 200 integration steps to get one value of t_trip. This of course is more accurate and is similar to a technique use in bombing algorithms to find the exact time to release a bomb to hit a target several seconds in the future. I plan to do both solutions in RobotC to see which is better.
5. PTC known parameters
Here is what we know about the 393 PTC
I_H =0.90 , I_T =1.80 V_max= 0.60 I_max = 30 P_D =40 T_trip =7.1s
R_min = 0.140 R_max = 0.230 R_ tmax = 0.350
IH = Hold current: maximum current at which the device will not trip at 25 still air.
IT = Trip current: minimum current at which the device will always trip at 25 still air.
Vmax=Maximum voltage device can withstand without damage at rated current.
Imax = Maximum fault current device can withstand without damage at rated voltage.
Pd= Power dissipation: typical amount of power dissipated by the device when in tripped state in 25 dec C still air.
Ttrip= Maximum time to trip(s) at 5*IH.
Rmin = The smallest zero power resistance under the ambient temperature of 25.
Rmax = The biggest zero power resistance in the ambient temperature of 25.
R1max = Maximum device resistance one hour after it is tripped at 25.
Since the web site doesn’t have the time to trip vs current graphs, we can get very similar data from other PTC’s that are rated the same but have the data. E.G. A Bourne MFR090
The time to trip read from the web site graph are:
5. Estimating Model parameters
There are a bunch of unknown parameters in the equations. Namely:
C_p, R0,m,Tc, K.
I estimated these from a variety of sources just to get started and adjusted them slightly to get a good match in an Excel model.
C_p = C_p_per vol * vol
C_p_per_vol = 2.7 Ws/Kcm3 for a titanate material (see epcos reference)
Using the vol for the Bourne R090 (8mm diameter, 1.5 mm thick) gives .0754 cm3
So C_p =.203
R_0 is .14 ohms from the PTC spec at 23 deg C.
m = slope of R curve vs T-Tref. This is .727 ohms per 100 deg C from Fig 7 of Tyco tutorial.
Once I had the linear approximation to R = R_0*(1 + m*(T-T_ref)) an Rc based upon jpearman PTC trip in this post was calculated. I picked a current just before the nonlinear jump in resistance… this was 1.5 amps for an input of 4 volts. This = the total drop across R and Rm. So R = V/I – Rm = 4/1.5 – 1.5 = 1.17 ohms. Plugging back into the R equation and solving for T gives
Tc =( Rc/R_0-1.)/m + T_ref =( 1.17 /.14 -1)/ .00727 + 23 = 1031 deg C Although this seems high, it is really a fictious number that makes Rc come out correctly for the linear approximation for R. If R was exponential , Tc would be smaller. I will revisit this later when I do not make the linear assumption. I suspect that the linear assumption desensitizes the effect of external temperature changes when the temperatures approach Tc. I.e. a 10 degree change will not increase R as much it would if an exponential was used to approximate R in the Tc region.
K was more difficult… so I assumed a value of tau = C_P/K and adjusted that until the Excel data matched the t_trip data. This essentially is adjusting the cooling time constant of the PTC. The best value for tau = 8 sec ==> K = 1.52
6. Excel Model Data matching
So I wrote an Excel program to integrate the differential equation for T and calculated when the PTC would trip for various currents. These were compared to the Bourne t_trip and the differences were minimized by adjusting tau and C_p a little. The data matches reasonably for the uninstalled PTC. It is almost amazing considering the amount of things involved in getting to the model. We are primarily concerned about the t_trip in the region 4 to 30 seconds and here the model matches to within a 7% or about .5 seconds.
Matching the Cortex HR16-400 test data from James Pearman Feb 2012 data posted in the vex forum.
|You may remember this thread from February where I was testing the 4A device used in the cortex, for whatever reason the trip times could vary by up to 100%, for example, with 3.5A current I saw times that varied from 48 seconds to 123 seconds in just a sample of three devices.|
I thought I had read that post, but when I went back to review it, I realized that it was a free test and not in the cortex as I had thought. It is a great set of data. I took the Jpearman data and averaged it to get a t_trip vs current to try to match with my thermal model.
I used a linear model of PTC resistance vs temperature. I can do this because the Tc critical temperature that I define occurs just before the big nonlinear jump occurs. If you look at the voltage trace in your curves , it is the point that the voltage doubles. I assume that the voltage doubles because the resistance doubles since it should have a regulated current.
The procedure is basically this: Recall the basic equation describing the temperature dynamics is
dT/dt = 1/C_p*(I^2*R – K*(T – T_0))
Pick R_0 … equal to the no power resistance at 25C. Define R_c ..equal to twice R_0. This is the critical resistance that will trigger the T_trip event.
Choose a representative temperature that coincides with the R_c event. I use Tc = 100C based upon your thermal measurements. At some point I would like to get T vs time instrumented along with current.
This defines the slope of the change in R vs T … = (R_c-R_0)/(T_c-T_0) = R_o/75. So the equation for R = R_0*(1 + (T- T_0)/75)
Next, find the thermal dissipation constant K that will cause a steady state non trip when the current is set at I= 4 (spec) but I used I = 3 amps per your test. K = I^2*R_c/(T_c – T_0)= 3^2*2*R_0/75 = 18/75*R_0
Once we have K then adjust C_p until the T_trip matches at the highest current… i.e. 8 amps. This sets the time constant tau at about 15 seconds.
Now slightly adjust T_c until the low current longer T_trip matches closely. Very minor adjustments are required.. < 20%.
The procedure is simple and seems to work OK. All we need is a data set similar to what you generated , but with the PTC inside the cortex. If we cannot get the temperature measurement, then we can just assume a representative number… say 100C.
8/12/2012 Update: Simplified Proceedure for finding PTC constants with R constant.
I decided to try a model that assumes R is constant with temperature . It matches well in the low t_trip but it under estimates the longer t_trip. Constant R simplifies the derivation of constants and the equation calculations and this is the model I selected for software implementation.
Recall the basic equation describing the temperature dynamics with R = R_0
dT/dt = 1/C_p*(I^2*R_0 – K*(T – T_0)) which can be rewritten using tau = C_p/K as
tau *dT/dt = (I^2*R_0/ K – (T – T_0)) or
tau*dT/dt = (T_input – (T-T0)); where T_input = I^2*R_0/ K,
We will use the steady state solution of this equation to find K and the initial rate with a large T_input to find tau=
steady state: Tinput = T -T0 -> K = I^2*R_0/(T -T0)
Now a key assumption is that Tc occurs at I_hold when T0 = 25C. That is with I = I_hold, the steady state tempurature will just reach Tc. So this equation in terms of I_hold and Tc is
K = I_hold*R_o/(Tc – T0)
tau = (T_input -T +T0)/(dT/dt) evaluated with a large T_input from known large current I_trip, T = T0 and a known t_trip.
Now: dT/dt ~= (Tc-T0)/t_trip . (key assumption that is valid with very large steps)
Substituting into tau equation and eliminating K gives:
tau = T_input/(Tc-T0)*t_trip = (I_trip/I_0)^2*t_trip !!
Empirically I have found that this over estimates t_trip in the region of shorter t_trip(<15 sec) and that reducing tau by factors of 75% and 50% can provide a better fit in the shorter t_trip region at the expense of the long t_trip. I.e. as shown in this figure the HR16-400 is better fit with 75% tau. The HR30-90 is better fit with 50% (not shown).
If we don’t have a best fit, I recommend using the 50% factor. This is conservative in that the monitor will trip faster than the hardware PTC and take corrective action to prevent the hardware trip. It will restore a high command sooner because it thinks the hardware is cooling faster but it is now in a closed loop control so it will still keep the hardware PTC from tripping. The price paid is the lowering of motor current a little sooner than necessary.
So this is the formula unless curvefitting is done:
tau =.5* (I_trip/I_0)^2*t_trip
#define c1 = 1/tau_ms;
#define c2= (Tc -T0)/(I_hold)^2 ;
Need a periodic or near periodic loop with loop time dt_ms in millisec.
Initialize T at T_0.
dt_ms = timer1[T1] ;
T = T + c1*(I*I*c2 -T +T0)*dt_ms
Here are typical constants used for each of the Vex motors , cortex and power expander;
/PTC Constant calculation****************************************** //R_0 No power PTC resistance at 25C still air // T_c Trip temperature degC, nom = 100C //T_ref = 25. //I_hold PTC hold current //tau is computed by putting a I_trip = 5*I_hold or something close. The time to trip T_trip is // measured at this current and used to compute tau. // tau = .5*T_trip*(I_trip/I_0)^2 I_trip typically = 5*I_hold // K = I_hold*I_hold*R_0/(T_c -T_0); //PTC dissipation constant // c_1 =(T_c – T_ref)/I_hold/I_hold ; // c1 = R_0/K = (T_c – T_ref)/I_hold/I_hold // c_2 = 1./(tau*1000.);
// PTC HR16-400 used in cortex and power expander // R_0_cortex = .018 ; // T_c_cortex = 100; // I_HOLD_cortex = 3.; // t_trip = 1.7 @ I_trip = 5*I_hold // TAU_cortex = 12.5*1.7= 21.25 sec; // c_1_cortex 75/9 = 8.3333 // c_2_cortex 1/21250= 4.7e-5
// PTC HR30-090 used in 393 // R_0_393 = .14 ; // T_c_393 = 100; // I_hold_393 = .9; // t_trip = 7.1 @ I_trip = 5*I+hold // tau_393 = 12.5*7.1= 88.75; // c_1_393 75/.81= 95.59 // c_2_393 1/88750= 1.1267e-5
// PTC HR16-075 used in 269 // R_0_269 = .11 ohm min .2 ohm max ; // T_c_269 = 100; // I_hold_269 = .75; // t_trip = 2 sec @ I_trip = 5*I_hold // tau_269 = .5*(I_trip/I_hold)^2*2 sec= 12.5*2 = 25 sec; // c_1_269 75/(.75^2)= 133.33 // c_2_269 1/25000= 4.e-5
// PTC MINISMDC-075F used in three wire // R_0_3wire = .11 min; max = .45 // T_c_3wire = 100; //assume same as 269 // I_hold_3wire = .75; // I_trip_3wire= 1.5 amp; // t_trip_3wire = .2 sec @8 amps // tau_3wire = .5*(8amp/.75amp)^2*t_trip =.5*22.8 = 11.4 sec; // c_1_3wire 75/(.75^2)= 133.33 // c_2_3wire 1/11400.= .00008789