Update the aggregate data
This commit is contained in:
parent
b0bd8fb3e2
commit
50eaf261a3
|
@ -1,3 +1,4 @@
|
||||||
|
using InnovEnergy.App.SaliMax.Ess;
|
||||||
using InnovEnergy.Lib.Utils;
|
using InnovEnergy.Lib.Utils;
|
||||||
using static System.Double;
|
using static System.Double;
|
||||||
|
|
||||||
|
@ -141,11 +142,19 @@ public static class Aggregator
|
||||||
batterySoc.Add(value);
|
batterySoc.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "/PvOnDc/Dc/Power" or "/SumPvPower":
|
case "/PvOnDc/DcWh" or "/SumPvPower":
|
||||||
pvPowerAverage.Add(value);
|
pvPowerAverage.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "/Battery/Dc/Power" or "/SumDischargingBatteryPower" or "/SumChargingBatteryPower":
|
case "/Battery/Dc/Power" or "/SumDischargingBatteryPower" or "/SumChargingBatteryPower":
|
||||||
|
|
||||||
|
//Average Power (Watts)= Sum of Power Readings/Number of Readings
|
||||||
|
|
||||||
|
//Then, you can use the average power in the energy formula:
|
||||||
|
//
|
||||||
|
//Energy (kWh)= (Average Power / 3600) × Time (seconds)
|
||||||
|
//
|
||||||
|
// Dividing the Average power readings by 3600 converts the result from watt-seconds to kilowatt-hours.
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
{
|
{
|
||||||
batteryDischargePower.Add(value);
|
batteryDischargePower.Add(value);
|
||||||
|
@ -157,16 +166,13 @@ public static class Aggregator
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "/GridMeter/Ac/Power/Active" or "/SumGridExportPower" or "/SumGridImportPower":
|
case "/GridMeter/ActivePowerExportT2" or "/SumGridExportPower":
|
||||||
if (value < 0)
|
// we are using different register to check which value from the grid meter we need to use
|
||||||
{
|
|
||||||
gridPowerExport.Add(value);
|
gridPowerExport.Add(value);
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
gridPowerImport.Add(value);
|
|
||||||
|
|
||||||
}
|
case "/GridMeter/ActivePowerImportT2" or "/SumGridImportPower":
|
||||||
|
gridPowerImport.Add(value);
|
||||||
break;
|
break;
|
||||||
// Add more cases as needed
|
// Add more cases as needed
|
||||||
default:
|
default:
|
||||||
|
@ -195,11 +201,11 @@ public static class Aggregator
|
||||||
{
|
{
|
||||||
MaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0,
|
MaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0,
|
||||||
MinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0,
|
MinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0,
|
||||||
SumDischargingBatteryPower = batteryDischargePower.Any() ? batteryDischargePower.Sum() : 0.0,
|
SumDischargingBatteryPower = batteryDischargePower.Any() ? batteryDischargePower.Average(): 0.0,
|
||||||
SumChargingBatteryPower = batteryChargePower.Any() ? batteryChargePower.Sum() : 0.0,
|
SumChargingBatteryPower = batteryChargePower.Any() ? batteryChargePower.Average() : 0.0,
|
||||||
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Sum() : 0.0,
|
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Average() : 0.0,
|
||||||
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Sum() : 0.0,
|
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Average() : 0.0,
|
||||||
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Sum() : 0.0,
|
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Average() : 0.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Print the stored CSV data for verification
|
// Print the stored CSV data for verification
|
||||||
|
|
Loading…
Reference in New Issue