# Capacitor Transient Response

Discussion in 'Programmer's Corner' started by silv3r.m00n, Apr 15, 2010.

1. ### silv3r.m00n Thread Starter New Member

Apr 15, 2010
14
0
Hello

This chapter >> http://www.allaboutcircuits.com/vol_1/chpt_16/2.html
on Capacitor Transient Response has a spice program at the end as follows :

capacitor charging
v1 1 0 dc 15
r1 1 2 10k
c1 2 0 100u ic=0
.tran .5 10 uic
.plot tran v(2,0) v(1,2)
.end

When I run the program in spice i get the correct plot.
I want to see the current also.
so I added
.plot tran v(2,0) v(1,2) i(v1)

but the current graph is flat i.e. near zero values right from the beginning.

Current is supposed to start from v/r and then slowly become zero. But I cant see that in the plot.

Is my program wrong ?

Please help

2. ### SgtWookie Expert

Jul 17, 2007
22,202
1,793
Instead of i(v1), try i(r1) or i(c1).

3. ### n9352527 AAC Fanatic!

Oct 14, 2005
1,198
5
Or try plotting the current only, it might only a problem in Y-axis scale of the V and I.

4. ### silv3r.m00n Thread Starter New Member

Apr 15, 2010
14
0
i(r1) or i(c1) gives error : Error: no such vector r1#branch

I guess current can only be measured across a voltage source in spice.
To measure it across a particular resistance branch a false voltage source = 0V has to be added.

Silver

5. ### silv3r.m00n Thread Starter New Member

Apr 15, 2010
14
0
Worked.

But the current is mirror image. It starts from -V/R and slowly moves to 0.

I see this everywhere. Currents are always reversed.

Code ( (Unknown Language)):
1.
2. AC Source connected to a resistor
3. v1 1 0 ac sin(0 100 60 0 0)
4. rload 1 0 2
5. .tran 1m 30m
6. .plot tran v(1) i(v1)
7. .end
8.
The above simple program shows the plot of voltage and current. And they are out of phase by 180 degree. Why does this happen ? Is the program wrong somewhere. The current is supposed to be in phase with voltage.