some QOL improvements
This commit is contained in:
parent
005a5460db
commit
64b64cc1e0
|
@ -6,8 +6,6 @@ namespace InnovEnergy.Lib.Units.Composite;
|
|||
|
||||
public sealed class AcPower
|
||||
{
|
||||
private AcPower(){}
|
||||
|
||||
public required ApparentPower Apparent { get; init; }
|
||||
public required ActivePower Active { get; init; }
|
||||
public required ReactivePower Reactive { get; init; }
|
||||
|
@ -84,22 +82,35 @@ public sealed class AcPower
|
|||
};
|
||||
}
|
||||
|
||||
public static AcPower Null => FromVoltageCurrentPhi(0, 0, 0);
|
||||
|
||||
public static AcPower operator +(AcPower left, AcPower right) => FromActiveReactive
|
||||
public static AcPower operator +(AcPower left, AcPower right)
|
||||
{
|
||||
return FromActiveReactive
|
||||
(
|
||||
left.Active + right.Active,
|
||||
left.Reactive + right.Reactive
|
||||
);
|
||||
}
|
||||
|
||||
public static AcPower operator -(AcPower left, AcPower right) => FromActiveReactive
|
||||
public static AcPower operator -(AcPower left, AcPower right)
|
||||
{
|
||||
return left + -right;
|
||||
}
|
||||
|
||||
public static AcPower operator -(AcPower p)
|
||||
{
|
||||
var activePower = -p.Active;
|
||||
var reactivePower = -p.Reactive;
|
||||
|
||||
return FromActiveReactive
|
||||
(
|
||||
left.Active - right.Active,
|
||||
left.Reactive - right.Reactive
|
||||
activePower,
|
||||
reactivePower
|
||||
);
|
||||
}
|
||||
|
||||
public static AcPower operator -(AcPower p) => FromActiveReactive(-p.Active, p.Reactive);
|
||||
|
||||
public static implicit operator AcPower(Double p) => FromActiveReactive(p, 0);
|
||||
public static implicit operator AcPower(Int32 p) => FromActiveReactive(p, 0);
|
||||
|
||||
|
||||
public override String ToString() => Active.ToString(); // TODO: show all
|
||||
|
|
Loading…
Reference in New Issue