# LTSpice: Can I vary schematic temperature over time?

I'm trying to simulate a temperature sensing schematic with a latching function (meaning that the schematic should go to overtemperature mode at let's say 75C and go back to normal at 50).

I can do a temperature sweep function with the command .temp 25 50 75. I see that the schematic responding well (I see that the forward diode voltage going down with a rate of -2mV/C as expected). But this means that the LTSpice engine does regular transient analisis for each temperature I'm giving, which stays constant over all the simulation time.

Actually I'd beter do only ONE transient with a temperature changing over the analisys time. I could pick a voltage source to be a temperature set point or may be there is a SPICE command that will tell the engine what I actually want to do with a temperature?

I see some models that containing another one pin representing the temperature of the chip. It can be connected to the heat sink with a capacitors (standing for corresponding thermal capacity), resistors (standing for correcponding thermal resistance). This technique looks very powerfull and accurate, but I will definitely struggle to find all needed components with this kind of thermal model, do accurately all thermal elements including heat sources. I don't actually need all this accuracy right now - all I need is to verify that the thermal protection will work fine at some certain points.

Any ideas?

• Last time I was looking into it I wasn't able to do it - a DC operation point analysis is not sufficient for your circuit I guess? – Arsenal Jan 19 '18 at 18:37
• @Arsenal thank you for your input! With a DC analisys I think I could do a 'versus temperature' analisys but it would be separated from dinamic proceses in the schematic. So I think that DC is a wrong way to solve my problem :( – Roman Matveev Jan 19 '18 at 18:48
• Yeah, I guessed so - last time I was lucky enough to be able to do a DC analysis, that's why I asked. – Arsenal Jan 19 '18 at 18:58
• Vary a threshold using 4-pin controlled source. The 2 input pins monitor some function of the temperature. The 2 output pins are used as you need, anywhere else in your circuit, knowing the output current or output voltage will vary with "temperature". – analogsystemsrf Jan 20 '18 at 3:28

LTspice only runs a .TRAN simulation at a single temperature. This temperature setting cannot be varied dynamically during the .TRAN simulation. And if you attempt to step the temperature (sweep it), you will instead get independent static simulations at those various temperatures. But you will not get a varying temperature during a single .TRAN simulation.

The complexity of the model behaviors with temperature incorporated, during a single .TRAN run, was considered to be too much to deal with well (back when.) I think some programs have managed to incorporate the idea. (I haven't used them, but I think I've heard word of it.) But not LTspice, so far as I'm aware.

What I'd try, I think, would depend upon the specifics. But broadly speaking, it breaks out something like this:

Isolate your circuit into two parts. One of the parts (call it TSENSE) is your "temperature sensor" part; the other is all the rest of the circuit (call it TFUNC.)

Perform a temperature sweep under .TRAN for TSENSE and capture some useful information; perform a .DC sweep where the 1st source is TEMP and then use .MEAS "at=" to capture some information for you under the "view/spice error log" menu option (which you can plot, too); or perform some .OP and capture the information that way. No matter which way you go, collect behavior information on current or voltage for the output of the TSENSE circuit.

This information must then be used to create a behavioral source that you can add into TFUNC for later testing.

So you now create a model device that is incorporated into TFUNC, which generates this range of current or voltage behavior over time. (Use 'time' as a variable for an equation, for example. Or use a table for a voltage or current source, with different times and values specified.) You will know the relationship between time and temperature, because you create that relationship here.

Once this is model device is ready, you can now add it to TFUNC in order to test TFUNC using .TRAN using the default temperature for the run. If it works well, given the new model device as its input, that's good. If so, perform a temperature sweep using .STEP TEMP on TFUNC to make sure that TFUNC always does the right thing when interpreting your model device's output, over the range of temperatures. (TFUNC should behave the similarly with respect to its model device's generated output, regardless of its operating temperature.)

Breaking it up into two parts like this allows you to use LTspice to achieve your goal. It's just not as easy as you'd like, is all.

• That sounds too complicated to be done by such a noob like me. I think that use of selfheating models would be much simplier (bad news for me - I still did not find ANY diode self-heating model). However I think that I understand your idea and I could simplify it to use in my (very simple) schematic. – Roman Matveev Jan 19 '18 at 18:55
• @RomanMatveev It depends upon your ability to isolate the circuit functions into the two parts I mentioned. If the circuit is a "black box" to you and you don't fully understand it, then this would be hopeless to attempt. However, if you are fully aware of the design (because you made it, yourself), then this usually isn't difficult to achieve because you know why your circuit works the way it does, which parts are sensing temperature and which are not supposed to do so. Either way, hopefully some of what I said helps a little. – jonk Jan 19 '18 at 18:59
• Adding to a diode a voltage source in a series representing a -2mV/C temperature drift should be great. I'm testing this right now. Thak you for the idea! – Roman Matveev Jan 19 '18 at 19:30

If there was a huge burning need to simulate temperature, and you wanted to rewrite every component in your simulation that requires temperature dependence, it could be possible to add b sources (sources that can have equations that set their voltage) with temperature dependent parameters. This could be done by adding a signal that varies the temperature over the simulation.

For example, here is a resistor that I've added a Tc into the equation that varies over the course of the simulation: