Prev: unexpected delay in a TWT
Next: memristors
From: John Larkin on 18 Apr 2010 12:08 On Tue, 13 Apr 2010 10:58:03 -0700, Joerg <invalid(a)invalid.invalid> wrote: >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. What's interesting is simulating a resistor in hardware. A couple of people make VME and CPCI modules that have a lot of resistors and relays on board. They have limited ranges, nasty transient glitches, and tend to be not monotonic. And expensive. We did this one, which we recently spun (rev C!) to finally make it really good. It was a surprisingly difficult thing to do. http://www.highlandtechnology.com/DSS/V420DS.html It's full of MDACs, trim DACs, SSRs, bootstrapped opamps, and lots, lots of firmware and cal tables. John
From: Jim Thompson on 18 Apr 2010 13:11 On Sun, 18 Apr 2010 08:57:31 -0700, qrk <SpamTrap(a)spam.net> wrote: >On Sat, 17 Apr 2010 10:42:27 -0700, Jim Thompson ><To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: > >>On Sat, 17 Apr 2010 08:58:58 -0700, Jim Thompson >><To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >> >>>On Wed, 14 Apr 2010 10:14:33 -0700, qrk <SpamTrap(a)spam.net> wrote: >>> >>>[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. Yep, That's what I've found. >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. It's actually downright trivial to paste the table into a subcircuit, even if it's published in PDF form (given some nice editor like UltraEdit). So I'm abandoning my "solver" approach (3 data points from the "table" :-), in favor of copy-and-paste of the whole table, as in: *************************************************** ..SUBCKT Thermistor THERMP THERMN R_RCONVERGE THERMP THERMN 1G G_G1 THERMP THERMN VALUE {V(THERMP, THERMN)/V(DATATABLE)} R_RDUMMY DATATABLE 0 1K X_SUB1 DATATABLE 0 THERM_DATA ..ENDS Thermistor *************************************************** ..SUBCKT THERM_DATA RTP RTN E_THERM_DATA RTP RTN TABLE {TEMP} + -55 26618 + -50 19333 + -45 14198 + -40 10537 + -35 7899 + -30 5979 + -25 4566 + -20 3518 + -15 2733 + -10 2140 + -5 1689 + 0 1342 + 5 1074 + 10 865.6 + 15 701.9 + 20 572.7 + 25 470.0 + 30 387.9 + 35 321.9 + 40 268.6 + 45 225.2 + 50 189.7 + 55 160.5 + 60 136.5 + 65 116.5 + 70 99.92 + 75 86.01 + 80 74.32 + 85 64.46 + 90 56.11 + 95 49.01 + 100 42.95 + 105 37.76 + 110 33.30 + 115 29.45 + 120 26.13 + 125 23.24 ..ENDS THERM_DATA *************************************************** The data was directly copied and pasted from the first two columns of the PDF link that Joerg posted. Then cleaned up (in UltraEdit) in column mode, then processed with a macro to add the "continuation +" marks needed by Spice. Much like the tabular varicap subcircuit posted on my website. I'll (later :-) create an appropriate symbol, then post all of this method. ...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
From: Jim Thompson on 18 Apr 2010 13:15 On Sun, 18 Apr 2010 09:08:40 -0700, John Larkin <jjlarkin(a)highNOTlandTHIStechnologyPART.com> wrote: >On Tue, 13 Apr 2010 10:58:03 -0700, Joerg <invalid(a)invalid.invalid> >wrote: > >>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. > > > >What's interesting is simulating a resistor in hardware. A couple of >people make VME and CPCI modules that have a lot of resistors and >relays on board. They have limited ranges, nasty transient glitches, >and tend to be not monotonic. And expensive. > >We did this one, which we recently spun (rev C!) to finally make it >really good. It was a surprisingly difficult thing to do. > >http://www.highlandtechnology.com/DSS/V420DS.html > >It's full of MDACs, trim DACs, SSRs, bootstrapped opamps, and lots, >lots of firmware and cal tables. > >John Compliance (both ends to freely assignable nodes) might present some momentary difficulty... the rest is trivial :-) ...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
From: Jim Thompson on 18 Apr 2010 15:32 On Sat, 17 Apr 2010 12:43:01 -0700, Jim Thompson <To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >On Sat, 17 Apr 2010 12:38:29 -0700, Joerg <invalid(a)invalid.invalid> >wrote: > >>Jim Thompson wrote: >>> On Sat, 17 Apr 2010 08:58:58 -0700, Jim Thompson >>> <To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >>> >>>> On Wed, 14 Apr 2010 10:14:33 -0700, qrk <SpamTrap(a)spam.net> wrote: >>>> >>>> [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 :-) > >Got a table of values I can try out my model on? > >My guess is it'll run in seconds. > > ...Jim Thompson 0.03 seconds, -55�C to 125�C, in 1�C steps, using the full table method. ...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
From: Jim Thompson on 21 Apr 2010 20:09
On Sun, 18 Apr 2010 10:11:59 -0700, Jim Thompson <To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >On Sun, 18 Apr 2010 08:57:31 -0700, qrk <SpamTrap(a)spam.net> wrote: > >>On Sat, 17 Apr 2010 10:42:27 -0700, Jim Thompson >><To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >> >>>On Sat, 17 Apr 2010 08:58:58 -0700, Jim Thompson >>><To-Email-Use-The-Envelope-Icon(a)On-My-Web-Site.com> wrote: >>> >>>>On Wed, 14 Apr 2010 10:14:33 -0700, qrk <SpamTrap(a)spam.net> wrote: >>>> >>>>[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. > >Yep, That's what I've found. > >>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. > >It's actually downright trivial to paste the table into a subcircuit, >even if it's published in PDF form (given some nice editor like >UltraEdit). > >So I'm abandoning my "solver" approach (3 data points from the "table" >:-), in favor of copy-and-paste of the whole table, as in: > >*************************************************** >.SUBCKT Thermistor THERMP THERMN >R_RCONVERGE THERMP THERMN 1G >G_G1 THERMP THERMN VALUE {V(THERMP, THERMN)/V(DATATABLE)} >R_RDUMMY DATATABLE 0 1K >X_SUB1 DATATABLE 0 THERM_DATA >.ENDS Thermistor >*************************************************** >.SUBCKT THERM_DATA RTP RTN >E_THERM_DATA RTP RTN TABLE {TEMP} >+ -55 26618 >+ -50 19333 >+ -45 14198 >+ -40 10537 >+ -35 7899 >+ -30 5979 >+ -25 4566 >+ -20 3518 >+ -15 2733 >+ -10 2140 >+ -5 1689 >+ 0 1342 >+ 5 1074 >+ 10 865.6 >+ 15 701.9 >+ 20 572.7 >+ 25 470.0 >+ 30 387.9 >+ 35 321.9 >+ 40 268.6 >+ 45 225.2 >+ 50 189.7 >+ 55 160.5 >+ 60 136.5 >+ 65 116.5 >+ 70 99.92 >+ 75 86.01 >+ 80 74.32 >+ 85 64.46 >+ 90 56.11 >+ 95 49.01 >+ 100 42.95 >+ 105 37.76 >+ 110 33.30 >+ 115 29.45 >+ 120 26.13 >+ 125 23.24 >.ENDS THERM_DATA >*************************************************** > >The data was directly copied and pasted from the first two columns of >the PDF link that Joerg posted. > >Then cleaned up (in UltraEdit) in column mode, then processed with a >macro to add the "continuation +" marks needed by Spice. > >Much like the tabular varicap subcircuit posted on my website. > >I'll (later :-) create an appropriate symbol, then post all of this >method. > > ...Jim Thompson Surprise! Three point subcircuit fit, R0 (nominal at 25�C) and at the end points of the data (same as above)... generates a Steinhart-Hart equation accurate to �0.3%.... *************************************************** ..SUBCKT ThermistorSH3PT THERMP THERMN + PARAMS: R0=470 T0=25 R1=26618 T1=-55 R2=23.24 T2=125 ..PARAM TK0={T0+273.15} ..PARAM TK1={T1+273.15} ..PARAM TK2={T2+273.15} ..PARAM K01={TK0*TK1/(TK0-TK1)} ..PARAM K02={TK0*TK2/(TK2-TK0)} ..PARAM Q01={(TK0**3-TK1**3)/(TK0**3)/(TK1**3)} ..PARAM Q02={(TK2**3-TK0**3)/(TK0**3)/(TK2**3)} ..PARAM C={(K02*LOG(R0/R2)-K01*LOG(R1/R0))/((Q02*K02)-(Q01*K01))} ..PARAM B={K01*LOG(R1/R0)-C*K01*Q01} ..PARAM A={(-1)*(B/TK0+C/(TK0**3))} ..PARAM TK={TEMP+273.15} ..PARAM RT={R0*EXP(A+B/TK+C/(TK**3))} G_G1 THERMP THERMN VALUE {V(THERMP,THERMN)/RT} ..ENDS ThermistorSH3PT *************************************************** (Math all solved by PSpice within the subcircuit declaration :-) ...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 |