2023-03-08 13:17:39 +00:00
|
|
|
using InnovEnergy.Lib.Time.Unix;
|
2023-02-26 14:39:55 +00:00
|
|
|
using InnovEnergy.Lib.Units.Generator;
|
2023-02-26 09:38:28 +00:00
|
|
|
|
2023-02-26 14:39:55 +00:00
|
|
|
namespace InnovEnergy.Lib.Units;
|
2023-02-26 09:38:28 +00:00
|
|
|
|
2023-03-20 12:22:57 +00:00
|
|
|
[Generate]
|
2023-02-26 14:39:55 +00:00
|
|
|
public readonly partial struct Power
|
2023-02-26 09:38:28 +00:00
|
|
|
{
|
|
|
|
public static String Unit => "W";
|
|
|
|
public static String Symbol => "P";
|
|
|
|
|
|
|
|
public Power(Decimal value) => Value = value;
|
|
|
|
|
|
|
|
// 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);
|
2023-03-08 13:06:39 +00:00
|
|
|
|
|
|
|
public static Energy operator *(Power power, TimeSpan timeSpan) => power.Value / 1000m * (Decimal) timeSpan.TotalHours;
|
|
|
|
public static Energy operator *(TimeSpan timeSpan, Power power) => power.Value / 1000m * (Decimal) timeSpan.TotalHours;
|
2023-03-08 13:17:39 +00:00
|
|
|
|
|
|
|
public static Energy operator *(Power power, UnixTimeSpan timeSpan) => power.Value * timeSpan.Ticks / 3_600_000;
|
|
|
|
public static Energy operator *(UnixTimeSpan timeSpan, Power power) => power.Value * timeSpan.Ticks / 3_600_000;
|
2023-02-26 09:38:28 +00:00
|
|
|
}
|