Author Topic: Phase/Capacitance calculation question.  (Read 5332 times)

0 Members and 1 Guest are viewing this topic.

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Phase/Capacitance calculation question.
« on: May 20, 2016, 01:28:11 am »
Hi Everyone.

I’m stuck interpreting some results from my experiments, and I think I’ve confused myself and hope someone can help clear it up. I’m playing around with the circuit pictures below, and I’m trying to use the voltage and current method to extract the phase and value of a capacitor. In the form pic is what I’m trying to do.

My DSO measures the phase shift of the resistor voltage to the capacitor voltage as ~ 33 degrees, which is about right as the calculated phase is 36.37 degrees.

The LT spice simulation shows V1, V2, and V3. V1, and V2 shows the R_current leading the C_voltage by about 33 degrees.

V3 is, V1-V2, the output from the diff-amp, and its phase difference from the sig_gen, is ~55 degrees. So the total phase shift is 33+52=85 degrees which agrees with my DSO value of ~84 degrees.

With the formulas above I can connect to my hardware to both channels of my function generator, dial up a frequency, and scan through 90 degrees of phase shift, and when I sample and run it through the algorithm, I can reliably measure the phase shift almost exactly as to what is displayed on my DSO.

Great!, but my capacitor value seems to be always out by a factor of 100. I connect V3 and V4 to my sampling circuit, with a 1uF cap in series with 100R, and I measure 100uF? Ive previously connected a 4.7uF and I measured about 470uF. The vales are not exact ie my MM measures the capacitor as 0.98uF, and my algorithm comes back as 93uF, and of course it changes with other caps as well.

Sure, it seems to me a scaling issue, but where?

Also does anyone know how to insert these mathtype formulas straight into the post?
« Last Edit: May 20, 2016, 01:40:15 am by kvresto »
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Phase/Capacitance calculation question.
« Reply #1 on: May 20, 2016, 01:46:46 am »
Well R1 is 100R.
.  That took much longer than I thought it would.
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #2 on: May 20, 2016, 04:32:09 am »
The correct answers for the calculated voltages are, for 1.0V at output of signal generator :-

Vresistor = 0.59296 at 53.632 degrees
Vcapacitor = 0.80523 at 36.367 degrees

This seems to be the same as your calculations, and close to what you measure. Your phasor diagram does not look quite right, because if you add the Vresistor vector to the Vcapacitor vector then this should equal the Vgenerator vector, but on your phasor diagram it does not. Maybe you did not draw it to scale.

We know that the capacitor is actually 1uF, because (presumably) it says so on the capacitor, and the circuit also behaves as for a 1 uF capacitor.

The only remaining question is why you don't 'measure' the capacitor as 1 uF, but apparently as 100 uF. I can't answer that, as you don't say how you 'measure' the capacitance, but however you are doing it, there is a x100 error either due to the instrument, your interpretation of what the instrument reads, or some other measurment error on your part.

Don't know what else there is to be said. Hope I understood what you were doing and asking.

Edit. Reading your post again, it's not clear what voltages you measure at V3 and V4. Never mind about phase for now. Can you tell us the magnitude of your measured V3 and V4? I would also get out your humble DVM, set on ACV, and measure V3, V4, and also directly measure the voltages across the 100 ohm resistor and 1uF capacitor, which of course should be the same as V3 and V4. Tell us the results of these measurements, and then explain exactly what puzzles you.
« Last Edit: May 20, 2016, 06:30:21 am by Zeranin »
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #3 on: May 20, 2016, 06:37:27 am »
Quote
Your phasor diagram does not look quite right

zeranin, going over my work, V3 is incorrect. Can you show me your calculations on how you got the resistor vector? (Vresistor = 0.59296 at 53.632 degrees)

thanks, I think you have understood my question very well.

EDIT: No worries, I'll make those measurements as soon as I get back to my bench this evening, I'll post my results.
« Last Edit: May 20, 2016, 06:39:00 am by kvresto »
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #4 on: May 20, 2016, 08:06:14 am »
Quote
Your phasor diagram does not look quite right

zeranin, going over my work, V3 is incorrect. Can you show me your calculations on how you got the resistor vector? (Vresistor = 0.59296 at 53.632 degrees)

thanks, I think you have understood my question very well.

EDIT: No worries, I'll make those measurements as soon as I get back to my bench this evening, I'll post my results.

I hurriedly scratched out the answer on the back of an envelope. There are many ways to skin a cat, but here’s how I did it.

Xc=1/(wC)=135.79 ohms

Z = SQRT(R^2 + Xc^2) = 168.64 ohms

For simplicity, set generator to 1.0 volts

I = V/Z = 1.0/Z = 5.93mA

Vresistor   = IR  = 0.59296 volts  (at angle theta wrt the generator)
Vcapacitor = IXc = 0.80523 volts (at angle beta wrt the generator)

Then draw your right-angled voltage vector triangle, with a hypotenuse of 1.0, lying along the Real x-axis.

Let theta be the angle between this horizontal hypotenuse, and Vresistor

Cos(theta) = 0.5926/1.0,   theta=53.632 degrees

From the triangle, beta=90-theta = 36.367 degrees
(or if you prefer, from Cos(beta)=0.80523/1.0)

No complex arithmetic required.  ;)

Cheers.
« Last Edit: May 20, 2016, 10:01:52 am by Zeranin »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Phase/Capacitance calculation question.
« Reply #5 on: May 20, 2016, 08:25:48 am »
Also does anyone know how to insert these mathtype formulas straight into the post?

Look for a LaTeX translation/export function, and put it in math mode in your post. Quote this to see what I mean... :)

\$ Z = \sqrt{R^2 + X^2} \$

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #6 on: May 20, 2016, 09:47:05 am »
zeranin,

Vsig=3Vpp
V3=1.6Vpp, 0.57Vrms
V4=2.44Vpp, 0.872Vrms
VR=0.568Vrms
VC=0.872Vrms.

Using the complex arithmetic  method, it appears only phase angle is correct, ie phi = 84.5 degrees, and phi = atan(Xs/Rs).
The calculated value for the cap (1uF) is not correct, ie C = 81.60uF, and C = 1 / (2*pi*f*Xs), f=1172Hz.
The ratio of Rs and Xs must be correct, because these phase calculations are confirmed by my DSO.

I want to keep working on this to get to the heart of my issue but I'm not sure how to proceed.

below are my calcs as per my matlab script:
 
Rs = ((Vp*Ip) + (Vq*Iq)) / ((Ip*Ip) + (Iq*Iq))
Xs = ((Vq*Ip) - (Vp*Iq)) / ((Ip*Ip) + (Iq*Iq))

Q = abs(abs(Xs)/Rs)

Z = sqrt((Rs*Rs) + (Xs*Xs))

phi = atan(Xs/Rs)

C = 1 / (2*pi*f*Xs)


Quote
Sin(theta) = 0.5926/1.0,   theta=53.632 degrees
zeranin, also sin(53.6) doesn't equal 0.5926, did I miss something. I admit I'm not picturing your description, can you draw it out, yep I always do better with pictures,,,, and really, really big letters :)


Thanks Tim







 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #7 on: May 20, 2016, 10:16:05 am »
Quote
Sin(theta) = 0.5926/1.0,   theta=53.632 degrees
zeranin, also sin(53.6) doesn't equal 0.5926, did I miss something. I admit I'm not picturing your description, can you draw it out, yep I always do better with pictures,,,, and really, really big letters :)

Thanks Tim

Ooops, sorry! I carelessly wrote SIN instead of COS, and have edited my previous posting accordingly. Well spotted. My result is correct though, the error being typographical only.

I'll take a look at the rest of your posting. Keep in mind that I solved the problem for Vsig=1.0, so you will need to scale all of my voltages by whatever your actual signal generator voltage is. It makes no difference whether we talk RMS, P-P or whatever, just as long as we are consistent throughout.

I presume that you followed my working up to :- Then draw your right-angled voltage vector triangle ...., is that correct?

 
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #8 on: May 20, 2016, 10:37:14 am »
It just occurred to me that we may be at cross purposes. What I did, was to calculate Vresistor and Vcapacitor, given that Vgenerator=1.0, f=1172Hz, R=100 ohms, and C=1.0 uF.

However, maybe what you want is the 'opposite'. You have experimentally measured Vresistor and Vcapacitor, and from this want to calculate C. Is that right? In that case, you don't need to measure phase angles at all just to determine C, though you can do so if you wish.

Tell me exactly what you want me to calculate.
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #9 on: May 20, 2016, 11:31:37 am »
It just occurred to me that we may be at cross purposes. What I did, was to calculate Vresistor and Vcapacitor, given that Vgenerator=1.0, f=1172Hz, R=100 ohms, and C=1.0 uF.

However, maybe what you want is the 'opposite'. You have experimentally measured Vresistor and Vcapacitor, and from this want to calculate C. Is that right? In that case, you don't need to measure phase angles at all just to determine C, though you can do so if you wish.

Tell me exactly what you want me to calculate.


If all you want to do is determine C from your experimentally measured Vresistor and Vcapacitor, then that's almost trivially easy. From measurement :-

Vresistor=Vr=1.60
Vcapacitor=Vc=2.44
f = 1172 Hz


I = Vr/R = Vc/Xc

Xc = R (Vc /Vr) = 100 x 2.44 / 1.60 = 152.5 ohms

C = 1/(2pi f Xc)
C = 0.89 uF

What's more, the value is not out by x100!


Let me make a general observation that might be helpful. Your data is not self-consistent.

As far a I can see, any calculation has to assume that your capacitor really does behave like a capacitor, with voltage and current shifted by 90 degrees. Likewise, we need to assume that your op-amps are not introducing additional phase shift. That being so, your data must 'add up' according to :-

Vsig^2 = Vr^2 + Vc^2
3^2 = 1.6^2 + 2.44^2
9 = 2.56 + 5.95
9 = 8.51

Unfortunately, as just demonstrated, your data does not 'add up' meaning it is not self consistent, meaning at least one of the measurements is wrong, or that there are additional phase shift(s) that we can't model, because we don't know if or where they occur. My calculation above for determining 'C' assumes that Vsig is wrong, and the measurements of Vr and Vc are correct, or at least in correct proportion. It seems to me that is the best you can do, and any calculation that purports to use all the data is fundamentally flawed right from the outset, given that the data is not self consistent.



« Last Edit: May 20, 2016, 11:44:37 am by Zeranin »
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #10 on: May 20, 2016, 12:21:24 pm »
Finally, you can also calculate 'C' from your phase shift measurements.

Let A be the phase angle between Vsig and Vr
Let B be the phase angle between Vsig and Vc

A=55 Degrees
B=33 Degrees

From the right-angle triangle phasor diagram that I referred to previously :-

COS(A)=Vr=IR
COS(B)=Vc=IXc

I Xc / Ir = Cos(B)/COS(A)
Xc=RCOS(B)/COS(A)
Xc=100 x 0.8387 / 0.6157
Xc = 136 Ohms


C = 1/(2pi x f x Xc)
C = 1/(2pi x 1172 x 136)

C = 0.998 uF

Not a bad match at all to 1uF  ;)

 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #11 on: May 20, 2016, 12:52:57 pm »
ok, let me re- read and digest, I''ll re post.

EDIT:
Quote
I presume that you followed my working up to :- Then draw your right-angled voltage vector triangle ...., is that correct?
yes,,, er I hope I did it correctly. But it was the only way I could get adj/hyp to work. Excuse my trig, its been too long.

Quote
Unfortunately, as just demonstrated, your data does not 'add up' meaning it is not self consistent
I see your point  Zeranin, and the numbers makes it clear.

Quote
or that there are additional phase shift(s) that we can't model
Interesting, I can look into this later by playing with the numbers and looking at what this algorithm spits out. So far I have only put in what I've measured.

The figures I posted are the correct values. My sig gen is also correct at 3Vpp, so then, additional phase shift, or other, I'll start to look into it.

Quote
It seems to me that is the best you can do, and any calculation that purports to use all the data is fundamentally flawed right from the outset, given that the data is not self consistent.
pretty much nails it.

Quote
You have experimentally measured Vresistor and Vcapacitor, and from this want to calculate C. Is that right?
yep, I want C, but I also want all the other values as well, ie phase, Z, Q, Xc, Rs, just experimenting at the moment, and I want to use this algorithm to do so.

Zeranin I think your calculation using first principles also shows Vc, and Vr measurements are correct, given that my DVM measures the capacitor I'm using at 0.93uF.

Quote
Finally, you can also calculate 'C' from your phase shift measurements.
great result, and something even a small micro can handle.
« Last Edit: May 20, 2016, 02:17:15 pm by kvresto »
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #12 on: May 20, 2016, 02:26:38 pm »
So just to re-cap, it seems to me that I've now got my phase measurements correct via my hardware and algorithm, as this was a problem earlier, but I still cant get any meaningful results out of the algorithm for the other parameters ie C, Z, Q, Xc, Rs, although as stated, the ratio of Xc and Rs is ok.
I would say good progress so far, very happy with that given this is a part time research project.
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #13 on: May 21, 2016, 01:30:35 am »
Zeranin, , just for the exercise I’m trying to scale my results to the generator voltage I’m using, and my calculation dont work out.

From your post reply #4, and your calculations, if I scale up to my generator voltage of 3Vpp, or 1.5Vp, or what ever, other than 1.0V, the current will change and so will the final angle.

Ie:

I = V/Z = 1.5/Z = 8.9mA

1/cos(0.89),   theta=27.12 degrees, no correct.

Anyway for completeness, below are LTSpice cursor delay calculations, along with the pics, just refer to the spice schematic above..

phi = 360*f*delta_t

V1_V2_phase = 360*f*86.2E-6 = 36.39
V1_V3_phase = 360*f*126E-6 = 53.2
V3_V4_phase = 360*f*212.3E-6 = 89.62


Cheers
« Last Edit: May 21, 2016, 01:33:37 am by kvresto »
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #14 on: May 21, 2016, 01:56:50 am »
Also as,
R=100R
C=1uF
f=1172

From the transfer function of the series RC circuit(LPF), we know, the magnitude and argument of Vcap = [0.806< -36.37]

then:
Vcapacitor = (0.806)*cos(-36.37) + (0.806)*sin(-36.37)
         =  0.6489 - j0.4781
and:
1 +j0 = generator voltage
then Vresistor must be:
(1 +j0) - (0.6489 - j0.4781) =   0.3511 + j0.4781
sqrt( 0.3511 ^2 + j0.4781^2) = 0.6244
atan(j0.4781/0.3511 ) = 53.7068 degrees
So then Vresistor is:
0.6244 < 53.71 degrees, which is not too far off what you previously calculated as, ( Cos(theta) = 0.5926/1.0,   theta=53.632 degrees )


How does that look?

EDIT: this is turning out to be a lesson in maths :)

more EDITS:
I forgot to multiply sin() and cos()with (0.806), I've made all the changes.
« Last Edit: May 21, 2016, 07:15:05 am by kvresto »
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #15 on: May 21, 2016, 07:35:11 am »
Zeranin, , just for the exercise I’m trying to scale my results to the generator voltage I’m using, and my calculation dont work out.

From your post reply #4, and your calculations, if I scale up to my generator voltage of 3Vpp, or 1.5Vp, or what ever, other than 1.0V, the current will change and so will the final angle.

Ie:

I = V/Z = 1.5/Z = 8.9mA

1/cos(0.89),   theta=27.12 degrees, no correct.


No correct, because you did not follow my example properly!

Here is my example done properly for Vsig=1.5 volts


Xc=1/(wC)=135.79 ohms

Z = SQRT(R^2 + Xc^2) = 168.64 ohms

Set generator to 1.5 volts

I = V/Z = 1.5/Z = 8.895mA

Vresistor   = IR  = 0.8895 volts  (at angle theta wrt the generator)
Vcapacitor = IXc = 1.2078 volts (at angle beta wrt the generator)

Then draw your right-angled voltage vector triangle, with a hypotenuse of 1.5, lying along the Real x-axis.

Let theta be the angle between this horizontal hypotenuse, and Vresistor

Cos(theta) = 0.8895/1.5,   theta=53.63 degrees

From the triangle, beta=90-theta = 36.37 degrees
(or if you prefer, from Cos(beta)=1.2078/1.5)


So of course the angles are the same as before, and rot my socks, I do believe that my results match LTspice simulations.  ;)

I'll go further, and say that if you use LT spice to report the voltages directly across R and C, you will get an exact match with my results, and any tiny difference will be due to LTspice, not the calculations.

My advice is to look very carefully at and try to understand all my calculations, because they are correct, and the method is easier than the method you are trying to use. If need be, I'll attach a sketch of the voltage vector diagram that I used, but you should be able to figure that out.

Then, try to duplicate these results using complex arithmetic.

 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #16 on: May 21, 2016, 09:48:54 am »
Yeh, I see where I went wrong, always looks obvious when looking back, and sure your method is far less computational, but for the exercise, for me, its been fun exploring these.
 

Offline Zeranin

  • Regular Contributor
  • *
  • Posts: 179
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #17 on: May 21, 2016, 10:20:32 am »
Looks like you are up and running, and now able to get the same correct results using a variety of methods, a good place to be.
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #18 on: May 21, 2016, 11:35:33 am »
Exactly, its all there. One more thing I need to investigate.
1) the quickest way to do the phase measurements.
            a) what I have already put together.
            b) or something like, phi = arcos(U.I / |U||I|)


« Last Edit: May 21, 2016, 01:10:48 pm by kvresto »
 

Offline kvrestoTopic starter

  • Regular Contributor
  • *
  • Posts: 164
  • Country: au
Re: Phase/Capacitance calculation question.
« Reply #19 on: May 21, 2016, 01:10:55 pm »
Thanks Zeranin for your patience and generosity.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf