Innovenergy_trunk/csharp/Lib/Units/Composite/Ac3Phase.cs

25 lines
873 B
C#
Raw Normal View History

2023-02-26 14:39:55 +00:00
using static DecimalMath.DecimalEx;
namespace InnovEnergy.Lib.Units.Composite;
2023-02-26 18:19:16 +00:00
public record Ac3Phase(AcPhase L1, AcPhase L2, AcPhase L3, Frequency Frequency)
{
2023-02-26 14:39:55 +00:00
public ApparentPower ApparentPower => L1.ApparentPower + L2.ApparentPower + L3.ApparentPower;
public ReactivePower ReactivePower => L1.ReactivePower + L2.ReactivePower + L3.ReactivePower;
public Power ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower;
public Angle Phi => ATan2(ReactivePower, ActivePower);
2023-02-26 18:19:16 +00:00
public static Ac3Phase operator +(Ac3Phase left, Ac3Phase right)
{
var f = (left.Frequency + right.Frequency) / 2m; // TODO: check that l & r approximately equal
var l1 = left.L1 + right.L1;
var l2 = left.L2 + right.L2;
var l3 = left.L3 + right.L3;
return new Ac3Phase(l1, l2, l3, f);
}
}