Estimating the PTC t_trip and temperature using motor current (third try a charm)

I have been fooling around for a while with the notion that we could predict t_trip for a PTC and use it to smartly manage the motor commands to keep from tripping the PTC and yet allow maximum current to be sustained.

I have come up with a first order equation that models the PTC temperature as a function of current and can be used to predict t_trip to with in 7% for the standard spec conditions. This gives me some hope that we can use a t_trip model in the current management.

See post for complete details and derivation of model. Quite an interesting foray into physics and thermodynamics. Here is an excerpt of the introduction to see if you have any interest in reading the whole post. You will have to go to the post to see the links:

Estimating the PTC temperature using motor current (third try a charm)

  1. Introduction:

The PTC temperature T® 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® 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.

http://vamfun.files.wordpress.com/2012/07/excel-ptc-model-vs-bourne-r090-t_trip-vs-current.jpg

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 synthesized 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.

  1. Calculating T®

Before going on, you might want to review some tutorials on PTC:

Thermistors Wikipedia

Tyco (I got R vs Temperature from Fig 7)

Epcos (I got C_p from here)

In addition here are the spec sheets for the PTCs

393 PTC HuiRui HR30-090

Bourne (Example MF-R090 .9 amp hold, 1.8 amp, I took t_trip data from this to match)

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®.

P_out = K*(T® - 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_ptcV_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_ptcR . 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.

So

dT/dt = 1/C_p*(I_ptc^2R - 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_0exp(beta(T-T_ref). We can use a Taylor approximation to linearize this.

The remaining sections deal with linearizing the differential equation and coming up with formulas for t_trip and then estimating the PTC parameters needed to compute it Beware… lots of math.

Chris

It’s a noble goal, and an idea I’ve wanted to implement, but I’m concerned that in tests I’ve done so far the PTC performance both differs from the datasheet and also from device to device. 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. Also have a look at this study if you have not already seen it, they also found a 3:1 difference in trip times over 6 devices for a given current.

Now despite my skepticism, I’m willing to give it a go. I hope to be able to test your motor current modeling this weekend and once that is done perhaps can get back to the PTC study I started earlier in the year.

I fully agree with your observations and indeed even expect it due to the nature of the problem. t_trip is almost chaotic in nature when the longer times are involved. A small change in initial conditions create large changes in the output. This is due to the near asymptotic crossing of the temperature curve T through the Tc reference. This occurs with small currents. The larger currents cause a temperature curve that is steeper and has a more distinct crossing that doesn’t’ t change much with current variation. So the key is to stay out of the asymptotic type crossing regions. Which means focusing on t_trip times from 2 to 10 seconds. I am a little surprised that 3.5 amps takes 48 to 123 seconds to trip… this implies to me that there is some good heat sinking going on in the cortex installation. So in general the heating and cooling time constant, tau will be longer than the PTC alone spec time tau as expected.

I fully expect to have a current monitor that is user friendly and robust. The reason I spend time modeling is to understand the physics of the problem. The physics produce a timing model that is realistic and once we have enough data, it can be adjusted without a lot of guess work.

One scheme might just keep T < Tc by regulating current such that T never exceeds T_c. This is done by creating a monitor threshold, T_m, that is set at some % of Tc. If T_m is exceeded, the current is cut by a fixed amount or an amount proportional to T-Tm. That way, the PTC should never trip. There will be some optimal Tm that maximizes the current allowed yet keeps the probability of tripping the PTC low. How optimal will depend on the variations experienced in the field using different combinations of hardware. If as we have seen, these variations prove to be large and the thermal time constant tau is longer making temperature control sluggish then T_m must be dialed down and the currents will be limited to smaller values. But, that is the best one can do.

Tm could be set at a tournament. The robot is stalled and if Tm is too high, the PTC trips. Tm is dialed down and the test is repeated until the monitor keeps the PTC from tripping.

I did take a look at this. I believe that much of their variation could have been due to initial currents preheating the PTCs. They appear to be moving a resistor by hand to change the current and the preconditions are not the same for each of the tests. It would have been better to step in a voltage much like you did in your tests.

Glad you are with me still. I’ll be interested in your results to see where the model has to be adjusted. If you need a 393 model I’ll give you my best shot.

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 your data and averaged it to get a t_trip vs current to try to match with my thermal model.
https://vexforum.com/attachment.php?attachmentid=6610&stc=1&d=1344012650
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^2R - 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^2R_c/(T_c - T_0)= 3^22R_0/75 = 18/75R_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.

I would like to turn next to the use of this in a current monitor that I spoke of before.
PTC model match of jpearman HR16-400 Feb data.jpg

Ok… I think I am done at last. Here is text of my last blog update.
I have completed my RobotC global PTC motor monitor that seems to actually work. I will post the testing results in another thread.

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^2R_0 - K(T - T_0)) which can be rewritten using tau = C_p/K as

tau dT/dt = (I^2R_0/ K - (T - T_0)) or

taudT/dt = (T_input - (T-T0)); where T_input = I^2R_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)

Initial rate:

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)^2t_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. https://vexforum.com/attachment.php?attachmentid=6631&stc=1&d=1344720954
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

Software Implementation:

#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.

while(true)

{

dt_ms = timer1[T1] ;

T = T + c1*(IIc2 -T +T0)*dt_ms

clear_timer[T1]

}

Typical Constants for Vex PTC

// PTC HR16-400// R_0_393 = .018 ; // T_c_393 = 100; // I_HOLD_393 = 3.; // t_trip = 1.7 @ I_trip = 5I_hold // TAU_393 = .75(5)^2*1.7=32 sec ; // c_1_393 75/9 = 8.3333 // c_2_393 1/42500= 2.35e-5

// PTC HR30-090 used in 269 // R_0_269 = .14 ; // T_c_269 = 100; // I_hold_269 = .9; // t_trip = 7.1 @ I_trip = 5I+hold // tau_269 = .55^2*7.1= 88.75 sec ; // c_1_269 75/.81= 95.59 // c_2_269 1/88750= 1.1267e-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/.2amp)^2*t_trip =160 sec; // c_1_3wire 75/(.75^2)= 133.33 // c_2_3wire 1/160000= 6.25e-6
PTC fixed R model match HR16-400--Effect of tau variation.jpg

Sorry, I mixed up which PTC was where. Ignore this quoted data.
Here are the correct constants that I am using.

/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 = 5I_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 = 5I_hold
// K = I_hold
I_holdR_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 = 5I_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 = 5I+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 = 5I_hold
// tau_269 = .5
(I_trip/I_hold)^22 sec= 12.52 = 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)^2t_trip =.522.8 = 11.4 sec;
// c_1_3wire 75/(.75^2)= 133.33
// c_2_3wire 1/11400.= .00008789