610 lines
32 KiB
C#
610 lines
32 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using InnovEnergy.Lib.Devices.Sinexcel_12K_TL.DataType;
|
|
using InnovEnergy.Lib.Units;
|
|
using InnovEnergy.Lib.Units.Power;
|
|
|
|
namespace InnovEnergy.Lib.Devices.Sinexcel_12K_TL;
|
|
|
|
public partial class SinexcelRecord
|
|
{
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Public API — Decoded Float Values
|
|
// ───────────────────────────────────────────────
|
|
// ───────────────────────────────────────────────
|
|
// Grid Measurements
|
|
// ───────────────────────────────────────────────
|
|
public Voltage GridAPhaseVoltage => ConvertBitPatternToFloat(_gridAPhaseVoltage);
|
|
public Voltage GridBPhaseVoltage => UIntToFloat(_grid_B_Phase_Voltage);
|
|
public Voltage GridCPhaseVoltage => UIntToFloat(_grid_C_Phase_Voltage);
|
|
|
|
public Voltage GridAbWireVoltage => UIntToFloat(_grid_AB_Wire_Voltage);
|
|
public Voltage GridBcWireVoltage => UIntToFloat(_grid_BC_Wire_Voltage);
|
|
public Voltage GridCaWireVoltage => UIntToFloat(_grid_CA_Wire_Voltage);
|
|
|
|
public Frequency GridVoltageFrequency => UIntToFloat(_grid_Voltage_Frequency);
|
|
|
|
public Current GridAPhaseCurrent => UIntToFloat(_grid_A_Phase_Current);
|
|
public Current GridBPhaseCurrent => UIntToFloat(_grid_B_Phase_Current);
|
|
public Current GridCPhaseCurrent => UIntToFloat(_grid_C_Phase_Current);
|
|
public Current GridNWireCurrent => UIntToFloat(_grid_N_Wire_Current);
|
|
|
|
public ApparentPower GridAPhaseApparentPower => UIntToFloat(_gridAPhaseApparentPower);
|
|
public ApparentPower GridBPhaseApparentPower => UIntToFloat(_gridBPhaseApparentPower);
|
|
public ApparentPower GridCPhaseApparentPower => UIntToFloat(_gridCPhaseApparentPower);
|
|
|
|
public ActivePower GridAPhaseActivePower => UIntToFloat(_gridAPhaseActivePower);
|
|
public ActivePower GridBPhaseActivePower => UIntToFloat(_gridBPhaseActivePower);
|
|
public ActivePower GridCPhaseActivePower => UIntToFloat(_gridCPhaseActivePower);
|
|
|
|
public ReactivePower GridAPhaseReactivePower => UIntToFloat(_gridAPhaseReactivePower);
|
|
public ReactivePower GridBPhaseReactivePower => UIntToFloat(_gridBPhaseReactivePower);
|
|
public ReactivePower GridCPhaseReactivePower => UIntToFloat(_gridCPhaseReactivePower);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Load Measurements
|
|
// ───────────────────────────────────────────────
|
|
public Voltage LoadAPhaseVoltage => UIntToFloat(_loadAPhaseVoltage);
|
|
public Voltage LoadBPhaseVoltage => UIntToFloat(_loadBPhaseVoltage);
|
|
public Voltage LoadCPhaseVoltage => UIntToFloat(_loadCPhaseVoltage);
|
|
|
|
public Voltage LoadAbWireVoltage => UIntToFloat(_loadABWireVoltage);
|
|
public Voltage LoadBcWireVoltage => UIntToFloat(_loadBCWireVoltage);
|
|
public Voltage LoadCaWireVoltage => UIntToFloat(_loadCAWireVoltage);
|
|
|
|
public Frequency LoadVoltageFrequency => UIntToFloat(_loadVoltageFrequency);
|
|
|
|
public Current LoadAPhaseCurrent => UIntToFloat(_loadAPhaseCurrent);
|
|
public Current LoadBPhaseCurrent => UIntToFloat(_loadBPhaseCurrent);
|
|
public Current LoadCPhaseCurrent => UIntToFloat(_loadCPhaseCurrent);
|
|
public Current LoadNWireCurrent => UIntToFloat(_loadNWireCurrent);
|
|
|
|
public ApparentPower LoadAPhaseApparentPower => UIntToFloat(_loadAPhaseApparentPower);
|
|
public ApparentPower LoadBPhaseApparentPower => UIntToFloat(_loadBPhaseApparentPower);
|
|
public ApparentPower LoadCPhaseApparentPower => UIntToFloat(_loadCPhaseApparentPower);
|
|
|
|
public ActivePower LoadAPhaseActivePower => UIntToFloat(_loadAPhaseActivePower);
|
|
public ActivePower LoadBPhaseActivePower => UIntToFloat(_loadBPhaseActivePower);
|
|
public ActivePower LoadCPhaseActivePower => UIntToFloat(_loadCPhaseActivePower);
|
|
|
|
public ReactivePower LoadAPhaseReactivePower => UIntToFloat(_loadAPhaseReactivePower);
|
|
public ReactivePower LoadBPhaseReactivePower => UIntToFloat(_loadBPhaseReactivePower);
|
|
public ReactivePower LoadCPhaseReactivePower => UIntToFloat(_loadCPhaseReactivePower);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Inverter Measurements
|
|
// ───────────────────────────────────────────────
|
|
public Voltage InverterAPhaseVoltage => UIntToFloat(_inverterAPhaseVoltage);
|
|
public Voltage InverterBPhaseVoltage => UIntToFloat(_inverterBPhaseVoltage);
|
|
public Voltage InverterCPhaseVoltage => UIntToFloat(_inverterCPhaseVoltage);
|
|
|
|
public Voltage InverterAbWireVoltage => UIntToFloat(_inverterABWireVoltage);
|
|
public Voltage InverterBcWireVoltage => UIntToFloat(_inverterBCWireVoltage);
|
|
public Voltage InverterCaWireVoltage => UIntToFloat(_inverterCAWireVoltage);
|
|
|
|
public ActivePower InverterAPhaseActivePower => UIntToFloat(_inverterAPhaseActivePower);
|
|
public ActivePower InverterBPhaseActivePower => UIntToFloat(_inverterBPhaseActivePower);
|
|
public ActivePower InverterCPhaseActivePower => UIntToFloat(_inverterCPhaseActivePower);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// DC/AC Temperature Sensors (°C)
|
|
// ───────────────────────────────────────────────
|
|
public Temperature DcacTemperature1 => UIntToFloat(_dcacTemperature1);
|
|
public Temperature DcacTemperature2 => UIntToFloat(_dcacTemperature2);
|
|
public Temperature DcacTemperature3 => UIntToFloat(_dcacTemperature3);
|
|
public Temperature DcacTemperature4 => UIntToFloat(_dcacTemperature4);
|
|
public Temperature DcacTemperature5 => UIntToFloat(_dcacTemperature5);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Date / Time Information
|
|
// ───────────────────────────────────────────────
|
|
public Single Year => UIntToFloat(_year);
|
|
public Single Month => UIntToFloat(_month);
|
|
public Single Day => UIntToFloat(_day);
|
|
public Single Hour => UIntToFloat(_hour);
|
|
public Single Minute => UIntToFloat(_minute);
|
|
public Single Second => UIntToFloat(_second);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Diesel Generator Measurements
|
|
// ───────────────────────────────────────────────
|
|
public Voltage DieselGenAPhaseVoltage => ConvertBitPatternToFloat(_dieselGenAPhaseVoltage);
|
|
public Voltage DieselGenBPhaseVoltage => ConvertBitPatternToFloat(_dieselGenBPhaseVoltage);
|
|
public Voltage DieselGenCPhaseVoltage => ConvertBitPatternToFloat(_dieselGenCPhaseVoltage);
|
|
public Voltage DieselGenABWireVoltage => ConvertBitPatternToFloat(_dieselGenABWireVoltage);
|
|
public Voltage DieselGenBCWireVoltage => ConvertBitPatternToFloat(_dieselGenBCWireVoltage);
|
|
public Voltage DieselGenCAWireVoltage => ConvertBitPatternToFloat(_dieselGenCAWireVoltage);
|
|
|
|
public Frequency DieselGenVoltageFrequency => ConvertBitPatternToFloat(_dieselGenVoltageFrequency);
|
|
|
|
public Current DieselGenAPhaseCurrent => ConvertBitPatternToFloat(_dieselGenAPhaseCurrent);
|
|
public Current DieselGenBPhaseCurrent => ConvertBitPatternToFloat(_dieselGenBPhaseCurrent);
|
|
public Current DieselGenCPhaseCurrent => ConvertBitPatternToFloat(_dieselGenCPhaseCurrent);
|
|
public Current DieselGenNWireCurrent => ConvertBitPatternToFloat(_dieselGenNWireCurrent);
|
|
|
|
public ApparentPower DieselGenAPhaseApparentPower => ConvertBitPatternToFloat(_dieselGenAPhaseApparentPower);
|
|
public ApparentPower DieselGenBPhaseApparentPower => ConvertBitPatternToFloat(_dieselGenBPhaseApparentPower);
|
|
public ApparentPower DieselGenCPhaseApparentPower => ConvertBitPatternToFloat(_dieselGenCPhaseApparentPower);
|
|
|
|
public ActivePower DieselGenAPhaseActivePower => ConvertBitPatternToFloat(_dieselGenAPhaseActivePower);
|
|
public ActivePower DieselGenBPhaseActivePower => ConvertBitPatternToFloat(_dieselGenBPhaseActivePower);
|
|
public ActivePower DieselGenCPhaseActivePower => ConvertBitPatternToFloat(_dieselGenCPhaseActivePower);
|
|
|
|
public ReactivePower DieselGenAPhaseReactivePower => ConvertBitPatternToFloat(_dieselGenAPhaseReactivePower);
|
|
public ReactivePower DieselGenBPhaseReactivePower => ConvertBitPatternToFloat(_dieselGenBPhaseReactivePower);
|
|
public ReactivePower DieselGenCPhaseReactivePower => ConvertBitPatternToFloat(_dieselGenCPhaseReactivePower);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Photovoltaic and Battery Measurements
|
|
// ───────────────────────────────────────────────
|
|
public Voltage PvVoltage1 => ConvertBitPatternToFloat(_pvVoltage1);
|
|
public Current PvCurrent1 => ConvertBitPatternToFloat(_pvCurrent1);
|
|
public ActivePower PvPower1 => ConvertBitPatternToFloat(_pvPower1);
|
|
public Voltage PvVoltage2 => ConvertBitPatternToFloat(_pvVoltage2);
|
|
public Current PvCurrent2 => ConvertBitPatternToFloat(_pvCurrent2);
|
|
public ActivePower PvPower2 => ConvertBitPatternToFloat(_pvPower2);
|
|
|
|
public Voltage BatteryVoltage1 => ConvertBitPatternToFloat(_batteryVoltage1);
|
|
public Current BatteryCurrent1 => ConvertBitPatternToFloat(_batteryCurrent1);
|
|
public ActivePower BatteryPower1 => ConvertBitPatternToFloat(_batteryPower1);
|
|
public Percent BatterySoc1 => ConvertBitPatternToFloat(_batterySoc1);
|
|
public float BatteryFullLoadDuration1 => ConvertBitPatternToFloat(_batteryFullLoadDuration1);
|
|
|
|
public Voltage BatteryVoltage2 => ConvertBitPatternToFloat(_batteryVoltage2);
|
|
public Current BatteryCurrent2 => ConvertBitPatternToFloat(_batteryCurrent2);
|
|
public ActivePower BatteryPower2 => ConvertBitPatternToFloat(_batteryPower2);
|
|
public Percent BatterySoc2 => ConvertBitPatternToFloat(_batterySoc2);
|
|
public float BatteryFullLoadDuration2 => ConvertBitPatternToFloat(_batteryFullLoadDuration2);
|
|
|
|
public Temperature DcdcTemperature1 => ConvertBitPatternToFloat(_dcdcTemperature1);
|
|
public Temperature DcdcTemperature2 => ConvertBitPatternToFloat(_dcdcTemperature2);
|
|
public Temperature DcdcTemperature3 => ConvertBitPatternToFloat(_dcdcTemperature3);
|
|
public Temperature DcdcTemperature4 => ConvertBitPatternToFloat(_dcdcTemperature4);
|
|
public Temperature DcdcTemperature5 => ConvertBitPatternToFloat(_dcdcTemperature5);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Energy and Power Summary
|
|
// ───────────────────────────────────────────────
|
|
public Energy ElectricityPurchased => ConvertBitPatternToFloat(_electricityPurchased);
|
|
public Energy ElectricityFed => ConvertBitPatternToFloat(_electricityFed);
|
|
public Energy SelfGeneratedElectricity => ConvertBitPatternToFloat(_selfGeneratedElectricity);
|
|
public Energy BatteryCharge => ConvertBitPatternToFloat(_batteryCharge);
|
|
public Energy BatteryDischarge => ConvertBitPatternToFloat(_batteryDischarge);
|
|
public Energy LoadPowerConsumption => ConvertBitPatternToFloat(_loadPowerConsumption);
|
|
public Energy DailySelfGeneratedElectricity => ConvertBitPatternToFloat(_dailySelfGeneratedElectricity);
|
|
public Energy DailyElectricityPurchased => ConvertBitPatternToFloat(_dailyElectricityPurchased);
|
|
public Energy DailyElectricityFed => ConvertBitPatternToFloat(_dailyElectricityFed);
|
|
public Energy DailyBatteryCharge => ConvertBitPatternToFloat(_dailyBatteryCharge);
|
|
public Energy DailyBatteryDischarge => ConvertBitPatternToFloat(_dailyBatteryDischarge);
|
|
public Energy DailyLoadPowerConsumption => ConvertBitPatternToFloat(_dailyLoadPowerConsumption);
|
|
public ActivePower TotalPhotovoltaicPower => ConvertBitPatternToFloat(_totalPhotovoltaicPower);
|
|
public ActivePower TotalBatteryPower => ConvertBitPatternToFloat(_totalBatteryPower);
|
|
public ActivePower TotalLoadPower => ConvertBitPatternToFloat(_totalLoadPower);
|
|
public ActivePower TotalGridPower => ConvertBitPatternToFloat(_totalGridPower);
|
|
public ActivePower ImportantLoadTotalPower => ConvertBitPatternToFloat(_importantLoadTotalPower);
|
|
public ActivePower GeneralLoadTotalPower => ConvertBitPatternToFloat(_generalLoadTotalPower);
|
|
public Voltage Pv3Voltage => ConvertBitPatternToFloat(_pv3Voltage);
|
|
public Current Pv3Current => ConvertBitPatternToFloat(_pv3Current);
|
|
public ActivePower Pv3Power => ConvertBitPatternToFloat(_pv3Power);
|
|
public Voltage Pv4Voltage => ConvertBitPatternToFloat(_pv4Voltage);
|
|
public Current Pv4Current => ConvertBitPatternToFloat(_pv4Current);
|
|
public ActivePower Pv4Power => ConvertBitPatternToFloat(_pv4Power);
|
|
public ActivePower GeneratorTotalPower => ConvertBitPatternToFloat(_generatorTotalPower);
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Manufacturer Information & Software Versions
|
|
// ───────────────────────────────────────────────
|
|
public UInt16 ProtocolVersionNo => _protocolVersionNo; // 0x2000
|
|
public UInt16 DcacSoftwareVersionNo => _dcacSoftwareVersionNo; // 0x2001
|
|
public UInt16 DcdcSoftwareVersionNo => _dcdcSoftwareVersionNo; // 0x2002
|
|
public UInt16 ArmSoftwareVersionNo => _armSoftwareVersionNo; // 0x2003
|
|
public UInt16 CpldVersion => _cpldVersion; // 0x2004
|
|
public UInt16 AfciSoftwareVersionNo => _afciSoftwareVersionNo; // 0x2005
|
|
public SinexcelMachineType MachineType => (SinexcelMachineType)_machineType; // 0x2006
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Device Info & Model
|
|
// ───────────────────────────────────────────────
|
|
public ApparentPower RatedPowerKva => _ratedPower / 100f; // 0x2008 (value / 100)
|
|
public SinexcelModel Model => (SinexcelModel)_model; // 0x200D
|
|
|
|
public ThreePhaseWireSystem ThreePhaseWireSystem
|
|
{
|
|
get => (ThreePhaseWireSystem)_threePhaseWireSystem;
|
|
set => _threePhaseWireSystem = (UInt32)value;
|
|
}
|
|
|
|
public InputFrequency InputFrequencyClass
|
|
{
|
|
get => (InputFrequency)_inputFrequencyClass;
|
|
set => _inputFrequencyClass = (UInt32)value;
|
|
}
|
|
|
|
public WorkingMode WorkingMode
|
|
{
|
|
get => (WorkingMode)ConvertBitPatternToFloat(_workingMode);
|
|
set => _workingMode = (UInt32)value;
|
|
}
|
|
|
|
public GridSwitchMethod GridSwitchMethod
|
|
{
|
|
get => (GridSwitchMethod)_methodSwitchMode;
|
|
set => _methodSwitchMode = (UInt32)value;
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Inverter Control Configuration
|
|
// ───────────────────────────────────────────────
|
|
public SinexcelUnbalanceCompensation EnableOnGridUnbalanceCompensation
|
|
{
|
|
get => (SinexcelUnbalanceCompensation)_enableOnGridUnbalanceCompensation;
|
|
set => _enableOnGridUnbalanceCompensation = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelTemperatureDrop TemperatureDrop
|
|
{
|
|
get => (SinexcelTemperatureDrop)ConvertBitPatternToFloat(_temperatureDrop);
|
|
set => _temperatureDrop = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelHvrt Hvrt
|
|
{
|
|
get => (SinexcelHvrt)_hvrt;
|
|
set => _hvrt = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelLvrt Lvrt
|
|
{
|
|
get => (SinexcelLvrt)_lvrt;
|
|
set => _lvrt = (UInt32)value;
|
|
}
|
|
|
|
// Fan Gear — numeric [0.5 ~ 1.0], default 1.0
|
|
public float FanGear
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_fanGear));
|
|
set => _fanGear = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Battery Configuration
|
|
// ───────────────────────────────────────────────
|
|
public SinexcelBatteryAccessMethod BatteryAccessMethod
|
|
{
|
|
get => (SinexcelBatteryAccessMethod)_batteryAccessMethod;
|
|
set => _batteryAccessMethod = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelMeterAccessEnable MeterAccessEnable
|
|
{
|
|
get => (SinexcelMeterAccessEnable)ConvertBitPatternToFloat(_meterAccessEnable);
|
|
set => _meterAccessEnable = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelBatteryEnable EnableBattery1
|
|
{
|
|
get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery1);
|
|
set => _enableBattery1 = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelBatteryEnable EnableBattery2
|
|
{
|
|
get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery2);
|
|
set => _enableBattery2 = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelPvEnable EnablePv1
|
|
{
|
|
get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv1);
|
|
set => _enablePv1 = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelPvEnable EnablePv2
|
|
{
|
|
get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv2);
|
|
set => _enablePv2 = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelBatteryType BatteryType
|
|
{
|
|
get => (SinexcelBatteryType)_batteryType;
|
|
set => _batteryType = (UInt32)value;
|
|
}
|
|
|
|
public float BatteryCapacity1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCapacity1));
|
|
set => _batteryCapacity1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float MaxChargingCurrentBattery1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxChargingCurrentBattery1));
|
|
set => _maxChargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float MaxDischargingCurrentBattery1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxDischargingCurrentBattery1));
|
|
set => _maxDischargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float RatedBatteryVoltage1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_ratedBatteryVoltage1));
|
|
set => _ratedBatteryVoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float MinSocBattery1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_minSocBattery1));
|
|
set => _minSocBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float SetValueBattery1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_setValueBattery1));
|
|
set => _setValueBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public SinexcelActiveChargeDischarge ActiveChargeDischarge
|
|
{
|
|
get => (SinexcelActiveChargeDischarge)ConvertBitPatternToFloat(_activeChargeDischarge);
|
|
set => _activeChargeDischarge = (UInt32)value;
|
|
}
|
|
|
|
public float ActiveChargeDischargePower
|
|
{
|
|
get => ConvertBitPatternToFloat(_activeChargeDischargePower);
|
|
set => _activeChargeDischargePower = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Protection & PV Mode
|
|
// ───────────────────────────────────────────────
|
|
public SinexcelIslandProtection EnableIslandProtection
|
|
{
|
|
get => (SinexcelIslandProtection)_enableIslandProtection;
|
|
set => _enableIslandProtection = (UInt32)value;
|
|
}
|
|
|
|
public SinexcelPvAccessMode PvAccessMode
|
|
{
|
|
get => (SinexcelPvAccessMode)_pvAccessMode;
|
|
set => _pvAccessMode = (UInt32)value;
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// System-Level Parameters
|
|
// ───────────────────────────────────────────────
|
|
public float OutputVoltageAdjustmentFactor
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_outputVoltageAdjustmentFactor));
|
|
set => _outputVoltageAdjustmentFactor = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float SetValueBatteryUndervoltage1
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_setValueBatteryUndervoltage1));
|
|
set => _setValueBatteryUndervoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float InverterPowerLimit
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_inverterPowerLimit));
|
|
set => _inverterPowerLimit = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Battery 2 Parameters
|
|
// ───────────────────────────────────────────────
|
|
public float Battery2Capacity
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2Capacity));
|
|
set => _battery2Capacity = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float MaxChargingCurrentBattery2
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_maxChargingCurrentBattery2));
|
|
set => _maxChargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float MaxDischargingCurrentBattery2
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_maxDischargingCurrentBattery2));
|
|
set => _maxDischargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float Battery2RatedVoltage
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2RatedVoltage));
|
|
set => _battery2RatedVoltage = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float Battery2MinSoc
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2MinSoc));
|
|
set => _battery2MinSoc = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float Battery2OverVoltageSetting
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2OverVoltageSetting));
|
|
set => _battery2OverVoltageSetting = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float Battery2UnderVoltageSetpoint
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2UnderVoltageSetpoint));
|
|
set => _battery2UnderVoltageSetpoint = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Parallel / System Settings
|
|
// ───────────────────────────────────────────────
|
|
public SinexcelMachineMode MachineMode
|
|
{
|
|
get => (SinexcelMachineMode)ConvertBitPatternToFloat(_singleOrParallelMachine);
|
|
set => _singleOrParallelMachine = (UInt32)value;
|
|
}
|
|
|
|
public UInt32 NumberOfSystemModules
|
|
{
|
|
get => (UInt32)ConvertBitPatternToFloat(_numberOfSystemModules);
|
|
set => _numberOfSystemModules = value;
|
|
}
|
|
|
|
public UInt32 ParallelModuleMachineNumber
|
|
{
|
|
get => (UInt32)ConvertBitPatternToFloat(_parallelModuleMachineNumber);
|
|
set => _parallelModuleMachineNumber = value;
|
|
}
|
|
|
|
public AccreditedCountry AccreditedCountry
|
|
{
|
|
get => (AccreditedCountry)ConvertBitPatternToFloat(_accreditedCountries);
|
|
set => _accreditedCountries = (UInt32)value;
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Control Commands
|
|
// ───────────────────────────────────────────────
|
|
public float PowerOn
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOn));
|
|
set => _powerOn = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float PowerOff
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOff));
|
|
set => _powerOff = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float FaultClearing
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_faultClearing));
|
|
set => _faultClearing = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Meter & Battery Control
|
|
// ───────────────────────────────────────────────
|
|
public float MeterReverseManualDetection
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_meterReverseManualDetection));
|
|
set => _meterReverseManualDetection = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public Voltage BatteryVoltage
|
|
{
|
|
get => (Voltage)ConvertBitPatternToFloat(_batteryVoltage);
|
|
set => _batteryVoltage = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public SinexcelBatteryRating BatteryRating
|
|
{
|
|
get => (SinexcelBatteryRating)ConvertBitPatternToFloat(_batteryRating);
|
|
set => _batteryRating = (UInt32)value;
|
|
}
|
|
|
|
public float Battery1Activation
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery1Activation));
|
|
set => _battery1Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
public float Battery2Activation
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery2Activation));
|
|
set => _battery2Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Electric Meter Operating State
|
|
// ───────────────────────────────────────────────
|
|
public MeterStatus ElectricMeterOperatingState
|
|
{
|
|
get => (MeterStatus)BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterOperatingState)); // 0 = Offline, 1 = Online
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Electric Meter Voltages (V)
|
|
// ───────────────────────────────────────────────
|
|
public Voltage ElectricMeterAPhaseVoltage
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterAPhaseVoltage));
|
|
}
|
|
|
|
public Voltage ElectricMeterBPhaseVoltage
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterBPhaseVoltage));
|
|
}
|
|
|
|
public Voltage ElectricMeterCPhaseVoltage
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterCPhaseVoltage));
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Electric Meter Currents (A)
|
|
// ───────────────────────────────────────────────
|
|
public Current ElectricMeterAPhaseCurrent
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterAPhaseCurrent));
|
|
}
|
|
|
|
public Current ElectricMeterBPhaseCurrent
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterBPhaseCurrent));
|
|
}
|
|
|
|
public Current ElectricMeterCPhaseCurrent
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterCPhaseCurrent));
|
|
}
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Electric Meter Active Power (kW)
|
|
// ───────────────────────────────────────────────
|
|
public ActivePower ElectricMeterAPhaseActivePower
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterAPhaseActivePower));
|
|
}
|
|
|
|
public ActivePower ElectricMeterBPhaseActivePower
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterBPhaseActivePower));
|
|
}
|
|
|
|
public ActivePower ElectricMeterCPhaseActivePower
|
|
{
|
|
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_electricMeterCPhaseActivePower));
|
|
}
|
|
|
|
|
|
// ───────────────────────────────────────────────
|
|
// Conversion methodes
|
|
// ───────────────────────────────────────────────
|
|
private static Single IntToFloat(Int32 intValue)
|
|
{
|
|
byte[] intBytes = BitConverter.GetBytes(intValue);
|
|
float f = BitConverter.ToSingle(intBytes, 0);
|
|
return f;
|
|
}
|
|
|
|
private static Single UIntToFloat(UInt32 uintValue)
|
|
{
|
|
byte[] uintBytes = BitConverter.GetBytes(uintValue);
|
|
float f = BitConverter.ToSingle(uintBytes, 0);
|
|
return f;
|
|
}
|
|
public static float ConvertBitPatternToFloat(uint rawValue)
|
|
{
|
|
byte[] bytes = BitConverter.GetBytes(rawValue);
|
|
return BitConverter.ToSingle(bytes, 0);
|
|
}
|
|
|
|
} |