0
\$\begingroup\$

LTspice calculates the DC operating points for the below circuit as as:

enter image description here

I have couple of questions here:

1-) If I would perform DC operating point for this circuit with pen and paper, I would first: short all the inductors and open all the capacitors. But then circuit becomes as:

enter image description here

But this seems wrong. What am I doing wrong here?

2-) In LTspice if we do not skip the initial operating point solution and obtain results, is that equivalent to: we first do a DC operating point analysis and we set uic for each component and do a transient analysis?

\$\endgroup\$
  • 1
    \$\begingroup\$ Question 1: No, it's perfectly right. What makes you think it isn't? \$\endgroup\$ – The Photon Nov 16 '17 at 19:19
  • \$\begingroup\$ Question 2: Do you mean to say, "when we do a transient analysis..."? \$\endgroup\$ – The Photon Nov 16 '17 at 19:20
  • \$\begingroup\$ 1-) SPICE calculates some current values (device_current). But in mine the circuit is open device_currents are zero. 2-)I mean lets say first you didnt skip anything and did transient analyses usual default settings. Lets call this A. Then you opened the same circuit , but this time first you did a DC op analysis and found initial points(initial currents or voltages) and right after you added these initial conditions of all elements with uic command and run the simulation. Now call this one B. Is A and B same things? \$\endgroup\$ – user1999 Nov 16 '17 at 19:28
  • 1
    \$\begingroup\$ SPICE is only a numerical calculator. There will be rounding errors in every SPICE simulation result. Also, SPICE may do things like add gigohm resistors to ground at every node to allow its algorithms to work. \$\endgroup\$ – The Photon Nov 16 '17 at 19:31
5
\$\begingroup\$

I would first: short all the inductors and open all the capacitors. But this seems wrong. What am I doing wrong here?

SPICE is a numerical simulator. There is a rounding error in every SPICE result.

In particular, SPICE only tries to solve the node equations until the currents balance to within an error defined by the parameter ABSTOL. In LTSpice the default value of ABSTOL is 1 pA, so if the currents at any node balance to within 1 pA, LTSpice considers that "good enough". You can change the value of ABSTOL using a .OPTIONS directive.

The errors you see are on the order of 1 pA, so this is expected behavior.

In LTspice if we do not skip the initial operating point solution [when doing a transient analysis] and obtain results, is that equivalent to: we first do a DC operating point analysis and we set uic for each component and do a transient analysis?

Yes, this is equivalent.

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

I thought I'd add the actual situation with Spice. I think The Photon focused on a different answer than you were seeking, if I understand your question correctly.

Time domain analysis (.TRAN) computes the charges \$q\$ and fluxes \$\phi\$ for each capacitor and inductor in an initial step called an initial transient solution (ITS) step. This is often just called the "DC solution." It computes the initial values of capacitor voltages and inductor currents needed for the integration of the branch-constitutive equations (BCEs) which are set up for the capacitors and inductors using the following:

$$\begin{align*} i_C = \frac{\textrm{d}q}{\textrm{d} t} &= C\frac{\textrm{d}v_C}{\textrm{d} t}\label{bcec}\tag{$BCE_C$}\\\\ v_L = \frac{\textrm{d}\phi}{\textrm{d} t} &= L\frac{\textrm{d}i_L}{\textrm{d} t}\label{bcel}\tag{$BCE_L$}\\\\ \end{align*}$$

You can avoid this ITS step by adding the UIC keyword to the .TRAN card. In this case, the initial value of every voltage and current for capacitors and inductors is set to zero, excepting those cases where you may have added a .IC card setting them explicitly. If you use the UIC keyword, but don't want all the voltages and currents set to zero at the start, then you must add .IC cards for non-zero cases you want to ensure at the start.

(Using the UIC keyword on the .TRAN card is like using a step function on the circuit at \$t=0\$. You could explicitly provide such a step function using a PWL source in order to receive similar results.)


I won't get into too much detail. I don't think you are ready for it. But let's look at the following circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

Applying KCL, we get:

$$C\frac{\textrm{d}v_C}{\textrm{d} t}+i_L + \frac{v_C}{R}=I_1\label{kcl}\tag{KCL}$$

We need to use \$\ref{bcel}\$ above in order to substitute in for \$i_L\$ above. But to do that, we'd need to integrate. Instead, we take the differential of \$\ref{kcl}\$ to get:

$$C\frac{\textrm{d}^2v_C}{\textrm{d} t^2}+\frac{\textrm{d}i_L}{\textrm{d} t} + \frac{1}{R}\frac{\textrm{d}v_C}{\textrm{d} t}=\frac{\textrm{d} I_1}{\textrm{d} t}$$

Now, we can substitute in \$\ref{bcel}\$ directly:

$$\begin{align*} C\frac{\textrm{d}^2v_C}{\textrm{d} t^2}+\frac{v_C}{L} + \frac{1}{R}\frac{\textrm{d}v_C}{\textrm{d} t}&=\frac{\textrm{d} I_1}{\textrm{d} t}\\\\ \frac{\textrm{d}^2v_C}{\textrm{d} t^2} + \frac{1}{L\:R}\frac{\textrm{d}v_C}{\textrm{d} t}+\frac{v_C}{L\: C}&=\frac{1}{C}\frac{\textrm{d} I_1}{\textrm{d} t} \end{align*}$$

But we know a couple of things. One is that \$\frac{\textrm{d} I_1}{\textrm{d} t}=0\$. Also, in the steady state, \$\frac{\textrm{d}v_C}{\textrm{d} t}=0\$ and \$\frac{\textrm{d}^2 v_C}{\textrm{d} t^2}=0\$. So:

$$\begin{align*} \frac{v_C}{L\: C}&=0 \end{align*}$$

The solution is \$v_C=0\:\textrm{V}\$. So Spice computes that as the capacitor voltage prior to starting a run. Given that fact, the current in the resistor must also be zero. So that means \$i_L=1\:\textrm{mA}\$. So let's run Spice:

enter image description here

Note that the values are as I just predicted they would be. Spice did the ITS step using the BCEs. Solved the problem and gave you the steady state. Once that was running, there was no further need for change. So you see none. That's actually the final equilibrium values. Done.

Now, let's add the UIC keyword so that the initial values are set to zero (which won't make any difference to the starting value of \$v_C\$ but will make a difference to the starting value of \$i_L\$):

enter image description here

Ah! Now we can see what happens with the step function.


Spice does also have numerical issues to deal with, of course. So the values Spice actually finds in specific circumstances may need to respond to those limits. If you place a voltage source directly across an inductor, there is no possible equilibrium state as the equations diverge. In this case, Spice has to just "pick something big" and go with it. The actual computation of that "big value" will be based on the tolerance settings for Spice and other factors.

\$\endgroup\$
  • \$\begingroup\$ I see, I can also do the same thing by using: .ic v(n001) = 0 and run transient analysis. But regarding initial conditions and using .ic command; we can only set initial current for an inductor and initial voltage for a capacitor? Or we can set both? How about for R? \$\endgroup\$ – user1999 Nov 17 '17 at 3:35
  • \$\begingroup\$ @newage2000 The only thing that makes any sense for a capacitor is to set the charge \$q\$ to something other than zero. The only thing that makes any sense for an inductor is to set the flux \$\phi\$ to something other than zero. So this means you can set the voltage on the capacitor and the current in the inductor. A resistor doesn't have charge and doesn't have flux. So no, you can't set anything there. Charge and flux are "state variables." \$\endgroup\$ – jonk Nov 17 '17 at 5:59
  • \$\begingroup\$ ohh i see, thanks a lot. your example in the answer is also great like in other answers of yours. btw i read some of your answers and also now saw your profile it says interests electronics. i know it's not the platform but there is no other way to write to people here, may i ask you how could you learn electronics that much with thorough understanding yourself? just curious:)) \$\endgroup\$ – user1999 Nov 17 '17 at 9:01
  • \$\begingroup\$ @newage2000 I never took a single class on electronics, but benefited from many who wrote articles, books, built libraries, and gave their time generously to me. Plus, I invested my time too. It's mostly the time of so many others, given, plus a little effort of mine added in. I am in debt and an paying back when I'm able. \$\endgroup\$ – jonk Nov 17 '17 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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