diff --git a/csharp/Lib/Devices/AMPT/AmptStatus.cs b/csharp/Lib/Devices/AMPT/AmptStatus.cs index 2b3df5422..19977095e 100644 --- a/csharp/Lib/Devices/AMPT/AmptStatus.cs +++ b/csharp/Lib/Devices/AMPT/AmptStatus.cs @@ -13,7 +13,7 @@ public class AmptStatus public DcBus? Dc { get; } public IReadOnlyList Strings { get; } - public static AmptStatus Null { get; } = new AmptStatus(null, Array.Empty()); + public static AmptStatus Null => new AmptStatus(null, Array.Empty()); } diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs index 3669d5e9a..5d5db55d2 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs @@ -34,5 +34,5 @@ public class Battery48TlRecords public IReadOnlyList Devices { get; init; } - public static Battery48TlRecords Null { get; } = new Battery48TlRecords(Array.Empty()); + public static Battery48TlRecords Null => new Battery48TlRecords(Array.Empty()); } \ No newline at end of file diff --git a/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcDevicesRecord.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcDevicesRecord.cs index 54eece404..577b485d2 100644 --- a/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcDevicesRecord.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcDevicesRecord.cs @@ -6,7 +6,7 @@ namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; public class AcDcDevicesRecord { - public static AcDcDevicesRecord Null { get; } = new AcDcDevicesRecord(null, Array.Empty()); + public static AcDcDevicesRecord Null => new AcDcDevicesRecord(null, Array.Empty()); public AcDcDevicesRecord(SystemControlRegisters? systemControl, IReadOnlyList devices) { diff --git a/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcRecord.Modbus.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcRecord.Modbus.cs index 2e1a0d7f0..e4d6756a7 100644 --- a/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcRecord.Modbus.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcDcRecord.Modbus.cs @@ -75,13 +75,13 @@ public partial class AcDcRecord [InputRegister(5141)] internal readonly Double ActivePowerL2; [InputRegister(5142)] internal readonly Double ActivePowerL3; - [InputRegister(5231)] internal readonly Double ReactivePowerL1; - [InputRegister(5232)] internal readonly Double ReactivePowerL2; - [InputRegister(5233)] internal readonly Double ReactivePowerL3; + [InputRegister(5231)] internal readonly Double ReactivePowerL1; + [InputRegister(5232)] internal readonly Double ReactivePowerL2; + [InputRegister(5233)] internal readonly Double ReactivePowerL3; - [InputRegister(5150, Scale = .01)] internal readonly Double GridCurrentL1; - [InputRegister(5151, Scale = .01)] internal readonly Double GridCurrentL2; - [InputRegister(5152, Scale = .01)] internal readonly Double GridCurrentL3; + [InputRegister(5150, Scale = .01)] internal readonly Double GridCurrentL1; + [InputRegister(5151, Scale = .01)] internal readonly Double GridCurrentL2; + [InputRegister(5152, Scale = .01)] internal readonly Double GridCurrentL3; [InputRegister(5160, Scale = .1)] internal readonly Double GridVoltageL1; [InputRegister(5161, Scale = .1)] internal readonly Double GridVoltageL2; diff --git a/csharp/Lib/Devices/Trumpf/TruConvertDc/DcDcDevicesRecord.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/DcDcDevicesRecord.cs index 8ea6ac807..e1491a49e 100644 --- a/csharp/Lib/Devices/Trumpf/TruConvertDc/DcDcDevicesRecord.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertDc/DcDcDevicesRecord.cs @@ -38,5 +38,5 @@ public class DcDcDevicesRecord public IEnumerable Alarms => Devices.SelectMany(d => d.Status.Alarms ).Distinct(); public IEnumerable Warnings => Devices.SelectMany(d => d.Status.Warnings).Distinct(); - public static DcDcDevicesRecord Null { get; } = new DcDcDevicesRecord(null, Array.Empty()); + public static DcDcDevicesRecord Null => new DcDcDevicesRecord(null, Array.Empty()); } \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/Ac1Bus.cs b/csharp/Lib/Units/Composite/Ac1Bus.cs index fd039647c..abdc15110 100644 --- a/csharp/Lib/Units/Composite/Ac1Bus.cs +++ b/csharp/Lib/Units/Composite/Ac1Bus.cs @@ -21,5 +21,5 @@ public sealed class Ac1Bus Power = AcPower.FromVoltageCurrentPhi(voltageRms, currentRms, phi) }; - public static Ac1Bus Null { get; } = FromVoltageCurrentFrequencyPhi(0, 0, 0, 0); + public static Ac1Bus Null => FromVoltageCurrentFrequencyPhi(0, 0, 0, 0); } \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/Ac3Bus.cs b/csharp/Lib/Units/Composite/Ac3Bus.cs index 61b9aed8a..884fcc690 100644 --- a/csharp/Lib/Units/Composite/Ac3Bus.cs +++ b/csharp/Lib/Units/Composite/Ac3Bus.cs @@ -24,5 +24,5 @@ public sealed class Ac3Bus Frequency = frequency, }; - public static Ac3Bus Null { get; } = FromPhasesAndFrequency(AcPhase.Null, AcPhase.Null, AcPhase.Null, 0); + public static Ac3Bus Null => FromPhasesAndFrequency(AcPhase.Null, AcPhase.Null, AcPhase.Null, 0); } \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/AcPhase.cs b/csharp/Lib/Units/Composite/AcPhase.cs index 165b9a0fa..acacd1343 100644 --- a/csharp/Lib/Units/Composite/AcPhase.cs +++ b/csharp/Lib/Units/Composite/AcPhase.cs @@ -41,7 +41,7 @@ public sealed class AcPhase Power = AcPower.FromActiveReactiveApparent(activePower, reactivePower, apparentPower) }; - public static AcPhase Null { get; } = FromVoltageCurrentPhi(0, 0, 0); + public static AcPhase Null => FromVoltageCurrentPhi(0, 0, 0); diff --git a/csharp/Lib/Units/Composite/AcPower.cs b/csharp/Lib/Units/Composite/AcPower.cs index b3a518e52..e9de3a735 100644 --- a/csharp/Lib/Units/Composite/AcPower.cs +++ b/csharp/Lib/Units/Composite/AcPower.cs @@ -84,7 +84,7 @@ public sealed class AcPower }; } - public static AcPower Null { get; } = FromVoltageCurrentPhi(0, 0, 0); + public static AcPower Null => FromVoltageCurrentPhi(0, 0, 0); public static AcPower operator +(AcPower left, AcPower right) => FromActiveReactive ( @@ -92,6 +92,12 @@ public sealed class AcPower left.Reactive + right.Reactive ); + public static AcPower operator -(AcPower left, AcPower right) => FromActiveReactive + ( + left.Active - right.Active, + left.Reactive - right.Reactive + ); + public static AcPower operator -(AcPower p) => FromActiveReactive(-p.Active, p.Reactive); diff --git a/csharp/Lib/Units/Composite/DcBus.cs b/csharp/Lib/Units/Composite/DcBus.cs index 011f31655..c75de28ed 100644 --- a/csharp/Lib/Units/Composite/DcBus.cs +++ b/csharp/Lib/Units/Composite/DcBus.cs @@ -17,5 +17,5 @@ public sealed class DcBus Power = current.Value * voltage.Value, }; - public static DcBus Null { get; } = FromVoltageCurrent(0, 0); + public static DcBus Null => FromVoltageCurrent(0, 0); } \ No newline at end of file diff --git a/csharp/Lib/Units/Power/DcPower.cs b/csharp/Lib/Units/Power/DcPower.cs index 944573bed..5709c20e3 100644 --- a/csharp/Lib/Units/Power/DcPower.cs +++ b/csharp/Lib/Units/Power/DcPower.cs @@ -12,5 +12,5 @@ public sealed class DcPower : AcPower public static implicit operator Double(DcPower d) => d.Value; - public static DcPower Null { get; } = new DcPower(0); + public static DcPower Null => new DcPower(0); }