Go Down

Topic: Question re: phase lag on energy measurements (Read 11759 times)previous topic - next topic

Constantin

Aug 13, 2013, 03:58 am
Hi guys and gals,

I hooked up the front end of my ADC to my oscilloscope and measured something interesting. Specifically, there appears to be a variable phase lag between the transformer for the voltage signal (ERA 0.08VA) and the current transformer (CR Magnetics CR8348-2500-N) as a function of load. Voltage always is lagging current.

The phase lag ranges from ~ 1.32ms at a 40W load to 0.722ms lag with a 1340W load. Both loads have unitary gain, i.e. a 40W light bulb and a toaster. Is this normal?

pito

#1
Aug 13, 2013, 03:04 pm
What is the impedance of your mains?

Constantin

#2
Aug 13, 2013, 03:55 pmLast Edit: Aug 13, 2013, 03:58 pm by Constantin Reason: 1
Good question, Pito. I thought the impedance of mains is assumed to be very, very low. IIRC, the house has a 400 Ampere service feed @ 240VAC and the outlet is fed by 12AWG wire (@ 120VAC through a 15A circuit breaker). So I'd like to think that the impedance would be low. However, that jogs a memory. We did some past measurements here with high-powered microwaves that had a nasty tendency to depress the line voltage out of spec re: the test procedure. Only measuring at the panel worked (i.e. stay within 1% of the stated line voltage even with a 1800W load attached).

I will re-measure right at the panel and see if that influences the results. Thanks for the suggestion!

pito

#3
Aug 13, 2013, 04:29 pmLast Edit: Aug 13, 2013, 04:47 pm by pito Reason: 1
I've seen somewhere it could be (or it shall be) something like Z=0.4+j0.25 ohm in EU
PS:
IEC TR 60725:   0.4 + j0.25 ohm at 90% of sites
Zref_1phase = 0.40 + j0.25 ohm
Zref_3phase = 0.24 + j0.15 ohm
PS1: with precise measurements you have to consider impedance at higher harmonics too..

Constantin

#4
Aug 13, 2013, 08:44 pm
I hope to have a look tonight. Any idea how much the above references would influence the measurements of loads with a power factor of one? The two loads I tested both should be 1 as one is a light bulb, the other a toaster. Now the latter features relay/contactor and both also enjoyed a Killawatt being in the measurement circuit but I doubt the killawatt nor the contactor would have meaningful impacts on the measurements.

What was also very interesting is how much 'fuzzier' the current signal was. Far more noise there than on the voltage signal.

dc42

#5
Sep 01, 2013, 03:06 pm
1. Are you sure that your toaster is a pure resistive load? Many modern toasters include electronics to do timing etc. and the small amount of current taken to feed the electronics could be leading or lagging the voltage.

2. Have you tried looking at the mains voltage directly with the oscilloscope, to see how much lead/lag the voltage transformer introduces?

3. Do the voltages you get on the transformer secondaries look like good sinusoids? Can you see any variation of waveshape with load?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Constantin

#6
Sep 02, 2013, 03:32 amLast Edit: Sep 02, 2013, 03:39 am by Constantin Reason: 1

1. Are you sure that your toaster is a pure resistive load? Many modern toasters include electronics to do timing etc. and the small amount of current taken to feed the electronics could be leading or lagging the voltage.

Interesting thought. It never occurred to me that even a very small non-resistive component could have a measurable impact. I noted a similar lag however with an incandescent 40W lamp and a simple on/off switch.

2. Have you tried looking at the mains voltage directly with the oscilloscope, to see how much lead/lag the voltage transformer introduces?

Whoa... I don't think I'm comfortable to stick a oscilloscope probe into a mains outlet, even with a voltage divider circuit, etc... call me a ninny but my oscilloscope is PC-based and I'd be afraid the computer would turn into molten slag rather quickly in my hands...

3. Do the voltages you get on the transformer secondaries look like good sinusoids? Can you see any variation of waveshape with load?

The oscilloscope suggests that the curves are pretty good. However, one thing I noticed is that the usual approach of using sum(V^2) followed by a sqrt operation to determine Vrms is fraught with trouble when you start with a 16-bit ADC, take 1.4ksps, etc. Even the teensy 3 (a 32-bit platform) seems to require the use of the big numbers library to make it work because the Arduino 1.0x environment seems to continue to use 8-bit referenced variables (i.e. a long on a 32-bit ARM is not a 128 bit number).

dc42

#7
Sep 02, 2013, 11:03 am

The oscilloscope suggests that the curves are pretty good. However, one thing I noticed is that the usual approach of using sum(V^2) followed by a sqrt operation to determine Vrms is fraught with trouble when you start with a 16-bit ADC, take 1.4ksps, etc. Even the teensy 3 (a 32-bit platform) seems to require the use of the big numbers library to make it work because the Arduino 1.0x environment seems to continue to use 8-bit referenced variables (i.e. a long on a 32-bit ARM is not a 128 bit number).

Do you really need to use 16 bits to get the desired accuracy? I would have thought 10 to 12 was more than enough, so that the square will fit in 19 to 23 bits (bearing in mind that the square can be unsigned) and you can sum at least 512 samples using 32-bit maths.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Constantin

#8
Sep 02, 2013, 02:47 pm
Hi DC,

Well, put it this way - I'd love to be able to use a 16-bit number in order to differentiate this unit from the other stuff out there - like openenergymonitor, kill-a-watt, etc. The ADC can actually deliver a 24-bit output but I consider that resolution to be somewhat questionable in terms of what the upstream signal conditioning can handle, my ham-fisted attempts at PCB design , the ADC itself (MCP3911) and so on. So I stick to 16 bits. But summing squared 16-bit results does trend towards very big numbers!

dc42

#9
Sep 02, 2013, 03:09 pm
Using a 16-bit ADC may give you a very high resolution, but it won't give a correspondingly high accuracy, because of errors introduced by the current and voltage transformers. The behaviour of real transformers is non-linear and temperature-dependent. Try searching for "current transformer errors", "current transformer accuracy", "current transformer linearity" and similar terms.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

pito

#10
Sep 02, 2013, 06:56 pmLast Edit: Sep 02, 2013, 08:18 pm by pito Reason: 1
Quote
Even the teensy 3 (a 32-bit platform) seems to require the use of the big numbers library to make it work because the Arduino 1.0x environment seems to continue to use 8-bit referenced variables (i.e. a long on a 32-bit ARM is not a 128 bit number).. But summing squared 16-bit results does trend towards very big numbers!

I do not think it is an issue even for an 8bit arduino..

This works and takes 71ms per calculation (an example only):

Code: [Select]
`int mil, i, j, adc_i, adc_v;long long sum;mil = millis();for(i=1; i<=10; i++) { sum = 0LL; for(j=1; j<=512; j++){ adc_i = 29342 - j;  // ADC I adc_v = -29342 + j;  // ADC V sum = sum + ((long long)(adc_i) * (long long)(adc_i)); sum = sum + ((long long)(adc_v) * (long long)(adc_v)); }}mil = millis() - mil;Serial.println("############################");Serial.println(sum);Serial.println(sqrt(sum));Serial.println(mil/10);`

Results (sum, sqrt(sum), time elapsed for single j-loop):
Code: [Select]
`############################866291871232930748.0071`

You can store a sum of 2billions of 16bit adc samples squared into a single "long long" (int64_t), supported by arduino.

Constantin

#11
Sep 02, 2013, 10:31 pm
Hi Pito,

You are correct, 2^64 numbers are supported on the math side of the IDE, but try printing one.

My comment re: the Teensy 3 is that the IDE apparently has not caught up with the numbers that a 32 bit MCU will easily handle, etc. Hence my use of the big number library since it also allows me to print big numbers for debugging purposes.

pito

#12
Sep 03, 2013, 09:02 amLast Edit: Sep 03, 2013, 09:17 am by pito Reason: 1
And it prints 64bitters as well (see my above replay):

http://forum.arduino.cc/index.php?topic=179111.msg1375203#msg1375203

Just use the new print.cpp and print.h, it supports new floating point formats as well.
You have to enable it in print.h
Code: [Select]
`// uncomment if you want: int64 support, scientific notation and overflow testing#define PRINT_LONGLONG#define PRINT_SCIENTIFIC_AND_ENGINEERING#define PRINT_NAN_INF`

Code: [Select]
` sum = 123456789123456789LL; Serial.println(sum);        sum = -123456789123456789LL; Serial.println(sum);..123456789123456789-123456789123456789`

Constantin

#13
Sep 04, 2013, 04:47 pm
Hey, that's awesome news. I had no idea that Rob had updated print to allow longer numbers. I wish this was part of the default IDE.

MarkT

#14
Sep 21, 2013, 03:58 pm

Hi guys and gals,

I hooked up the front end of my ADC to my oscilloscope and measured something interesting. Specifically, there appears to be a variable phase lag between the transformer for the voltage signal (ERA 0.08VA) and the current transformer (CR Magnetics CR8348-2500-N) as a function of load. Voltage always is lagging current.

That's the difference between an actual and an ideal transformer.   With no load the transformer will approximate
an inductor in series with a resistor.

There may also be time delays in the measuring chain, which can be calibrated if you replace the transformer
directly with a resistive mains load like a tungsten bulb.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up