Simulating a variable resistance input with LTSpice?

formatting link

Yeah, I saw those. But it would be handy for the occasional user (like me) to have some basic math functions all boxed up; mul, log, antilog, clippers, deadband come to mind. Adds and subs are easy... just stack VCVS's.

They do have a programmable transzorb, which looks to me like a programmable clipper/deadband of sorts.

I Spice a circuit maybe once a month, if that, so it's a minor nuisance to prowl through the sometimes-helpful Help to re-learn the syntax for stuff like this.

John

Reply to
John Larkin
Loading thread data ...

formatting link

I find myself SPICE-ing many hours a week by now. With some of the more unorthodox circuits there is no other way. Like PWM chips used flat-out as solenoid drivers and so on.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

formatting link

Well, books are one thing but I usually must do what the manufacturer sez :-)

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

formatting link

formatting link

That ain't the normal thermistor curve. There are some switching types where there's reversal but those are typically used sans controller, as triggers, before something goes kablouie.

The client asked that they'd like to see at least 12 bits so I figure they have a reason for that.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

formatting link

I do most ordinary control loop design pretty much by eyeball Bode plot, math in my head. That's fine for stuff with plenty of margin. And design is usually easier than analysis.

The picosecond stuff has exotic parasitics and, usually, no worthwhile nonlinear device models, so that's out too.

I did do a fairly high-order loop simulation last week. It's technically a 4-20 mA output stage but can run in constant-voltage or constant-current mode, like a CV/CC power supply. The voltage/current mode transitions are interesting enough to make simulation worthwhile. I did it in LT Spice, but the loop will actually run in a 100 MHz ARM processor with ADCs/DACs and the actual loop coded in C. Should be interesting. There will be 13 ARMs and one FPGA on this VME board!

It is fun to Spice a circuit then implement it digitally. I've done lots of filters that way. I haven't found any references to implementing double-integrator (state-variable) or Sallen-Key active filters digitally, but they work great and are easy to design (right out of Don Lancaster's book!). One nice feature, compared to classic Z-1 butterfly filters, is that stage gain is exactly 1. If you round all the coefficients into right shifts, it's good to Spice it first to see how weird it will be.

Spice can simulate thermal systems, too. There are some surprisingly simple equivalences.

John

Reply to
John Larkin

formatting link

The manufacturer "sez" whatever is necessary to protect his ass :-)

To coin a "farmerism", the 3-term Steinhart-Hart equation is about as useful as teats on a boar hog :-)

The 2-term version is quite good enough for simulation work, and it converges nicely (the version, solved for R, that I posted above). ...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
Reply to
Jim Thompson

formatting link

formatting link

In the late '60's I had customers ask me for 16-bit audio for the sound system of an L1011... asking doesn't make them have a legitimate reason :-) ...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
Reply to
Jim Thompson

formatting link

formatting link

That was one fine aircraft. The best flight on one was with Air Caledonian from London to Shannon. With a grand total of about 20 passengers in there ...

Projects are sorta piling up here, this afternoon a new one in the aerospace field will be discussed. Why is it that you chip guys complain about a dry market inside the US and us hardware guys are living under a chunk of domestic projects?

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

I agree. And it was back in the days where stewardesses were pretty and had pleasant personalities :-)

I don't know. I'm finally starting to see inquiries from within the US, but they're coming via my SE Asia connections. Of course, manufacturing is to be done in mainland China :-) ...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
Reply to
Jim Thompson

For my consumer market designs that's sometimes also the case. But aerospace and similar high-end products like that are made right here in our country.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

Here's a couple NTC subcircuits I made up for PSpice. LTspice is compatible with PSpice syntax, so these should work. These respond to the temperature parameter in Spice. Easiest to use the Beta equation approximation, but Steinhart-Hart equation is a bit more accurate.

**************************************************
  • NTC resistor using the Beta equation: *
  • R = Ro * EXP(B*(1/T - 1/298.15)) *
  • Requires resistor value at 25 deg C and Beta *
  • which can be set in this subcircuit or passed *
  • thru the X instantiation. e.g. *
  • X1 1 0 THERMISTORntcB PARAMS: Ro=100k B=4300 *
  • Schematics component: RntcB *
  • By: Mark 26 March 2003 *
**************************************************
  • +------------------- NTC resistor terminals
  • |
  • |
+-------- Resistance at 25 deg C
  • |
| +- Beta value .SUBCKT THERMISTORntcB 1 2 PARAMS: Ro=10k B=4300 ETHERM 1 3 VALUE={ I(VSENSE)*Ro*EXP(B*(1/(TEMP+273.15)-1/298.15)) } VSENSE 3 2 DC 0 .ENDS THERMISTORntcB

*********************************************************

  • 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

Reply to
qrk

Hi Mark, That's the same _standard_ equation I posted, but Joerg seems to think he has to use Steinhart-Hart... he's fond of generating

3-place simulation "accuracy" from a 2-place data sheet ;-) ...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
Reply to
Jim Thompson

Spice has polynomial sources, though: start with X and Y, form X+Y and X-Y and then square those, subtract, and divide by four.

You can also do complex arithmetic in Excel, by using little 2x2 matrices... Excel has matrix invert, even, built-in. It's better than encryption, if someone is trying to look over your shoulder and figure out what's happening.

Reply to
whit3rd

If he wants to use Steinhart-Hart equation, I probably have a solver for the coefficients using Mathcad somewhere. I think I pulled that off an app note. The beta and S-H equations are pretty close to another if I recall correctly. That's why I have two different PSpice components - to please the inner "place".

Coefficients calculation given in this note:

formatting link

Excel solver:

formatting link

--
Mark
Reply to
qrk

formatting link

If I need it again I'll probably pour it into one large WAV file and feed that into SPICE. I know that sounds like cheating but then the PC doesn't have to crunch so much on every run. One value for every 0.5C or so should suffice.

formatting link

Thanks, for all the info, Mark. I'll take a look, but this small circuit had to be done quickly and is now finished.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

formatting link

formatting link

Hello Joerg,

I have sent you an email with an example using the models from Mark.. It's for LTspice of course.

Best regards, Helmut

Reply to
Helmut Sennewald

formatting link

formatting link

Thanks, Helmut, got it and will try it out this weekend. It was a little off when I sent the stuff to the client. The method with the formula in the resistor (controlled via voltage source) that I used yesterday did the trick but it does leave one weirdness: The x-axis of the plot is now labeled in kilovolts instead of kiloohms :-)

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

formatting link

formatting link

Hello Joerg,

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

Best regards, Helmut

Reply to
Helmut Sennewald

formatting link

formatting link

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.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

Mark,

It occurs to me, since I think, as an electrical engineer, in Ohms, rather than L/W, I twisted XFAB's resistor equations thusly...

*

----------------------------------------------------------------------

  • TYPICAL MEAN CONDITION
*

----------------------------------------------------------------------

  • NOTE: TNOM = 27 deg C
  • NOTE: Recommended minimum numbers of squares L/W > 5
  • NOTE: Contact resistance with maximum number of contacts is appr.
  • resrc={rcont/ncont/m}
  • ncont1=(1+((w-2*0.5e-06)/1.2e-06-0.499)) calculated,
  • but can exactly specified with parameter ncont
  • ncont=int(1+((w-2*0.5e-06)/1.2e-06-0.499))
  • VARIABLES: w,l=device width and length ; m, par1 = multiplier
  • .SUBCKT RPOLYH N1 N2 PARAMS: R=15K W=3u ;L=10u .PARAM M=1 NCONT=1000 ;PAR1=1 .PARAM RSH=3.5K .PARAM RSH0=3.5K .PARAM NCONT1={1+((W-2*0.5E-06)/1.2u-0.499)} .PARAM NCONT2={MIN(NCONT1,NCONT)} .PARAM NCONT3={MAX(1,NCONT2)} .PARAM RESRC={115/NCONT3/M} .PARAM RESRC0={115/NCONT3/M} .PARAM L={(R-2*RESRC0)*(W-0.12u)/RSH0} RC1 N1 NA {RESRC} TC=-0.95m,0.3u R1 NA NB {(3.5K*(L-(0.0))/(W-(0.12u)))/M} TC=-3.30m,10.9u RC2 NB N2 {RESRC} TC=-0.95m,0.3u C1 NA 0 {(5.40E-05*0.5*(W-(0.12u))*(L-(0.0))+3.80E-11*(L-(0.0)))*M} C2 NB 0 {(5.40E-05*0.5*(W-(0.12u))*(L-(0.0))+3.80E-11*(L-(0.0)))*M} .ENDS RPOLYH
*

----------------------------------------------------------------------

Thus I can do do a fit of Steinhart-Hart, with three point-pairs: R1, T1; R2, T2; R3, T3; then work backwards as you did, using PSpice's or LTspice's behavior language, to get to a standard subcircuit declaration.

Good mind teasing! Thanks, Mark! ...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
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.