From 9aad4851b273fb6bdc4f2655950199a275532a1d Mon Sep 17 00:00:00 2001 From: atef Date: Wed, 6 Dec 2023 14:54:08 +0100 Subject: [PATCH] Added Doepke device in Lib/devices --- csharp/Lib/Devices/Doepke/DoepkeDevice.cs | 19 ++++++++ csharp/Lib/Devices/Doepke/DoepkeRegisters.cs | 48 ++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 csharp/Lib/Devices/Doepke/DoepkeDevice.cs create mode 100644 csharp/Lib/Devices/Doepke/DoepkeRegisters.cs diff --git a/csharp/Lib/Devices/Doepke/DoepkeDevice.cs b/csharp/Lib/Devices/Doepke/DoepkeDevice.cs new file mode 100644 index 000000000..b67bd58a2 --- /dev/null +++ b/csharp/Lib/Devices/Doepke/DoepkeDevice.cs @@ -0,0 +1,19 @@ +using InnovEnergy.Lib.Protocols.Modbus.Channels; +using InnovEnergy.Lib.Protocols.Modbus.Clients; +using InnovEnergy.Lib.Protocols.Modbus.Slaves; + +namespace InnovEnergy.Lib.Devices.Doepke; + +public class DoepkeDevice : ModbusDevice +{ + + public DoepkeDevice(String hostname, Byte slaveId, UInt16 port = 502) : + this(new TcpChannel(hostname, port), slaveId) + { + + } + + public DoepkeDevice(Channel channel, Byte slaveId) : base(new ModbusTcpClient(channel, slaveId)) + { + } +} \ No newline at end of file diff --git a/csharp/Lib/Devices/Doepke/DoepkeRegisters.cs b/csharp/Lib/Devices/Doepke/DoepkeRegisters.cs new file mode 100644 index 000000000..ad1c34015 --- /dev/null +++ b/csharp/Lib/Devices/Doepke/DoepkeRegisters.cs @@ -0,0 +1,48 @@ +using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes; + +namespace InnovEnergy.Lib.Devices.Doepke; + +public class DoepkeRegisters +{ + [InputRegister(0)] public UInt16 ValidityOfTheMeasurement { get; private set; } // 0 = Invalid (e.g. internal error/overload), 1 = OK + [InputRegister(1)] public UInt16 CurrentMeasured1 { get; private set; } // Differential current absolute value + [InputRegister(2)] public UInt16 CurrentMeasured2 { get; private set; } // Differential current absolute value + [InputRegister(3)] public UInt16 CurrentMeasured3 { get; private set; } // Differential current absolute value + [InputRegister(4)] public UInt16 CurrentMeasured4 { get; private set; } // Differential current absolute value + [InputRegister(5)] public UInt16 CurrentMeasured5 { get; private set; } // Differential current absolute value + [InputRegister(6)] public UInt16 CurrentMeasured6 { get; private set; } // Differential current absolute value + [InputRegister(7)] public UInt16 CurrentMeasured7 { get; private set; } // Differential current absolute value + [InputRegister(8)] public UInt16 CurrentMeasured8 { get; private set; } // Differential current absolute value + [InputRegister(9)] public UInt16 CurrentStatusAlarmsA { get; private set; } // See bit coding* (0 = OK, 1 = Alarm) + [InputRegister(10)] public UInt16 CurrentStatusAlarmsB { get; private set; } // See bit coding* (0 = OK, 1 = Alarm) + + [HoldingRegister(15)] public UInt16 FirmwareVersion { get; set; } // x0.01 => Example: 123 = Version 1.23 + [HoldingRegister(16)] public UInt16 AlarmThresholdA1 { get; set; } // absolute value + [HoldingRegister(17)] public UInt16 AlarmThresholdA2 { get; set; } // absolute value + [HoldingRegister(18)] public UInt16 AlarmThresholdA3 { get; set; } // absolute value + [HoldingRegister(19)] public UInt16 AlarmThresholdA4 { get; set; } // absolute value + [HoldingRegister(20)] public UInt16 AlarmThresholdA5 { get; set; } // absolute value + [HoldingRegister(21)] public UInt16 AlarmThresholdA6 { get; set; } // absolute value + [HoldingRegister(22)] public UInt16 AlarmThresholdA7 { get; set; } // absolute value + [HoldingRegister(23)] public UInt16 AlarmThresholdA8 { get; set; } // absolute value + [HoldingRegister(24)] public UInt16 ActivationOfAlarmsA { get; set; } // See bit coding* (0=Inactive, 1=Active) + [HoldingRegister(25)] public UInt16 AlarmThresholdB1 { get; set; } // absolute value + [HoldingRegister(26)] public UInt16 AlarmThresholdB2 { get; set; } // absolute value + [HoldingRegister(27)] public UInt16 AlarmThresholdB3 { get; set; } // absolute value + [HoldingRegister(28)] public UInt16 AlarmThresholdB4 { get; set; } // absolute value + [HoldingRegister(29)] public UInt16 AlarmThresholdB5 { get; set; } // absolute value + [HoldingRegister(30)] public UInt16 AlarmThresholdB6 { get; set; } // absolute value + [HoldingRegister(31)] public UInt16 AlarmThresholdB7 { get; set; } // absolute value + [HoldingRegister(32)] public UInt16 AlarmThresholdB8 { get; set; } // absolute value + [HoldingRegister(33)] public UInt16 ActivationOfAlarmsB { get; set; } // See bit coding* (0=Inactive, 1=Active) + [HoldingRegister(34)] public UInt16 AlarmDelay { get; set; } // 0 = No delay, 1= 500ms, 2= 1000ms, + [HoldingRegister(35)] public UInt16 SaveCurrentSettings { get; set; } // 0 = Successful, 1= Save, 2= Error + [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 + +} \ No newline at end of file