17
\$\begingroup\$

I would like to simulate a circuit with a capaciot in LTSPICE. In the first hand, I have tried to charge the capacitors in a period of time. However, the charging current is very high and I am not sure whether the capacitor will be completely charged or not.

Therefore, I am looking for a way to initiate the initial state of charge of a capacitor in SPICE.

\$\endgroup\$
1
  • \$\begingroup\$ Did you try looking at the documentation and the initial voltage setting? \$\endgroup\$
    – PlasmaHH
    Commented May 31, 2016 at 8:23

3 Answers 3

26
\$\begingroup\$

Ctrl-RightClick on the capacitor. In the SpiceLine cell, type "IC=2", for example, to set its initial voltage to 2V.

\$\endgroup\$
4
  • \$\begingroup\$ this method only works with certain OS's, doesn't work with OSX, even when you remember that CTRL is usually replaced by that weird flowery symbol key (the windoze key on a standard keyboard) \$\endgroup\$
    – Neil_UK
    Commented May 31, 2016 at 9:13
  • \$\begingroup\$ Neil_UK: Did you try [ctrl]-two-finger-click on the trackpad? One of common sources of complaint in OSX meets LTSpice is that that [cltr]-click is one style of "right click", two-finger-click is another form of "right click" In LTSpice, it makes a difference. \$\endgroup\$ Commented Nov 7, 2016 at 4:11
  • 2
    \$\begingroup\$ How does setting the initial condition for an inductor work? IC=2 in the spice line seems to have no effect. (I am aware of the .ic I(L1)=2 solution). \$\endgroup\$
    – Semnodime
    Commented Mar 26, 2021 at 15:39
  • \$\begingroup\$ Works verbatim on macos in LTSpice XVII. \$\endgroup\$ Commented Mar 19 at 16:36
8
\$\begingroup\$

Look up help on .IC, initial conditions. This is a directive you drop on the schematic (it finds its way into the spice file when it runs), that allows you to specify initial capacitor voltages and inductor currents, amongst other things.

This is in OSX, I think the GUI in different OS's may be different.

Remember the GUI is a front end for (more or less) standard SPICE. Anything that SPICE can do can be done in LTSPICE, just look at the help for exactly how to do it.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ You can use ic on individual components too \$\endgroup\$
    – PlasmaHH
    Commented May 31, 2016 at 8:28
  • \$\begingroup\$ Nobody will disagree that LTspice is a bit clunky (although I really thank Linear to give it for free). But your post looks more like a rant against LTspice than a real answer to the question... \$\endgroup\$
    – dim
    Commented May 31, 2016 at 9:03
  • \$\begingroup\$ @Neil_UK is correct. I just want to add that if the capacitor isn't connected to ground but at some floating potential, you are better off defining both ports of the capacitor to individual names and forcing both ports to some voltage relative to ground and the difference between them being the voltage you want on your capacitor. \$\endgroup\$
    – winny
    Commented May 31, 2016 at 9:04
  • \$\begingroup\$ @dim that wasn't my intention, I'll edit my answer to make it look less ranty. I was so blown away by the silky smoothness of Simetrix (notice I did not mention them in my answer) that I am really pi..ed that they cripple it to 140 nodes and no scripting for the free version. LTSpice might as well be a straight DOS app in comparison, but it works, anywhere, for any sized circuit, so you just have to suck up the learning curve and live with it. \$\endgroup\$
    – Neil_UK
    Commented May 31, 2016 at 9:08
  • \$\begingroup\$ No problem... I totally agree anyway. To be honest, I never really had the opportunity to use anything else, but I can easily imagine that other softwares are way better in terms of useability. Ah, yes, I tried to use Tina-TI: it looks nice, but I couldn't even find a way to get a simple graph of an arbitrary voltage node after the simulation had run. Also, simply running wires between pins made me mad. So I thought that, after all, LTspice wasn't that bad. \$\endgroup\$
    – dim
    Commented May 31, 2016 at 9:20
0
\$\begingroup\$

For a capacitor you can simply do, in the field of the cap value something like this:

1u, IC=3

and this appears to work.

But not for an inductor, for some reason...

\$\endgroup\$

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.