Add +- operators to AcPower
This commit is contained in:
parent
9b997b353f
commit
4cdfb37e96
|
@ -42,4 +42,7 @@ public sealed class AcPhase
|
|||
};
|
||||
|
||||
public static AcPhase Null { get; } = FromVoltageCurrentPhi(0, 0, 0);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -86,5 +86,15 @@ public sealed class AcPower
|
|||
|
||||
public static AcPower Null { get; } = FromVoltageCurrentPhi(0, 0, 0);
|
||||
|
||||
public static AcPower operator +(AcPower left, AcPower right) => FromActiveReactive
|
||||
(
|
||||
left.Active + right.Active,
|
||||
left.Reactive + right.Reactive
|
||||
);
|
||||
|
||||
public static AcPower operator -(AcPower p) => FromActiveReactive(-p.Active, p.Reactive);
|
||||
|
||||
|
||||
|
||||
public override String ToString() => Active.ToString(); // TODO: show all
|
||||
}
|
|
@ -11,5 +11,8 @@ public sealed class ActivePower : AcPower
|
|||
|
||||
public static implicit operator ActivePower(Double d) => new ActivePower(d);
|
||||
public static implicit operator Double(ActivePower d) => d.Value;
|
||||
|
||||
|
||||
public static ActivePower operator -(ActivePower d) => -d.Value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue