Introduce Lib for Adam6360D

This commit is contained in:
ig 2023-06-13 11:26:48 +02:00
parent 1745d2cb06
commit 43e628502c
5 changed files with 30 additions and 10 deletions

View File

@ -1,14 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../InnovEnergy.lib.props" /> <!-- <Import Project="../../InnovEnergy.Lib.props" />-->
<PropertyGroup> <Import Project="../../../App/InnovEnergy.App.props" />
<AssemblyName>InnovEnergy.Lib.Devices.Adam6060</AssemblyName>
<RootNamespace>InnovEnergy.Lib.Devices.Adam6060</RootNamespace>
<!-- <OutputType>Exe</OutputType> -->
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" /> <ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" />
<ProjectReference Include="../../Units/Units.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,7 +2,7 @@ using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Protocols.Modbus.Clients; using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Slaves; using InnovEnergy.Lib.Protocols.Modbus.Slaves;
namespace InnovEnergy.Lib.Devices.Adam6060; namespace InnovEnergy.Lib.Devices.Adam6360D;
public class Adam6360DDevice : ModbusDevice<Adam6360DRegisters> public class Adam6360DDevice : ModbusDevice<Adam6360DRegisters>
{ {
@ -12,6 +12,7 @@ public class Adam6360DDevice : ModbusDevice<Adam6360DRegisters>
{ {
} }
public Adam6360DDevice(Channel channel, Byte slaveId) : base(new ModbusTcpClient(channel, slaveId)) public Adam6360DDevice(Channel channel, Byte slaveId) : base(new ModbusTcpClient(channel, slaveId))
{ {
} }

View File

@ -1,10 +1,11 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes; using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes;
namespace InnovEnergy.Lib.Devices.Adam6060; namespace InnovEnergy.Lib.Devices.Adam6360D;
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]
[AddressOffset(-1)]
public class Adam6360DRegisters public class Adam6360DRegisters
{ {
[DiscreteInput(1)] public Boolean DigitalInput0 { get; private set; } [DiscreteInput(1)] public Boolean DigitalInput0 { get; private set; }
@ -20,6 +21,7 @@ public class Adam6360DRegisters
[DiscreteInput(11)] public Boolean DigitalInput10 { get; private set; } [DiscreteInput(11)] public Boolean DigitalInput10 { get; private set; }
[DiscreteInput(12)] public Boolean DigitalInput11 { get; private set; } [DiscreteInput(12)] public Boolean DigitalInput11 { get; private set; }
[DiscreteInput(13)] public Boolean DigitalInput12 { get; private set; } [DiscreteInput(13)] public Boolean DigitalInput12 { get; private set; }
[DiscreteInput(14)] public Boolean DigitalInput13 { get; private set; }
[Coil(33)] public Boolean Relay0 { get; set; } [Coil(33)] public Boolean Relay0 { get; set; }
[Coil(34)] public Boolean Relay1 { get; set; } [Coil(34)] public Boolean Relay1 { get; set; }

View File

@ -0,0 +1,20 @@
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.Adam6360D;
public static class Program
{
public static Task Main(String[] args)
{
var d = new Adam6360DDevice("localhost", 2, 5006);
while (true)
{
var x = d.Read();
x.ToCsv().WriteLine();
}
}
}