Prev: unexpected delay in a TWT
Next: memristors
From: Jim Thompson on 14 Apr 2010 13:23 On Wed, 14 Apr 2010 10:14:33 -0700, qrk <SpamTrap(a)spam.net> 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. >> >>Tried to make a voltage dependent resistor this way: >> >>http://www.electro-tech-online.com/attachments/general-electronics-chat/40714d1269571000-sine-variable-resistor-ltspice-d2.png >> >>It works but is incredibly slow. Any better ideas? > >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 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
From: whit3rd on 14 Apr 2010 13:56 On Apr 13, 11:26 am, John Larkin <jjlar...(a)highNOTlandTHIStechnologyPART.com> wrote: > On Tue, 13 Apr 2010 10:58:03 -0700, Joerg <inva...(a)invalid.invalid> > wrote: > >Got stuck when trying to simulate an NTC. This temperature-variant > >resistor will be the only variable input > >Tried to make a voltage dependent resistor... > 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. 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.
From: qrk on 14 Apr 2010 14:47 On Wed, 14 Apr 2010 10:23:14 -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: > >>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. >>> >>>Tried to make a voltage dependent resistor this way: >>> >>>http://www.electro-tech-online.com/attachments/general-electronics-chat/40714d1269571000-sine-variable-resistor-ltspice-d2.png >>> >>>It works but is incredibly slow. Any better ideas? >> >>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 > >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 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: http://www.cornerstonesensors.com/reports/AboutEquation.pdf Excel solver: http://www.ilxlightwave.com/appnotes/AN%204%20REV02%20Thermistor%20Calibration%20and%20Steinhart%20Hart.pdf -- Mark
From: Joerg on 14 Apr 2010 15:45 qrk wrote: > On Wed, 14 Apr 2010 10:23:14 -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: >> >>> 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. >>>> >>>> Tried to make a voltage dependent resistor this way: >>>> >>>> http://www.electro-tech-online.com/attachments/general-electronics-chat/40714d1269571000-sine-variable-resistor-ltspice-d2.png >>>> >>>> It works but is incredibly slow. Any better ideas? >>> 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 >> 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 > > 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". > 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. > Coefficients calculation given in this note: > http://www.cornerstonesensors.com/reports/AboutEquation.pdf > > Excel solver: > http://www.ilxlightwave.com/appnotes/AN%204%20REV02%20Thermistor%20Calibration%20and%20Steinhart%20Hart.pdf > 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.
From: Helmut Sennewald on 14 Apr 2010 16:00
"Joerg" <invalid(a)invalid.invalid> schrieb im Newsbeitrag news:82mkahF8k0U1(a)mid.individual.net... > qrk wrote: >> On Wed, 14 Apr 2010 10:23:14 -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: >>> >>>> 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. >>>>> >>>>> Tried to make a voltage dependent resistor this way: >>>>> >>>>> http://www.electro-tech-online.com/attachments/general-electronics-chat/40714d1269571000-sine-variable-resistor-ltspice-d2.png >>>>> >>>>> It works but is incredibly slow. Any better ideas? >>>> 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 >>> 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 >> >> 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". >> > > 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. > > >> Coefficients calculation given in this note: >> http://www.cornerstonesensors.com/reports/AboutEquation.pdf >> >> Excel solver: >> http://www.ilxlightwave.com/appnotes/AN%204%20REV02%20Thermistor%20Calibration%20and%20Steinhart%20Hart.pdf >> > > 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. 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 |