improvement of power factor in AC circuit
In this example, we will illustrate the use of C++ language for the calculation of improvement of power factor in an AC circuit.
Here’s a basic program in C++ that calculates the improvement of the power factor in an AC circuit:
#include <iostream.h>
#include <math.h>
#include <conio.h>
void main()
{
float voltage, current, opf, npf, activePower, reactivePower, apparentPower, orp, nrp, improvement;
clrscr();
cout << "Enter Voltage (V)";
cin >> voltage;
cout << "Enter current (A): ";
cin >> current;
cout << "Enter old power factor: ";
cin >> opr;
cout << "Enter new power factor: ";
cin >> npr;
activePower = voltage * current * npr;
orp = voltage * current * sqrt(1 - opf * opf);
nrpr = voltage * current * sqrt(1 - npf *npf);
apparentPower = sqrt(activePower * activePower + orp * orp);
improvement = (orp - nrp) / apparentPower * 100;
cout << "Improvement in Power Factor: " << improvement << "%" << endl;
getch();
}
Variables used:
orp: old reactive power
npf: new power factor
nrp: new reactive power
npr: new power reactive
opf: old power factor
npf: new power factor
Program takes as input the voltage, current, and old and new power factors of an AC circuit and calculates the improvement in the power factor using the formula:
Improvement = (Old Reactive Power – New Reactive Power) / Apparent Power * 100%
Where:
Old Reactive Power = Voltage * Current * sqrt(1 – Old Power Factor^2)
New Reactive Power = Voltage * Current * sqrt(1 – New Power Factor^2)
Apparent Power = sqrt(Active Power^2 + Old Reactive Power^2)
Active Power = Voltage * Current * New Power Factor
The sqrt function is from the math.h library and calculates the square root of a number.