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

45 lines
1.8 KiB
C#

using InnovEnergy.Lib.Units.Power;
namespace InnovEnergy.Lib.Units.Composite;
public sealed class AcPhase
{
private AcPhase(){}
public Voltage Voltage { get; private init; } = null!;
public Current Current { get; private init; } = null!;
public AcPower Power { get; private init; } = null!;
public static AcPhase FromVoltageCurrentPhi(Voltage voltageRms,
Current currentRms,
Angle phi) => new()
{
Current = currentRms,
Voltage = voltageRms,
Power = AcPower.FromVoltageCurrentPhi(voltageRms, currentRms, phi)
};
public static AcPhase FromVoltageCurrentActiveReactive(Voltage voltageRms,
Current currentRms,
ActivePower activePower,
ReactivePower reactivePower) => new()
{
Current = currentRms,
Voltage = voltageRms,
Power = AcPower.FromActiveReactive(activePower, reactivePower)
};
public static AcPhase FromVoltageCurrentActiveReactiveApparent(Voltage voltageRms,
Current currentRms,
ActivePower activePower,
ReactivePower reactivePower,
ApparentPower apparentPower) => new()
{
Current = currentRms,
Voltage = voltageRms,
Power = AcPower.FromActiveReactiveApparent(activePower, reactivePower, apparentPower)
};
public static AcPhase Null { get; } = FromVoltageCurrentPhi(0, 0, 0);
}