using static DecimalMath.DecimalEx; namespace InnovEnergy.Lib.Units.Composite; public record AcPhase : Phase { 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; } 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); }