I try to model a simple RC circuit with input of 2 A DC and I get an out voltage (Vc) of 2 TV. I am not sure what I am doing wrong.
EDIT: This is for MacOS
I guess, first off, your .TRAN card is providing \$10\:\text{s}\$ as an initial step-size guess (as well as a plotting increment.) This is unusual. But it's fine, too. I'm just being pedantic to note it here.
You are specifying an end-time of \$100\:\text{s}\$ for the run. Again, just being pedantic for now.
Spice simulators will usually first try to find the DC operating point of the circuit. This is called the "initial transient solution" step (sometimes shortened to ITS), which takes place immediately prior to \$t=0\$.
There is an option called UIC on the .TRAN card that will tell Spice to avoid this initial ITS step.
The use of UIC on the .TRAN card means that Spice will not go through the ITS step.
Instead, when using this option, 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.)
So, without the UIC option on the .TRAN card, Spice will go through the ITS step.
(In doing so, it will still look for specific .IC cards and set things as indicated. But aside from any modifications by .IC cards, the other energy storage devices (inductors and capacitors) will be initialized with zero stored energy.)
This means it will attempt to find a \$t\to\infty\$ solution before starting the run. And in your case, this means finding a very large result as the starting point of the run.
This isn't what you want.
So check off the UIC option of the .TRAN card. This will avoid the ITS step.
If you do as I suggested, then you will expect to see \$\frac{\text{d}\,V}{\text{d}t}=\frac{I}{C}=\frac{2\:\text{A}}{20\:\mu\text{F}}=100\:\text{k}\frac{\text{V}}{\text{s}}\$. So, in \$t=100\:\text{s}\$ you would expect to see \$10\:\text{MV}\$ at the output.
Let's see:
Yup! Looks right to me!
.tran
command directly, which also explains why they ended up with a strange .tran
command. Usually it's either 1, 3, or 4 time parameters. Never 2. Anyway, in one of Mike Engelhardt's live talks he boasted about this "new" UI in the Mac version. It seems like this same non-hand holding approach made its way over to QSPICE.
\$\endgroup\$
Commented
Jan 26 at 19:25
The problem is the simulation does a DC operating point, and so it runs the circuit and figures out the starting voltage. Sometimes it can get confused
"Ctrl-RightClick on the capacitor. In the SpiceLine cell, type "IC=0", for example, to set its initial voltage to 0V"
Changed 2V to 0V where applicable
Source: How to define the initial charge of a capacitor in SPICE
SpiceLine
field. Alternatively, you can just add the IC=0 right after the capacitance value such that it reads like this: 20u IC=0
.
\$\endgroup\$
Commented
Jan 26 at 19:17
Vc
is floating and therefore automatically adds (behind the scenes) a 1 teraohm resistor to ground. So 2A into 1 teraohm is equal to 2 teravolts. As explained in the answers, if you don't put an initial condition on the voltage across the capacitor then the simulation will begin with the capacitor fully charged and therefore an open circuit. So you just have I1, R1, and the "hidden" 1 teraohm resistor. Hope that makes sense. \$\endgroup\$