update config class, create salimax device and device state attribute for devices

This commit is contained in:
atef 2023-10-23 10:35:13 +02:00
parent 01f1def61b
commit 171d3715b0
4 changed files with 64 additions and 31 deletions

View File

@ -0,0 +1,8 @@
namespace InnovEnergy.App.SaliMax.Devices;
public enum DeviceState
{
Disabled,
Measured,
Computed
}

View File

@ -0,0 +1,8 @@
using InnovEnergy.Lib.Utils.Net;
namespace InnovEnergy.App.SaliMax.Devices;
public class SalimaxDevice : Ip4Address
{
public required DeviceState DeviceState { get; init; }
}

View File

@ -1,4 +1,5 @@
using System.Text.Json; using System.Text.Json;
using InnovEnergy.App.SaliMax.Devices;
using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils;
using static System.Text.Json.JsonSerializer; using static System.Text.Json.JsonSerializer;
@ -86,15 +87,20 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
Devices = new () Devices = new ()
{ {
TruConvertAcIp = new() { Host = "localhost", Port = 5001}, RelaysIp = new() { Host = "localhost", Port = 5006, DeviceState = DeviceState.Measured},
TruConvertDcIp = new() { Host = "localhost", Port = 5002}, GridMeterIp = new() { Host = "localhost", Port = 5003, DeviceState = DeviceState.Measured},
GridMeterIp = new() { Host = "localhost", Port = 5003}, PvOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
IslandBusLoadMeterIp = new() { Host = "localhost", Port = 5004}, LoadOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
AmptIp = new() { Host = "localhost", Port = 5005}, PvOnAcIsland = new() { Host = "true" , Port = 0 , DeviceState = DeviceState.Measured},
RelaysIp = new() { Host = "localhost", Port = 5006}, IslandBusLoadMeterIp = new() { Host = "localhost", Port = 5004, DeviceState = DeviceState.Measured},
BatteryIp = new() { Host = "localhost", Port = 5007}, TruConvertAcIp = new() { Host = "localhost", Port = 5001, DeviceState = DeviceState.Measured},
PvOnDc = new() { Host = "localhost", Port = 5005, DeviceState = DeviceState.Measured},
LoadOnDc = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
TruConvertDcIp = new() { Host = "localhost", Port = 5002, DeviceState = DeviceState.Measured},
BatteryIp = new() { Host = "localhost", Port = 5007, DeviceState = DeviceState.Measured},
BatteryNodes = new []{ 2, 3, 4, 5, 6 } BatteryNodes = new []{ 2, 3, 4, 5, 6 }
}, },
S3 = new() S3 = new()
{ {
Bucket = "1-3e5b3069-214a-43ee-8d85-57d72000c19d", Bucket = "1-3e5b3069-214a-43ee-8d85-57d72000c19d",
@ -155,24 +161,30 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
MaxChargeBatteryVoltage = 57, MaxChargeBatteryVoltage = 57,
MinDischargeBatteryVoltage = 0, MinDischargeBatteryVoltage = 0,
S3 = new() S3 = new()
{ {
Bucket = "saliomameiringen", Bucket = "1-3e5b3069-214a-43ee-8d85-57d72000c19d",
Region = "sos-ch-dk-2", Region = "sos-ch-dk-2",
Provider = "exo.io", Provider = "exo.io",
ContentType = "text/plain; charset=utf-8", Key = "EXObb5a49acb1061781761895e7",
Key = "EXO2bf0cbd97fbfa75aa36ed46f", Secret = "sKhln0w8ii3ezZ1SJFF33yeDo8NWR1V4w2H0D4-350I",
Secret = "Bn1CDPqOG-XpDSbYjfIJxojcHTm391vZTc8z8l_fEPs" ContentType = "text/plain; charset=utf-8"
}, },
Devices = new () Devices = new ()
{ {
RelaysIp = new() { Host = "10.0.1.1", Port = 502}, RelaysIp = new() { Host = "10.0.1.1", Port = 502, DeviceState = DeviceState.Measured},
TruConvertAcIp = new() { Host = "10.0.2.1", Port = 502}, GridMeterIp = new() { Host = "10.0.4.1", Port = 502, DeviceState = DeviceState.Measured},
TruConvertDcIp = new() { Host = "10.0.3.1", Port = 502}, PvOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
GridMeterIp = new() { Host = "10.0.4.1", Port = 502}, LoadOnAcGrid = new() { Host = "true" , Port = 0 , DeviceState = DeviceState.Measured},
IslandBusLoadMeterIp = new() { Host = "10.0.4.2", Port = 502}, PvOnAcIsland = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
AmptIp = new() { Host = "10.0.5.1", Port = 502}, IslandBusLoadMeterIp = new() { Host = "10.0.4.2", Port = 502, DeviceState = DeviceState.Measured},
BatteryIp = new() { Host = "localhost", Port = 6855}, TruConvertAcIp = new() { Host = "10.0.2.1", Port = 502, DeviceState = DeviceState.Measured},
PvOnDc = new() { Host = "10.0.5.1", Port = 502, DeviceState = DeviceState.Measured},
LoadOnDc = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
TruConvertDcIp = new() { Host = "10.0.3.1", Port = 502, DeviceState = DeviceState.Measured},
BatteryIp = new() { Host = "localhost", Port = 6855, DeviceState = DeviceState.Measured },
BatteryNodes = new []{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, BatteryNodes = new []{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
}, },
}; };

View File

@ -1,15 +1,20 @@
using InnovEnergy.App.SaliMax.Devices;
using InnovEnergy.Lib.Utils.Net; using InnovEnergy.Lib.Utils.Net;
namespace InnovEnergy.App.SaliMax.SystemConfig; namespace InnovEnergy.App.SaliMax.SystemConfig;
public class DeviceConfig public class DeviceConfig
{ {
public required Ip4Address RelaysIp { get; init; } public required SalimaxDevice RelaysIp { get; init; }
public required Ip4Address TruConvertAcIp { get; init; } public required SalimaxDevice GridMeterIp { get; init; }
public required Ip4Address TruConvertDcIp { get; init; } public required SalimaxDevice PvOnAcGrid { get; init; }
public required Ip4Address GridMeterIp { get; init; } public required SalimaxDevice LoadOnAcGrid { get; init; }
public required Ip4Address IslandBusLoadMeterIp { get; init; } public required SalimaxDevice PvOnAcIsland { get; init; }
public required Ip4Address AmptIp { get; init; } public required SalimaxDevice IslandBusLoadMeterIp { get; init; }
public required Ip4Address BatteryIp { get; init; } public required SalimaxDevice TruConvertAcIp { get; init; }
public required SalimaxDevice PvOnDc { get; init; }
public required SalimaxDevice LoadOnDc { get; init; }
public required SalimaxDevice TruConvertDcIp { get; init; }
public required SalimaxDevice BatteryIp { get; init; }
public required Int32[] BatteryNodes { get; init; } public required Int32[] BatteryNodes { get; init; }
} }