statusApi V2

This commit is contained in:
ig 2023-05-04 09:37:22 +02:00
parent 249d4e7c31
commit 2ec5b34971
17 changed files with 79 additions and 96 deletions

View File

@ -1,15 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record BatteryStatus : IDcConnection
{
public DcBus Dc { get; init; }
public Percent Soc { get; init; }
public Temperature Temperature { get; init; }
}

View File

@ -1,12 +1,20 @@
using System.Collections;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record CombinedStatus<T>
public class CombinedStatus<T> : IReadOnlyList<T>
{
public T Combined { get; init; }
public IReadOnlyList<T> Children { get; init; }
public T? Combined { get; init; }
public IReadOnlyList<T> Stati { get; init; }
public Boolean Available => Children.Any();
public Boolean Available => Stati.Count > 0;
public IEnumerator<T> GetEnumerator() => Stati.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public Int32 Count => Stati.Count;
public T this[Int32 index] => Stati[index];
}

View File

@ -0,0 +1,7 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAc1Meter : IAc1Connection
{
}

View File

@ -0,0 +1,7 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAc3Meter : IAc3Connection
{
}

View File

@ -0,0 +1,8 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAcDc1 : IAc1Connection, IDcConnection
{
}

View File

@ -0,0 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IAcDc3 : IAc3Connection, IDcConnection
{
}

View File

@ -0,0 +1,9 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IBattery : IDcConnection
{
public Percent Soc { get;}
}

View File

@ -1,10 +1,10 @@
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
#pragma warning disable CS8618
public record DcDcConverterStatus
public interface IDcDc
{
public DcBus Left { get; init; }
public DcBus Right { get; init; }

View File

@ -0,0 +1,10 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IMppt : IDcConnection, IPvConnection
{
}

View File

@ -0,0 +1,7 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IPvAc1 : IAc1Connection, IPvConnection
{
}

View File

@ -0,0 +1,8 @@
using InnovEnergy.Lib.StatusApi.Connections;
namespace InnovEnergy.Lib.StatusApi.DeviceTypes;
public interface IPvAc3 : IAc3Connection, IPvConnection
{
}

View File

@ -1,14 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record MpptStatus : IDcConnection, IPvConnection
{
public DcBus Dc { get; init; }
public IReadOnlyList<DcBus> Strings { get; init; }
}

View File

@ -1,11 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record PowerMeterStatus : IAc3Connection
{
public Ac3Bus Ac { get; init; }
}

View File

@ -1,13 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record SinglePhaseInverterStatus : IAc1Connection, IDcConnection
{
public Ac1Bus Ac { get; init; }
public DcBus Dc { get; init; }
}

View File

@ -1,12 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record SinglePhasePvInverterStatus : IAc1Connection, IPvConnection
{
public Ac1Bus Ac { get; init; }
public IReadOnlyList<DcBus> Strings { get; init; }
}

View File

@ -1,13 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record ThreePhaseInverterStatus : IAc3Connection, IDcConnection
{
public Ac3Bus Ac { get; init; }
public DcBus Dc { get; init; }
}

View File

@ -1,12 +0,0 @@
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.StatusApi;
#pragma warning disable CS8618
public record ThreePhasePvInverterStatus : IAc3Connection, IPvConnection
{
public Ac3Bus Ac { get; init; }
public IReadOnlyList<DcBus> Strings { get; init; }
}