update Deligreen stand alone application
This commit is contained in:
parent
28fe33f48d
commit
5fc72a4f39
|
|
@ -0,0 +1,8 @@
|
|||
namespace InnovEnergy.App.DeligreenBatteryCommunication;
|
||||
|
||||
public enum DeviceState
|
||||
{
|
||||
Disabled,
|
||||
Measured,
|
||||
Computed
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using InnovEnergy.Lib.Devices.Amax5070;
|
||||
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
||||
using InnovEnergy.Lib.Utils;
|
||||
|
||||
|
||||
namespace InnovEnergy.App.SodiStoreMax.SaliMaxRelays;
|
||||
namespace InnovEnergy.App.DeligreenBatteryCommunication;
|
||||
|
||||
public class RelaysDeviceAmax
|
||||
{
|
||||
|
|
@ -12,13 +12,14 @@ public class RelaysDeviceAmax
|
|||
|
||||
public RelaysRecordAmax? Read()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
return AmaxDevice.Read();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
$"Failed to read from {nameof(RelaysDeviceAmax)}\n{e}".LogError();
|
||||
$"Failed to read from {nameof(RelaysDeviceAmax)}\n{e}".WriteLine();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +32,7 @@ public class RelaysDeviceAmax
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
$"Failed to write to {nameof(RelaysDeviceAmax)}\n{e}".LogError();
|
||||
$"Failed to write to {nameof(RelaysDeviceAmax)}\n{e}".WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
using InnovEnergy.Lib.Devices.Amax5070;
|
||||
|
||||
namespace InnovEnergy.App.DeligreenBatteryCommunication;
|
||||
|
||||
public class RelaysRecordAmax
|
||||
{
|
||||
private readonly Amax5070Registers _regs;
|
||||
|
||||
private RelaysRecordAmax(Amax5070Registers regs) => _regs = regs;
|
||||
|
||||
//public UInt16 K0Input
|
||||
//{
|
||||
// get => _regs.DigitalInput;
|
||||
//}
|
||||
|
||||
|
||||
public Boolean K0
|
||||
{
|
||||
get => _regs.DigitalOutput0;
|
||||
set => _regs.DigitalOutput0 = value;
|
||||
}
|
||||
|
||||
public Boolean K1
|
||||
{
|
||||
get => _regs.DigitalOutput1;
|
||||
set => _regs.DigitalOutput1 = value;
|
||||
}
|
||||
|
||||
public Boolean K2
|
||||
{
|
||||
get => _regs.DigitalOutput2;
|
||||
set => _regs.DigitalOutput2 = value;
|
||||
}
|
||||
|
||||
public Boolean K3
|
||||
{
|
||||
get => _regs.DigitalOutput3;
|
||||
set => _regs.DigitalOutput3 = value;
|
||||
}
|
||||
|
||||
|
||||
public Boolean R0
|
||||
{
|
||||
get => _regs.Relay12;
|
||||
set => _regs.Relay12 = value;
|
||||
}
|
||||
|
||||
public Boolean R1
|
||||
{
|
||||
get => _regs.Relay22;
|
||||
set => _regs.Relay22 = value;
|
||||
}
|
||||
|
||||
public Boolean R2
|
||||
{
|
||||
get => _regs.Relay32;
|
||||
set => _regs.Relay32 = value;
|
||||
}
|
||||
|
||||
public Boolean R3
|
||||
{
|
||||
get => _regs.Relay42;
|
||||
set => _regs.Relay42 = value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public Boolean K1GridBusIsConnectedToGrid => _regs.DigitalInput22;
|
||||
public Boolean K2IslandBusIsConnectedToGridBus => !_regs.DigitalInput20;
|
||||
public IEnumerable<Boolean> K3InverterIsConnectedToIslandBus
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return K3Inverter1IsConnectedToIslandBus;
|
||||
yield return K3Inverter2IsConnectedToIslandBus;
|
||||
yield return K3Inverter3IsConnectedToIslandBus;
|
||||
yield return K3Inverter4IsConnectedToIslandBus;
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean K3Inverter1IsConnectedToIslandBus => !_regs.DigitalInput16;
|
||||
private Boolean K3Inverter2IsConnectedToIslandBus => !_regs.DigitalInput17;
|
||||
private Boolean K3Inverter3IsConnectedToIslandBus => !_regs.DigitalInput18;
|
||||
private Boolean K3Inverter4IsConnectedToIslandBus => !_regs.DigitalInput19;
|
||||
|
||||
public Boolean FiWarning => !_regs.DigitalInput21;
|
||||
public Boolean FiError => !_regs.DigitalInput23;*/
|
||||
|
||||
//public Boolean K2ConnectIslandBusToGridBus
|
||||
//{
|
||||
// get => _regs.Relay22;
|
||||
// set => _regs.Relay22 = value;
|
||||
//}
|
||||
|
||||
|
||||
public static implicit operator Amax5070Registers(RelaysRecordAmax d) => d._regs;
|
||||
public static implicit operator RelaysRecordAmax(Amax5070Registers d) => new RelaysRecordAmax(d);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using InnovEnergy.Lib.Utils.Net;
|
||||
|
||||
namespace InnovEnergy.App.DeligreenBatteryCommunication;
|
||||
|
||||
public class SalimaxDevice : Ip4Address
|
||||
{
|
||||
public required DeviceState DeviceState { get; init; }
|
||||
|
||||
public override String ToString() => $"{base.ToString()} ({DeviceState})";
|
||||
|
||||
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), DeviceState);
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue