Power Factor Measurement

How can I measure PF (power factor) of a circuit in the simulator ?

It would require the voltage and current waveform, over 1 cycle For example, as seen in a simple power supply rectifier followed by a capacitor input filter.

Since there is no built in measurement function for this, what is the best way to do this ?

Draw a circuit and post it here.
Mark the point (branch) where to mesure the power factor.
Define the power factor, derived from current and voltage, for a more or less arbitrary waveform. Give a function PF = f(V, I).

Then we might be able to measure it, e.g. by using a user defined function.

when you say power factor… do you really mean power factor or displacement power factor?
if it truly is PF you could determine it via V*A in and W out. if you want DPF you will need to isolate the fundemental of the current waveform to determine the phase shift. An FFT outputing phase information should do

First this circuit is giving me trouble this morning (Timestep too small…), or I would upload the file, that’s a different topic. Will fix that later.


This is a common simple power supply behavior, after C1 is charged, a current spike seen at R3 recharges C1 only when the AC is above the current C1 level.

I did find this interesting web page which is going to help.

https://www.monolithicpower.com/en/learning/resources/power-factor-correction

PF Circuit


Application: KiCad Schematic Editor x86_64 on x86_64

Version: 9.0.0-rc3-5ca7abf2c1~182~ubuntu24.04.1, release build

Libraries:
wxWidgets 3.2.4
FreeType 2.13.2
HarfBuzz 8.3.0
FontConfig 2.15.0
libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.7

Platform: Ubuntu 24.04.2 LTS, 64 bit, Little endian, wxGTK, X11, ubuntu, wayland
OpenGL: Intel, Mesa Intel(R) HD Graphics 530 (SKL GT2), 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1

Build Info:
Date: Feb 19 2025 14:50:32
wxWidgets: 3.2.4 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.83.0
OCC: 7.6.3
Curl: 8.5.0
ngspice: 43
Compiler: GCC 13.3.0 with C++ ABI 1018
KICAD_IPC_API=ON

Locale:
Lang: en_US
Enc: UTF-8
Num: 1,234.5
Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)

I forgot to mention where to measure PF.

V(V1) and I(V1) should be all the info needed, I think. The PF load on the power source is what is normally of interest. Then it will be useful for whatever circuit is downstream from it.

I went back to the 8.0 rather than nightly and have uploaded the zip file.

PF_Circuit.zip (7.2 KB)

Application: KiCad Schematic Editor x86_64 on x86_64

Version: 8.0.4, release build

Libraries:
wxWidgets 3.2.5
FreeType 2.13.2
HarfBuzz 8.1.1
FontConfig 2.15.0
libcurl/8.8.0-DEV OpenSSL/3.1.6 zlib/1.3.1 libidn2/2.3.4 libpsl/0.21.2 nghttp2/1.58.0

Platform: Freedesktop SDK 23.08 (Flatpak runtime), 64 bit, Little endian, wxGTK, X11, ubuntu, wayland
OpenGL: Intel, Mesa Intel(R) HD Graphics 530 (SKL GT2), 4.6 (Compatibility Profile) Mesa 24.1.3 (git-0c49f54c76)

Build Info:
Date: Jul 17 2024 04:02:12
wxWidgets: 3.2.5 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.85.0
OCC: 7.7.2
Curl: 8.8.0-DEV
ngspice: 43
Compiler: GCC 13.2.0 with C++ ABI 1018

Build settings:

I can’t help with the simulation part, just wanted to point out that v8.0.4 is quite old within the v8 releases. v8.0.9 is the (probably final) v8 release. Also, v9.0.0 is now fully released with many bug fixes between rc3 and the released build. In case you run into other issues, it may be worth updating to the most recent bugfix of whichever major version you choose to work with.

scone, thanks for the version info, but unfortunately I am having problems using apt for installing the stable version 9.0.0 .

The following packages have unmet dependencies:
 libocct-visualization-7.6t64 : Depends: occt-misc (= 7.6.3+dfsg1-7.1build1) but 1:7.6.3+dfsg1-8~ubuntu24.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

The latest snap package is 8.08

I had the unmet dependency warning. I uninstalled 8.08 first, then installed 9.00 and it worked

I fixed it by installing the specified version of occt-misc. So running 9.0.0 now. Thanks.

Using kicad 9.0.0

I added the MES1 component to get a pretty sine wave since V1 isn’t ground referenced
The circuit is finicky, some changes and the simulation won’t run
I tried to set the start stop time to get 2 full half cycles of relevant data
Avoided initial capacitor charge

I’m not at all sure I am computing the input apparent power correctly. Help.

AC Input Power
35.35 Vrms = 50V * .707 (50V peak was specified)
0.217 AMP rms ngspice measured
7.67 W = 35.35V * 0.217A
DC Output Power
2.33 W in R1 Load, NgSpice measured

PF Circuit

PF_Circuit.zip (9.1 KB)

In the 1970s I simulated AC>Bridge Rectifier>Filter Capacitor using a programmable calculator. (HP55 model number comes to mind as the first one with which I did this.) The results were pretty close to those on the bench, if I remember correctly. The HP55 had limited memory so I would have to run the program more than once for different outputs, such as RMS current and p-p output ripple.

Once I had a PC, It was do-able in Microsoft Excel.

The current pulses which I see in the graphical result above look surprisingly narrow.

They look about right, given the circumstances.
But using ideal diodes and a voltage source without output impedance will not give a realistic picture.

to be more realistic,

  • a real 1N4000 series diode model
  • Also, instead of just VSIN for the voltage source, I should represent the typical AC outlet, but I don’t know what that looks like.

This doesn’t have to be perfectly realistic, since my goal is to understand how to approximately compute the PF using spice.

I gave the generic diodes rs= .05ohm and it does run the simulation better.

I had been using the 45 degree diodes from the kicad standard library. Its possible that was part of my inconsistent simulations. So, here using the un-angled diodes, so far better results. Still not 100% sure why I had problems.

Updated circuit attached.

PF_Circuit2.zip (9.0 KB)

22.44W = Apparent power is RMS_I(V1) * RMS_V(V1) = 120*0.187
5.72W = Real Power AVG P(V1) as measured by ngSpice
???

PF = (True power)/(Apparent power)

Measurements by ngspice:

PF_MES

He shows this using ltspice, 2nd half deals with this type waveform.

I need to learn to use the four statement

It looks like the LT FOUR function automatically computes the PF while NG FOUR does not.

Here is the output of the LT version.

Fourier Function