.ic : LTspice -- Set Initial Conditions
This article details the use of the dot command ".ic".
The simulation time can be shortened by using ".ic" to set the initial conditions of voltage and current.
".ic" syntax
The ".ic" syntax is as follows. Normally, the initial condition at the start of a simulation is 0V, but by using ".ic", the initial conditions of voltage and current can be set to any value.
The ".ic" syntax is not very difficult. For example, to set the initial state of V(n001) to 5V at the start of the simulation, the syntax is as follows:
.ic V(n001)=5
Examples of ".ic" simulation
As an example of ".ic" simulation, we would like to shorten the simulation time to check the ripple voltage after the output voltage reaches steady state in the demonstration circuit of the LT3580, a boost/inverting DC-DC converter, using ".ic".
Click on the link below to go to the Analog Devices demo circuits download page.
Enter "LT3580" in the "Search" field. A link to the LT3580 demo circuit will appear in the search results.
To make the waveform of the simulation results easier to distinguish, connect the "SS" label to the SS pin (soft-start pin) of the LT3580 in advance.
After connecting the label, first run the simulation normally by clicking "Run" without ".ic".
Click "out" and "ss" on the LT3580 schematic with a voltage probe to display the "V(out)" and "V(ss)" voltage waveforms in the waveform viewer.
You can see that the LT3580 charges the SS pin voltage V(ss) to about 2.2V and the output voltage V(out) rises to 12V.
Furthermore, to check the ripple voltage after it becomes constant at 12V, we expand the range of V(out) from 0.5 to 0.6 msec.
Expanding the 0.5 to 0.6 msec range of V(out), the ripple voltage of V(out) was confirmed.
This simulation took about 17 seconds.
The reason the simulation takes so long is that it takes time to charge the voltage on the SS pin, which delays the rise of the output voltage.
Therefore, use ".ic" to set the initial condition of the SS pin voltage to 2V to shorten the time until the output voltage rises.
Add the ".ic" syntax, change the transient analysis time from 1 msec to 0.9 msec, and click "Run" to run the simulation.
The ".ic" syntax is described and placed as follows:
.ic V(ss)=2
The initial condition of the voltage on the SS pin of the LT3580 will now be 2V.
By setting the initial condition of the voltage on the SS pin of the LT3580 to 2 V, the rise time of the output voltage is shortened, so the transient analysis time is changed from 1 msec to 0.9 msec.
Also, uncheck "Start external DC supply voltage at 0V" because if it is left checked, the initial condition of the SS pin voltage will return to 0V at the start of the simulation even if the initial condition is set to 2V.
The initial condition of V(ss) is now 2V using ".ic" and the rise time until the output voltage V(out) is constant at 12V has been shortened by 100usec.
Therefore, even a transient analysis time of 0.9 msec is no problem at all, resulting in a shorter simulation time.
Of course, if you expand the 0.4 to 0.5 msec range of V(out), you can see the ripple voltage of V(out).
Simulation times can be viewed by clicking on "View-SPICE Error Log" and opening the log file.
Count | V(ss) Initial Condition: 0V Simulation Time | V(ss) Initial Condition: 2V Simulation Time |
---|---|---|
1st | 16.908sec | 16.531sec |
2nd | 16.654sec | 16.383sec |
3rd | 16.535sec | 16.386sec |
4th | 16.510sec | 16.404sec |
5th | 16.626sec | 16.372sec |
Average | 16.6466sec | 16.4152sec |
Comparing the simulation time when the initial condition of V(ss) is 0V and after changing the initial condition of V(ss) to 2V using ".ic", you see that the simulation time was shortened by 0.2314 seconds on average.
In this simulation example, the simulation time could not be shortened that much, but if the circuit is large, the effect of shortening the simulation time will be significant.