Add the daily production data in AMPT

This commit is contained in:
atef 2024-01-19 12:32:43 +01:00
parent 50eaf261a3
commit 80f9186319
2 changed files with 17 additions and 6 deletions

View File

@ -47,6 +47,11 @@ public class AmptDevices
// CommunicationUnit knows how many StringOptimizers are connected // CommunicationUnit knows how many StringOptimizers are connected
var nStringOptimizers = cuStatus.NumberOfStringOptimizers; var nStringOptimizers = cuStatus.NumberOfStringOptimizers;
//Factor
var nEnergyFactor = cuStatus.EnergyScaleFactor;
var nCurrentFactor = cuStatus.CurrentScaleFactor;
var nVoltageFactor = cuStatus.VoltageScaleFactor;
// hardcoded: every SO has 2 strings (produced like this by AMPT) // hardcoded: every SO has 2 strings (produced like this by AMPT)
var nStrings = nStringOptimizers * 2; var nStrings = nStringOptimizers * 2;
@ -64,10 +69,14 @@ public class AmptDevices
var busVoltage = nStringOptimizers == 0 ? 0 : soStati.Average(r => r.Voltage); var busVoltage = nStringOptimizers == 0 ? 0 : soStati.Average(r => r.Voltage);
var busCurrent = nStringOptimizers == 0 ? 0 : soStati.Sum (r => r.Current); var busCurrent = nStringOptimizers == 0 ? 0 : soStati.Sum (r => r.Current);
var dailyOutputEnergy = nStringOptimizers == 0 ? 0 : soStati.Sum (r => r.ProductionToday);
dailyOutputEnergy.WriteLine(" Daily Production ");
var dc = new DcBus var dc = new DcBus
{ {
Voltage = busVoltage, Voltage = busVoltage,
Current = busCurrent, Current = busCurrent
}; };
// flatten the 2 strings of each SO into one array // flatten the 2 strings of each SO into one array
@ -76,7 +85,8 @@ public class AmptDevices
return new AmptStatus return new AmptStatus
{ {
Dc = dc, Dc = dc,
Strings = strings Strings = strings,
DcWh = dailyOutputEnergy
}; };
} }

View File

@ -7,5 +7,6 @@ public class AmptStatus : IMppt
{ {
public required DcBus Dc { get; init; } public required DcBus Dc { get; init; }
public required IReadOnlyList<DcBus> Strings { get; init; } public required IReadOnlyList<DcBus> Strings { get; init; }
public required Double DcWh { get; init; } //Daily integrated string output energy in Wh
} }