Closed ted32 closed 6 years ago
Dear How I can change power factor meter readings from value of cos φ to arccos φ to get reading results in degree ?
LiquidCrystal lcd(PA0, PA1, PA2, PA3, PA4, PA5); EnergyMonitor emon1, emon2;
float volt, avolt[50], sumv, volt2, avolt2[50], sumv2, powerFactor, apowerFactor[50], sumPF, catchPF, cur, acur[50], sumc; char symbPF = 223;
void setup() {
int i;
pinMode(PA6, INPUT_ANALOG); // U1 pinMode(PA7, INPUT_ANALOG); // I2 lcd.begin(16, 2); // set up the LCD’s number of columns and rows:
emon1.voltage(PA6, 3000, 1.7); // Voltage: input pin, calibration, phase_shift U1 emon2.voltage(PA7, 3000, 1.7); emon1.current(PA7, 111.1); // Current
Serial.begin(9600); // initialize serial communication with bit rate of 9600
} void loop() { emon1.calcVI(20, 2000); // Calculate all. No.of half wavelengths (crossings), time-out emon1.serialprint(); // Print out variable power factor) float powerFactor = emon1.powerFactor; //extract Power Factor into Variable
sumv = 0; sumv2 = 0;
for (int i = 0; i < 50; i++)
{ emon1.calcVI(20, 200); emon2.calcVI(20, 200); avolt[i] = emon1.Vrms; // holds volt value avolt2[i] = emon2.Vrms; // holds volt value apowerFactor[i] = emon1.powerFactor;
}
for (int i = 0; i < 50; i++) { sumv += avolt[i]; // LED1 AND LED2 , PB6, U1 sumv2 += avolt2[i]; // LED C13, PB7 , U3 OR DC input on PB0
volt = sumv / 50; volt2 = sumv2 / 50;
lcd.setCursor(0, 0); lcd.print(" "); lcd.setCursor(0, 1); lcd.print(" ");
lcd.setCursor(0, 0); lcd.print("PF="); lcd.print(powerFactor); lcd.print(symbPF); lcd.setCursor(5, 0);
lcd.setCursor(0, 1); lcd.print("U="); lcd.print(volt);
lcd.setCursor(8, 1); lcd.print("I="); lcd.print(volt2);
Please post support requests on our community forum, we will do our best to help: https://community.openenergymonitor.org
Dear How I can change power factor meter readings from value of cos φ to arccos φ to get reading results in degree ?
include
include "EmonLib.h"
LiquidCrystal lcd(PA0, PA1, PA2, PA3, PA4, PA5); EnergyMonitor emon1, emon2;
float volt, avolt[50], sumv, volt2, avolt2[50], sumv2, powerFactor, apowerFactor[50], sumPF, catchPF, cur, acur[50], sumc; char symbPF = 223;
void setup() {
int i;
pinMode(PA6, INPUT_ANALOG); // U1 pinMode(PA7, INPUT_ANALOG); // I2 lcd.begin(16, 2); // set up the LCD’s number of columns and rows:
emon1.voltage(PA6, 3000, 1.7); // Voltage: input pin, calibration, phase_shift U1 emon2.voltage(PA7, 3000, 1.7); emon1.current(PA7, 111.1); // Current
Serial.begin(9600); // initialize serial communication with bit rate of 9600
} void loop() { emon1.calcVI(20, 2000); // Calculate all. No.of half wavelengths (crossings), time-out emon1.serialprint(); // Print out variable power factor) float powerFactor = emon1.powerFactor; //extract Power Factor into Variable
sumv = 0; sumv2 = 0;
for (int i = 0; i < 50; i++)
{ emon1.calcVI(20, 200); emon2.calcVI(20, 200); avolt[i] = emon1.Vrms; // holds volt value avolt2[i] = emon2.Vrms; // holds volt value apowerFactor[i] = emon1.powerFactor;
}
for (int i = 0; i < 50; i++) { sumv += avolt[i]; // LED1 AND LED2 , PB6, U1 sumv2 += avolt2[i]; // LED C13, PB7 , U3 OR DC input on PB0
}
volt = sumv / 50; volt2 = sumv2 / 50;
lcd.setCursor(0, 0); lcd.print(" "); lcd.setCursor(0, 1); lcd.print(" ");
lcd.setCursor(0, 0); lcd.print("PF="); lcd.print(powerFactor); lcd.print(symbPF); lcd.setCursor(5, 0);
lcd.setCursor(0, 1); lcd.print("U="); lcd.print(volt);
lcd.setCursor(8, 1); lcd.print("I="); lcd.print(volt2);
}