Innovenergy_trunk/csharp/Lib/Units/Units.cs

29 lines
1.2 KiB
C#
Raw Normal View History

using System.Text.Json.Serialization;
using InnovEnergy.Lib.Units.Json;
namespace InnovEnergy.Lib.Units;
public static class Units
{
public const Decimal MaxRelativeError = 0.05m; // 5%
2023-02-26 14:39:55 +00:00
public static Current A (this Decimal value) => new Current(value);
public static Voltage V (this Decimal value) => new Voltage(value);
public static Power W (this Decimal value) => new Power(value);
public static ReactivePower Var (this Decimal value) => new ReactivePower(value);
public static ApparentPower Va (this Decimal value) => new ApparentPower(value);
public static Resistance Ohm (this Decimal value) => new Resistance(value);
public static Frequency Hz (this Decimal value) => new Frequency(value);
public static Angle Rad (this Decimal value) => new Angle(value);
public static Temperature Celsius(this Decimal value) => new Temperature(value);
public static readonly IReadOnlyList<JsonConverter> JsonConverters = new JsonConverter[]
{
new CurrentConverter(),
new VoltageConverter(),
new PowerConverter(),
2023-02-26 14:39:55 +00:00
new ResistanceConverter(),
// TODO
};
}