17 lines
551 B
C#
17 lines
551 B
C#
using InnovEnergy.Lib.Time.Unix;
|
|
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;
|
|
|
|
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;
|
|
} |