remove 'require' again (sigh). It only *seems* to build, but doesnt. we need net7.0

This commit is contained in:
ig 2023-03-01 10:40:25 +01:00
parent 4cb8e9ecfa
commit f5ff1d70a5
12 changed files with 28 additions and 34 deletions

View File

@ -10,8 +10,8 @@ using T = BatteryStatus;
[OpParallel]
public partial record BatteryStatus : DeviceStatus, IDcConnection
{
public required DcPhase Dc { get; init; }
public required Percent Soc { get; init; }
public required Temperature Temperature { get; init; }
public DcPhase Dc { get; init; }
public Percent Soc { get; init; }
public Temperature Temperature { get; init; }
}

View File

@ -6,8 +6,8 @@ namespace InnovEnergy.Lib.StatusApi;
[OpParallel]
public partial record DcDcConverterStatus : DeviceStatus
{
public required DcPhase Left { get; init; }
public required DcPhase Right { get; init; }
public DcPhase Left { get; init; }
public DcPhase Right { get; init; }
}

View File

@ -7,8 +7,8 @@ namespace InnovEnergy.Lib.StatusApi;
[OpParallel]
public partial record MpptStatus : IDcConnection, IPvConnection
{
public required DcPhase Dc { get; init; }
public required IReadOnlyList<DcPhase> Strings { get; init; }
public DcPhase Dc { get; init; }
public IReadOnlyList<DcPhase> Strings { get; init; }
}

View File

@ -7,5 +7,5 @@ namespace InnovEnergy.Lib.StatusApi;
[OpParallel]
public partial record PowerMeterStatus : DeviceStatus, IAc3Connection
{
public required Ac3Phase Ac { get; init; }
public Ac3Phase Ac { get; init; }
}

View File

@ -10,6 +10,6 @@ public partial record SinglePhaseInverterStatus :
IAc1Connection,
IDcConnection
{
public required Ac1Phase Ac { get; init; }
public required DcPhase Dc { get; init; }
public Ac1Phase Ac { get; init; }
public DcPhase Dc { get; init; }
}

View File

@ -10,6 +10,6 @@ public partial record SinglePhasePvInverterStatus :
IAc1Connection,
IPvConnection
{
public required Ac1Phase Ac { get; init; }
public required IReadOnlyList<DcPhase> Strings { get; init; }
public Ac1Phase Ac { get; init; }
public IReadOnlyList<DcPhase> Strings { get; init; }
}

View File

@ -10,7 +10,7 @@ public partial record ThreePhaseInverterStatus :
IAc3Connection,
IDcConnection
{
public required Ac3Phase Ac { get; init; }
public required DcPhase Dc { get; init; }
public Ac3Phase Ac { get; init; }
public DcPhase Dc { get; init; }
}

View File

@ -10,6 +10,6 @@ public partial record ThreePhasePvInverterStatus :
IAc3Connection,
IPvConnection
{
public required Ac3Phase Ac { get; init; }
public required IReadOnlyList<DcPhase> Strings { get; init; }
public Ac3Phase Ac { get; init; }
public IReadOnlyList<DcPhase> Strings { get; init; }
}

View File

@ -1,11 +1,10 @@
using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Lib.Units.Composite;
public record Ac1Phase : AcPhase
{
public required Frequency Frequency { get; init; }
public Frequency Frequency { get; init; }
[SuppressMessage("ReSharper", "RedundantCast")]
public static Ac1Phase operator |(Ac1Phase left, Ac1Phase right)
@ -22,7 +21,6 @@ public record Ac1Phase : AcPhase
};
}
}

View File

@ -5,10 +5,10 @@ namespace InnovEnergy.Lib.Units.Composite;
public record Ac3Phase
{
public required AcPhase L1 { get; init; }
public required AcPhase L2 { get; init; }
public required AcPhase L3 { get; init; }
public required Frequency Frequency { get; init; }
public AcPhase L1 { get; init; }
public AcPhase L2 { get; init; }
public AcPhase L3 { get; init; }
public Frequency Frequency { get; init; }
public ApparentPower ApparentPower => L1.ApparentPower + L2.ApparentPower + L3.ApparentPower;
public ReactivePower ReactivePower => L1.ReactivePower + L2.ReactivePower + L3.ReactivePower;
@ -17,6 +17,4 @@ public record Ac3Phase
public static Ac3Phase operator |(Ac3Phase left, Ac3Phase right) => OpParallel(left, right);
private static readonly Func<Ac3Phase, Ac3Phase, Ac3Phase> OpParallel = "|".CreateBinaryOpForProps<Ac3Phase>();
}

View File

@ -6,20 +6,20 @@ namespace InnovEnergy.Lib.Units.Composite;
public record AcPhase : IPhase
{
private readonly Voltage _Voltage;
public required Voltage Voltage
public Voltage Voltage
{
get => _Voltage;
init => _Voltage = value >= 0 ? value : throw new ArgumentException("RMS value cannot be negative");
init => _Voltage = value >= 0m ? value : throw new ArgumentException("RMS value cannot be negative");
}
private readonly Current _Current;
public required Current Current
public Current Current
{
get => _Current;
init => _Current = value >= 0 ? value : throw new ArgumentException("RMS value cannot be negative");
init => _Current = value >= 0m ? value : throw new ArgumentException("RMS value cannot be negative");
}
public required Angle Phi { get; init; }
public Angle Phi { get; init; }
public ApparentPower ApparentPower => Voltage.Value * Current.Value ;
public Power ActivePower => ApparentPower.Value * PowerFactor;

View File

@ -4,13 +4,11 @@ namespace InnovEnergy.Lib.Units.Composite;
public record DcPhase : IPhase
{
public required Voltage Voltage { get; init;}
public required Current Current { get; init;}
public Voltage Voltage { get; init; }
public Current Current { get; init; }
public Power Power => Current * Voltage;
public static DcPhase operator |(DcPhase left, DcPhase right) => OpParallel(left, right);
private static readonly Func<DcPhase, DcPhase, DcPhase> OpParallel = "|".CreateBinaryOpForProps<DcPhase>();
}