以下是我读取功率因素的程序
double getPowerFactor()
{
uint8 buf[3] = {0};
uint32 temp_v = 0;
uint8 flag = 0;
double PowerFactor = 0.0;
write_to_register(0x5E,0x80,0x00,0x00);
read_register(0x10,buf);//有功功率 0x14
flag = (buf[0] & 0x80)/0x80;
temp_v = ((uint32)(buf[0] & 0x7F)) <<16;
temp_v |= ((uint32)(buf[1])) << 8;
temp_v |= ((uint32)(buf[2]));
PowerFactor = temp_v/1024.0/1024.0/8.0 - 1*flag;
PowerFactor = PowerFactor * 100;
return PowerFactor;
}
我读取有效电压和有效电流的时候,都是乘以一个系数得出的,
但是功率因素我以为直接读出来就会准了,但是读出来的值是0.03%,
还是说我也列个方程式求解算出来呢
求大虾帮助啊。
一周热门 更多>