15 lines
558 B
C#
15 lines
558 B
C#
using InnovEnergy.Lib.SrcGen;
|
|
using InnovEnergy.Lib.SrcGen.Attributes;
|
|
using InnovEnergy.Lib.Time.Unix;
|
|
|
|
namespace InnovEnergy.Lib.Units;
|
|
|
|
[Generate<Operators>][Generate<Sum>]
|
|
public readonly partial struct Energy
|
|
{
|
|
public static String Unit => "kWh";
|
|
public static String Symbol => "E";
|
|
|
|
public static ActivePower operator /(Energy energy, TimeSpan timeSpan) => energy.Value * 1000 / timeSpan.TotalHours ;
|
|
public static ActivePower operator /(Energy energy, UnixTimeSpan timeSpan) => energy.Value * 3_600_000 / timeSpan.Ticks;
|
|
} |