2023-03-08 13:17:39 +00:00
|
|
|
using InnovEnergy.Lib.Time.Unix;
|
2023-03-08 13:06:39 +00:00
|
|
|
using InnovEnergy.Lib.Units.Generator;
|
|
|
|
|
|
|
|
|
|
|
|
namespace InnovEnergy.Lib.Units;
|
|
|
|
|
|
|
|
[Sum]
|
|
|
|
public readonly partial struct Energy
|
|
|
|
{
|
|
|
|
public static String Unit => "kWh";
|
|
|
|
public static String Symbol => "E";
|
|
|
|
|
|
|
|
public Energy(Decimal value) => Value = value;
|
|
|
|
|
2023-03-08 13:17:39 +00:00
|
|
|
public static Power operator /(Energy energy, TimeSpan timeSpan) => energy.Value * 1000m / (Decimal) timeSpan.TotalHours ;
|
|
|
|
public static Power operator /(Energy energy, UnixTimeSpan timeSpan) => energy.Value * 3_600_000m / timeSpan.Ticks;
|
2023-03-08 13:06:39 +00:00
|
|
|
}
|