make BatteryStatus nullable
This commit is contained in:
parent
851b936217
commit
7fc5f80e8c
|
@ -14,7 +14,7 @@ public record StatusRecord
|
|||
{
|
||||
public required AcDcDevicesRecord AcDc { get; init; }
|
||||
public required DcDcDevicesRecord DcDc { get; init; }
|
||||
public required Battery48TlRecords Battery { get; init; }
|
||||
public required Battery48TlRecords? Battery { get; init; }
|
||||
public required EmuMeterRegisters? GridMeter { get; init; }
|
||||
public required EmuMeterRegisters? LoadOnAcIsland { get; init; }
|
||||
public required AcPowerDevice? LoadOnAcGrid { get; init; }
|
||||
|
|
|
@ -18,11 +18,8 @@ using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc.Control;
|
|||
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
||||
using InnovEnergy.Lib.Time.Unix;
|
||||
using InnovEnergy.Lib.Units;
|
||||
using InnovEnergy.Lib.Units.Power;
|
||||
using InnovEnergy.Lib.Utils;
|
||||
using static InnovEnergy.Lib.Devices.Trumpf.SystemControl.DataTypes.SystemConfig;
|
||||
using AcPower = InnovEnergy.Lib.Units.Composite.AcPower;
|
||||
using Exception = System.Exception;
|
||||
|
||||
#pragma warning disable IL2026
|
||||
|
||||
|
@ -75,6 +72,7 @@ internal static class Program
|
|||
e.LogError();
|
||||
}
|
||||
}
|
||||
// ReSharper disable once FunctionNeverReturns
|
||||
}
|
||||
|
||||
private static async Task Run()
|
||||
|
@ -115,9 +113,9 @@ internal static class Program
|
|||
|
||||
return new StatusRecord
|
||||
{
|
||||
AcDc = acDc ,
|
||||
DcDc = dcDc ,
|
||||
Battery = battery ,
|
||||
AcDc = acDc,
|
||||
DcDc = dcDc,
|
||||
Battery = battery,
|
||||
Relays = relays,
|
||||
GridMeter = gridMeter,
|
||||
|
||||
|
@ -171,6 +169,7 @@ internal static class Program
|
|||
{
|
||||
Watchdog.NotifyAlive();
|
||||
|
||||
var t = UnixTime.Now;
|
||||
var record = ReadStatus();
|
||||
|
||||
int i = 1;
|
||||
|
@ -219,15 +218,6 @@ internal static class Program
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static async Task<T?> ResultOrNull<T>(this Task<T> task)
|
||||
{
|
||||
if (task.Status == TaskStatus.RanToCompletion)
|
||||
return await task;
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
private static void ControlConstants(this StatusRecord r)
|
||||
{
|
||||
var inverters = r.AcDc.Devices;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace InnovEnergy.Lib.StatusApi.Connections;
|
|||
|
||||
public interface IPvConnection
|
||||
{
|
||||
IReadOnlyList<DcBus> Strings { get; }
|
||||
IReadOnlyList<DcBus> Strings { get; }
|
||||
}
|
||||
|
||||
public interface IPvConnection<out T> where T : IReadOnlyList<DcBus>
|
||||
|
|
Loading…
Reference in New Issue