Initial Conditions

Initial conditions in the circuit can be set in two ways. First we can put an *.ic* statement,
which defines node voltages at time *t* = 0*ic* parameter of a device
instance (for example capacitor or inductor), which defines initial instance voltage or current.
Let us examine a simple circuit with one capacitor and two resistances.

r1 1 0 1

r2 2 0 1

c1 1 2 1

If we define an initial state with only one nodal voltage by *.ic* statement

.ic v(1)=1V

then the initial voltage *c1* is 1V. The same effect can be obtained by defining

.ic v(1)=2V v(2)=1V

Again the initial voltage on capacitor *c1* is 1V. Both examples are equivalent to defining initial capacitor voltage by

c1 1 2 1 ic=1V

If there is a nonsense like

c1 1 2 1 ic=1V

.ic v(1)=10V v(2)=1V

then *ic* parameter at element instance definition is considered.
So the initial capacitor voltage *t* = *t*_{0} = 0*SPICE*, which does not perform any analysis, but simply copies the *.ic* values as solutions for
*t* = *t*_{0} = 0

- in the first case we get
v(1) = 1V andv(2) = 0, - in the second case we get
v(1) = 2V andv(2) = 1V, - in the third case we get
v(1) = 0 andv(2) = 0 and - in the fourth case we get
v(1) = 10V andv(2) = 1V.

All four results are wrong. The only way to get a correct result for
*t* = *t*_{0} = 0

.ic v(1)=0.5V v(2)=-0.5V

In the first time point *t* = *t*_{1}*method* and *maxord* simulator options).

*t* = *t*_{1}, *n* = 1

*u*_{n - 1} = *u*_{t = 0}
... initial capacitor voltage, in our case 1V

D*t* = *t*_{1} - *t*_{0} =
*t*_{1}

Solving this circuit gives a correct results for *t* = *t*_{1}*t* = *t*_{2}, *t*_{3} ...*t* = 0.*icstep* simulator option. It uses the fact that the
circuit in the second figure gives the same results as the circuit in the third figure for D*t*
limiting towards 0. So before the circuit is analysed at *t* = *t*_{1}*t* = *t*_{1} / *icstep*.*t* = 0.*icstep* is large, than this solution is near the exact solution of the circuit shown in the second figure.
If parameter *icstep* is less than 1, it is ignored. The default value is 0.

So if the user wants to have a correct initial value in the resulting plot (solution vectors), than he has to
include an appropriate *.ic* statement or he has to set the *icstep* simulator parameter. In the first
case he has to know the initial node voltages, which is not usual. In the second case the simulator will work
transparently and the initial node voltages will be at least very near to the right ones. In our example circuit
we would reach this goal by issuing following line

.options icstep=1e9

*icstep* simulator parameter can also be changed through *set* command like all other parameters.