problem to compute RC circuit in ngspice

Status
Not open for further replies.

indigo33

Newbie level 2
Joined
Jun 25, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
Hi,

I did the following analysis of a simple RC circuit in ngspice, it works fine.

V1 1 0 1
R1 1 2 100K
C1 2 0 10u
.ic V(1)=0 V(2)=0
.tran 0.2s 5s
.plot tran v(2,0)
.end

But, if I invert the order of R and C, the analysis starts with the capacitor already charge. Why? When components are in series, does the order matter?

V1 1 0 1
C1 1 2 10u
R1 2 0 100K
.ic V(1)=0 V(2)=0
.tran 0.2s 5s
.plot tran v(1,2)
.end
 

.tran 0.2s 5s uic
will force v(1) to 0, during the first time step it jumps to 1 as given by V1 1 0 1.

If not using uic, ngspice has to calculate an initial value with the contradictory inputs
V1 1 0 1 and
.ic V(1)=0
which leads to results depending on the circuit.

Even better would be not using just
V1 1 0 1, but
V1 1 0 1 pwl(0 0 0.2 0 0.205 1)
which will start with all zero and then pose a voltage jump with controlled slope at node 1.

Holger
 
Thank you very much! It works perfectly now.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…