From b983614cfc4ebb50dbd3a219697ba49955205e28 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 1 Mar 2023 10:52:21 +0100 Subject: [PATCH] Phase => Bus --- .../Lib/Units/Composite/{Ac1Phase.cs => Ac1Bus.cs} | 6 +++--- .../Lib/Units/Composite/{Ac3Phase.cs => Ac3Bus.cs} | 6 +++--- csharp/Lib/Units/Composite/AcPhase.cs | 2 +- csharp/Lib/Units/Composite/DcBus.cs | 14 ++++++++++++++ csharp/Lib/Units/Composite/DcPhase.cs | 14 -------------- csharp/Lib/Units/Composite/{IPhase.cs => IBus.cs} | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) rename csharp/Lib/Units/Composite/{Ac1Phase.cs => Ac1Bus.cs} (77%) rename csharp/Lib/Units/Composite/{Ac3Phase.cs => Ac3Bus.cs} (74%) create mode 100644 csharp/Lib/Units/Composite/DcBus.cs delete mode 100644 csharp/Lib/Units/Composite/DcPhase.cs rename csharp/Lib/Units/Composite/{IPhase.cs => IBus.cs} (89%) diff --git a/csharp/Lib/Units/Composite/Ac1Phase.cs b/csharp/Lib/Units/Composite/Ac1Bus.cs similarity index 77% rename from csharp/Lib/Units/Composite/Ac1Phase.cs rename to csharp/Lib/Units/Composite/Ac1Bus.cs index 40ddd54b0..f2c769f24 100644 --- a/csharp/Lib/Units/Composite/Ac1Phase.cs +++ b/csharp/Lib/Units/Composite/Ac1Bus.cs @@ -2,17 +2,17 @@ using System.Diagnostics.CodeAnalysis; namespace InnovEnergy.Lib.Units.Composite; -public record Ac1Phase : AcPhase +public record Ac1Bus : AcPhase { public Frequency Frequency { get; init; } [SuppressMessage("ReSharper", "RedundantCast")] - public static Ac1Phase operator |(Ac1Phase left, Ac1Phase right) + public static Ac1Bus operator |(Ac1Bus left, Ac1Bus right) { var f = left.Frequency | right.Frequency; var p = (AcPhase)left | (AcPhase)right; - return new Ac1Phase + return new Ac1Bus { Frequency = f, Current = p.Current, diff --git a/csharp/Lib/Units/Composite/Ac3Phase.cs b/csharp/Lib/Units/Composite/Ac3Bus.cs similarity index 74% rename from csharp/Lib/Units/Composite/Ac3Phase.cs rename to csharp/Lib/Units/Composite/Ac3Bus.cs index a80f89ba0..e35c73cfc 100644 --- a/csharp/Lib/Units/Composite/Ac3Phase.cs +++ b/csharp/Lib/Units/Composite/Ac3Bus.cs @@ -3,7 +3,7 @@ using static DecimalMath.DecimalEx; namespace InnovEnergy.Lib.Units.Composite; -public record Ac3Phase +public record Ac3Bus { public AcPhase L1 { get; init; } public AcPhase L2 { get; init; } @@ -15,6 +15,6 @@ public record Ac3Phase public Power ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower; public Angle Phi => ATan2(ReactivePower, ActivePower); - public static Ac3Phase operator |(Ac3Phase left, Ac3Phase right) => OpParallel(left, right); - private static readonly Func OpParallel = "|".CreateBinaryOpForProps(); + public static Ac3Bus operator |(Ac3Bus left, Ac3Bus 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 de526650d..faa20f23d 100644 --- a/csharp/Lib/Units/Composite/AcPhase.cs +++ b/csharp/Lib/Units/Composite/AcPhase.cs @@ -3,7 +3,7 @@ using static DecimalMath.DecimalEx; namespace InnovEnergy.Lib.Units.Composite; -public record AcPhase : IPhase +public record AcPhase : IBus { private readonly Voltage _Voltage; public Voltage Voltage diff --git a/csharp/Lib/Units/Composite/DcBus.cs b/csharp/Lib/Units/Composite/DcBus.cs new file mode 100644 index 000000000..9bab0143a --- /dev/null +++ b/csharp/Lib/Units/Composite/DcBus.cs @@ -0,0 +1,14 @@ +using InnovEnergy.Lib.Utils; + +namespace InnovEnergy.Lib.Units.Composite; + +public record DcBus : IBus +{ + public Voltage Voltage { get; init; } + public Current Current { get; init; } + + public Power Power => Current * Voltage; + + public static DcBus operator |(DcBus left, DcBus right) => OpParallel(left, right); + private static readonly Func OpParallel = "|".CreateBinaryOpForProps(); +} \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/DcPhase.cs b/csharp/Lib/Units/Composite/DcPhase.cs deleted file mode 100644 index 919589b6a..000000000 --- a/csharp/Lib/Units/Composite/DcPhase.cs +++ /dev/null @@ -1,14 +0,0 @@ -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.Lib.Units.Composite; - -public record DcPhase : IPhase -{ - 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 diff --git a/csharp/Lib/Units/Composite/IPhase.cs b/csharp/Lib/Units/Composite/IBus.cs similarity index 89% rename from csharp/Lib/Units/Composite/IPhase.cs rename to csharp/Lib/Units/Composite/IBus.cs index b0ccfee66..8b9694972 100644 --- a/csharp/Lib/Units/Composite/IPhase.cs +++ b/csharp/Lib/Units/Composite/IBus.cs @@ -4,7 +4,7 @@ namespace InnovEnergy.Lib.Units.Composite; [SuppressMessage("ReSharper", "MemberCanBeProtected.Global")] -public interface IPhase +public interface IBus { public Voltage Voltage { get; } public Current Current { get; }