add doepke to the device config and to our ems

This commit is contained in:
atef 2025-06-11 15:59:26 +02:00
parent 8be31b4e0c
commit 0d9135ba06
3 changed files with 31 additions and 3 deletions

View File

@ -16,6 +16,7 @@ public class DeviceConfig
public required SalimaxDevice PvOnDc { get; init; }
public required SalimaxDevice LoadOnDc { get; init; }
public required SalimaxDevice TruConvertDcIp { get; init; }
public required SalimaxDevice DoepkeIp { get; init; }
public required SalimaxDevice BatteryIp { get; init; }
public required Int32[] BatteryNodes { get; init; }
}

View File

@ -1,19 +1,47 @@
using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Slaves;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.Doepke;
public class DoepkeDevice : ModbusDevice<DoepkeRegisters>
{
public DoepkeDevice(String hostname, Byte slaveId, UInt16 port = 502) :
public DoepkeDevice(String hostname, Byte slaveId = 0, UInt16 port = 502) :
this(new TcpChannel(hostname, port), slaveId)
{
}
public DoepkeDevice(Channel channel, Byte slaveId) : base(new ModbusTcpClient(channel, slaveId))
public DoepkeDevice(Channel channel, Byte slaveId = 0) : base(new ModbusTcpClient(channel, slaveId))
{
}
public new DoepkeRegisters? Read()
{
try
{
return base.Read();
}
catch
{
"Failed to read data from EmuMeter".WriteLine();
return null;
}
}
public new void Write(DoepkeRegisters registers)
{
try
{
base.Write(registers);
}
catch (Exception e)
{
// TODO: Log
Console.WriteLine(e);
}
}
}

View File

@ -40,7 +40,6 @@ public class DoepkeRegisters
[HoldingRegister(36)] public UInt16 DeviceTest { get; set; } // 0 = Successful, 1= Test active, 2= Error
//*Bit coding alarm status/activation
// Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
// DC Ac In total 50 Hz < 100 Hz 150 Hz 100 Hz - 1kHz > 1 kHz > 10 kHz