Add Active Power Total

Add Active Power Total if multiple phases AND both positive and negative values (#19141)
This commit is contained in:
Theo Arends 2023-10-13 13:56:04 +02:00
parent 32cbd330aa
commit 5cee525d02
30 changed files with 50 additions and 12 deletions

View File

@ -970,6 +970,7 @@ const char HTTP_SNS_POWER[] PROGMEM = "{s}" D_POWERUSAGE_ACTIVE
const char HTTP_SNS_IMPORT_POWER[] PROGMEM = "{s}" D_IMPORT_POWER "{m}%s " D_UNIT_WATT "{e}";
const char HTTP_SNS_EXPORT_POWER[] PROGMEM = "{s}" D_EXPORT_POWER "{m}%s " D_UNIT_WATT "{e}";
const char HTTP_SNS_MAX_POWER[] PROGMEM = "{s}" D_MAX_POWER "{m}%s " D_UNIT_WATT "{e}";
const char HTTP_SNS_POWER_TOTAL[] PROGMEM = "{s}" D_POWERUSAGE_ACTIVE_TOTAL "{m}%s " D_UNIT_WATT "{e}";
const char HTTP_SNS_POWERUSAGE_APPARENT[] PROGMEM = "{s}" D_POWERUSAGE_APPARENT "{m}%s " D_UNIT_VA "{e}";
const char HTTP_SNS_POWERUSAGE_REACTIVE[] PROGMEM = "{s}" D_POWERUSAGE_REACTIVE "{m}%s " D_UNIT_VAR "{e}";
const char HTTP_SNS_POWER_FACTOR[] PROGMEM = "{s}" D_POWER_FACTOR "{m}%s {e}";

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Krag faktor"
#define D_POWERUSAGE "Krag"
#define D_POWERUSAGE_ACTIVE "Regte krag"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Oënskynlike krag"
#define D_POWERUSAGE_REACTIVE "reaktiewe krag"
#define D_PRESSURE "Druk"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Фактор на мощността"
#define D_POWERUSAGE "Мощност"
#define D_POWERUSAGE_ACTIVE "Активна мощност"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Пълна мощност"
#define D_POWERUSAGE_REACTIVE "Реактивна мощност"
#define D_PRESSURE "Налягане"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Factor de poténcia"
#define D_POWERUSAGE "Poténcia"
#define D_POWERUSAGE_ACTIVE "Poténcia Activa"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Poténcia Aparent"
#define D_POWERUSAGE_REACTIVE "Poténcia Reactiva"
#define D_PRESSURE "Pressió"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Účiník"
#define D_POWERUSAGE "Příkon"
#define D_POWERUSAGE_ACTIVE "Činný příkon"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Zdánlivý příkon"
#define D_POWERUSAGE_REACTIVE "Jalový příkon"
#define D_PRESSURE "Tlak"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Leistungsfaktor"
#define D_POWERUSAGE "Leistung"
#define D_POWERUSAGE_ACTIVE "Wirkleistung"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Scheinleistung"
#define D_POWERUSAGE_REACTIVE "Blindleistung"
#define D_PRESSURE "Luftdruck"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Συντελεστής Ισχύος"
#define D_POWERUSAGE "Ισχύς"
#define D_POWERUSAGE_ACTIVE "Ενεργός ισχύς"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Φαινόμενη ισχύς"
#define D_POWERUSAGE_REACTIVE "Άεργη ισχύς"
#define D_PRESSURE "Πίεση"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Power Factor"
#define D_POWERUSAGE "Power"
#define D_POWERUSAGE_ACTIVE "Active Power"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Apparent Power"
#define D_POWERUSAGE_REACTIVE "Reactive Power"
#define D_PRESSURE "Pressure"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Factor de Potencia"
#define D_POWERUSAGE "Potencia"
#define D_POWERUSAGE_ACTIVE "Potencia Activa"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Potencia Aparente"
#define D_POWERUSAGE_REACTIVE "Potencia Reactiva"
#define D_PRESSURE "Presión"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Fact de puiss"
#define D_POWERUSAGE "Puissance"
#define D_POWERUSAGE_ACTIVE "Puiss active"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Puiss apparente"
#define D_POWERUSAGE_REACTIVE "Puiss réactive"
#define D_PRESSURE "Pression"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Krêftfaktor"
#define D_POWERUSAGE "Krêft"
#define D_POWERUSAGE_ACTIVE "Eigentlike krêft"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Skynber krêft"
#define D_POWERUSAGE_REACTIVE "Blynde krêft"
#define D_PRESSURE "Luchtdruk"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "גורם כוח"
#define D_POWERUSAGE "כוח"
#define D_POWERUSAGE_ACTIVE "כוח פעיל"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "כוח לכאורה"
#define D_POWERUSAGE_REACTIVE "כוח תגובתי"
#define D_PRESSURE "לחץ"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Teljesítménytényező"
#define D_POWERUSAGE "Energiafelhasználás"
#define D_POWERUSAGE_ACTIVE "Aktív teljesítmény"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Látszólagos teljesítmény"
#define D_POWERUSAGE_REACTIVE "Reaktív teljesítmény"
#define D_PRESSURE "Nyomás"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Fattore di potenza"
#define D_POWERUSAGE "Potenza"
#define D_POWERUSAGE_ACTIVE "Potenza attiva"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Potenza apparente"
#define D_POWERUSAGE_REACTIVE "Potenza reattiva"
#define D_PRESSURE "Pressione"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Power Factor"
#define D_POWERUSAGE "전원"
#define D_POWERUSAGE_ACTIVE "Active Power"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Apparent Power"
#define D_POWERUSAGE_REACTIVE "Reactive Power"
#define D_PRESSURE "기압"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Arbeidsfactor"
#define D_POWERUSAGE "Vermogen"
#define D_POWERUSAGE_ACTIVE "Werkelijk vermogen"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Schijnbaar vermogen"
#define D_POWERUSAGE_REACTIVE "Blindvermogen"
#define D_PRESSURE "Luchtdruk"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Cosinus fi"
#define D_POWERUSAGE "Moc"
#define D_POWERUSAGE_ACTIVE "Moc czynna"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Moc pozorna"
#define D_POWERUSAGE_REACTIVE "Moc bierna"
#define D_PRESSURE "Ciśnienie"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Fator de potência"
#define D_POWERUSAGE "Potência"
#define D_POWERUSAGE_ACTIVE "Potência ativa"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Potência aparente"
#define D_POWERUSAGE_REACTIVE "Potência reativa"
#define D_PRESSURE "Pressão"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Factor de Potência"
#define D_POWERUSAGE "Potência"
#define D_POWERUSAGE_ACTIVE "Potência Ativa"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Potência Aparente"
#define D_POWERUSAGE_REACTIVE "Potência Reativa"
#define D_PRESSURE "Pressão"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Factor de Putere"
#define D_POWERUSAGE "Putere"
#define D_POWERUSAGE_ACTIVE "Putere Activă"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Putere Aparentă"
#define D_POWERUSAGE_REACTIVE "Putere Reactivă"
#define D_PRESSURE "Presiune"

View File

@ -153,6 +153,7 @@
#define D_POWER_FACTOR "Коэффициент мощности"
#define D_POWERUSAGE "Мощность"
#define D_POWERUSAGE_ACTIVE "Активная мощность"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Полная мощность"
#define D_POWERUSAGE_REACTIVE "Реактивная мощность"
#define D_PRESSURE "Давление"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Účinník"
#define D_POWERUSAGE "Príkon"
#define D_POWERUSAGE_ACTIVE "Činný príkon"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Zdanlivý príkon"
#define D_POWERUSAGE_REACTIVE "Jalový príkon"
#define D_PRESSURE "Tlak"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Spänningsfaktor"
#define D_POWERUSAGE "Spänning"
#define D_POWERUSAGE_ACTIVE "Aktiv spänning"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Skenbar spänning"
#define D_POWERUSAGE_REACTIVE "Responsiv spänning"
#define D_PRESSURE "Tryck"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Güç Faktörü"
#define D_POWERUSAGE "Güç"
#define D_POWERUSAGE_ACTIVE "Aktif Güç"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Görünen Güç"
#define D_POWERUSAGE_REACTIVE "Reaktif Güç"
#define D_PRESSURE "Basınç"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Коефіцієнт потужності"
#define D_POWERUSAGE "Потужність"
#define D_POWERUSAGE_ACTIVE "Активна потужність"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Загальна потужність"
#define D_POWERUSAGE_REACTIVE "Реактивна потужність"
#define D_PRESSURE "Тиск"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "Hệ số công suất"
#define D_POWERUSAGE "Công suất"
#define D_POWERUSAGE_ACTIVE "Công suất hoạt động"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "Công suất biểu kiến"
#define D_POWERUSAGE_REACTIVE "Công suất phản kháng"
#define D_PRESSURE "Áp suất"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "功率因数"
#define D_POWERUSAGE "功率"
#define D_POWERUSAGE_ACTIVE "有功功率"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "视在功率"
#define D_POWERUSAGE_REACTIVE "无功功率"
#define D_PRESSURE "气压"

View File

@ -152,6 +152,7 @@
#define D_POWER_FACTOR "功率因數"
#define D_POWERUSAGE "用電量"
#define D_POWERUSAGE_ACTIVE "有功功率"
#define D_POWERUSAGE_ACTIVE_TOTAL "Active Power Total"
#define D_POWERUSAGE_APPARENT "視在功率"
#define D_POWERUSAGE_REACTIVE "虛功率"
#define D_PRESSURE "氣壓"

View File

@ -205,12 +205,13 @@ char* WebEnergyFmt(float* input, uint32_t resolution, uint32_t single) {
// single = 0 - Energy->phase_count - xx / xx / xx or multi column
// single = 1 - Energy->voltage_common or Energy->frequency_common - xx or single column using colspan (if needed)
// single = 2 - Sum of Energy->phase_count if SO129 0 - xx or single column using colspan (if needed) or if SO129 1 - xx / xx / xx or multi column
// single = 3 - Sum of Energy->phase_count xx or single column using colspan (if needed)
if (!EnergyFmtMalloc()) { return EmptyStr; }
float input_sum = 0.0f;
if (single > 1) { // Sum and/or Single column
if (!Settings->flag5.energy_phase) { // SetOption129 - (Energy) Show phase information
if (single > 1) { // Sum and/or Single column
if ((3 == single) || !Settings->flag5.energy_phase) { // SetOption129 - (Energy) Show phase information
for (uint32_t i = 0; i < Energy->phase_count; i++) {
if (!isnan(input[i])) {
input_sum += input[i];
@ -221,8 +222,8 @@ char* WebEnergyFmt(float* input, uint32_t resolution, uint32_t single) {
single = 0;
}
}
ext_snprintf_P(Energy->value, GUISZ, PSTR("</td>")); // Skip first column
if ((Energy->phase_count > 1) && single) { // Need to set colspan so need new columns
ext_snprintf_P(Energy->value, GUISZ, PSTR("</td>")); // Skip first column
if ((Energy->phase_count > 1) && single) { // Need to set colspan so need new columns
// </td><td colspan='3' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
// </td><td colspan='5' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
// </td><td colspan='7' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
@ -1258,12 +1259,13 @@ void EnergyShow(bool json) {
}
}
float active_power_sum = 0.0f;
float energy_yesterday_ph[Energy->phase_count];
float active_power_sum = 0.0f;
int negative_phases = 0;
for (uint32_t i = 0; i < Energy->phase_count; i++) {
energy_yesterday_ph[i] = (float)Settings->energy_kWhyesterday_ph[i] / 100000;
active_power_sum += Energy->active_power[i];
negative_phases += (Energy->active_power[i] < 0) ? -1 : 1;
}
bool energy_tariff = false;
@ -1435,6 +1437,9 @@ void EnergyShow(bool json) {
WSContentSend_PD(HTTP_SNS_POWER_FACTOR, WebEnergyFmt(power_factor, 2));
}
}
if (abs(negative_phases) != Energy->phase_count) { // Provide total power if producing power (PV) and multi phase
WSContentSend_PD(HTTP_SNS_POWER_TOTAL, WebEnergyFmt(Energy->active_power, Settings->flag2.wattage_resolution, 3));
}
WSContentSend_PD(HTTP_SNS_ENERGY_TODAY, WebEnergyFmt(Energy->daily, Settings->flag2.energy_resolution, 2));
WSContentSend_PD(HTTP_SNS_ENERGY_YESTERDAY, WebEnergyFmt(energy_yesterday_ph, Settings->flag2.energy_resolution, 2));
WSContentSend_PD(HTTP_SNS_ENERGY_TOTAL, WebEnergyFmt(Energy->total, Settings->flag2.energy_resolution, 2));

View File

@ -438,12 +438,13 @@ char* WebEnergyFmt(float* input, uint32_t resolution, uint32_t single) {
// single = 0 - Energy->phase_count - xx / xx / xx or multi column
// single = 1 - Energy->voltage_common or Energy->frequency_common - xx or single column using colspan (if needed)
// single = 2 - Sum of Energy->phase_count if SO129 0 - xx or single column using colspan (if needed) or if SO129 1 - xx / xx / xx or multi column
// single = 3 - Sum of Energy->phase_count xx or single column using colspan (if needed)
if (!EnergyFmtMalloc()) { return EmptyStr; }
float input_sum = 0.0f;
if (single > 1) { // Sum and/or Single column
if (!Settings->flag5.energy_phase) { // SetOption129 - (Energy) Show phase information
if (single > 1) { // Sum and/or Single column
if ((3 == single) || !Settings->flag5.energy_phase) { // SetOption129 - (Energy) Show phase information
for (uint32_t i = 0; i < Energy->phase_count; i++) {
if (!isnan(input[i])) {
input_sum += input[i];
@ -454,8 +455,8 @@ char* WebEnergyFmt(float* input, uint32_t resolution, uint32_t single) {
single = 0;
}
}
ext_snprintf_P(Energy->value, GUISZ, PSTR("</td>")); // Skip first column
if ((Energy->gui_count > 1) && single) { // Need to set colspan so need new columns
ext_snprintf_P(Energy->value, GUISZ, PSTR("</td>")); // Skip first column
if ((Energy->gui_count > 1) && single) { // Need to set colspan so need new columns
// </td><td colspan='3' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
// </td><td colspan='5' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
// </td><td colspan='7' style='text-align:right'>1.23</td><td>&nbsp;</td><td>
@ -1493,12 +1494,13 @@ void EnergyShow(bool json) {
}
}
float active_power_sum = 0.0f;
float energy_yesterday_kWh[Energy->phase_count];
float active_power_sum = 0.0f;
int negative_phases = 0;
for (uint32_t i = 0; i < Energy->phase_count; i++) {
energy_yesterday_kWh[i] = Energy->Settings.energy_yesterday_kWh[i];
active_power_sum += Energy->active_power[i];
negative_phases += (Energy->active_power[i] < 0) ? -1 : 1;
}
bool energy_tariff = false;
@ -1716,6 +1718,9 @@ void EnergyShow(bool json) {
WSContentSend_PD(HTTP_SNS_POWER_FACTOR, WebEnergyFmt(power_factor, 2));
}
}
if (abs(negative_phases) != Energy->phase_count) { // Provide total power if producing power (PV) and multi phase
WSContentSend_PD(HTTP_SNS_POWER_TOTAL, WebEnergyFmt(Energy->active_power, Settings->flag2.wattage_resolution, 3));
}
WSContentSend_PD(HTTP_SNS_ENERGY_TODAY, WebEnergyFmt(Energy->daily_kWh, Settings->flag2.energy_resolution, 2));
WSContentSend_PD(HTTP_SNS_ENERGY_YESTERDAY, WebEnergyFmt(energy_yesterday_kWh, Settings->flag2.energy_resolution, 2));
WSContentSend_PD(HTTP_SNS_ENERGY_TOTAL, WebEnergyFmt(Energy->total, Settings->flag2.energy_resolution, 2));