Phase => Bus

This commit is contained in:
ig 2023-03-01 10:53:34 +01:00
parent fac1a090bf
commit afe83e943f
7 changed files with 37 additions and 32 deletions

View File

@ -1,5 +1,5 @@
using InnovEnergy.Lib.StatusApi;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Devices;
namespace InnovEnergy.Lib.Devices.AMPT; namespace InnovEnergy.Lib.Devices.AMPT;
@ -11,5 +11,5 @@ public record AmptDeviceStatus
UInt32 Timestamp, // The UTC timestamp of the measurements UInt32 Timestamp, // The UTC timestamp of the measurements
Decimal ProductionToday, // converted to kW in AmptCU class Decimal ProductionToday, // converted to kW in AmptCU class
IReadOnlyList<DcConnection> Strings IReadOnlyList<DcConnection> Strings
): Mppt(Dc, Strings) ): MpptStatus(Dc, Strings)
{} {}

View File

@ -177,7 +177,7 @@ public static class ModbusParser
return Math.Max(pLimit, 0); return Math.Max(pLimit, 0);
} }
internal static DcPhase ParseDcBus(this ModbusRegisters data) internal static DcBus ParseDcBus(this ModbusRegisters data)
{ {
return new() return new()
{ {

View File

@ -1,7 +1,7 @@
using InnovEnergy.Lib.Protocols.Modbus.Clients; using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Connections; using InnovEnergy.Lib.Protocols.Modbus.Connections;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Phases; using InnovEnergy.Lib.Units.Composite;
using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils;
using static DecimalMath.DecimalEx; using static DecimalMath.DecimalEx;
@ -77,7 +77,7 @@ public class EmuMeterDevice
return new EmuMeterStatus return new EmuMeterStatus
( (
Ac: new ThreePhaseAcConnection Ac: new Ac3Bus
( (
new AcPhase( new AcPhase(
voltageL1N, voltageL1N,

View File

@ -1,11 +1,12 @@
using InnovEnergy.Lib.StatusApi;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Devices; using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.Devices.EmuMeter; namespace InnovEnergy.Lib.Devices.EmuMeter;
public record EmuMeterStatus public record EmuMeterStatus
( (
ThreePhaseAcConnection Ac, Ac3Bus Ac,
Decimal ActivePowerL123, Decimal ActivePowerL123,
Decimal ReactivePowerL123, Decimal ReactivePowerL123,
Decimal ApparentPowerL123, Decimal ApparentPowerL123,
@ -21,6 +22,6 @@ public record EmuMeterStatus
Decimal EnergyExportL1, Decimal EnergyExportL1,
Decimal EnergyExportL2, Decimal EnergyExportL2,
Decimal EnergyExportL3 Decimal EnergyExportL3
):GridMeter(Ac) ):PowerMeterStatus(Ac)
{} {}

View File

@ -2,8 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Devices.Trumpf.TruConvert; using InnovEnergy.Lib.Devices.Trumpf.TruConvert;
using InnovEnergy.Lib.Protocols.Modbus.Clients; using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Connections; using InnovEnergy.Lib.Protocols.Modbus.Connections;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.Units.Composite;
using InnovEnergy.Lib.StatusApi.Phases;
using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils;
using static DecimalMath.DecimalEx; using static DecimalMath.DecimalEx;
using static InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.AcControlRegisters; using static InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.AcControlRegisters;
@ -216,7 +215,7 @@ public class TruConvertAcDevice
return new TruConvertAcStatus return new TruConvertAcStatus
( (
Ac: new ThreePhaseAcConnection Ac: new Ac3Bus
( (
new AcPhase(gridVoltageL1,phaseCurrentL1, ACos(powerAcL1/apparentPowerAcL1)), new AcPhase(gridVoltageL1,phaseCurrentL1, ACos(powerAcL1/apparentPowerAcL1)),
new AcPhase(gridVoltageL2,phaseCurrentL2, ACos(powerAcL2/apparentPowerAcL2)), new AcPhase(gridVoltageL2,phaseCurrentL2, ACos(powerAcL2/apparentPowerAcL2)),

View File

@ -1,6 +1,6 @@
using InnovEnergy.Lib.Devices.Trumpf.TruConvert; using InnovEnergy.Lib.Devices.Trumpf.TruConvert;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Devices; using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc;
@ -9,7 +9,7 @@ using WarningMessages = IReadOnlyList<WarningMessage>;
public record TruConvertAcStatus public record TruConvertAcStatus
( (
ThreePhaseAcConnection Ac, Ac3Bus Ac,
DcConnection Dc, DcConnection Dc,
String SerialNumber, String SerialNumber,
MainState MainState, MainState MainState,

View File

@ -1,6 +1,7 @@
using InnovEnergy.Lib.Devices.Trumpf.TruConvert; using InnovEnergy.Lib.StatusApi;
using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.StatusApi.Devices; using InnovEnergy.Lib.Units.Composite;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
@ -8,20 +9,24 @@ using AlarmMessages = IReadOnlyList<AlarmMessage>;
using WarningMessages = IReadOnlyList<WarningMessage>; using WarningMessages = IReadOnlyList<WarningMessage>;
using DcCurrentLimitStates = IReadOnlyList<DcCurrentLimitState>; using DcCurrentLimitStates = IReadOnlyList<DcCurrentLimitState>;
public record TruConvertDcStatus public record TruConvertDcStatus
( (
DcConnection Dc, DcBus DcLeft,
MainState MainState, DcBus DcRight,
UInt16 NumberOfConnectedSlaves, State MainState,
UInt16 NumberOfConnectedSubSlaves, Power TotalDcPower, // TODO: necessary?
Decimal BatteryVoltage, State StatusOfCurrentLimiting,
Decimal BatteryCurrent, Decimal OverloadCapacity,
Decimal TotalDcPower, Temperature DcDcInletTemperature,
DcCurrentLimitStates StatusOfCurrentLimiting, State Alarms,
Decimal OverloadCapacity, State Warnings,
Decimal DcDcInletTemperature, State PowerOperation
AlarmMessages Alarms,
WarningMessages Warnings, // UInt16 NumberOfConnectedSlaves, // TODO: necessary?
Boolean PowerOperation // UInt16 NumberOfConnectedSubSlaves, // TODO: necessary?
):DcDevice(Dc) ) :
{} DcDcConverterStatus(DcLeft, DcRight)
{
public static TruConvertDcStatus operator |(TruConvertDcStatus left, TruConvertDcStatus right) => OpParallel(left, right);
private static readonly Func<TruConvertDcStatus, TruConvertDcStatus, TruConvertDcStatus> OpParallel = Operators.Op<TruConvertDcStatus>("|");
}