Compare commits
No commits in common. "3b1242583858af314ce0837cb94ac8b6689308f3" and "0babdf71a9b9a17e6701143f4fe0370aead4c053" have entirely different histories.
3b12425838
...
0babdf71a9
|
@ -102,7 +102,6 @@ public static class Aggregator
|
||||||
var csvFiles = Directory.GetFiles(myDirectory, "*.csv");
|
var csvFiles = Directory.GetFiles(myDirectory, "*.csv");
|
||||||
var batterySoc = new List<Double>();
|
var batterySoc = new List<Double>();
|
||||||
var pvPowerAverage = new List<Double>();
|
var pvPowerAverage = new List<Double>();
|
||||||
var heatingPower = new List<Double>();
|
|
||||||
var gridPowerImport = new List<Double>();
|
var gridPowerImport = new List<Double>();
|
||||||
var gridPowerExport = new List<Double>();
|
var gridPowerExport = new List<Double>();
|
||||||
var batteryDischargePower = new List<Double>();
|
var batteryDischargePower = new List<Double>();
|
||||||
|
@ -167,9 +166,6 @@ public static class Aggregator
|
||||||
case "/GridMeter/ActivePowerImportT2":
|
case "/GridMeter/ActivePowerImportT2":
|
||||||
gridPowerImport.Add(value);
|
gridPowerImport.Add(value);
|
||||||
break;
|
break;
|
||||||
case "/Battery/HeatingPower":
|
|
||||||
heatingPower.Add(value);
|
|
||||||
break;
|
|
||||||
// Add more cases as needed
|
// Add more cases as needed
|
||||||
default:
|
default:
|
||||||
// Code to execute when variableName doesn't match any condition
|
// Code to execute when variableName doesn't match any condition
|
||||||
|
@ -201,10 +197,10 @@ public static class Aggregator
|
||||||
//
|
//
|
||||||
// Dividing the Average power readings by 3600 converts the result from watt-seconds to kilowatt-hours.
|
// Dividing the Average power readings by 3600 converts the result from watt-seconds to kilowatt-hours.
|
||||||
|
|
||||||
var dischargingEnergy = (batteryDischargePower.Any() ? batteryDischargePower.Average() : 0.0) / 3600;
|
var dischargingEnergy = (batteryDischargePower.Any() ? batteryDischargePower.Average() : 0.0) / 3600 ;
|
||||||
var chargingEnergy = (batteryChargePower.Any() ? batteryChargePower.Average() : 0.0) / 3600;
|
var chargingEnergy = (batteryChargePower.Any() ? batteryChargePower.Average() : 0.0) / 3600 ;
|
||||||
|
|
||||||
|
|
||||||
var heatingPowerAvg = (heatingPower.Any() ? heatingPower.Average() : 0.0) / 3600;
|
|
||||||
var dMaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0;
|
var dMaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0;
|
||||||
var dMinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0;
|
var dMinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0;
|
||||||
var dSumGridExportPower = gridPowerExport.Any() ? (gridPowerExport.Max() - gridPowerExport.Min()) / 1000 : 0.0;
|
var dSumGridExportPower = gridPowerExport.Any() ? (gridPowerExport.Max() - gridPowerExport.Min()) / 1000 : 0.0;
|
||||||
|
@ -217,10 +213,9 @@ public static class Aggregator
|
||||||
MinSoc = dMinSoc,
|
MinSoc = dMinSoc,
|
||||||
SumDischargingBatteryPower = dischargingEnergy,
|
SumDischargingBatteryPower = dischargingEnergy,
|
||||||
SumChargingBatteryPower = chargingEnergy,
|
SumChargingBatteryPower = chargingEnergy,
|
||||||
SumGridExportPower = dSumGridExportPower,
|
SumGridExportPower = dSumGridExportPower, // divide it
|
||||||
SumGridImportPower = dSumGridImportPower,
|
SumGridImportPower = dSumGridImportPower, // divide it
|
||||||
SumPvPower = dSumPvPower,
|
SumPvPower = dSumPvPower
|
||||||
HeatingPowerAvg = heatingPowerAvg
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Print the stored CSV data for verification
|
// Print the stored CSV data for verification
|
||||||
|
@ -252,7 +247,6 @@ public static class Aggregator
|
||||||
var gridPowerExport = new List<Double>();
|
var gridPowerExport = new List<Double>();
|
||||||
var batteryDischargePower = new List<Double>();
|
var batteryDischargePower = new List<Double>();
|
||||||
var batteryChargePower = new List<Double>();
|
var batteryChargePower = new List<Double>();
|
||||||
var heatingPowerAvg = new List<Double>();
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
|
Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
|
||||||
|
@ -307,10 +301,6 @@ public static class Aggregator
|
||||||
case "/SumGridImportPower":
|
case "/SumGridImportPower":
|
||||||
gridPowerImport.Add(value);
|
gridPowerImport.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "/HeatingPowerAvg":
|
|
||||||
heatingPowerAvg.Add(value);
|
|
||||||
break;
|
|
||||||
// Add more cases as needed
|
// Add more cases as needed
|
||||||
default:
|
default:
|
||||||
// Code to execute when variableName doesn't match any condition
|
// Code to execute when variableName doesn't match any condition
|
||||||
|
@ -343,7 +333,6 @@ public static class Aggregator
|
||||||
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Average() : 0.0,
|
SumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Average() : 0.0,
|
||||||
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Average() : 0.0,
|
SumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Average() : 0.0,
|
||||||
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Average() : 0.0,
|
SumPvPower = pvPowerAverage.Any() ? pvPowerAverage.Average() : 0.0,
|
||||||
HeatingPowerAvg = heatingPowerAvg.Any() ? heatingPowerAvg.Average() : 0.0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Print the stored CSV data for verification
|
// Print the stored CSV data for verification
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class AggregatedData
|
||||||
public required Double SumChargingBatteryPower { get; set; }
|
public required Double SumChargingBatteryPower { get; set; }
|
||||||
public required Double SumGridExportPower { get; set; }
|
public required Double SumGridExportPower { get; set; }
|
||||||
public required Double SumGridImportPower { get; set; }
|
public required Double SumGridImportPower { get; set; }
|
||||||
public required Double HeatingPowerAvg { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private readonly S3Config? _S3Config = Config.Load().S3;
|
private readonly S3Config? _S3Config = Config.Load().S3;
|
||||||
|
|
|
@ -213,22 +213,24 @@ internal static class Program
|
||||||
|
|
||||||
int nodeIndex = 2; // Starting node number
|
int nodeIndex = 2; // Starting node number
|
||||||
|
|
||||||
//foreach (var batteryNodeRecord in record.Battery.Devices)
|
foreach (var batteryNodeRecord in record.Battery.Devices)
|
||||||
//{
|
{
|
||||||
// var ioStates = batteryNodeRecord.IoStates;
|
var ioStates = batteryNodeRecord.IoStates;
|
||||||
|
|
||||||
// batteryNodeRecord.FwVersion.WriteLine(" FwVersion ");
|
batteryNodeRecord.FwVersion.WriteLine(" FwVersion ");
|
||||||
// Convert.ToString(ioStates, 2).PadLeft(16, '0').WriteLine($" IoStates Battery node {nodeIndex}");
|
Convert.ToString(ioStates, 2).PadLeft(16, '0').WriteLine($" IoStates Battery node {nodeIndex}");
|
||||||
|
|
||||||
// batteryNodeRecord.Dc.Current.WriteLine($" Current Battery node {nodeIndex}");
|
batteryNodeRecord.Dc.Current.WriteLine($" Current Battery node {nodeIndex}");
|
||||||
// batteryNodeRecord.Dc.Voltage.WriteLine($" Voltage Battery node {nodeIndex}");
|
batteryNodeRecord.Dc.Voltage.WriteLine($" Voltage Battery node {nodeIndex}");
|
||||||
// ("********************************************************").WriteLine();
|
|
||||||
// nodeIndex++;
|
("********************************************************").WriteLine();
|
||||||
//}
|
|
||||||
|
nodeIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
// record.GridMeter?.ActivePowerExportT1.WriteLine("kWh Import 7008");
|
// record.GridMeter?.ActivePowerExportT1.WriteLine("kWh Import 7008");
|
||||||
// record.GridMeter?.ActivePowerImportT1.WriteLine("kWh Export 7028");
|
// record.GridMeter?.ActivePowerImportT1.WriteLine("kWh Export 7028");
|
||||||
// record.GridMeter?.ActivePowerExportT2.WriteLine("Wh Import 6008");
|
record.GridMeter?.ActivePowerExportT2.WriteLine("Wh Import 6008");
|
||||||
// record.GridMeter?.ActivePowerImportT2.WriteLine("Wh Export 6028");
|
// record.GridMeter?.ActivePowerImportT2.WriteLine("Wh Export 6028");
|
||||||
// record.GridMeter?.ActivePowerExportT3.WriteLine("Kwh Import 8004");
|
// record.GridMeter?.ActivePowerExportT3.WriteLine("Kwh Import 8004");
|
||||||
// record.GridMeter?.ActivePowerImportT3.WriteLine("kWh Export 8014");
|
// record.GridMeter?.ActivePowerImportT3.WriteLine("kWh Export 8014");
|
||||||
|
|
Loading…
Reference in New Issue