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 static System.Double;
|
||||
|
||||
|
@ -141,11 +142,19 @@ public static class Aggregator
|
|||
batterySoc.Add(value);
|
||||
break;
|
||||
|
||||
case "/PvOnDc/Dc/Power" or "/SumPvPower":
|
||||
case "/PvOnDc/DcWh" or "/SumPvPower":
|
||||
pvPowerAverage.Add(value);
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
batteryDischargePower.Add(value);
|
||||
|
@ -157,16 +166,13 @@ public static class Aggregator
|
|||
}
|
||||
break;
|
||||
|
||||
case "/GridMeter/Ac/Power/Active" or "/SumGridExportPower" or "/SumGridImportPower":
|
||||
if (value < 0)
|
||||
{
|
||||
case "/GridMeter/ActivePowerExportT2" or "/SumGridExportPower":
|
||||
// we are using different register to check which value from the grid meter we need to use
|
||||
gridPowerExport.Add(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
gridPowerImport.Add(value);
|
||||
break;
|
||||
|
||||
}
|
||||
case "/GridMeter/ActivePowerImportT2" or "/SumGridImportPower":
|
||||
gridPowerImport.Add(value);
|
||||
break;
|
||||
// Add more cases as needed
|
||||
default:
|
||||
|
@ -195,11 +201,11 @@ public static class Aggregator
|
|||
{
|
||||
MaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0,
|
||||
MinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0,
|
||||
SumDischargingBatteryPower = batteryDischargePower.Any() ? batteryDischargePower.Sum() : 0.0,
|
||||
SumChargingBatteryPower = batteryChargePower.Any() ? batteryChargePower.Sum() : 0.0,
|
||||
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Sum() : 0.0,
|
||||
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Sum() : 0.0,
|
||||
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Sum() : 0.0,
|
||||
SumDischargingBatteryPower = batteryDischargePower.Any() ? batteryDischargePower.Average(): 0.0,
|
||||
SumChargingBatteryPower = batteryChargePower.Any() ? batteryChargePower.Average() : 0.0,
|
||||
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Average() : 0.0,
|
||||
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Average() : 0.0,
|
||||
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Average() : 0.0,
|
||||
};
|
||||
|
||||
// Print the stored CSV data for verification
|
||||
|
|
Loading…
Reference in New Issue