LTspice: simulating temperature

I want to simulate the effect of temperature on a semiconductor.

I can use .temp ... or .option temp ... or .step temp ..., but all of these show multiple lines and I am not able to do anything with it in the simulation, for instance, having an op-amp/comparator react on the change in the forward voltage of the semiconductor.

LTspice has some tricks to convert a voltage to a resistance, like this:

Is there something similar to create a gradient in temperature from 0°C at the beginning of the simulation to 100°C at the end?

I think you just want a linear sweep of the temperature. If so, just use a card like this one:

.step temp 0 100 1


That sweeps from $$\0^\circ\text{C}\$$ to $$\100^\circ\text{C}\$$ in $$\1^\circ\text{C}\$$ increments.

I'd then set up a behavioral voltage supply and set it equal to temp. Then set the x-axis to its output.

Here's an example to illustrate:

Let me know if there's something I missed.

• thank you for the solution. I have created hundreds of simulations with .tran already, but I had never used .op before. With .op all the "duplicate" lines in the plot are gone and that makes it a lot easier to read. Jan 13 at 9:41
• @hennep I'm glad that helped. :) Jan 13 at 9:52
• There is still something I cannot solve. To be able to add a hysteresis resistor to an opamp, I need to reverse the temperature scale or better let the temperature go up in the first half and down in the second half of the scale. Using a PWL for voltage is also not possible because there is no time scale in the plot. Jan 13 at 11:47
• @hennep I can't offer a specific suggestion without seeing the situation. But if you post up a new question with an exact schematic that presents the specific issues, I'll try to help find an answer. Jan 13 at 12:00
• @hennep There is this reference that is worth reading closely about using LTspice and temperature sweeps. You may be able to consider that approach, as well, when considering getting a nice hysteresis loop plot. I've done it before, that way. But a lot depends on exactly what you are doing. Jan 13 at 13:05