2024-06-04 10:25:51 +00:00
|
|
|
using System.Reflection;
|
|
|
|
using InnovEnergy.Lib.Victron.VeDBus;
|
|
|
|
|
2024-06-04 13:28:17 +00:00
|
|
|
namespace InnovEnergy.App.SchneiderDriver;
|
2024-06-04 10:25:51 +00:00
|
|
|
|
|
|
|
public static class Config
|
|
|
|
{
|
|
|
|
public const String Version = "1.0";
|
2024-06-13 13:18:05 +00:00
|
|
|
public const String BusName = "com.victronenergy.grid";
|
2024-06-04 10:25:51 +00:00
|
|
|
public const Byte ModbusNodeId = 1;
|
2024-06-05 14:17:21 +00:00
|
|
|
public const String OwnAddress = "192.168.1.246";
|
|
|
|
public const String PeerAddress = "192.168.1.82";
|
2024-06-04 10:25:51 +00:00
|
|
|
//public const String PeerAddress = "127.0.0.1";
|
|
|
|
public const UInt16 PeerPort = 502;
|
|
|
|
|
|
|
|
public static TimeSpan TcpTimeout { get; } = TimeSpan.FromSeconds(2);
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly TimeSpan UpdatePeriod = TimeSpan.FromSeconds(1);
|
|
|
|
|
2024-06-07 08:36:15 +00:00
|
|
|
public static readonly IReadOnlyList<Signal> Signals = new List<Signal>
|
2024-06-12 12:05:29 +00:00
|
|
|
{
|
|
|
|
new Signal(s => s._CurrentL1, "/Ac/L1/Current", "0.0 A"),
|
|
|
|
new Signal(s => s._CurrentL2, "/Ac/L2/Current", "0.0 A"),
|
|
|
|
new Signal(s => s._CurrentL3, "/Ac/L3/Current", "0.0 A"),
|
|
|
|
new Signal(s => s._CurrentL1 + s._CurrentL2 + s._CurrentL3, "/Ac/Current", "0.0 A"),
|
2024-06-04 10:25:51 +00:00
|
|
|
|
2024-06-12 12:05:29 +00:00
|
|
|
new Signal(s => s._VoltageL1N, "/Ac/L1/Voltage", "0.0 V"),
|
|
|
|
new Signal(s => s._VoltageL2N, "/Ac/L2/Voltage", "0.0 V"),
|
|
|
|
new Signal(s => s._VoltageL3N, "/Ac/L3/Voltage", "0.0 V"),
|
|
|
|
new Signal(s => (s._VoltageL1N + s._VoltageL2N + s._VoltageL3N) / 3.0f, "/Ac/Voltage", "0.0 V"),
|
2024-06-04 10:25:51 +00:00
|
|
|
|
2024-06-07 08:36:15 +00:00
|
|
|
new Signal(s => s.ActivePowerL1, "/Ac/L1/Power", "0 W"),
|
|
|
|
new Signal(s => s.ActivePowerL2, "/Ac/L2/Power", "0 W"),
|
|
|
|
new Signal(s => s.ActivePowerL3, "/Ac/L3/Power", "0 W"),
|
2024-06-12 12:05:29 +00:00
|
|
|
new Signal(s => s.ActivePowerL1 + s.ActivePowerL2 + s.ActivePowerL3, "/Ac/Power", "0 W"),
|
|
|
|
|
|
|
|
|
|
|
|
new Signal(s => s.TotalActiveImport, "Ac/Energy/Forward", "0.00 kWh"),
|
|
|
|
new Signal(s => s.TotalActiveExport, "Ac/Energy/Reverse", "0.00 kWh"),
|
|
|
|
new Signal(s => s.ActiveEnergyImportL1, "Ac/L1/Energy/Forward", "0.00 kWh"),
|
|
|
|
// new(s => s.EnergyExportL1, "Ac/L1/Energy/Reverse", "0.00 kWh"),
|
|
|
|
//
|
|
|
|
new Signal(s => s.ActiveEnergyImportL2, "Ac/L2/Energy/Forward", "0.00 kWh"),
|
|
|
|
// new(s => s.EnergyExportL2, "Ac/L2/Energy/Reverse", "0.00 kWh"),
|
|
|
|
//
|
|
|
|
new Signal(s => s.ActiveEnergyImportL3, "Ac/L3/Energy/Forward", "0.00 kWh"),
|
|
|
|
// new(s => s.EnergyExportL3, "Ac/L3/Energy/Reverse", "0.00 kWh"),
|
2024-06-04 10:25:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public static VeProperties DefaultProperties => new VeProperties
|
|
|
|
{
|
|
|
|
new("/ProductName" , "Grid meter" ),
|
2024-06-05 14:17:21 +00:00
|
|
|
new("/CustomName" , "Schneider Professional"),
|
2024-06-04 10:25:51 +00:00
|
|
|
new("/DeviceInstance" , 30),
|
|
|
|
new("/DeviceType" , 72),
|
|
|
|
new("/Mgmt/Connection" , "Modbus TCP"),
|
|
|
|
new("/Mgmt/ProcessName" , Assembly.GetEntryAssembly()?.Location ?? "unknown"),
|
|
|
|
new("/Mgmt/ProcessVersion", Version),
|
|
|
|
new("/Connected" , 1),
|
|
|
|
new("/ProductId" , 45058, "b002"),
|
|
|
|
new("/Role" , "grid"),
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|