Phase => Bus

This commit is contained in:
ig 2023-03-01 10:52:21 +01:00
parent 4bf9deffac
commit b983614cfc
6 changed files with 22 additions and 22 deletions

View File

@ -2,17 +2,17 @@ using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Lib.Units.Composite; namespace InnovEnergy.Lib.Units.Composite;
public record Ac1Phase : AcPhase public record Ac1Bus : AcPhase
{ {
public Frequency Frequency { get; init; } public Frequency Frequency { get; init; }
[SuppressMessage("ReSharper", "RedundantCast")] [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 f = left.Frequency | right.Frequency;
var p = (AcPhase)left | (AcPhase)right; var p = (AcPhase)left | (AcPhase)right;
return new Ac1Phase return new Ac1Bus
{ {
Frequency = f, Frequency = f,
Current = p.Current, Current = p.Current,

View File

@ -3,7 +3,7 @@ using static DecimalMath.DecimalEx;
namespace InnovEnergy.Lib.Units.Composite; namespace InnovEnergy.Lib.Units.Composite;
public record Ac3Phase public record Ac3Bus
{ {
public AcPhase L1 { get; init; } public AcPhase L1 { get; init; }
public AcPhase L2 { get; init; } public AcPhase L2 { get; init; }
@ -15,6 +15,6 @@ public record Ac3Phase
public Power ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower; public Power ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower;
public Angle Phi => ATan2(ReactivePower, ActivePower); public Angle Phi => ATan2(ReactivePower, ActivePower);
public static Ac3Phase operator |(Ac3Phase left, Ac3Phase right) => OpParallel(left, right); public static Ac3Bus operator |(Ac3Bus left, Ac3Bus right) => OpParallel(left, right);
private static readonly Func<Ac3Phase, Ac3Phase, Ac3Phase> OpParallel = "|".CreateBinaryOpForProps<Ac3Phase>(); private static readonly Func<Ac3Bus, Ac3Bus, Ac3Bus> OpParallel = "|".CreateBinaryOpForProps<Ac3Bus>();
} }

View File

@ -3,7 +3,7 @@ using static DecimalMath.DecimalEx;
namespace InnovEnergy.Lib.Units.Composite; namespace InnovEnergy.Lib.Units.Composite;
public record AcPhase : IPhase public record AcPhase : IBus
{ {
private readonly Voltage _Voltage; private readonly Voltage _Voltage;
public Voltage Voltage public Voltage Voltage

View File

@ -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<DcBus, DcBus, DcBus> OpParallel = "|".CreateBinaryOpForProps<DcBus>();
}

View File

@ -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<DcPhase, DcPhase, DcPhase> OpParallel = "|".CreateBinaryOpForProps<DcPhase>();
}

View File

@ -4,7 +4,7 @@ namespace InnovEnergy.Lib.Units.Composite;
[SuppressMessage("ReSharper", "MemberCanBeProtected.Global")] [SuppressMessage("ReSharper", "MemberCanBeProtected.Global")]
public interface IPhase public interface IBus
{ {
public Voltage Voltage { get; } public Voltage Voltage { get; }
public Current Current { get; } public Current Current { get; }