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

27 lines
613 B
C#
Raw Normal View History

2023-02-26 18:19:16 +00:00
using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Lib.Units.Composite;
public record Ac1Phase
2023-02-26 14:39:55 +00:00
(
2023-02-26 18:19:16 +00:00
Voltage Voltage,
Current Current,
Angle Phi,
2023-02-26 14:39:55 +00:00
Frequency Frequency
2023-02-26 18:19:16 +00:00
)
: AcPhase(Voltage, Current, Phi)
{
[SuppressMessage("ReSharper", "RedundantCast")]
public static Ac1Phase operator +(Ac1Phase left, Ac1Phase right)
{
var f = (left.Frequency + right.Frequency) / 2m; // TODO: check that l & r approximately equal
var acPhase = (AcPhase)left + (AcPhase)right;
return new Ac1Phase(acPhase.Voltage, acPhase.Current, acPhase.Phi, f);
}
}