Previous in Forum: Any sites with free java tutorials?   Next in Forum: Formatting a virus affected harddisk
Close
Close
Close
14 comments
Rate Comments: Nested
Member

Join Date: Jun 2007
Posts: 8

Power Factor Measurement with PICs

06/21/2007 5:07 PM

I need to build a microcontroller Power Factor Meter, does any one know a technic to perfom it.? I use to work with PIC's. I know that measuring phase diference between Voltage an Current wave forms and doing the cosine, I'll find it, but how to perform the cosine calculations with a PIC.? I'm using the PIC Simulator (Basic compiler) from oshon soft, but it does not have trigonometric functions. Thanks in advance for any help.

Register to Reply
Pathfinder Tags: measurement pic's Power Factor
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
United States - Member - New Member Technical Fields - Technical Writing - New Member Popular Science - Weaponology - Organizer Hobbies - Target Shooting - New Member Engineering Fields - Nuclear Engineering - New Member

Join Date: Mar 2005
Posts: 2969
Good Answers: 33
#1

Re: Power Factor Measurement with PICs

06/22/2007 8:32 AM

Hi, egyr. What's a PIC? I'm not familiar with the acronym.

Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#2
In reply to #1

Re: Power Factor Measurement with PICs

06/22/2007 10:07 AM

Hello, PIC is a trade mark for the Microchip microcontroller family. Here is the Link http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=74 Such microcontroller are quite reliable and low cost. You can also findd a lot of support from various software/hardware developpers, such as complilers, programmers etc. Best Regards.. Enrique...

Register to Reply
Active Contributor

Join Date: Oct 2006
Location: San Diego, CA
Posts: 18
#3

Re: Power Factor Measurement with PICs

06/22/2007 11:36 PM

A cheat that I used on a different processor was to create a lookup table on the angles. Imagine an array that contains 3600 entries - this will give you an accuracy to .1 of a degree angle. Assign the respective cosine value (from a file) to each index into the array. The advantage of this technique is that it's FAST but not super accurate.

Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#6
In reply to #3

Re: Power Factor Measurement with PICs

06/23/2007 11:31 AM

Thankyou jmoliere, Yes the lookup table can do the job, one interrogation I have is that I dont know yet is the accuracy I'll need, this is first time to me to build a power factor meter for industrial purposes, it must only logg (not to control anything) 3 Phase Voltage, Current and Power Factor & time for energy quality supervision. I got another tip from Kjennejohn in a PIC discussion group is to add a low cost PIC math cooprocessor here is the link: http://awce. com/pak1. htm, I didnt knew math coprocessors where avalible, for this kind of instument I'm building may be the cost aprox $30.00usd is not a problem but for some other low cost projects cost will be important. I'm gonig to implement both solutions the lookup table and the math cooprocessor to get knowledge and experience on this matter. Once again thankyou....

Register to Reply
Guru

Join Date: Dec 2005
Location: Etats Unis
Posts: 1871
Good Answers: 45
#4

Re: Power Factor Measurement with PICs

06/23/2007 1:16 AM

You might look at some of Microchip's DSP libraries for their DSPic controllers. Also the lookup table can work very well if you have enough space for it. Also you may want to take a look at the TI MSP430 parts. They have a version that has three A-D converters that can sample simultaneously which could be useful.

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#7
In reply to #4

Re: Power Factor Measurement with PICs

06/23/2007 11:34 AM

Thanks rcapper, I w'll give a good look at the DSP libraries and to the TI MSP430 and I'll come back to give comment about it. Best Regards and thanks for your help.... enrique.

Register to Reply
Power-User

Join Date: Jan 2007
Location: Berlin (Germany)
Posts: 332
Good Answers: 1
#5

Re: Power Factor Measurement with PICs

06/23/2007 9:59 AM

Hello,
as jmoliere says you can build a lookup-table. Your memory may be small, if so, try to reduce the number of items:

For a resolution of 0.1 deg you dont need 3600 values but only 900 as the triangular functions are symmetric and can be completely described with a data set for 0-90 deg.

There are two ways to make a basic calculation as the largest gradient around zero determines the voltage or current resolution:

1. Your phase resolution is a must. Then take the 1/asin(alpha) and get the amplitude resolution of one half wave. In this example you get

sin(0.1)=1.745E-3 1/sin(0.1)=572

Full scale resolution is 572*2=1144, thats a little bit better than 10 bits.

2. Your ADC-resolution is given (mostly, because of hardware specs). Example: 12 bit

The least significant bit makes 0.488E-3 (resolution of amplitude, 1/2048)
asin(LSB)=2.79E-2 deg (worst resolution of period, determines the minimum
lookup table content.

Regards Uwe

__________________
The sum of intelligence on earth is a constant. And the population grows and grows and .....
Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#8
In reply to #5

Re: Power Factor Measurement with PICs

06/23/2007 11:43 AM

Right uweka, the jmoliere is a good choice, 0.1 degree I think is perfect, memory may not be a problem because this instrument as you may notice will logg all aquired data into a big I2C memory array. Please see the reply I did to jmoliere to findout my next steps. --- o --- Thankyou jmoliere, Yes the lookup table can do the job, one interrogation I have is that I dont know yet is the accuracy I'll need, this is first time to me to build a power factor meter for industrial purposes, it must only logg (not to control anything) 3 Phase Voltage, Current and Power Factor & time for energy quality supervision. I got another tip from Kjennejohn in a PIC discussion group is to add a low cost PIC math cooprocessor here is the link: http://awce. com/pak1. htm, I didnt knew math coprocessors where avalible, for this kind of instument I'm building may be the cost aprox $30.00usd is not a problem but for some other low cost projects cost will be important. I'm going to implement both solutions the lookup table and the math-coprocessor to get knowledge and experience on this matter. Once again thankyou.... --- o --- Best Regards..

Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#9
In reply to #5

Re: Power Factor Measurement with PICs

06/23/2007 11:46 AM

Forgot to tell you, "Excelent and well documented comments" Regards..

Register to Reply
Guru

Join Date: Jul 2006
Location: Eastern Kansas USA
Posts: 1503
Good Answers: 128
#12
In reply to #5

Re: Power Factor Measurement with PICs

06/26/2007 8:17 PM

I am impressed with your thoughts for determining the optimum number of lookup points, although much of it is "over my head". What about approximating the Cosine curve as a number of straight line segments, and do the lookup with straight line interpolation between points. Would this reduce the number of lookup points while leaving the magnitude of error sufficiently small? Or would this make the programming and related portions of the application too cumbersome for the processor being used?

-JMM

Register to Reply
Power-User

Join Date: Jan 2007
Location: Berlin (Germany)
Posts: 332
Good Answers: 1
#13
In reply to #12

Re: Power Factor Measurement with PICs

06/27/2007 3:51 AM

Hello JMM,

I hope I understand you right. The lookup table consists of numbers xn, xn+1 ---- xn+m which already describe the end points of the single line segments.

xn ; xn+1 ---> segm 1
xn+1 ; xn+1 ---> segm 2
.....

Of course then you can reduce your number of pairs and afterwords divide these segments in a linear way. In the 0 ... 90 deg and 180 ... 270 deg range you get a small positive angle error and in the range of 90 ... 180 and 270 ... 360 deg a negative phi error. But I didn`t evaluate wether its more effective to implement an interpolation routine or to put in some more lookup points. I think it depends totally on the hardware you use.

In other applications par example you can simply produce a rather good sine wave with harmonic distortion of less than 1% using 16 points per quarter wave.


Tnx for your additional hint.
Regards Uwe

__________________
The sum of intelligence on earth is a constant. And the population grows and grows and .....
Register to Reply
Guru

Join Date: Jul 2006
Location: Eastern Kansas USA
Posts: 1503
Good Answers: 128
#14
In reply to #13

Re: Power Factor Measurement with PICs

06/29/2007 4:14 PM

Uwe--

Yes, you understood my thought. One can even reduce the error further (or make the points further apart while staying within the same maximum error) by placing the points slightly beyond the actual value of the sine wave's curve, instead of at the actual value of the curve for that point. Thus the straight line segment starts above the curve at its first point, but then the curve crosses above the line segment and back below it before reaching the next point. The process would continue for each succeeding point. A least-squares type of formula could determine the value of each point for a given spacing of points along the curve.

--JMM

Register to Reply
Guru

Join Date: Aug 2006
Posts: 4484
Good Answers: 246
#10

Re: Power Factor Measurement with PICs

06/24/2007 1:00 AM

This may be a bit off the wall, but Bhaskara developed a formula for approximating the sin of angles. I just used to to calculate the sin of 1pi radians, and the value produced was .840 (vs .841 for my Windows' calculator). Here is an article that includes the formula. At some angles, this approximation can be off by 1.9%, but maybe it could work for your purposes, particularly if you put in some conditionals to correct the calculation for angle ranges where the deviation is greatest.

__________________
There is more to life than just eating mice.
Register to Reply
Member

Join Date: Jun 2007
Posts: 8
#11
In reply to #10

Re: Power Factor Measurement with PICs

06/25/2007 11:30 AM

Hi Blink, Definitively this is another aproach, I'm already tryng the formula with excel, it could be useful to reduce cost and execution time, besides it is easy to implement with regular compilers. Thank you Blink....!

Register to Reply
Register to Reply 14 comments
Copy to Clipboard

Users who posted comments:

Blink (1); egyr (6); jmoliere (1); jmueller (2); rcapper (1); Steve Melito (1); uweka (2)

Previous in Forum: Any sites with free java tutorials?   Next in Forum: Formatting a virus affected harddisk

Advertisement