Maker Pro
Maker Pro

Simulating a variable resistance input with LTSpice?

J

Joerg

Helmut said:
Hello Joerg,

I assumed you want simulate resistance versus temperature.
Do you need it the other way? Temperature(resistance)?

I had to simulate the output of my circuit versus stepped temperature,
IOW the temperature would have been the stimulus. Since I hadn't poured
in the whole equation I instead stepped the resistance and plotted the
electrical output.

In real life it will be the opposite. The software will have to
calculate temperature from the voltage it sees. That requires the
inverse Steinhart-Hart which gets sort of ugly.
 
J

Joerg

neddie said:
.step temp 0 100 10
, with simulation command set to DC op point
or am I missing something here.
Rob


The it drew a staggered set of curves but I needed only one graph.
 
J

Joerg

Jim said:
What exactly are you trying to do, Joerg? Get a DC output versus
temperature? Or what? You're showing less and less clarity as you go
:)

Yes, a DC output versus temperature as _one_ contiguous graph. Not as a
set of graphs like what the .step function usually does.

But as I said, it's now all done and done, using a few sheets of paper
and ye olde pencil :)
 
H

Helmut Sennewald

Joerg said:
Yes, a DC output versus temperature as _one_ contiguous graph. Not as a
set of graphs like what the .step function usually does.

But as I said, it's now all done and done, using a few sheets of paper and
ye olde pencil :)


Hello Joerg,

If you use

..step TEMP 0 100 1

together with only

..OP

You will get only one graph.

There is one drawback with the global TEMP.
If you have opamp models around, they may suffer because of this varying
TEMP.
Opamp models are mostly made for only the standard temperature in SPICE
(27°C).
If this is the case with your circuit, I can make you another example where
the
NTC-resistor is controlled by a free variable, e.g. TMP.

Best regards,
Helmut
 
J

Joerg

Helmut said:
Hello Joerg,

If you use

.step TEMP 0 100 1

together with only

.OP

You will get only one graph.

There is one drawback with the global TEMP.
If you have opamp models around, they may suffer because of this varying
TEMP.
Opamp models are mostly made for only the standard temperature in SPICE
(27°C).
If this is the case with your circuit, I can make you another example where
the
NTC-resistor is controlled by a free variable, e.g. TMP.

Yes, there are opamps in there. But as I mentioned before I am already
done with this circuit, did it in part with the old method (dead tree
plus pencil, and lots of eraser crumbs by the end ...).

But I still want to check out the file set you sent. Not sure if I can
this weekend because I may have to work. Another switcher design. It
almost feels like eating the same meal every day :)
 
Q

qrk

[snip]
*********************************************************
* NTC resistor using the Steinhart-Hart equation: *
* 1/T = A + B*ln(R) + C*ln(R)**3 (ugly solution for R) *
* Requires equation coefficients which can be *
* set in this subcircuit or passed thru the *
* X instantiation. e.g. *
* X1 1 0 THERMISTORntcS PARAMS: A=8.215E-4 B=2.111E-4 C=6.716E-8 *
* See Thermistor_Calculator.mcd for coefficient gen *
* Schematics component: RntcS *
* By: Mark 26 March 2003 *
*********************************************************
* +-------------------NTC resistor terminals
* | +------+------+- equation coeffs
coefficients
.SUBCKT THERMISTORntcS 1 2 PARAMS: A=8E-4 B=2E-4 C=7E-8
.PARAM D={ ((1/(TEMP+273.15))-A)/(2*C) }
.PARAM E={ (B/(3*C))**3 }
.PARAM F={ SQRT(D**2+E) }
.PARAM G={ EXP(PWRS(D-F,1/3)+PWRS(D+F,1/3)) }
ETHERM 1 3 VALUE={ I(VSENSE)*G }
VSENSE 3 2 DC 0
.ENDS THERMISTORntcS



Regards,
Mark

Hi Mark,

Saturday morning, time to muse over adding your thermistor equation to
my symbol and model libraries, and studying the Steinhart-Hart
equations for "R", I wondered why you needed to use "PWRS"?

They way I read those equations, "x" is always greater than "y/2", so
simply PWR, or even **(1/3) should suffice.

Or am I overlooking a trap (like, can B/3C be negative ?:)

Thanks!

...Jim Thompson

Not sure why I used PWRS. This was done 7 years ago and my stack
overfloweth. I would guess that it's force of habit or there could be
a negative value involved. I sort of remember fighting with the PWR
function and realizing that it didn't honor the negative sign some
years ago.

Mark
 
J

Joerg

Jim said:
[snip]
*********************************************************
* NTC resistor using the Steinhart-Hart equation: *
* 1/T = A + B*ln(R) + C*ln(R)**3 (ugly solution for R) *
* Requires equation coefficients which can be *
* set in this subcircuit or passed thru the *
* X instantiation. e.g. *
* X1 1 0 THERMISTORntcS PARAMS: A=8.215E-4 B=2.111E-4 C=6.716E-8 *
* See Thermistor_Calculator.mcd for coefficient gen *
* Schematics component: RntcS *
* By: Mark 26 March 2003 *
*********************************************************
* +-------------------NTC resistor terminals
* | +------+------+- equation coeffs
coefficients
.SUBCKT THERMISTORntcS 1 2 PARAMS: A=8E-4 B=2E-4 C=7E-8
.PARAM D={ ((1/(TEMP+273.15))-A)/(2*C) }
.PARAM E={ (B/(3*C))**3 }
.PARAM F={ SQRT(D**2+E) }
.PARAM G={ EXP(PWRS(D-F,1/3)+PWRS(D+F,1/3)) }
ETHERM 1 3 VALUE={ I(VSENSE)*G }
VSENSE 3 2 DC 0
.ENDS THERMISTORntcS



Regards,
Mark
Hi Mark,

Saturday morning, time to muse over adding your thermistor equation to
my symbol and model libraries, and studying the Steinhart-Hart
equations for "R", I wondered why you needed to use "PWRS"?

They way I read those equations, "x" is always greater than "y/2", so
simply PWR, or even **(1/3) should suffice.

Or am I overlooking a trap (like, can B/3C be negative ?:)

Thanks!

...Jim Thompson

And it looks like "standard" data is resistance versus temperature
tables, rather than specifying A, B & C. Is that typical, or am I not
looking in the right places?

That is the standard for NTC. Probably because the big market for them
is industrial control and the usual PLC can't do much more than simple
ladder logic.

Also, those things have large tolerances so there ain't no real
precision. However, if you run a tight PID control with them the table
surely doesn't cut it.

It _would_ be easy enough to specify the subcircuit with parameter
pairs, R1/T1, R2/T2, R3/T3, then have the behavioral model compute A,
B & C.

Most of the times when I try this the PC starts to bog down. And heat
the office which is nice these days but not in August :)
 
J

Joerg

Jim said:
Jim said:
On Sat, 17 Apr 2010 08:58:58 -0700, Jim Thompson


[snip]
*********************************************************
* NTC resistor using the Steinhart-Hart equation: *
* 1/T = A + B*ln(R) + C*ln(R)**3 (ugly solution for R) *
* Requires equation coefficients which can be *
* set in this subcircuit or passed thru the *
* X instantiation. e.g. *
* X1 1 0 THERMISTORntcS PARAMS: A=8.215E-4 B=2.111E-4 C=6.716E-8 *
* See Thermistor_Calculator.mcd for coefficient gen *
* Schematics component: RntcS *
* By: Mark 26 March 2003 *
*********************************************************
* +-------------------NTC resistor terminals
* | +------+------+- equation coeffs
coefficients
.SUBCKT THERMISTORntcS 1 2 PARAMS: A=8E-4 B=2E-4 C=7E-8
.PARAM D={ ((1/(TEMP+273.15))-A)/(2*C) }
.PARAM E={ (B/(3*C))**3 }
.PARAM F={ SQRT(D**2+E) }
.PARAM G={ EXP(PWRS(D-F,1/3)+PWRS(D+F,1/3)) }
ETHERM 1 3 VALUE={ I(VSENSE)*G }
VSENSE 3 2 DC 0
.ENDS THERMISTORntcS



Regards,
Mark
Hi Mark,

Saturday morning, time to muse over adding your thermistor equation to
my symbol and model libraries, and studying the Steinhart-Hart
equations for "R", I wondered why you needed to use "PWRS"?

They way I read those equations, "x" is always greater than "y/2", so
simply PWR, or even **(1/3) should suffice.

Or am I overlooking a trap (like, can B/3C be negative ?:)

Thanks!

...Jim Thompson
And it looks like "standard" data is resistance versus temperature
tables, rather than specifying A, B & C. Is that typical, or am I not
looking in the right places?
That is the standard for NTC. Probably because the big market for them
is industrial control and the usual PLC can't do much more than simple
ladder logic.

Also, those things have large tolerances so there ain't no real
precision. However, if you run a tight PID control with them the table
surely doesn't cut it.

It _would_ be easy enough to specify the subcircuit with parameter
pairs, R1/T1, R2/T2, R3/T3, then have the behavioral model compute A,
B & C.
Most of the times when I try this the PC starts to bog down. And heat
the office which is nice these days but not in August :)

I run a _real_ simulator :)

For circuit level design I have yet to find anything I need where
LTSpice can't do something that PSpice does. Chip design is probably
different, I guess there comes a limit in terms of BSIM model support
and so on.

Got a table of values I can try out my model on?


Here ya go:

http://www.epcos.com/inf/50/db/ntc_06/SMD__NiBarrier__0402__B572x1__V2x1.pdf

My guess is it'll run in seconds.

On its own it always does but once it's in the middle of a rather dense
concoction of analog parts that quickly changes.
 
J

Joerg

Jim said:
Jim said:
[snip]
I run a _real_ simulator :)
For circuit level design I have yet to find anything I need where
LTSpice can't do something that PSpice does. Chip design is probably
different, I guess there comes a limit in terms of BSIM model support
and so on.

Got a table of values I can try out my model on?

Here ya go:

http://www.epcos.com/inf/50/db/ntc_06/SMD__NiBarrier__0402__B572x1__V2x1.pdf

My guess is it'll run in seconds.
On its own it always does but once it's in the middle of a rather dense
concoction of analog parts that quickly changes.

That part should end up all being linear Algebra. Does temperature
change in ns ??

No, but once in a while one must monitor temperature pulses or fast
trends. Usually to dodge a phut ... *BOOM* situation.
 
Q

qrk

[snip]
*********************************************************
* NTC resistor using the Steinhart-Hart equation: *
* 1/T = A + B*ln(R) + C*ln(R)**3 (ugly solution for R) *
* Requires equation coefficients which can be *
* set in this subcircuit or passed thru the *
* X instantiation. e.g. *
* X1 1 0 THERMISTORntcS PARAMS: A=8.215E-4 B=2.111E-4 C=6.716E-8 *
* See Thermistor_Calculator.mcd for coefficient gen *
* Schematics component: RntcS *
* By: Mark 26 March 2003 *
*********************************************************
* +-------------------NTC resistor terminals
* | +------+------+- equation coeffs
coefficients
.SUBCKT THERMISTORntcS 1 2 PARAMS: A=8E-4 B=2E-4 C=7E-8
.PARAM D={ ((1/(TEMP+273.15))-A)/(2*C) }
.PARAM E={ (B/(3*C))**3 }
.PARAM F={ SQRT(D**2+E) }
.PARAM G={ EXP(PWRS(D-F,1/3)+PWRS(D+F,1/3)) }
ETHERM 1 3 VALUE={ I(VSENSE)*G }
VSENSE 3 2 DC 0
.ENDS THERMISTORntcS



Regards,
Mark

Hi Mark,

Saturday morning, time to muse over adding your thermistor equation to
my symbol and model libraries, and studying the Steinhart-Hart
equations for "R", I wondered why you needed to use "PWRS"?

They way I read those equations, "x" is always greater than "y/2", so
simply PWR, or even **(1/3) should suffice.

Or am I overlooking a trap (like, can B/3C be negative ?:)

Thanks!

...Jim Thompson

And it looks like "standard" data is resistance versus temperature
tables, rather than specifying A, B & C. Is that typical, or am I not
looking in the right places?

It _would_ be easy enough to specify the subcircuit with parameter
pairs, R1/T1, R2/T2, R3/T3, then have the behavioral model compute A,
B & C.

...Jim Thompson

Standard are tables, not the A B C coeffs. I had an app note with the
equations on it (too lazy to do arithmetic) which I solved in Mathcad
using 3 points, but you can probably use Excel. Seems like a lot of
work for PSpice to solve the coefficients.
 
Top