diff --git a/csharp/Lib/Devices/AMPT/AmptDevices.cs b/csharp/Lib/Devices/AMPT/AmptDevices.cs index 04f6183f3..8ba1248ca 100644 --- a/csharp/Lib/Devices/AMPT/AmptDevices.cs +++ b/csharp/Lib/Devices/AMPT/AmptDevices.cs @@ -47,6 +47,11 @@ public class AmptDevices // CommunicationUnit knows how many StringOptimizers are connected 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) var nStrings = nStringOptimizers * 2; @@ -62,12 +67,16 @@ public class AmptDevices // TODO: alarm when we see substantially different voltages - var busVoltage = nStringOptimizers == 0 ? 0 : soStati.Average(r => r.Voltage); - var busCurrent = nStringOptimizers == 0 ? 0 : soStati.Sum (r => r.Current); + var busVoltage = nStringOptimizers == 0 ? 0 : soStati.Average(r => r.Voltage); + 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 { Voltage = busVoltage, - Current = busCurrent, + Current = busCurrent }; // flatten the 2 strings of each SO into one array @@ -76,7 +85,8 @@ public class AmptDevices return new AmptStatus { Dc = dc, - Strings = strings + Strings = strings, + DcWh = dailyOutputEnergy }; } diff --git a/csharp/Lib/Devices/AMPT/AmptStatus.cs b/csharp/Lib/Devices/AMPT/AmptStatus.cs index 49f118011..bbaa5fd05 100644 --- a/csharp/Lib/Devices/AMPT/AmptStatus.cs +++ b/csharp/Lib/Devices/AMPT/AmptStatus.cs @@ -5,7 +5,8 @@ namespace InnovEnergy.Lib.Devices.AMPT; public class AmptStatus : IMppt { - public required DcBus Dc { get; init; } - public required IReadOnlyList Strings { get; init; } + public required DcBus Dc { get; init; } + public required IReadOnlyList Strings { get; init; } + public required Double DcWh { get; init; } //Daily integrated string output energy in Wh }