22 lines
717 B
C#
22 lines
717 B
C#
|
using static DecimalMath.DecimalEx;
|
||
|
|
||
|
namespace InnovEnergy.Lib.Units.Composite;
|
||
|
|
||
|
|
||
|
public record AcPhase : Phase
|
||
|
{
|
||
|
protected 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; }
|
||
|
|
||
|
public Power ApparentPower => Voltage * Current;
|
||
|
public Power ActivePower => ApparentPower * PowerFactor;
|
||
|
public Power ReactivePower => ApparentPower * Sin(Phi);
|
||
|
public Decimal PowerFactor => Cos(Phi);
|
||
|
}
|