Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Power Factor calculator

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Tue Jul 14, 2020 12:36 pm    Post subject: Power Factor calculator Reply with quote

In AC circuits it is necessary to measure power factor to determine
actual power being used, its normally complicated thing to do.
But there is a old way with meters , resistor and pencil and paper
with help from a calculator to save paper.

Note resistor value only needs to be large enough to get a reasonable reading
its value is not used.

So I thought why not use an AVR even bascom simulator.

I will put together a circuit with an AVR when I get time.

Regards Paul


this is a diagram:



This code provides the power factor from measurements
Cos_phi is the answer

Code:

  $regfile = "m1284pdef.dat"                                ' specify the used micro

Const Xtal = 20000000                                       'use constant for baud rate

$crystal = Xtal                                             ' used crystal frequency
$baud = 9600                                                ' use baud rate
$hwstack = 100
$swstack = 100
$framesize = 150


      Dim Cos_phi As Single
      Dim U1 As Single
       Dim U2 As Single
        Dim U3 As Single
        Dim A1 As Single
         Dim A2 As Single
          Dim A3 As Single
           Dim A4 As Single



        U1 = 230
        U2 = 8
        U3 = 225

'Cos_phi =((u1 * U1) -(u2 * U2) -(u3 * U3)) /(2 * U2 * U3)


        A1 = U1 * U1
        A2 = U2 * U2
        A3 = U3 * U3
       A4 = 2 * U2
        A4 = A4 * U3



           Cos_phi = A1 - A2
            Cos_phi = Cos_phi - A3
            Cos_phi = Cos_phi / A4




Print Cos_phi

End
 
Back to top
View user's profile
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 282
Location: D.F.

mexico.gif
PostPosted: Wed Jul 15, 2020 2:37 am    Post subject: Reply with quote

Very Happy Very Happy
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum