Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

RC Circuit - Numerical time domain analysis

Status
Not open for further replies.

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
In a RC circuit, if the voltage source is a sinusoidal source, I found the given equation. C is constant.
I tried to solve this problem in time domain. So, I use a source in an EDA tool. I found the current in time. I know the voltage. I use simple numerical derivaton df(x)=[f(x2)-f(x1)]/(x2-x1). In this case, derivation is almost zero at the peak and bottom of the sinus. So, capacitance goes infinite. What am I doing wrong?
20150326_172155.jpg
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,664
Helped
14,077
Reputation
28,411
Reaction score
12,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
276,914
In this case, derivation is almost zero at the peak and bottom of the sinus. So, capacitance goes infinite.
C being a constant is a prerequisite of the differential equation.

You first have to find a steady state solution for i(t). You already know that it's sinusoidal, so you'll determine the magnitude and phase that allows for a constant C. Then calculate C.
 

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
Consider the C is zero. I mean there is no condition at the begining. If I solve the i(t), there is no requirement for the numerical solution. I would like to solve in Matlab without any pre-calculation. It may be more complex circuit.

- - - Updated - - -

Vs(t) may also be a composition of several sinusoidal signal. cos(wt)+cos(2wt) etc. So it becomes a very hard differential equation.
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,738
Helped
2,719
Reputation
5,434
Reaction score
2,636
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
102,538
Current always leads voltage by 90 degrees in a capacitor (when you apply AC sinewave). This is true for every capacitor you or I will ever test.

When you measure voltage, it is important which component you are reading across. The voltage amplitude peaks at different times, across different components in the circuit. Of course this goes against our intuitive sense.

However your instantaneous Ampere reading will be the same wherever you measure it, whether through supply, capacitor, or resistor. Of course this is easy for our intuitive sense to grasp.

It is only across the ohmic resistor, that V relates to A in linear proportion. This is not so in the other components.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,664
Helped
14,077
Reputation
28,411
Reaction score
12,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
276,914
Consider the C is zero.
That's in fact an easy case, i(t) will be zero as well.

Vs(t) may also be a composition of several sinusoidal signal. cos(wt)+cos(2wt) etc. So it becomes a very hard differential equation.
Yes, and not a particularly meaningful job. Solving steady state for linear AC networks can be done much easier.
 

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
I use a software to find voltage and current values. (You can see it.) Voltage shape is not very good, because capacitor is not ideal, its value changes by time. So, I am trying to find a capacitance value which depends on time, such as C(t). So, I am trying a basic numerical method. I can not solve any equation, because I do not have any equation. I have only measurements.
I have i(t) and v(t), so it looks very easy. However it does not work. What is wrong?

time-current.jpg
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,738
Helped
2,719
Reputation
5,434
Reaction score
2,636
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
102,538
Your waveforms appear to be textbook perfect. Almost anyway.

Current graph extends into the positive region a little.
It is slightly asymmetric (rises faster than it falls).
It leads the voltage graph by a little less than theory dictates.

These are small anomalies. The sort of things that might be accounted for by ESR changes in the capacitor depending on current flow, resistance changes in the power supply during each sine cycle, or the high frequency (8 GHz) acting on real components.

Are you testing real components?

- - - Updated - - -

 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,664
Helped
14,077
Reputation
28,411
Reaction score
12,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
276,914
I am trying to find a capacitance value which depends on time, such as C(t).
This creates a system of nonlinear differential equations, and also contradicts the assumption in post #1 (i(t) is differntial of capacitor voltage).

Nonlinear differntial equations can be analytically solved only in special cases, means you have to rely on numerical methods.
 

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
BradtheRad; This is a computer analysis output. I am trying to understand my circuit's response, so I need to find capacitance. It does not matter, because if we use your graphs, as you see derivation is zero at the top and bottom of the sinus. So, in a numerical solution C valuse goes verh high. I am trying to understand the problem on numerical solution.

FvM; Yes, it is a nonlinear capacitor. Before the nonlinear solution, I am trying the linear function. My basic numerical solution is not working. It is only OK for the decreasing or increasin part of the signal. In normal case, C should be constant, right?

Maybe I need to ask this question to a mathematical forum :)
 

_Eduardo_

Full Member level 5
Joined
Aug 31, 2009
Messages
292
Helped
118
Reputation
236
Reaction score
102
Trophy points
1,323
Location
Argentina
Activity points
2,733
So, is circuit theory wrong?
:)
No, your electrical skills are wrong ;)

If C variable, then

Ic.jpg

is not true.

Must be:

\[V_c(t) = V_s(t)-RI(t) \\
I(t)=\frac{d}{dt}(C(t) V_c(t))\]

Integrating both member

\[\int_0^t{I(t)dt = C(t) V_c(t) - C(0) V_c(0) = C(t) V_c(t) + K\]

Naming \[II(t)=\int_0^t{I(t)dt\] (by numerical methods)

Then \[K = II(t_z)\] where \[t_z\] is the time when \[V_c=0\]
 
  • Like
Reactions: ferdem and FvM

    FvM

    points: 2
    Helpful Answer Positive Rating

    ferdem

    points: 2
    Helpful Answer Positive Rating

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
I know the variable C equation. Consider that C is constant. So this is true:
Ic.jpg
Denominator still goes zero... So, C is not constant? How can we verify this equation?
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,738
Helped
2,719
Reputation
5,434
Reaction score
2,636
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
102,538
Anomalies appear when you apply sinewaves to a capacitor.

This simulation tells more of the story than my previous screenshot (post #7).



No two waveforms are aligned (except the R voltage and current).

Current leads both supply V and capacitor V.

Current peaks when capacitor V is zero.
Capacitor V peaks when current is zero.

These observations may or may not explain how the math works.

Or else, math might be able to explain what is happening, and I can see it in action... Nevertheless my mind still has trouble getting a handle on it.
 

_Eduardo_

Full Member level 5
Joined
Aug 31, 2009
Messages
292
Helped
118
Reputation
236
Reaction score
102
Trophy points
1,323
Location
Argentina
Activity points
2,733
I know the variable C equation. Consider that C is constant. So this is true:
View attachment 116168
Denominator still goes zero... So, C is not constant? How can we verify this equation?
If your circuit perfectly match your proposed model (RC series), then is always verified:

\[C = \frac {I(t)} {\frac{d}{dt}(V_s(t)-R\;I(t))}\] for all t

Of course, when the denominator go to zero the numerator too.


But your current measurements has a slight asymmetry -> your model is not appropriate.
A C with a leakage resistance will be better.

Furthermore, you have a few points and made a numerical derivation ==> Giant errors.
Errors that have higher incidence precisely when the denominator approaches 0 ==> is always better integrate numerically derived.


Finally, if you find differences between the results of your procedure and the circuit theory, remember there are 99.99999% chance that you are wrong.
Therefore, you save time searching your error instead the theory error.
 

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
Thanks for the interting ideas. However we did not have an answer yet. I think I have enough data, I use MATLAB and resolution is smaller than 10^-24. I checked the numerical derivation, it is very OK.

I added my numerical solution. If we neclect R, and input voltage is sin(t), i(t) becomes cos(t). so it seems C value turns to tan(t) function. At first, I thought it is a kind of boundry value problem, but as you see there is no constant point at the drawing. So, I dont know which part is useful for me.
blue line is voltage, green line is current, red line is C value. all vaues are normalized. as you see, when derivation goes zero, capacitance goes infinite. Additionally, C is always changing... That is my problem, why C is always changing at the numerical analysis?

View attachment 116440
 

ferdem

Advanced Member level 4
Joined
Oct 18, 2008
Messages
115
Helped
29
Reputation
58
Reaction score
26
Trophy points
1,308
Location
Türkiye
Activity points
2,297
If we neclect R, and input voltage is sin(t), i(t) becomes cos(t). so it seems C value turns to tan(t) function.
NO.
How is it tan(t)? It is still constant.
I guess I have found the bug! :)
 

Ratch

Advanced Member level 1
Joined
Mar 20, 2012
Messages
401
Helped
74
Reputation
148
Reaction score
72
Trophy points
1,308
Activity points
4,178
In a RC circuit, if the voltage source is a sinusoidal source, I found the given equation. C is constant.
I tried to solve this problem in time domain. So, I use a source in an EDA tool. I found the current in time. I know the voltage. I use simple numerical derivaton df(x)=[f(x2)-f(x1)]/(x2-x1). In this case, derivation is almost zero at the peak and bottom of the sinus. So, capacitance goes infinite. What am I doing wrong?
View attachment 115956
Since this is a circuit driven by a sinusoidal source, you can find out everything by using phasors. No derivatives are needed. What are you trying to find out, anyway? You don't say what it is.

Ratch
 

Osman Ceylan

Junior Member level 1
Joined
Mar 26, 2015
Messages
19
Helped
5
Reputation
10
Reaction score
5
Trophy points
3
Activity points
129
Ratch, I am looking for time domain numerical solution.

Guys, please do not try to change topic. I know phasor, I know differential equations, I know everything about the circuit theory. I do not know how to solve this problem in MATLAB in time domain. No hand-solution, no differential equation, no analysis on paper.

Is it clear enough?
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top