• AVR Freaks

Helpful ReplyHot!C18 48bit addition to form kWh counter. (from page 3)

Page: << < ..6 Showing page 6 of 6
Author
Hen
Senior Member
  • Total Posts : 88
  • Reward points : 0
  • Joined: 2018/10/24 04:01:44
  • Location: 0
  • Status: offline
Re: 64bit addition. 2020/06/16 03:23:30 (permalink)
0
Nice, Andy grin: grin
 
Do you use the 18F87J72?
I have used it succesfully in several applications.
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 04:34:02 (permalink)
0
Hi Hen,
 
It is another solution but the 18F87J72 would be just right for that.
 
Thanks for info. I look closely at it.
 
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 06:52:47 (permalink)
0
Paul & NorthGuy,
 
You seem to have some experience with power measurement.
 
I have a small difference (approx. 1%) between L and N voltage measurements. The phase is not determined in Germany. The plug can be turned.
Is that known.
I have built in phase detection but wanted to know if it is basically like this?
 
 
NorthGuy
Super Member
  • Total Posts : 6288
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: 64bit addition. 2020/06/16 07:42:15 (permalink)
+3 (3)
andy_n
The phase is not determined in Germany.



Not that phase. When you use non-resistive loads, such as a motor, the current draw is shifted in time compared to voltage - the peaks in current do not coincide with peaks in voltage. This is called a phase shift. If it is 90 degrees, the power is zero despite huge swings in current - power factor (PF) is zero.
 
When you measure current (with current transformer), your measurement is also phase-shifted compared to actual current. This is called phase error. Phase error distorts PF and leads to errors in calculated power. If PF is 0.5-0.6 (as it is in inductive motor), a few degree phase error may lead to huge errors in your power measurements. If you use single ADC to measure both current and voltage, you can select the time between measurements equal to your phase error. This way, your consecutive readings of voltage and current will refer to the same point in time.
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 08:00:56 (permalink)
0
NorthGuy
 
I did not describe it correctly: not this phase grin: grin
You have (L) = Line and Neutral (N) in the power line.
The 'L' is not determined in Germany. The plug can be turned. No polarity L/N
 
If I turn the plag (change N with L) get different (ca. 1%) voltage measurement.
 
 
post edited by andy_n - 2020/06/16 08:29:43
moser
Super Member
  • Total Posts : 587
  • Reward points : 0
  • Joined: 2015/06/16 02:53:47
  • Location: Germany
  • Status: offline
Re: 64bit addition. 2020/06/16 09:04:27 (permalink)
+2 (2)
If rotating the plug makes a difference, then this is your measurement. If we assume that the device which you try to measure does not behave different, then physics is clear:
 
Vplug_not_rotated = - Vplug_rotated
Iplug_not_rotated = - Iplug_rotated
 
However, if the behavior of your device is affected by something else, for example it is electrically connected to another device which doesn't have its plug rotated, then this could in theory cause a different current behavior.
 
By the way, PStechPaul and NorthGuy are referring to the difference of
  • Active power
  • Reactive power
  • Apparent power (or Complex power)
See for example:
https://en.wikipedia.org/wiki/AC_power
https://en.wikipedia.org/wiki/Power_factor
 
crosland
Super Member
  • Total Posts : 2041
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: offline
Re: 64bit addition. 2020/06/16 09:11:53 (permalink)
+3 (3)
andy_n
I have a small difference (approx. 1%) between L and N voltage measurements. 



Measured relative to Earth? In which case are they guaranteed to be balanced? In the UK the N is tied to Earth..
 
Or simply the differential measurement between the two? In which case your measuring equipment is introducing an offset.
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 09:47:56 (permalink)
0
Active power, Reactive power, Apparent power are depending of PF. This works properly. 
 
Andrew:
Differential measurement between the two.
If the current measurement is at 'L', the voltage measurement is greater.
Can the L 'hum' like in audio amplifiers? grin: grin
No idea! 
 
 
dan1138
Super Member
  • Total Posts : 3840
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: 64bit addition. 2020/06/16 11:49:12 (permalink)
+2 (2)
andy_n,
 
What you described where the load can have L (LINE) and N (NEUTRAL) connected in any order is a problem for modern equipment that has a safety E (EARTH) ground connection, and is very dangerous in old equipment that does not.
 
That you see an error in power measurement in reversed connection suggests there is unmeasured current between the L (LINE) and E (EARTH) ground.
 
That you have not posted about equipment failures, explosions or fires would indicate that these kinds of connections are not so serious in your test environment.
 
Perhaps you should check with some real electrical power engineers rather that this nasty lot of ne'er-do-well reprobates (me included) that hang about this forum. :)
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 12:24:59 (permalink)
0
 
"unmeasured current between the L (LINE) and E (EARTH) ground." Is a good idea. 
 
Till now I found a lot of experience. 
I think "real electrical power engineers" has no time for practical problems.
Some answers have helped me a lot, fewer unnecessary questions.
Some claim to have the only correct answer. This is dangerous. grin: grin
 
 
 
post edited by andy_n - 2020/06/16 13:25:42
PStechPaul
Super Member
  • Total Posts : 2919
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: 64bit addition. 2020/06/16 14:44:01 (permalink)
+1 (1)
All the references I have found indicate that Germany (and most of the EU) use 230/400 volt service, and household 230 VAC sockets allow reversal of neutral and line. This necessitates the use of two pole switches and breakers on appliances, but distribution panels may have single pole breakers, fuses, and disconnects. The full three phase supply may be commonly available for many residents, and probably almost all commercial and industrial installations.
 
https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets
 
https://www.generatorsour...and_Hz_by_Country.aspx
 
Thus, it may be expected that a small error (or difference) may be found in voltage, current, and power measurement if line and neutral are reversed. The measurement device most likely has a grounded enclosure, which means that internal components may have some leakage or capacitive current to earth ground, and this could affect the measurement. The CT is the most likely source of error, as its potential to earth will change when line and neutral are reversed. Even if the device is fully insulated and lacks a ground connection (as would be the case with a battery operated DMM), there will still be capacitance and resistance to the earth reference, and prevailing power line EM radiation will be present unless all power lines and components are fully shielded.

 
andy_n
Senior Member
  • Total Posts : 155
  • Reward points : 0
  • Status: offline
Re: 64bit addition. 2020/06/16 22:21:40 (permalink)
0
Thanks Paul,
it have to be potential between L and Earth. N is practically Earth.
I've built L detection and can correct the problem.
PStechPaul
Super Member
  • Total Posts : 2919
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: 64bit addition. 2020/06/16 22:39:34 (permalink)
0
Sounds like you have a good handle on the situation.
 
Maybe it's time to change the title of this thread to something more appropriate, now that it's back on a good track. Lots of good info here, and it might help someone else with similar issues. ; )

 
GlennP
Super Member
  • Total Posts : 833
  • Reward points : 0
  • Joined: 2009/03/29 15:04:55
  • Location: El Paso County, CO, USA
  • Status: offline
Re: 64bit addition. 2020/06/16 23:16:53 (permalink)
+3 (3)
PStechPaul ...
Also, the RMS value will be 70.7% of peak value, or 362 counts. Thus the product will be a maximum of 131,000, or 17 bits. ...

Emphasis added.
 
Huh?  I must be missing something.  Doesn't one compute the product before doing the mean or the root?
 
I think the maximum product is -512 * -512 = 262,144, which is 2^18.
 
GP
 
Edit 1: square -> product in "Huh" line.
post edited by GlennP - 2020/06/16 23:28:31
PStechPaul
Super Member
  • Total Posts : 2919
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: 64bit addition. 2020/06/16 23:43:40 (permalink)
+1 (1)
If the waveform being measured is DC, or a square wave, then each measurement will be a maximum of either 512 or -512, and you would be correct that the square would be 2^18. But the readings for a sine wave having a peak value of +/-512 would have a sequence of readings (every 30 degrees for simplicity) of:
 
0, 256, 443, 512, 443, 256, ...
 
The squares (for RMS voltage or current) or products (for power) would be:
 
0, 65536, 196608, 262154, 196608, 65536, ...
 
The sum of squares (products) is 785724. Divide by six samples is 130954. The square root is 362, while 512/sqrt(2) = 362.
 
post edited by PStechPaul - 2020/06/16 23:55:08

 
Page: << < ..6 Showing page 6 of 6
Jump to:
© 2020 APG vNext Commercial Version 4.5