using System.Reflection; using InnovEnergy.Lib.Victron.VeDBus; namespace InnovEnergy.App.EmuMeterDriver; public static class Config { public const String Version = "1.0"; public const String BusName = "com.victronenergy.grid.emu"; public const Byte ModbusNodeId = 1; public const String OwnAddress = "10.0.0.1"; public const String PeerAddress = "10.0.0.2"; //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); public static readonly IReadOnlyList Signals = new Signal[] { new(s => s.Ac.L1.Current, "/Ac/L1/Current", "0.0 A"), new(s => s.Ac.L2.Current, "/Ac/L2/Current", "0.0 A"), new(s => s.Ac.L3.Current, "/Ac/L3/Current", "0.0 A"), new(s => s.Ac.L1.Current + s.Ac.L2.Current + s.Ac.L3.Current, "/Ac/Current", "0.0 A"), new(s => s.Ac.L1.Voltage, "/Ac/L1/Voltage", "0.0 A"), new(s => s.Ac.L2.Voltage, "/Ac/L2/Voltage", "0.0 A"), new(s => s.Ac.L3.Voltage, "/Ac/L3/Voltage", "0.0 A"), new(s => (s.Ac.L1.Voltage + s.Ac.L2.Voltage + s.Ac.L3.Voltage) / 3, "/Ac/Voltage", "0.0 A"), new(s => s.Ac.L1.Power.Active, "/Ac/L1/Power", "0 W"), new(s => s.Ac.L2.Power.Active, "/Ac/L2/Power", "0 W"), new(s => s.Ac.L3.Power.Active, "/Ac/L3/Power", "0 W"), new(s => s.Ac.Power.Active, "/Ac/Power", "0 W"), // new(s => s.EnergyImportL123, "Ac/Energy/Forward", "0.00 kWh"), // new(s => s.EnergyExportL123, "Ac/Energy/Reverse", "0.00 kWh"), // // new(s => s.EnergyImportL1, "Ac/L1/Energy/Forward", "0.00 kWh"), // new(s => s.EnergyExportL1, "Ac/L1/Energy/Reverse", "0.00 kWh"), // // new(s => s.EnergyImportL2, "Ac/L2/Energy/Forward", "0.00 kWh"), // new(s => s.EnergyExportL2, "Ac/L2/Energy/Reverse", "0.00 kWh"), // // new(s => s.EnergyImportL3, "Ac/L3/Energy/Forward", "0.00 kWh"), // new(s => s.EnergyExportL3, "Ac/L3/Energy/Reverse", "0.00 kWh"), }; public static VeProperties DefaultProperties => new VeProperties { new("/ProductName" , "Grid meter" ), new("/CustomName" , "EMU Professional II"), 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"), }; }