Compare commits

...

5 Commits

Author SHA1 Message Date
atef 8cc41163f7 Merge remote-tracking branch 'origin/main' 2023-12-08 09:45:34 +01:00
atef 227505f9d4 Add Sunspec Doc 2023-12-08 09:45:10 +01:00
atef 432e230b03 Add Doepke project 2023-12-08 09:32:08 +01:00
atef ecfac5ea94 Display Alarm of each battery 2023-12-06 14:54:38 +01:00
atef 9aad4851b2 Added Doepke device in Lib/devices 2023-12-06 14:54:08 +01:00
5 changed files with 96 additions and 7 deletions

View File

@ -428,18 +428,25 @@ internal static class Program
if (record.Battery != null) if (record.Battery != null)
{ {
foreach (var alarm in record.Battery.Alarms) var i = 0;
foreach (var battery in record.Battery.Devices)
{
i++;
foreach (var alarm in battery.Alarms)
{ {
alarmList.Add(new AlarmOrWarning alarmList.Add(new AlarmOrWarning
{ {
Date = DateTime.Now.ToString("yyyy-MM-dd"), Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"), Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "Battery", CreatedBy = "Battery" + i,
Description = alarm Description = alarm
}); });
} }
} }
}
foreach (var warning in record.AcDc.Warnings) foreach (var warning in record.AcDc.Warnings)
{ {
warningList.Add(new AlarmOrWarning warningList.Add(new AlarmOrWarning

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>InnovEnergy.Lib.Devices.Doepke</RootNamespace>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Protocols\Modbus\Modbus.csproj" />
</ItemGroup>
</Project>

View File

@ -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<DoepkeRegisters>
{
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))
{
}
}

View File

@ -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
}

Binary file not shown.