From 7b39e02bcd9e6bc13f7058eb9fecd0f1825e9f5c Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 23 Oct 2023 10:43:42 +0200 Subject: [PATCH] Update Topology data. --- csharp/App/SaliMax/src/Topology.cs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/csharp/App/SaliMax/src/Topology.cs b/csharp/App/SaliMax/src/Topology.cs index 9891fe573..58ad19e19 100644 --- a/csharp/App/SaliMax/src/Topology.cs +++ b/csharp/App/SaliMax/src/Topology.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; +using InnovEnergy.App.SaliMax.Devices; using InnovEnergy.App.SaliMax.Ess; -using InnovEnergy.App.SaliMax.VirtualDevices; using InnovEnergy.Lib.Devices.AMPT; using InnovEnergy.Lib.Devices.Battery48TL; using InnovEnergy.Lib.Devices.EmuMeter; @@ -65,8 +65,8 @@ public static class Topology public static TextBlock CreateTopologyTextBlock(this StatusRecord status) { var a = status.GridMeter?.Ac.Power.Active; - var b = status.PvOnAcGrid?.Power.Active; - var e = status.PvOnAcIsland?.Power.Active; + var b = status.PvOnAcGrid?.Dc.Power.Value; + var e = status.PvOnAcIsland?.Dc.Power.Value; var f = status.LoadOnAcIsland?.Ac.Power.Active; var g = status.AcDc.Dc.Power.Value; var h = g; @@ -473,11 +473,11 @@ public static class Topology : Flow.Horizontal(power); } - - public static AcPowerDevice? CalculateGridBusLoad(EmuMeterRegisters? gridMeter, AcPowerDevice? pvOnAcGrid, AcPowerDevice? gridBusToIslandBusPower) + //We are fake using the ampt instead of PvOnAc, We dont have a Pv on Ac at the moment and we don't have it classes :TODO + public static AcPowerDevice? CalculateGridBusLoad(EmuMeterRegisters? gridMeter, AmptStatus? pvOnAcGrid, AcPowerDevice? gridBusToIslandBusPower) { var a = gridMeter ?.Ac.Power; - var b = pvOnAcGrid ?.Power; + var b = pvOnAcGrid is not null? pvOnAcGrid?.Dc.Power.Value: 0; var d = gridBusToIslandBusPower?.Power; if (a is null || b is null || d is null) @@ -487,12 +487,13 @@ public static class Topology return new AcPowerDevice { Power = c }; } - - public static AcPowerDevice? CalculateGridBusToIslandBusPower(AcPowerDevice? pvOnAcIsland, EmuMeterRegisters? loadOnAcIsland, AcDcDevicesRecord? acDc) + + //We are fake using the ampt instead of PvOnAc, We dont have a Pv on Ac at the moment and we don't have it classes :TODO + public static AcPowerDevice? CalculateGridBusToIslandBusPower(AmptStatus? pvOnAcIsland, EmuMeterRegisters? loadOnAcIsland, AcDcDevicesRecord? acDc) { - var e = pvOnAcIsland ?.Power; - var f = loadOnAcIsland?.Ac.Power; - var g = acDc ?.Ac.Power; + var e = pvOnAcIsland is not null? pvOnAcIsland?.Dc.Power.Value: 0; + var f = loadOnAcIsland is not null? loadOnAcIsland?.Ac.Power : 0; + var g = acDc ?.Ac.Power; // We dont check on the AcDc because this device is mandatory, if this does not exist the system will not start if (e is null || f is null || g is null) return null; @@ -504,9 +505,9 @@ public static class Topology public static DcPowerDevice? CalculateDcLoad(AcDcDevicesRecord? acDc, AmptStatus? pvOnDc, DcDcDevicesRecord? dcDc) { - var h = acDc?.Dc.Power; - var i = pvOnDc?.Dc.Power; - var k = dcDc?.Dc.Link.Power; + var h = acDc?.Dc.Power; // We dont check on the AcDc because this device is mandatory + var i = pvOnDc is not null? pvOnDc?.Dc.Power: 0; + var k = dcDc?.Dc.Link.Power; // We dont check on the DcDc because this device is mandatory if (h is null || i is null || k is null) return null;