diff --git a/csharp/App/SaliMax/src/Topology.cs b/csharp/App/SaliMax/src/Topology.cs index 859ac69f6..df9c94a82 100644 --- a/csharp/App/SaliMax/src/Topology.cs +++ b/csharp/App/SaliMax/src/Topology.cs @@ -70,7 +70,7 @@ public static class Topology var e = status.PvOnAcIsland?.Dc.Power.Value; var f = status.LoadOnAcIsland?.Ac.Power.Active; var g = status.AcDc.Dc.Power.Value; - var h = status.AcDcToDcLink.Power.Value; + var h = status.AcDcToDcLink?.Power.Value; var i = status.PvOnDc?.Dc.Power.Value; var k = status.DcDc.Dc.Link.Power.Value; var l = status.Battery is not null ? status.Battery.Dc.Power.Value : 0; @@ -367,6 +367,10 @@ public static class Topology private static TextBlock CreateBatteryColumn(this StatusRecord status) { var bat = status.Battery; + if (bat is null) + return TextBlock.AlignLeft("no battery").Box(); + + var batteryAvgBox = CreateAveragedBatteryBox(bat); var batteryBoxes = bat @@ -387,11 +391,8 @@ public static class Topology return status.Config.DisplayIndividualBatteries ? individualWithAvgBox : batteryAvgBox; } - private static TextBlock CreateAveragedBatteryBox(Battery48TlRecords? bat) + private static TextBlock CreateAveragedBatteryBox(Battery48TlRecords bat) { - if (bat is null) - return TextBlock.AlignLeft("no battery").Box(); - var voltage = bat.Dc.Voltage.ToDisplayString(); var soc = bat.Devices.Any() ? bat.Devices.Average(b => b.Soc).Percent().ToDisplayString() : "0"; // TODO var current = bat.Dc.Current.ToDisplayString();