From f5ff1d70a5f78097faf106d316d59a4502678608 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 1 Mar 2023 10:40:25 +0100 Subject: [PATCH] remove 'require' again (sigh). It only *seems* to build, but doesnt. we need net7.0 --- csharp/Lib/StatusApi/BatteryStatus.cs | 6 +++--- csharp/Lib/StatusApi/DcDcConverterStatus.cs | 4 ++-- csharp/Lib/StatusApi/MpptStatus.cs | 4 ++-- csharp/Lib/StatusApi/PowerMeterStatus.cs | 2 +- csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs | 4 ++-- csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs | 4 ++-- csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs | 4 ++-- csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs | 4 ++-- csharp/Lib/Units/Composite/Ac1Phase.cs | 4 +--- csharp/Lib/Units/Composite/Ac3Phase.cs | 10 ++++------ csharp/Lib/Units/Composite/AcPhase.cs | 10 +++++----- csharp/Lib/Units/Composite/DcPhase.cs | 6 ++---- 12 files changed, 28 insertions(+), 34 deletions(-) diff --git a/csharp/Lib/StatusApi/BatteryStatus.cs b/csharp/Lib/StatusApi/BatteryStatus.cs index fc8961fd1..0f1fedc46 100644 --- a/csharp/Lib/StatusApi/BatteryStatus.cs +++ b/csharp/Lib/StatusApi/BatteryStatus.cs @@ -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; } } \ No newline at end of file diff --git a/csharp/Lib/StatusApi/DcDcConverterStatus.cs b/csharp/Lib/StatusApi/DcDcConverterStatus.cs index a7d931065..de33033d2 100644 --- a/csharp/Lib/StatusApi/DcDcConverterStatus.cs +++ b/csharp/Lib/StatusApi/DcDcConverterStatus.cs @@ -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; } } diff --git a/csharp/Lib/StatusApi/MpptStatus.cs b/csharp/Lib/StatusApi/MpptStatus.cs index 6514ad5f0..99d4df09b 100644 --- a/csharp/Lib/StatusApi/MpptStatus.cs +++ b/csharp/Lib/StatusApi/MpptStatus.cs @@ -7,8 +7,8 @@ namespace InnovEnergy.Lib.StatusApi; [OpParallel] public partial record MpptStatus : IDcConnection, IPvConnection { - public required DcPhase Dc { get; init; } - public required IReadOnlyList Strings { get; init; } + public DcPhase Dc { get; init; } + public IReadOnlyList Strings { get; init; } } \ No newline at end of file diff --git a/csharp/Lib/StatusApi/PowerMeterStatus.cs b/csharp/Lib/StatusApi/PowerMeterStatus.cs index d02a2ea72..26552861e 100644 --- a/csharp/Lib/StatusApi/PowerMeterStatus.cs +++ b/csharp/Lib/StatusApi/PowerMeterStatus.cs @@ -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; } } \ No newline at end of file diff --git a/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs b/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs index efd9e7f5c..caaec0d94 100644 --- a/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs +++ b/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs @@ -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; } } diff --git a/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs b/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs index 3fc2db56a..d6d885a78 100644 --- a/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs +++ b/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs @@ -10,6 +10,6 @@ public partial record SinglePhasePvInverterStatus : IAc1Connection, IPvConnection { - public required Ac1Phase Ac { get; init; } - public required IReadOnlyList Strings { get; init; } + public Ac1Phase Ac { get; init; } + public IReadOnlyList Strings { get; init; } } diff --git a/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs b/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs index 306430190..e9fe03d3c 100644 --- a/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs +++ b/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs @@ -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; } } \ No newline at end of file diff --git a/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs b/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs index b5a7686da..c2fb05d30 100644 --- a/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs +++ b/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs @@ -10,6 +10,6 @@ public partial record ThreePhasePvInverterStatus : IAc3Connection, IPvConnection { - public required Ac3Phase Ac { get; init; } - public required IReadOnlyList Strings { get; init; } + public Ac3Phase Ac { get; init; } + public IReadOnlyList Strings { get; init; } } diff --git a/csharp/Lib/Units/Composite/Ac1Phase.cs b/csharp/Lib/Units/Composite/Ac1Phase.cs index d7cfc20e7..40ddd54b0 100644 --- a/csharp/Lib/Units/Composite/Ac1Phase.cs +++ b/csharp/Lib/Units/Composite/Ac1Phase.cs @@ -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) @@ -21,7 +20,6 @@ public record Ac1Phase : AcPhase Phi = p.Phi }; } - } diff --git a/csharp/Lib/Units/Composite/Ac3Phase.cs b/csharp/Lib/Units/Composite/Ac3Phase.cs index d73f8e9e4..a80f89ba0 100644 --- a/csharp/Lib/Units/Composite/Ac3Phase.cs +++ b/csharp/Lib/Units/Composite/Ac3Phase.cs @@ -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 OpParallel = "|".CreateBinaryOpForProps(); - - } \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/AcPhase.cs b/csharp/Lib/Units/Composite/AcPhase.cs index 426091fbc..de526650d 100644 --- a/csharp/Lib/Units/Composite/AcPhase.cs +++ b/csharp/Lib/Units/Composite/AcPhase.cs @@ -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; diff --git a/csharp/Lib/Units/Composite/DcPhase.cs b/csharp/Lib/Units/Composite/DcPhase.cs index 2d0b24b68..919589b6a 100644 --- a/csharp/Lib/Units/Composite/DcPhase.cs +++ b/csharp/Lib/Units/Composite/DcPhase.cs @@ -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 OpParallel = "|".CreateBinaryOpForProps(); - - } \ No newline at end of file