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 InnovEnergy.App.SaliMax.Devices;
using InnovEnergy.Lib.Utils;
using static System.Text.Json.JsonSerializer;
@ -26,11 +27,11 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
public required Double MaxBatteryDischargingCurrent { get; set; }
public required Double MaxDcPower { get; set; }
public required Double MaxChargeBatteryVoltage { get; set; }
public required Double MinDischargeBatteryVoltage { get; set; }
public required Double MaxChargeBatteryVoltage { get; set; }
public required Double MinDischargeBatteryVoltage { get; set; }
public required DeviceConfig Devices { get; set; }
public required S3Config? S3 { get; set; }
public required DeviceConfig Devices { get; set; }
public required S3Config? S3 { get; set; }
private static String? LastSavedData { get; set; }
@ -86,15 +87,20 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
Devices = new ()
{
TruConvertAcIp = new() { Host = "localhost", Port = 5001},
TruConvertDcIp = new() { Host = "localhost", Port = 5002},
GridMeterIp = new() { Host = "localhost", Port = 5003},
IslandBusLoadMeterIp = new() { Host = "localhost", Port = 5004},
AmptIp = new() { Host = "localhost", Port = 5005},
RelaysIp = new() { Host = "localhost", Port = 5006},
BatteryIp = new() { Host = "localhost", Port = 5007},
RelaysIp = new() { Host = "localhost", Port = 5006, DeviceState = DeviceState.Measured},
GridMeterIp = new() { Host = "localhost", Port = 5003, DeviceState = DeviceState.Measured},
PvOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
LoadOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
PvOnAcIsland = new() { Host = "true" , Port = 0 , DeviceState = DeviceState.Measured},
IslandBusLoadMeterIp = new() { Host = "localhost", Port = 5004, DeviceState = DeviceState.Measured},
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 }
},
S3 = new()
{
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,
MinDischargeBatteryVoltage = 0,
S3 = new()
{
Bucket = "saliomameiringen",
Bucket = "1-3e5b3069-214a-43ee-8d85-57d72000c19d",
Region = "sos-ch-dk-2",
Provider = "exo.io",
ContentType = "text/plain; charset=utf-8",
Key = "EXO2bf0cbd97fbfa75aa36ed46f",
Secret = "Bn1CDPqOG-XpDSbYjfIJxojcHTm391vZTc8z8l_fEPs"
Key = "EXObb5a49acb1061781761895e7",
Secret = "sKhln0w8ii3ezZ1SJFF33yeDo8NWR1V4w2H0D4-350I",
ContentType = "text/plain; charset=utf-8"
},
Devices = new ()
Devices = new ()
{
RelaysIp = new() { Host = "10.0.1.1", Port = 502},
TruConvertAcIp = new() { Host = "10.0.2.1", Port = 502},
TruConvertDcIp = new() { Host = "10.0.3.1", Port = 502},
GridMeterIp = new() { Host = "10.0.4.1", Port = 502},
IslandBusLoadMeterIp = new() { Host = "10.0.4.2", Port = 502},
AmptIp = new() { Host = "10.0.5.1", Port = 502},
BatteryIp = new() { Host = "localhost", Port = 6855},
RelaysIp = new() { Host = "10.0.1.1", Port = 502, DeviceState = DeviceState.Measured},
GridMeterIp = new() { Host = "10.0.4.1", Port = 502, DeviceState = DeviceState.Measured},
PvOnAcGrid = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
LoadOnAcGrid = new() { Host = "true" , Port = 0 , DeviceState = DeviceState.Measured},
PvOnAcIsland = new() { Host = "false" , Port = 0 , DeviceState = DeviceState.Measured},
IslandBusLoadMeterIp = new() { Host = "10.0.4.2", Port = 502, DeviceState = DeviceState.Measured},
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},
},
};

View File

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