0
\$\begingroup\$

I am trying to learn LTspice. I have drawn a simple RC circuit and the probe-cursor is currently at the node connecting the cap and the resistor (Vc) (cursor image is not captured by PrintScreen).

I am expecting to see a slow voltage rise from 0 to 12 V on the graph, but instead I see a straight line:

enter image description here

However, if I change voltage source to pulse, I am getting the correct response:

enter image description here

What am I doing wrong?

\$\endgroup\$
1

3 Answers 3

3
\$\begingroup\$

In contrast with the other answers, you should actually avoid "Skip initial operating point solution" (i.e. the uic flag) whenever possible. The built-in LTspice help has a page on this explaining why.

Use Initial Conditions. Normally, a DC operating point analysis is performed before starting the transient analysis. This directive suppresses this initialization. The initial conditions of some circuit elements can be can be specified on an instance-per-instance basis. Uic is not a particularly recommended feature of SPICE. Skipping the DC operating point analysis leads to a nonphysical initial condition. For example, consider a voltage source connected in parallel to a capacitance. The node voltage is taken as zero if not specified. Then, in the first time step, an infinite current is required to charge the capacitor. The simulator cannot find a short enough time step to make the current nonsingular, and a "time step too small convergence fail" message is issued.


In your particular circuit, the better solution would be to use the "Start external DC supply voltages at 0V" (i.e. the startup flag). This approach is more representative of what you are actually simulating. Checking this option will impose a fixed ramp-up time of 20µs to all your DC supplies. In your case, it will make your 12V voltage source ramp from 0V to 12V linearly within the first 20µs of simulation time.

enter image description here


Alternatively, you can change your voltage source to a PWL function and use a custom startup ramp. Example below showing a 100ns ramp. This option is also useful if you have multiple DC sources and only want specific ones to perform the ramp-up.

enter image description here

\$\endgroup\$
2
\$\begingroup\$

For transient analysis (the card used is .TRAN), LTspice (and other Spice simulators) are often meant to simulate a circuit with an applied signal and non-linear devices, such as various semiconductors like BJTs and diodes, and devices having 'state' such as capacitors (charge) or inductors (current.) Usually there is more interest in the small-signal behavior, once the circuit "powers up", and less interest in the process of powering up, itself.

Spice simulators will usually first try to find the DC operating point of the circuit. This is called the "initial transient solution" step (sometimes shorted to "ITS"), which takes place immediately prior to \$t=0\$. This ITS step take into account the large scale non-linear behaviors of devices like BJTs and diodes, and also attempts to find the quiescent (after things settle down) voltage on capacitors and current through inductors. Once the ITS is performed then the simulation is allowed to start.

There is an option called UIC on the .TRAN card that will tell Spice to avoid this initial ITS step. The use of UIC means that Spice will not go through the ITS step. Instead, when using this option causes the initial value of every single energy storage (voltage/capacitor and current/inductor) device to be treated as zero -- except for those which are explicitly provided using the .IC card. (You can add as many .IC cards as you feel you need.)

In your initial case with the DC supply, LTspice performed the ITS step and found a quiescent DC voltage for the capacitor. Once set, the simulation started. But since the quiescent DC voltage was what things would look like "after a long time", there was nothing more to change once the simulation started up. So you just see a horizontal line.

Using the UIC option of the .TRAN card forces LTspice to avoid the ITS step and to set the voltage across the capacitor to zero and then start the simulation. Which seems to be what you wanted to see.

This is just a matter of learning more about Spice programs, generally. There are a few details like this that once you learn them, you will remember to apply them when you see a result like that. And then you'll be fine.

\$\endgroup\$
1
\$\begingroup\$

What am I doing wrong?

You need to tell LTspice to NOT calculate DC values first. It will default to doing a DC calculation and, conclude that the node you want to measure, will naturally reach 12 volts then, it will start plotting the voltage on that node. That's OK in most circuits but, not in this circuit.

There is a setting that disables LTspice from assuming you want a DC calculation done first before running transient analysis. It's called "skip initial operating point solution": -

enter image description here

Image from here.

If you were using Micro-cap simulation software you would uncheck this radio button: -

enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ That's it, thank you! \$\endgroup\$ Commented Feb 4, 2023 at 17:05
  • \$\begingroup\$ @JimmyFalcon have you used a circuit simulator before i.e. something other than LTspice? \$\endgroup\$
    – Andy aka
    Commented Feb 4, 2023 at 17:09
  • 2
    \$\begingroup\$ @JimmyFalcon you should check this as the answer, then. \$\endgroup\$
    – TimWescott
    Commented Feb 4, 2023 at 17:17
  • 1
    \$\begingroup\$ @JimmyFalcon Another way to do this is force the initial condition by using the .IC statement. In your project: .IC V(Vc)=0, or actually since you haven't labeled the net properly, .IC V(n002)=0. \$\endgroup\$
    – qrk
    Commented Feb 4, 2023 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.