Use IReadOnlyList for BatteryNodes

This commit is contained in:
ig 2023-07-06 15:18:57 +02:00
parent 72ced4be3e
commit 39262d1a46
1 changed files with 8 additions and 2 deletions

View File

@ -33,7 +33,7 @@ internal static class Program
private const UInt32 UpdateIntervalSeconds = 2;
private static readonly Byte[] BatteryNodes = { 2, 3, 4, 5, 6 };
private static readonly IReadOnlyList<Byte> BatteryNodes;
private static readonly TcpChannel TruConvertAcChannel ;
private static readonly TcpChannel TruConvertDcChannel ;
@ -55,6 +55,12 @@ internal static class Program
AmptChannel = new TcpChannel(d.AmptIp);
RelaysChannel = new TcpChannel(d.RelaysIp);
BatteriesChannel = new TcpChannel(d.BatteryIp);
BatteryNodes = config
.Devices
.BatteryNodes
.Select(n=>n.ConvertTo<Byte>())
.ToArray(config.Devices.BatteryNodes.Length);
}
public static async Task Main(String[] args)
@ -103,7 +109,7 @@ internal static class Program
var pvOnAcGrid = AcPowerDevice.Null;
var pvOnAcIsland = AcPowerDevice.Null;
var gridPower = gridMeter is null ? AcPower.Null : gridMeter.Ac.Power;
var gridPower = gridMeter is null ? AcPower.Null : gridMeter.Ac.Power;
var islandLoadPower = loadOnAcIsland is null ? AcPower.Null : loadOnAcIsland.Ac.Power;
var inverterAcPower = acDc.Ac.Power;