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

22 lines
773 B
C#
Raw Normal View History

using static DecimalMath.DecimalEx;
namespace InnovEnergy.Lib.Units.Composite;
public record AcPhase : Phase
{
2023-02-26 14:39:55 +00:00
public AcPhase(Voltage voltage, Current current, Angle phi) : base(voltage, current)
{
if (voltage < 0) throw new ArgumentException("RMS value cannot be negative", nameof(voltage));
if (current < 0) throw new ArgumentException("RMS value cannot be negative", nameof(current));
Phi = phi;
}
public Angle Phi { get; }
2023-02-26 14:39:55 +00:00
public ApparentPower ApparentPower => Math.Abs(Voltage.Value * Current.Value) ;
public Power ActivePower => ApparentPower.Value * PowerFactor;
public ReactivePower ReactivePower => ApparentPower.Value * Sin(Phi);
public Decimal PowerFactor => Cos(Phi);
}