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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
using InnovEnergy.Lib.StatusApi;
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Devices;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.Devices.EmuMeter;
public record EmuMeterStatus
(
ThreePhaseAcConnection Ac,
Ac3Bus Ac,
Decimal ActivePowerL123,
Decimal ReactivePowerL123,
Decimal ApparentPowerL123,
@ -21,6 +22,6 @@ public record EmuMeterStatus
Decimal EnergyExportL1,
Decimal EnergyExportL2,
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.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Protocols.Modbus.Connections;
using InnovEnergy.Lib.StatusApi.Connections;
using InnovEnergy.Lib.StatusApi.Phases;
using InnovEnergy.Lib.Units.Composite;
using InnovEnergy.Lib.Utils;
using static DecimalMath.DecimalEx;
using static InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.AcControlRegisters;
@ -216,7 +215,7 @@ public class TruConvertAcDevice
return new TruConvertAcStatus
(
Ac: new ThreePhaseAcConnection
Ac: new Ac3Bus
(
new AcPhase(gridVoltageL1,phaseCurrentL1, ACos(powerAcL1/apparentPowerAcL1)),
new AcPhase(gridVoltageL2,phaseCurrentL2, ACos(powerAcL2/apparentPowerAcL2)),

View File

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

View File

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