Simulating a variable resistance input with LTSpice?

Apr 13, 2010 60 Replies

Hello Folks,



Got stuck when trying to simulate an NTC. This temperature-variant resistor will be the only variable input so ".STEP" and stuff do not cut it because that only overlays multiple curve in an AC or DC simulation. I want just one curve: Output of my circuit versus varying NTC resistor value.



Tried to make a voltage dependent resistor this way:



formatting link



It works but is incredibly slow. Any better ideas?


Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Do you need a voltage to resistance converter? That's easy if you have a multiplier. Interestingly, LT Spice doesn't provide a multiplier component.

John

formatting link

Well, the one in the link works now. Turns out one shall not get too close to very low values where LTSpice has a hard time. At least it heats my office :-)

When do we get some global warming out here?

This function stuff is pretty cool. For example, it can be used to get pressure sensor readings from a file into something that electrically resembles the sensor.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Get this file...

VVR.zip VOLTAGE VARIABLE RESISTOR SYMBOL/SUBCIRCUIT

On the Subcircuits and Symbols Page of my website.

It's just a text file... all you care about is the "Template" line. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

Joerg a écrit :

formatting link

The way I'd do it is with a B current source (OK, sink). Basically you measure voltage across the NL resistor nodes (a,b) and sink a current between these nodes which is your NL function of V(a,b).

That also better handles the R=0 pathological case, because you're less tempted to allow infinite current flow :-)

Thanks, Fred.

formatting link

Thanks, will check it out. Got the circuit pretty much done by now but some day if I get more of those little temp sense projects I want to pour the Steinhart-Hart equation in there. Then I'd have a true temperature-variable resistor. LTSpice has the nice feature of being able to read in a WAV table.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

formatting link

That's a good idea. Right now I map a variable voltage source into a resistor. Works, but leaves one weirdness: kiloohms on the horizontal scale are labeled kilovolts.

I always wondered if there'd be a way to inlude a phssst ... *POOF* function in LTSpice, with audio effects, sirens and all. That would be nice to have during a design review :-)

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

formatting link

Read up on behavioral modeling techniques... lots of simulation power there. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

formatting link

Some XSPICE simulators allow you to monitor values during simulation and do almost whatever you want. The one I use handles wave files, so maybe :-)

Thanks, Fred.

Loosen up them thar spats, the multiplier "element" is "*" :-)

As in...

Emult Outnode1 Outnode2 Value = {(Vinnode1,0)*(Vinnode2,0)}

[Snicker :-] ...Jim Thompson
| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

Sorry, Joerg, I misread your need. It's actually quite simple, IF you can describe the TC with coefficients of T and T^2... make your own resistor model:

Resistor

General form

R [model name]

  • [TC = [,]]

TC1, and TC2 are the linear and squared coefficients, respectively.

See the LTspice manual for clarity (the above was pasted from PSPCREF.pdf) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

"John Larkin" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Hello John,

LTspice has B-deviecs. They can do a lot of math.

* ** power / divide sin tanh exp

See the help pages for B-devices. The B-device is the best device to implement a NTC-resistor with it's exponential resistance versus temperature function.

The LTspice Yahoo group provides examples.

Best regards, Helmut

formatting link

In the current case it's a whole lot uglier than that, see under "Inverse of the equation":

formatting link

T (Temperature) must be scooted. I think LTSpice will have a cow when I try this.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Sure, but a canned multiplier component would be handy, without a bunch of typing. As would an ideal diode. At least they have ideal opamps.

John

formatting link

Then use a resistance vs temperature table... trivial in PSpice, probably so in LTspice.

Besides, that smells like unnecessary obfuscation :-)

What kind of NTC?

They're usually spec's as R = Ro*e^(beta*(1/T-1/To)) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

Lazy spat wearer, can't even roll his own B-devices ;-) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

formatting link

Depends on the client, how much precision they want, how much MIPS is there, how much RAM is there.

Just the regular kind, silicon-based resistor.

In industry it's usually the 2-term or the 3-term Steinhart-Hart equation.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

formatting link

There are modulators though, regular and I/Q, under special functions.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Thompson's Fundamental Rule #1, Stay away from PhD's, use this instead....

formatting link

Do you really have one bad enough to need the high order corrections? ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

formatting link

It's "usually" the equation I cited... I have several books here that say so ;-)

And it's trivial to do in Spice. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | The only thing bipartisan in this country is hypocrisy

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required