# Capacitor Discharging Time under a Sinusoidal Voltage Source

I just can't find the correct solution to the following, pretty basic problem:

A capacitor $$\C\$$ is continuously discharged by a resistor $$\R\$$. This is easily described by an exponential decay ($$\\tau:= RC\$$): $$U_C(t)=U_{C,0}\exp(-t\tau^{-1})$$

Hence, a time $$\t_1\$$ can be calculated at which the voltage reaches a specific, lower voltage $$\U_1\$$: $$t_1 = -\tau\ln(U_1/U_{C,0})$$

Now consider a sinusoidal voltage source which, as its voltages increases over time, will reach the voltage of the discharging capacitor and will thus recharge it. I'm searching for this exact moment in time $$\t_2\$$.

My Approach: Equating the capacitor discharge formula and the given voltage function: $$\hat{U}\sin(\omega t_2) = U_{C,0}\exp(-t_2\tau^{-1})$$ Using Euler's Formula yields $$-\mathrm{i}\hat{U}\exp(\mathrm{i}\omega t_2) = U_{C,0}\exp(-t_2\tau^{-1})\\ \Longrightarrow\ \exp(\mathrm{i}\omega t_2+t_2\tau^{-1})=\mathrm{i}U_{C,0}/\hat{U}\\ \Longrightarrow\ \mathrm{i}\omega t_2+t_2\tau^{-1}=\ln(\mathrm{i}U_{C,0}/\hat{U})$$ Using the complex logarithm gives $$\mathrm{i}\omega t_2+t_2\tau^{-1}=\ln(U_{C,0}/\hat{U})+\mathrm{i}\arg(\mathrm{i}U_{C,0}/\hat{U})\\ \Longleftrightarrow\mathrm{i}\omega t_2+t_2\tau^{-1}=\ln(U_{C,0}/\hat{U})-\mathrm{i}(\pi/2+2k\pi)$$ Since we don't leave the first periodicity ($$\0\$$ to $$\2\pi\$$) $$\k=0\$$ should be applicable. We also expand the denominator: $$t_2=\frac{(\ln(U_{C,0}/\hat{U})-\mathrm{i}\pi/2)(\tau^{-1}-\mathrm{i}\omega)}{\omega^2+\tau^{-2}}$$ Only considering the real parts again yields $$t_2=\frac{\tau^{-1}\ln(U_{C,0}/\hat{U})-\omega\pi/2}{\omega^2+\tau^{-2}}$$ which sadly only returns unrealistic values in my simulation.

How can I find $$\t_2\$$ correctly?

Example: As requested, a short example is presented below. In this case $$\U_e=\hat{U}\sin(\omega t)\$$ is the input voltage used above. However, $$\R_1\$$ is the charging resistor and is not considered here as there already is a simple approximate for the time $$\t_1\$$ when the capacitor stops charging. Thus, $$\R:=R_2\$$ was used in my description above. I've marked the time $$\t_2\$$ at which I want to re-apply the current charge function which already is implemented for the first part ($$\t) of the capactior voltage function. The "finished simulation" would inlcude an alternation of charging (cap. voltage increases) and discharging (cap. voltage drops). I've plotted the given equation, which seems to lack an expected exponential decay: Using the following component values resulted in the following simulation result: Even though the extreme values seem to somewhat match, I'm really at a loss why your solution doesn't give the same result.

• try drawing a valid schematic – Tony Stewart EE75 Jan 8 '20 at 8:40
• The circuit you show and the waveform of capacitor voltage is wrong. The capacitor will charge up and down and somewhat follow the rectified mains waveform. – Andy aka Jan 8 '20 at 9:33
• @Andyaka Yes, you perfectly describe what I want to achieve. However, in order to correctly switch between the charging/discharging function I need to know the numerical value of t2: an equation for t2 is required. What you see on my graph is only the first charging and discharging process. E.g. for t>t2 another charging process would follow; as you've already correctly described. – Dennis H Jan 8 '20 at 9:47
• So is it your intention to connect a capacitor across a rectified ac supply, and you are asking how the remaining ripple depends on the value of the capacitor? – Clara Diaz Sanchez Jan 8 '20 at 14:40
• @ClaraDiazSanchez In some sense yes, but I'd heavily prefer a somewhat analytical solution because I want to apply that to the I-V-Characteristic of a MOSFET. The circuit above would be the gate driver (Gate after R1) of a "DC"-"DC"-Converter. – Dennis H Jan 10 '20 at 5:47

Well, we have the following circuit: simulate this circuit – Schematic created using CircuitLab

The input voltage is a rectified mains voltage, which can be mathematically written as follows:

$$\text{v}_\text{in}\left(t\right)=\left|\hat{\text{V}}_\text{i}\sin\left(\omega t\right)\right|\tag1$$

Using Laplace transform, we can write:

$$\text{V}_\text{in}\left(\text{s}\right)=\text{I}_\text{in}\left(\text{s}\right)\cdot\left(\text{R}_1+\frac{\text{R}_2}{1+\text{sCR}_2}\right)\tag2$$

Using the definition of the Laplace transform we get:

$$\text{V}_\text{in}\left(\text{s}\right)=\mathcal{L}_t\left[\text{v}_\text{in}\left(t\right)\right]_{\left(\text{s}\right)}=\int_0^\infty\text{v}_\text{in}\left(t\right)\exp\left(-\text{s}t\right)\space\text{d}t=\frac{\left|\hat{\text{V}}_\text{i}\right|\omega\coth\left(\frac{\pi\text{s}}{2\omega}\right)}{\text{s}^2+\omega^2}\tag3$$

The voltage across the capacitor is given by:

$$\text{V}_\text{C}\left(\text{s}\right)=\frac{1}{\text{sC}}\cdot\frac{\text{R}_2}{\text{R}_2+\frac{1}{\text{sC}}}\cdot\text{I}_\text{in}\left(\text{s}\right)\tag4$$

So:

$$\text{V}_\text{C}\left(\text{s}\right)=\frac{1}{\text{sC}}\cdot\frac{\text{R}_2}{\text{R}_2+\frac{1}{\text{sC}}}\cdot\frac{\left|\hat{\text{V}}_\text{i}\right|\omega\coth\left(\frac{\pi\text{s}}{2\omega}\right)}{\text{s}^2+\omega^2}\cdot\frac{1}{\text{R}_1+\frac{\text{R}_2}{1+\text{sCR}_2}}=$$ $$\frac{\left|\hat{\text{V}}_\text{i}\right|\omega\coth\left(\frac{\pi\text{s}}{2\omega}\right)}{\text{s}^2+\omega^2}\cdot\frac{1}{1+\frac{\text{R}_1}{\text{R}_2}\cdot\left(1+\text{sCR}_2\right)}\tag5$$

Using the properties of the Laplace transform, we can write:

$$\text{v}_\text{C}\left(t\right)=\frac{1}{\text{CR}_1}\int_0^t\left|\hat{\text{V}}_\text{i}\sin\left(\omega\left(t-\tau\right)\right)\right|\exp\left(-\frac{\left(\text{R}_1+\text{R}_2\right)\tau}{\text{C}\text{R}_1\text{R}_2}\right)\space\text{d}\tau\tag6$$

• Thanks for your answer, it's highly appreciated. I've never used this method before, so that might be an excuse why I'm stack at Eq.5, because I only get $1/(sCR_1+1)(sCR_2+1)$ for the second fraction, which would require the convolution to be applied another time. Nonetheless I graphed your solution and it doesn't show the expected exponential decay during the time the cap. discharges. Maybe this is related to vin(t) not being differentiable at t=pi/omega? – Dennis H Jan 10 '20 at 5:58
• I inserted a long comment as an answer about the case. The lack of exponential decay here is discussed, too. – user287001 Jan 10 '20 at 10:11
• @DennisH Well if you use WolframAlpha to check the fraction (code: TrueQ[(1/(s * c))*(b/(b+(1/(s * c))))*(1/(a+(b/(1+s * c * b))))==1/(1+(a/b)*(1+s * c * b))]) you will see that my equation is correct. – Jan Jan 10 '20 at 11:34

This is actually a comment, but comments this long are not allowed.

Your circuit (=R1+C+R2) has no rectifier and you showed the input voltage is full wave rectified sinusoidal. You have got an answer which shows the resulted capacitor voltage as a formula which is derived with Laplace transforms. That's exact and no problem there. You have even plotted the formula and it looks perfect.

But seemingly you wanted something totally else. You have in your thinking - not in the original circuit diagram - included a diode rectifier which changes the function totally. The capacitor in the original circuit is charged and discharged, too, by the supplying voltage source. Rectifier causes that only R2 discharges the capacitor You have found the right curve for it with simulation software.

The problem how to calculate exactly the resulted voltage curve can be solved only with numerical simulation. There's no formula for the point where the exponential decay meets the rising sinusoidal. In addition practical diodes cause voltage drop which depend in a complex way on the current. This all even with ideal diodes leads to transcendental equations which can be solved only numerically, the solution isn't writable with elementary functions. An infinite series perhaps can be presented but that's beyond my calculation capabilities.

Your attempt to solve the transcendental equation analytically unfortunately diverges in the beginning. You have extracted the sine from the Euler's formula totally in your own way. You omitted the cosine part of the formula.

Analytical solutions are used in simplified cases. As you see in your simulation, the decay of Vc looks linear after the input from diodes drops faster than VC and the next sine pulse hasnt got high enough. Assuming the decay of Vc linear (=constant load current) gives a possiblity to calculate the max. drop rate for allowed minimum Vc. From it one gets either the needed C or max. allowed load current.

If you need analytical solution you probably can make a numerical table for your own special function "tedmris" (= time for exponential decay to meet a rising sine). It's not worse than having a formula with sin, cos, exp, sqrt etc... which are already as tables or fast converging series in calculators. Some mathematically valid research of the properties of tedmris is needed to be able to keep the numbers of the parameters in minimum, to be able to simplify formulas algebraically and for finding a good way to calculate it and its inverse.