Maker Pro
Managing temperature in LTSPICE

Managing temperature in LTSPICE

Simulating temperature dependency:
LTSPICE knows 2 ways of setting the temperature for a simulation:
  • global temperature for all devices
  • local temperature for selected devices
The global temperature can be set using the SPICE directive (see „Adding LTSPICE directives“) .TEMP, e.g. :

.TEMP 40
sets the temperature at 40 °C (note: LTSPICE uses degrees Centigrade, not Fahrenheit!)

The global temperature may also be stepped to cover a temperature range. For example:

.STEP temp -40 20 5
steps the global temperature from -40 °C to +20 °C in steps of 5 °.

The local temperature can be set by attaching the temperature to the device's value, see figure 1:

figure 1.png

Figure 1: 100kOhm, tc=50ppm, Temp=100 °C

In this example the resistor is 100kOhm at 27 °C (the default temperature for LTSPICE). The resistor is assigned a temperature coefficient of tc=0.00005=50ppm. The temperature of the resistor is set to 100 °C. In the same way the temperature can be set for other components, provided the component or the component's parameters support temperature dependency, e.g. transistors.

Another way of setting local temperature is using parametric values (“What if”), see figure 2:

figure 2.png

Figure 2: BC817 with parametric temperature value

BC817-40 temp={T1}
.PARAM T1=100 or
.STEP PARAM T1 -20 100 20
Where T1 is the parametric value and is either set to 100 °C (.PARAM directive) or is stepped from -20 °C to +100 °C (.STEP directive). Note that .PARAM and .STEP are mutually exclusive.

Global temperature setting and local temperature settings can be combined to simulate e.g. local heating due to power dissipation of power components.

SPICE help topics to look at: .TEMP, .STEP

Simulating an RTD sensor (e.g. PT100)
An RTD sensor (e.g. PT100) is characterized by a rather strong temperature dependency (as opposed to "standard" resistors where temperature dependency usually is an unwanted effect which manufacturers try to minimize). As such, an RTD sensor can be described by the same equation as a standard resistor, albeit with much larger temperature coefficients.

For example PT100 (http://en.wikipedia.org/wiki/Resistance_thermometer):
  • for Temp >= 0 °C:
    R = 100 Ohm * (1+ 3.9083*10 -3/° * Temp - 5.775*10-7/°² * Temp²)
  • for Temp < 0 °C:
    R = 100 Ohm * (1+ 3.9083*10 -3/° * Temp - 5.775*10-7/°² * Temp² - 4.183*10-12/°4 * (Temp -100 °) * Temp³)
where
  • 100 Ohm = resistance at 0 °C
  • Temp = temperature in °C
Due to the additional term of 4th order for temperature below 0 °C, LTSPICEs built-in temperature dependency for resistors („Simulating temperature dependency“) cannot be used. Instead a combination of parameters using SPICE directives needs to be called for help (see also „Using parametric values in LTSPICE“):

figure 3.png

Figure 3 sample PT100 circuit using parameters.

In figure 3 the following set of parameters is used to describe R1 as PT100 sensor:
.STEP param Temp -100 100 10
.PARAM tc1=3.9083e-3
.PARAM tc2=-5.775e-7
.PARAM tc3=-4.183e-12
.PARAM R0=100
.PARAM Rrtd=R0*(1 + (tc1*Temp)+(tc2*Temp**2) + tc3*(Temp-100)*(Temp**3)*(1-u(Temp)))
Note: LTSPICE uses "**" for exponentiation, thus a**b is a to the power of b or ab.

The temperature is stepped from -100 °C to +100 °C in steps of 10 °
The temperature coefficients tc1...tc3 are defined as parameters to improve readability of the final formula only. I could have put them directly into the equation. The same goes for the base resistance R0 = 100 Ohm at 0 °C.
The specialty shows in the expression 1-u(Temp) in the last line. The LTSPICE function u(x) is a step function with u(x)=1 for x > 0 and u(x)=0 else. By computing 1-u(Temp) the temperature coefficient tc3 is effective only if Temp < 0 °C.

See also: http://en.wikipedia.org/wiki/Resistance_thermometer

SPICE help topics to look at: .TEMP, .STEP, .PARAM

Harald Kapp, 2014-05-13
Author
Harald Kapp
Views
27
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Harald Kapp

Top