using InnovEnergy.Units; namespace InnovEnergy.Lib.StatusData; public readonly struct Power { public static String Unit => "W"; public static String Symbol => "P"; public Decimal Value { get; } public Power(Decimal value) => Value = value; public override String ToString() => Value + Unit; // parallel public static Power operator |(Power left, Power right) => new Power(left.Value + right.Value); // series public static Power operator +(Power left, Power right) => new Power(left.Value + right.Value); // scalar multiplication public static Power operator *(Decimal scalar, Power power ) => new Power(scalar * power.Value); public static Power operator *(Power power , Decimal scalar) => new Power(scalar * power.Value); public static Power operator *(Int32 scalar, Power power ) => new Power(scalar * power.Value); public static Power operator *(Power power , Int32 scalar) => new Power(scalar * power.Value); public static Power operator /(Power power , Decimal scalar) => new Power(power.Value / scalar); public static Power operator /(Power power , Int32 scalar) => new Power(power.Value / scalar); // P=UI public static Voltage operator /(Power power, Current current) => new Voltage(power.Value / current.Value); public static Current operator /(Power power, Voltage voltage) => new Current(power.Value / voltage.Value); }