14

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.

Hamed
  • 311
  • 1
  • 2
  • 10

2 Answers2

23

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

dim
  • 15,845
  • 3
  • 39
  • 84
  • 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) – Neil_UK May 31 '16 at 09:13
  • 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. – fearless_fool Nov 07 '16 at 04:11
  • 1
    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). – Semnodime Mar 26 '21 at 15:39
6

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.

Neil_UK
  • 158,152
  • 3
  • 173
  • 387
  • 1
    You can use ic on individual components too – PlasmaHH May 31 '16 at 08:28
  • 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... – dim May 31 '16 at 09:03
  • @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. – winny May 31 '16 at 09:04
  • @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. – Neil_UK May 31 '16 at 09:08
  • 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. – dim May 31 '16 at 09:20