diff --git a/csharp/Sinexcel 12K TL/SinexcelRecord.Api.cs b/csharp/Sinexcel 12K TL/SinexcelRecord.Api.cs index 9e97fa23c..735bb1545 100644 --- a/csharp/Sinexcel 12K TL/SinexcelRecord.Api.cs +++ b/csharp/Sinexcel 12K TL/SinexcelRecord.Api.cs @@ -6,7 +6,193 @@ namespace InnovEnergy.Lib.Devices.Sinexcel_12K_TL; public partial class SinexcelRecord { - + + /* + // -------------------------------------------------------- + // Helpers + // -------------------------------------------------------- + private static ushort Bit(ushort v) => (ushort)(v & 0x01); + + private static ushort Compose3(ushort b0, ushort b1, ushort b2) + => (ushort)(Bit(b0) | (Bit(b1) << 1) | (Bit(b2) << 2)); + + private static ushort Compose4(ushort b0, ushort b1, ushort b2, ushort b3) + => (ushort)(Bit(b0) | (Bit(b1) << 1) | (Bit(b2) << 2) | (Bit(b3) << 3)); + + // ---- Operating states + public SinexcelInverterOperatingState InverterOperatingState + => (SinexcelInverterOperatingState)(_inverterOperatingState & 0x07); + + public SinexcelPvOperatingState Pv1OperatingState + => (SinexcelPvOperatingState)Bit(_pv1OperatingState); + + public SinexcelPvOperatingState Pv2OperatingState + => (SinexcelPvOperatingState)Bit(_pv2OperatingState); + + public SinexcelPvOperatingState Pv3OperatingState + => (SinexcelPvOperatingState)Bit(_pv3OperatingState); + + public SinexcelPvOperatingState Pv4OperatingState + => (SinexcelPvOperatingState)Bit(_pv4OperatingState); + + public SinexcelBatteryOperatingState Battery1OperatingState + => (SinexcelBatteryOperatingState)(_battery1OperatingState & 0x07); + + public SinexcelBatteryOperatingState Battery2OperatingState + => (SinexcelBatteryOperatingState)Compose3(_bat2StateBit0, _bat2StateBit1, _bat2StateBit2); + + public SinexcelOredState OredState + => (SinexcelOredState)Compose4(_oredStateBit0, _oredStateBit1, _oredStateBit2, _oredStateBit3); + + public SinexcelDcdcState DcdcStateDc + => (SinexcelDcdcState)Bit(_dcdcStateDc); + + public SinexcelDcdcState DcdcStateAc + => (SinexcelDcdcState)Bit(_dcdcStateAc); + + public SinexcelPowerGridStatus PowerGridStatus + => (SinexcelPowerGridStatus)Bit(_powerGridStatus); + + // ---- Alarm / fault flags + public SinexcelAbnormalFlag AbnormalGridVoltage => (SinexcelAbnormalFlag)Bit(_abnormalGridVoltage); + public SinexcelAbnormalFlag AbnormalGridFrequency => (SinexcelAbnormalFlag)Bit(_abnormalGridFrequency); + public SinexcelAbnormalFlag InvertedSequenceOfGridVoltage => (SinexcelAbnormalFlag)Bit(_invertedSequenceOfGridVoltage); + public SinexcelAbnormalFlag GridVoltagePhaseLoss => (SinexcelAbnormalFlag)Bit(_gridVoltagePhaseLoss); + public SinexcelAbnormalFlag AbnormalOutputVoltage => (SinexcelAbnormalFlag)Bit(_abnormalOutputVoltage); + public SinexcelAbnormalFlag AbnormalOutputFrequency => (SinexcelAbnormalFlag)Bit(_abnormalOutputFrequency); + public SinexcelAbnormalFlag AbnormalNullLine => (SinexcelAbnormalFlag)Bit(_abnormalNullLine); + public SinexcelAbnormalFlag ExcessivelyHighAmbientTemperature => (SinexcelAbnormalFlag)Bit(_excessivelyHighAmbientTemperature); + public SinexcelAbnormalFlag ExcessiveRadiatorTemperature => (SinexcelAbnormalFlag)Bit(_excessiveRadiatorTemperature); + public SinexcelAbnormalFlag InsulationFault => (SinexcelAbnormalFlag)Bit(_insulationFault); + public SinexcelAbnormalFlag LeakageProtectionFault => (SinexcelAbnormalFlag)Bit(_leakageProtectionFault); + public SinexcelAbnormalFlag AuxiliaryPowerFault => (SinexcelAbnormalFlag)Bit(_auxiliaryPowerFault); + public SinexcelAbnormalFlag FanFault => (SinexcelAbnormalFlag)Bit(_fanFault); + public SinexcelAbnormalFlag ModelCapacityFault => (SinexcelAbnormalFlag)Bit(_modelCapacityFault); + public SinexcelAbnormalFlag AbnormalLightningArrester => (SinexcelAbnormalFlag)Bit(_abnormalLightningArrester); + public SinexcelAbnormalFlag IslandProtection => (SinexcelAbnormalFlag)Bit(_islandProtection); + public SinexcelAbnormalFlag Battery1NotConnected => (SinexcelAbnormalFlag)Bit(_battery1NotConnected); + public SinexcelAbnormalFlag Battery1Overvoltage => (SinexcelAbnormalFlag)Bit(_battery1Overvoltage); + public SinexcelAbnormalFlag Battery1Undervoltage => (SinexcelAbnormalFlag)Bit(_battery1Undervoltage); + public SinexcelAbnormalFlag Battery1DischargeEnd => (SinexcelAbnormalFlag)Bit(_battery1DischargeEnd); + public SinexcelAbnormalFlag Battery1Inverted => (SinexcelAbnormalFlag)Bit(_battery1Inverted); + public SinexcelAbnormalFlag Battery2NotConnected => (SinexcelAbnormalFlag)Bit(_battery2NotConnected); + public SinexcelAbnormalFlag Battery2Overvoltage => (SinexcelAbnormalFlag)Bit(_battery2Overvoltage); + public SinexcelAbnormalFlag Battery2Undervoltage => (SinexcelAbnormalFlag)Bit(_battery2Undervoltage); + public SinexcelAbnormalFlag Battery2DischargeEnd => (SinexcelAbnormalFlag)Bit(_battery2DischargeEnd); + public SinexcelAbnormalFlag Battery2Inverted => (SinexcelAbnormalFlag)Bit(_battery2Inverted); + public SinexcelAbnormalFlag Pv1NotAccessed => (SinexcelAbnormalFlag)Bit(_pv1NotAccessed); + public SinexcelAbnormalFlag Pv1Overvoltage => (SinexcelAbnormalFlag)Bit(_pv1Overvoltage); + public SinexcelAbnormalFlag AbnormalPv1CurrentSharing => (SinexcelAbnormalFlag)Bit(_abnormalPv1CurrentSharing); + public SinexcelAbnormalFlag Pv2NotAccessed => (SinexcelAbnormalFlag)Bit(_pv2NotAccessed); + public SinexcelAbnormalFlag Pv2Overvoltage => (SinexcelAbnormalFlag)Bit(_pv2Overvoltage); + public SinexcelAbnormalFlag AbnormalPv2CurrentSharing => (SinexcelAbnormalFlag)Bit(_abnormalPv2CurrentSharing); + public SinexcelAbnormalFlag DcBusOvervoltage => (SinexcelAbnormalFlag)Bit(_dcBusOvervoltage); + public SinexcelAbnormalFlag DcBusUndervoltage => (SinexcelAbnormalFlag)Bit(_dcBusUndervoltage); + public SinexcelAbnormalFlag DcBusVoltageUnbalance => (SinexcelAbnormalFlag)Bit(_dcBusVoltageUnbalance); + public SinexcelAbnormalFlag Pv1PowerTubeFault => (SinexcelAbnormalFlag)Bit(_pv1PowerTubeFault); + public SinexcelAbnormalFlag Pv2PowerTubeFault => (SinexcelAbnormalFlag)Bit(_pv2PowerTubeFault); + public SinexcelAbnormalFlag Battery1PowerTubeFault => (SinexcelAbnormalFlag)Bit(_battery1PowerTubeFault); + public SinexcelAbnormalFlag Battery2PowerTubeFault => (SinexcelAbnormalFlag)Bit(_battery2PowerTubeFault); + public SinexcelAbnormalFlag InverterPowerTubeFault => (SinexcelAbnormalFlag)Bit(_inverterPowerTubeFault); + public SinexcelAbnormalFlag SystemOutputOverload => (SinexcelAbnormalFlag)Bit(_systemOutputOverload); + public SinexcelAbnormalFlag InverterOverload => (SinexcelAbnormalFlag)Bit(_inverterOverload); + public SinexcelAbnormalFlag InverterOverloadTimeout => (SinexcelAbnormalFlag)Bit(_inverterOverloadTimeout); + public SinexcelAbnormalFlag Battery1OverloadTimeout => (SinexcelAbnormalFlag)Bit(_battery1OverloadTimeout); + public SinexcelAbnormalFlag Battery2OverloadTimeout => (SinexcelAbnormalFlag)Bit(_battery2OverloadTimeout); + public SinexcelAbnormalFlag InverterSoftStartFailure => (SinexcelAbnormalFlag)Bit(_inverterSoftStartFailure); + public SinexcelAbnormalFlag Battery1SoftStartFailure => (SinexcelAbnormalFlag)Bit(_battery1SoftStartFailure); + public SinexcelAbnormalFlag Battery2SoftStartFailure => (SinexcelAbnormalFlag)Bit(_battery2SoftStartFailure); + public SinexcelAbnormalFlag Dsp1ParameterSettingFault => (SinexcelAbnormalFlag)Bit(_dsp1ParameterSettingFault); + public SinexcelAbnormalFlag Dsp2ParameterSettingFault => (SinexcelAbnormalFlag)Bit(_dsp2ParameterSettingFault); + public SinexcelAbnormalFlag DspVersionCompatibilityFault => (SinexcelAbnormalFlag)Bit(_dspVersionCompatibilityFault); + public SinexcelAbnormalFlag CpldVersionCompatibilityFault => (SinexcelAbnormalFlag)Bit(_cpldVersionCompatibilityFault); + public SinexcelAbnormalFlag CpldCommunicationFault => (SinexcelAbnormalFlag)Bit(_cpldCommunicationFault); + public SinexcelAbnormalFlag DspCommunicationFault => (SinexcelAbnormalFlag)Bit(_dspCommunicationFault); + public SinexcelAbnormalFlag OutputVoltageDcOverlimit => (SinexcelAbnormalFlag)Bit(_outputVoltageDcOverlimit); + public SinexcelAbnormalFlag OutputCurrentDcOverlimit => (SinexcelAbnormalFlag)Bit(_outputCurrentDcOverlimit); + public SinexcelAbnormalFlag RelaySelfCheckFails => (SinexcelAbnormalFlag)Bit(_relaySelfCheckFails); + public SinexcelAbnormalFlag AbnormalInverter => (SinexcelAbnormalFlag)Bit(_abnormalInverter); + public SinexcelAbnormalFlag PoorGrounding => (SinexcelAbnormalFlag)Bit(_poorGrounding); + public SinexcelAbnormalFlag Pv1SoftStartFailure => (SinexcelAbnormalFlag)Bit(_pv1SoftStartFailure); + public SinexcelAbnormalFlag Pv2SoftStartFailure => (SinexcelAbnormalFlag)Bit(_pv2SoftStartFailure2); + public SinexcelAbnormalFlag BalancedCircuitOverloadTimeout => (SinexcelAbnormalFlag)Bit(_balancedCircuitOverloadTimeout); + public SinexcelAbnormalFlag Pv1OverloadTimeout => (SinexcelAbnormalFlag)Bit(_pv1OverloadTimeout); + public SinexcelAbnormalFlag Pv2OverloadTimeout => (SinexcelAbnormalFlag)Bit(_pv2OverloadTimeout); + public SinexcelAbnormalFlag PcbOvertemperature => (SinexcelAbnormalFlag)Bit(_pcbOvertemperature); + public SinexcelAbnormalFlag DcConverterOvertemperature => (SinexcelAbnormalFlag)Bit(_dcConverterOvertemperature); + public SinexcelAbnormalFlag BusSlowOvervoltage => (SinexcelAbnormalFlag)Bit(_busSlowOvervoltage); + public SinexcelAbnormalFlag AbnormalOffGridOutputVoltage => (SinexcelAbnormalFlag)Bit(_abnormalOffGridOutputVoltage); + public SinexcelAbnormalFlag HardwareBusOvervoltage => (SinexcelAbnormalFlag)Bit(_hardwareBusOvervoltage); + public SinexcelAbnormalFlag HardwareOvercurrent => (SinexcelAbnormalFlag)Bit(_hardwareOvercurrent); + public SinexcelAbnormalFlag DcConverterOvervoltage => (SinexcelAbnormalFlag)Bit(_dcConverterOvervoltage); + public SinexcelAbnormalFlag DcConverterHardwareOvervoltage => (SinexcelAbnormalFlag)Bit(_dcConverterHardwareOvervoltage); + public SinexcelAbnormalFlag DcConverterOvercurrent => (SinexcelAbnormalFlag)Bit(_dcConverterOvercurrent); + public SinexcelAbnormalFlag DcConverterHardwareOvercurrent => (SinexcelAbnormalFlag)Bit(_dcConverterHardwareOvercurrent); + public SinexcelAbnormalFlag DcConverterResonatorOvercurrent => (SinexcelAbnormalFlag)Bit(_dcConverterResonatorOvercurrent); + public SinexcelAbnormalFlag Pv1InsufficientPower => (SinexcelAbnormalFlag)Bit(_pv1InsufficientPower); + public SinexcelAbnormalFlag Pv2InsufficientPower => (SinexcelAbnormalFlag)Bit(_pv2InsufficientPower); + public SinexcelAbnormalFlag Battery1InsufficientPower => (SinexcelAbnormalFlag)Bit(_battery1InsufficientPower); + public SinexcelAbnormalFlag Battery2InsufficientPower => (SinexcelAbnormalFlag)Bit(_battery2InsufficientPower); + public SinexcelAbnormalFlag LithiumBattery1ChargeForbidden => (SinexcelAbnormalFlag)Bit(_lithiumBattery1ChargeForbidden); + public SinexcelAbnormalFlag LithiumBattery1DischargeForbidden => (SinexcelAbnormalFlag)Bit(_lithiumBattery1DischargeForbidden); + public SinexcelAbnormalFlag LithiumBattery2ChargeForbidden => (SinexcelAbnormalFlag)Bit(_lithiumBattery2ChargeForbidden); + public SinexcelAbnormalFlag LithiumBattery2DischargeForbidden => (SinexcelAbnormalFlag)Bit(_lithiumBattery2DischargeForbidden); + public SinexcelAbnormalFlag LithiumBattery1Full => (SinexcelAbnormalFlag)Bit(_lithiumBattery1Full); + public SinexcelAbnormalFlag LithiumBattery1DischargeEnd => (SinexcelAbnormalFlag)Bit(_lithiumBattery1DischargeEnd); + public SinexcelAbnormalFlag LithiumBattery2Full => (SinexcelAbnormalFlag)Bit(_lithiumBattery2Full); + public SinexcelAbnormalFlag LithiumBattery2DischargeEnd => (SinexcelAbnormalFlag)Bit(_lithiumBattery2DischargeEnd); + public SinexcelAbnormalFlag LoadPowerOverload => (SinexcelAbnormalFlag)Bit(_loadPowerOverload); + public SinexcelAbnormalFlag AbnormalLeakageSelfCheck => (SinexcelAbnormalFlag)Bit(_abnormalLeakageSelfCheck); + public SinexcelAbnormalFlag InverterOvertemperatureAlarm => (SinexcelAbnormalFlag)Bit(_inverterOvertemperatureAlarm); + public SinexcelAbnormalFlag InverterOvertemperature => (SinexcelAbnormalFlag)Bit(_inverterOvertemperature); + public SinexcelAbnormalFlag DcConverterOvertemperatureAlarm => (SinexcelAbnormalFlag)Bit(_dcConverterOvertemperatureAlarm); + public SinexcelAbnormalFlag ParallelCommunicationAlarm => (SinexcelAbnormalFlag)Bit(_parallelCommunicationAlarm); + public SinexcelAbnormalFlag SystemDerating => (SinexcelAbnormalFlag)Bit(_systemDerating); + public SinexcelAbnormalFlag InverterRelayOpen => (SinexcelAbnormalFlag)Bit(_inverterRelayOpen); + public SinexcelAbnormalFlag InverterRelayShortCircuit => (SinexcelAbnormalFlag)Bit(_inverterRelayShortCircuit); + public SinexcelAbnormalFlag PvAccessMethodErrorAlarm => (SinexcelAbnormalFlag)Bit(_pvAccessMethodErrorAlarm); + public SinexcelAbnormalFlag ParallelModuleMissing => (SinexcelAbnormalFlag)Bit(_parallelModuleMissing); + public SinexcelAbnormalFlag DuplicateMachineNumbersForParallelModules=> (SinexcelAbnormalFlag)Bit(_duplicateMachineNumbersForParallelModules); + public SinexcelAbnormalFlag ParameterConflictInParallelModule => (SinexcelAbnormalFlag)Bit(_parameterConflictInParallelModule); + public SinexcelAbnormalFlag ReservedAlarms4 => (SinexcelAbnormalFlag)Bit(_reservedAlarms4); + public SinexcelAbnormalFlag ReverseMeterConnection => (SinexcelAbnormalFlag)Bit(_reverseMeterConnection); + public SinexcelAbnormalFlag InverterSealPulse => (SinexcelAbnormalFlag)Bit(_inverterSealPulse); + public SinexcelAbnormalFlag Pv3NotConnected => (SinexcelAbnormalFlag)Bit(_pv3NotConnected); + public SinexcelAbnormalFlag Pv3Overvoltage => (SinexcelAbnormalFlag)Bit(_pv3Overvoltage); + public SinexcelAbnormalFlag Pv3AverageCurrentAnomaly => (SinexcelAbnormalFlag)Bit(_pv3AverageCurrentAnomaly); + public SinexcelAbnormalFlag Pv4NotConnected => (SinexcelAbnormalFlag)Bit(_pv4NotConnected); + public SinexcelAbnormalFlag Pv4Overvoltage => (SinexcelAbnormalFlag)Bit(_pv4Overvoltage); + public SinexcelAbnormalFlag Pv4AverageCurrentAnomaly => (SinexcelAbnormalFlag)Bit(_pv4AverageCurrentAnomaly); + public SinexcelAbnormalFlag Pv3PowerTubeFailure => (SinexcelAbnormalFlag)Bit(_pv3PowerTubeFailure); + public SinexcelAbnormalFlag Pv4PowerTubeFailure => (SinexcelAbnormalFlag)Bit(_pv4PowerTubeFailure); + public SinexcelAbnormalFlag Pv3SoftStartFailure => (SinexcelAbnormalFlag)Bit(_pv3SoftStartFailure); + public SinexcelAbnormalFlag Pv4SoftStartFailure => (SinexcelAbnormalFlag)Bit(_pv4SoftStartFailure); + public SinexcelAbnormalFlag Pv3OverloadTimeout => (SinexcelAbnormalFlag)Bit(_pv3OverloadTimeout); + public SinexcelAbnormalFlag Pv4OverloadTimeout => (SinexcelAbnormalFlag)Bit(_pv4OverloadTimeout); + public SinexcelAbnormalFlag Pv3ReverseConnection => (SinexcelAbnormalFlag)Bit(_pv3ReverseConnection); + public SinexcelAbnormalFlag Pv4ReverseConnection => (SinexcelAbnormalFlag)Bit(_pv4ReverseConnection); + public SinexcelAbnormalFlag AbnormalDieselGeneratorVoltage => (SinexcelAbnormalFlag)Bit(_abnormalDieselGeneratorVoltage); + public SinexcelAbnormalFlag AbnormalDieselGeneratorFrequency => (SinexcelAbnormalFlag)Bit(_abnormalDieselGeneratorFrequency); + public SinexcelAbnormalFlag DieselGeneratorVoltageReverseSequence => (SinexcelAbnormalFlag)Bit(_dieselGeneratorVoltageReverseSequence); + public SinexcelAbnormalFlag DieselGeneratorVoltageOutOfPhase => (SinexcelAbnormalFlag)Bit(_dieselGeneratorVoltageOutOfPhase); + public SinexcelAbnormalFlag LeadBatteryTemperatureAbnormality => (SinexcelAbnormalFlag)Bit(_leadBatteryTemperatureAbnormality); + public SinexcelAbnormalFlag BatteryAccessMethodError => (SinexcelAbnormalFlag)Bit(_batteryAccessMethodError); + public SinexcelAbnormalFlag ReservedAlarms5 => (SinexcelAbnormalFlag)Bit(_reservedAlarms5); + public SinexcelAbnormalFlag Battery1BackupProhibited => (SinexcelAbnormalFlag)Bit(_battery1BackupProhibited); + public SinexcelAbnormalFlag Battery2BackupProhibited => (SinexcelAbnormalFlag)Bit(_battery2BackupProhibited); + public SinexcelAbnormalFlag AbnormalGridCurrent => (SinexcelAbnormalFlag)Bit(_abnormalGridCurrent); + public SinexcelAbnormalFlag GeneratorOverload => (SinexcelAbnormalFlag)Bit(_generatorOverload); + public SinexcelAbnormalFlag BusSoftStartFailure => (SinexcelAbnormalFlag)Bit(_busSoftStartFailure); + public SinexcelAbnormalFlag OpenCircuitOfPowerGridRelay => (SinexcelAbnormalFlag)Bit(_openCircuitOfPowerGridRelay); + public SinexcelAbnormalFlag ShortCircuitOfPowerGridRelay => (SinexcelAbnormalFlag)Bit(_shortCircuitOfPowerGridRelay); + public SinexcelAbnormalFlag GeneratorRelayOpenCircuit => (SinexcelAbnormalFlag)Bit(_generatorRelayOpenCircuit); + public SinexcelAbnormalFlag GeneratorRelayShortCircuit => (SinexcelAbnormalFlag)Bit(_generatorRelayShortCircuit); + public SinexcelAbnormalFlag InsufficientPhotovoltaicPower => (SinexcelAbnormalFlag)Bit(_insufficientPhotovoltaicPower); + public SinexcelAbnormalFlag Photovoltaic1Overcurrent => (SinexcelAbnormalFlag)Bit(_photovoltaic1Overcurrent); + */ + + + private Int16 _factorFromKwtoW = 1000; // ─────────────────────────────────────────────── // Public API — Decoded Float Values @@ -153,7 +339,7 @@ public partial class SinexcelRecord public Voltage Battery1Voltage => ConvertBitPatternToFloat(_batteryVoltage1); public Current Battery1Current => ConvertBitPatternToFloat(_batteryCurrent1); - public ActivePower Battery1Power => ConvertBitPatternToFloat(_batteryPower1) * _factorFromKwtoW; + public ActivePower Battery1Power => ConvertBitPatternToFloat(_batteryPower1) * _factorFromKwtoW; public Percent Battery1Soc => ConvertBitPatternToFloat(_batterySoc1); public float BatteryFullLoadDuration1 => ConvertBitPatternToFloat(_batteryFullLoadDuration1); // this is in hour @@ -190,14 +376,15 @@ public partial class SinexcelRecord public ActivePower TotalGridPower => ConvertBitPatternToFloat(_totalGridPower) * _factorFromKwtoW ; public ActivePower ImportantLoadTotalPower => ConvertBitPatternToFloat(_importantLoadTotalPower)* _factorFromKwtoW; public ActivePower GeneralLoadTotalPower => ConvertBitPatternToFloat(_generalLoadTotalPower)* _factorFromKwtoW; - public Voltage Pv3Voltage => ConvertBitPatternToFloat(_pv3Voltage); - public Current Pv3Current => ConvertBitPatternToFloat(_pv3Current); - public ActivePower Pv3Power => ConvertBitPatternToFloat(_pv3Power) * _factorFromKwtoW; - public Voltage Pv4Voltage => ConvertBitPatternToFloat(_pv4Voltage); - public Current Pv4Current => ConvertBitPatternToFloat(_pv4Current); - public ActivePower Pv4Power => ConvertBitPatternToFloat(_pv4Power) * _factorFromKwtoW; + public Voltage PvVoltage3 => ConvertBitPatternToFloat(_pv3Voltage); + public Current PvCurrent3 => ConvertBitPatternToFloat(_pv3Current); + public ActivePower PvPower3 => ConvertBitPatternToFloat(_pv3Power) * _factorFromKwtoW; + public Voltage PvVoltage4 => ConvertBitPatternToFloat(_pv4Voltage); + public Current PvCurrent4 => ConvertBitPatternToFloat(_pv4Current); + public ActivePower PvPower4 => ConvertBitPatternToFloat(_pv4Power) * _factorFromKwtoW; public ActivePower GeneratorTotalPower => ConvertBitPatternToFloat(_generatorTotalPower); + public ActivePower PvTotalPower => PvPower1 + PvPower2 + PvPower3 + PvPower4; // ─────────────────────────────────────────────── // Manufacturer Information & Software Versions // ─────────────────────────────────────────────── @@ -215,269 +402,292 @@ public partial class SinexcelRecord 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 ThreePhaseWireSystem ThreePhaseWireSystem + { + get => (ThreePhaseWireSystem)_threePhaseWireSystem; + set => _threePhaseWireSystem = (UInt32)value; + } // - //public InputFrequency InputFrequencyClass - //{ - // get => (InputFrequency)_inputFrequencyClass; - // //set => _inputFrequencyClass = (UInt32)value; - //} + public InputFrequency InputFrequencyClass + { + get => (InputFrequency)_inputFrequencyClass; + set => _inputFrequencyClass = (UInt32)value; + } // public WorkingMode WorkingMode { - get => (WorkingMode)(int)BitConverter.Int32BitsToSingle(unchecked((int)_workingMode)); - set => _workingMode = BitConverter.ToUInt32(BitConverter.GetBytes((float)value), 0); + get => (WorkingMode)(Int32)BitConverter.Int32BitsToSingle(unchecked((Int32)_workingMode)); + set => _workingMode = BitConverter.ToUInt32(BitConverter.GetBytes((Single)value), 0); } + + public GridSwitchMethod GridSwitchMethod + { + get => (GridSwitchMethod)(Int32)BitConverter.Int32BitsToSingle(unchecked((Int32)_methodSwitchMode)); + set => _methodSwitchMode = BitConverter.ToUInt32(BitConverter.GetBytes((Single)value), 0); + } + + // ─────────────────────────────────────────────── + // 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 GridSwitchMethod GridSwitchMethod - //{ - // get => (GridSwitchMethod)_methodSwitchMode; - // //set => _methodSwitchMode = (UInt32)value; - //} + public SinexcelHvrt Hvrt + { + get => (SinexcelHvrt)_hvrt; + // set => _hvrt = (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; - //} + public SinexcelLvrt Lvrt + { + get => (SinexcelLvrt)_lvrt; + // set => _lvrt = (UInt32)value; + } // // F//an 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); - //} -// + 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 Battery1MaxChargingCurrent - //{ - // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxChargingCurrentBattery1)); - // //set => _maxChargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); - //} - // - //public float Battery1MaxDischargingCurrent - //{ - // 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 Battery1MinSoc - //{ - // 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) * _factorFromKwtoW; - // //set => _activeChargeDischargePower = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // we should check this may need to convert from W to KW - //} - // - //// ─────────────────────────────────────────────── - //// 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 Battery2MaxChargingCurrent - //{ - // get => BitConverter.Int32BitsToSingle(unchecked((int)_maxChargingCurrentBattery2)); - // //set => _maxChargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); - //} - // - //public float Battery2MaxDischargingCurrent - //{ - // 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 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 Battery1MaxChargingCurrent + { + get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxChargingCurrentBattery1)); + set => _maxChargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } + + public float Battery1MaxDischargingCurrent + { + 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 Battery1MinSoc + { + 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)(Int32)BitConverter.Int32BitsToSingle(unchecked((Int32)_activeChargeDischarge)); + set => _activeChargeDischarge = BitConverter.ToUInt32(BitConverter.GetBytes((Single)value), 0); + }*/ + + public float ActiveChargeDischargePower + { + get => ConvertBitPatternToFloat(_activeChargeDischargePower) * _factorFromKwtoW; + set => _activeChargeDischargePower = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // we should check this may need to convert from W to KW + } + // ─────────────────────────────────────────────── + // 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 Battery2MaxChargingCurrent + { + get => BitConverter.Int32BitsToSingle(unchecked((int)_maxChargingCurrentBattery2)); + set => _maxChargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } + + public float Battery2MaxDischargingCurrent + { + 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); + } + + public float Battery1BackupSoc + { + get => BitConverter.Int32BitsToSingle(unchecked((int)_battery1BackupSOC)); + set => _battery1BackupSOC = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } + + public float Battery2BackupSoc + { + get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2BackupSOC)); + set => _battery2BackupSOC = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } + // to be tested + public float EnableGridExport + + { + get => BitConverter.Int32BitsToSingle(unchecked((int)_enableGridExport)); + set => _enableGridExport = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } + + public float PowerGridExportLimit + { + get => BitConverter.Int32BitsToSingle(unchecked((int)_powerGridExportLimit)); + set => _powerGridExportLimit = 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)(Int32)BitConverter.Int32BitsToSingle(unchecked((Int32)_accreditedCountries)); + set => _accreditedCountries = BitConverter.ToUInt32(BitConverter.GetBytes((Single)value), 0); + } + + // ─────────────────────────────────────────────── + // Control Commands + // ─────────────────────────────────────────────── public float PowerOn { get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOn)); @@ -489,39 +699,40 @@ public partial class SinexcelRecord 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); + } // - //public float FaultClearingf - //{ - // 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); + } + + // This causing the inverter to switch off, please consider testing it first before uncommenting + /*public SinexcelBatteryRating SinexcelBatteryRating + { + get => (SinexcelBatteryRating)(Int32)BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryVoltageRating)); + set => _batteryVoltageRating = BitConverter.ToUInt32(BitConverter.GetBytes((Single)value), 0); + }*/ + + public float Battery1Activation + { + get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery1Activation)); + set => _battery1Activation = 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 SinexcelBatteryRating BatteryVoltageRating - //{ - // get => (SinexcelBatteryRating)ConvertBitPatternToFloat(_batteryVoltageRating); - // //set => _batteryVoltageRating = (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); - //} + public float Battery2Activation + { + get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery2Activation)); + set => _battery2Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); + } // ─────────────────────────────────────────────── // Electric Meter Operating State @@ -609,44 +820,30 @@ public partial class SinexcelRecord // Pack Voltage / Current / Temperature public Voltage Battery2PackTotalVoltage => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2PackTotalVoltage)); // 0xB200 (0.01 V resolution) public Current Battery2PackTotalCurrent => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2PackTotalCurrent)); // 0xB202 (0.01 A resolution) - public Temperature Battery2Socsecondvalue => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soc)); // 0xB206 % + public Percent Battery2Socsecondvalue => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soc)); // 0xB206 % public Percent Battery2Soh => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soh)); // 0xB208 % - // Repetitive-week mask (bit-mapped 0–6 = Sun–Sat) - //public float TimedChargeAndDischargeOff - //{ - // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_Timed_Charge_and_Discharge_Off)) ; // only 7 bits used - // //set => _Timed_Charge_and_Discharge_Off = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); - //} - // Repetitive-week mask (bit-mapped 0–6 = Sun–Sat) - /* public float OtherTimePeriodMode - { - get => _Other_time_period_mode ; // only 7 bits used - //set => _Other_time_period_mode = (UInt32)value; - }*/ - - - + // Repetitive-week mask (bit-mapped 0–6 = Sun–Sat) public SinexcelWeekDays RepetitiveWeeks { get => (SinexcelWeekDays)(_repetitiveWeeks & 0x7F); // only 7 bits used set => _repetitiveWeeks = (UInt32)value; } -// + // Effective start / end as UNIX timestamps public DateTime EffectiveStartDate { get => DateTimeOffset.FromUnixTimeSeconds(_effectiveStartDate).DateTime; - set => _effectiveStartDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds(); + set => _effectiveStartDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds(); } -// + public DateTime EffectiveEndDate { get => DateTimeOffset.FromUnixTimeSeconds(_effectiveEndDate).DateTime; set => _effectiveEndDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds(); } -// // Charging power during time period 1 (kW) + // Charging power during time period 1 (kW) public float ChargingPowerPeriod1 { get => BitConverter.Int32BitsToSingle(unchecked((Int32)_chargingPowerPeriod1)); diff --git a/csharp/Sinexcel 12K TL/SinexcelRecord.Modbus.cs b/csharp/Sinexcel 12K TL/SinexcelRecord.Modbus.cs index 39197e941..ceeab2844 100644 --- a/csharp/Sinexcel 12K TL/SinexcelRecord.Modbus.cs +++ b/csharp/Sinexcel 12K TL/SinexcelRecord.Modbus.cs @@ -11,7 +11,178 @@ namespace InnovEnergy.Lib.Devices.Sinexcel_12K_TL; [BigEndian] public partial class SinexcelRecord { - /****************************** Input registers ****************************/ +/* + // ======================================================== + // Register declarations + // ======================================================== + // to test by block first + // ---- Operating states (0x1000–0x1014) + [HoldingRegister(4096, writable: false)] private UInt16 _notUsedRemain; // 0x1000 + [HoldingRegister(4098, writable: false)] private UInt16 _inverterOperatingState; // 0x1002 (3 bits) + [HoldingRegister(4100, writable: false)] private UInt16 _pv1OperatingState; // 0x1004 (1 bit) + [HoldingRegister(4101, writable: false)] private UInt16 _pv2OperatingState; // 0x1005 (1 bit) + [HoldingRegister(4103, writable: false)] private UInt16 _battery1OperatingState; // 0x1007 (3 bits) + + // Battery 2 operating state bits (0x1009–0x100B) + [HoldingRegister(4105, writable: false)] private UInt16 _bat2StateBit0; // 0x1009 + [HoldingRegister(4106, writable: false)] private UInt16 _bat2StateBit1; // 0x100A + [HoldingRegister(4107, writable: false)] private UInt16 _bat2StateBit2; // 0x100B + + // ORED state bits (0x100C–0x100F) + [HoldingRegister(4108, writable: false)] private UInt16 _oredStateBit0; // 0x100C + [HoldingRegister(4109, writable: false)] private UInt16 _oredStateBit1; // 0x100D + [HoldingRegister(4110, writable: false)] private UInt16 _oredStateBit2; // 0x100E + [HoldingRegister(4111, writable: false)] private UInt16 _oredStateBit3; // 0x100F + + // DCDC state (separate bits for DC/AC variants) + [HoldingRegister(4112, writable: false)] private UInt16 _dcdcStateDc; // 0x1010 + [HoldingRegister(4113, writable: false)] private UInt16 _dcdcStateAc; // 0x1011 + + // PV3 / PV4 operational state + [HoldingRegister(4114, writable: false)] private UInt16 _pv3OperatingState; // 0x1012 + [HoldingRegister(4115, writable: false)] private UInt16 _pv4OperatingState; // 0x1013 + + // Power grid status + [HoldingRegister(4116, writable: false)] private UInt16 _powerGridStatus; // 0x1014 + + // ---- Alarm / fault flags (0x1048–0x10CE) (0: Normal, 1: Abnormal) + [HoldingRegister(4168, writable: false)] private UInt16 _abnormalGridVoltage; // 0x1048 Abnormal grid voltage + [HoldingRegister(4169, writable: false)] private UInt16 _abnormalGridFrequency; // 0x1049 Abnormal grid frequency + [HoldingRegister(4170, writable: false)] private UInt16 _invertedSequenceOfGridVoltage; // 0x104A Inverted sequence of grid voltage + [HoldingRegister(4171, writable: false)] private UInt16 _gridVoltagePhaseLoss; // 0x104B Grid voltage phase loss + [HoldingRegister(4172, writable: false)] private UInt16 _abnormalOutputVoltage; // 0x104C Abnormal output voltage + [HoldingRegister(4173, writable: false)] private UInt16 _abnormalOutputFrequency; // 0x104D Abnormal output frequency + [HoldingRegister(4174, writable: false)] private UInt16 _abnormalNullLine; // 0x104E Abnormal null line + [HoldingRegister(4175, writable: false)] private UInt16 _excessivelyHighAmbientTemperature; // 0x104F Excessively high ambient temperature + [HoldingRegister(4176, writable: false)] private UInt16 _excessiveRadiatorTemperature; // 0x1050 Excessive radiator temperature + [HoldingRegister(4177, writable: false)] private UInt16 _insulationFault; // 0x1051 Insulation fault + [HoldingRegister(4178, writable: false)] private UInt16 _leakageProtectionFault; // 0x1052 Leakage protection fault + [HoldingRegister(4179, writable: false)] private UInt16 _auxiliaryPowerFault; // 0x1053 Auxiliary power fault + [HoldingRegister(4180, writable: false)] private UInt16 _fanFault; // 0x1054 Fan fault + [HoldingRegister(4181, writable: false)] private UInt16 _modelCapacityFault; // 0x1055 Model capacity fault + [HoldingRegister(4182, writable: false)] private UInt16 _abnormalLightningArrester; // 0x1056 Abnormal lightning arrester + [HoldingRegister(4183, writable: false)] private UInt16 _islandProtection; // 0x1057 Island protection + [HoldingRegister(4184, writable: false)] private UInt16 _battery1NotConnected; // 0x1058 Battery 1 not connected + [HoldingRegister(4185, writable: false)] private UInt16 _battery1Overvoltage; // 0x1059 Battery 1 overvoltage + [HoldingRegister(4186, writable: false)] private UInt16 _battery1Undervoltage; // 0x105A Battery 1 undervoltage + [HoldingRegister(4187, writable: false)] private UInt16 _battery1DischargeEnd; // 0x105B Battery 1 discharge end + [HoldingRegister(4188, writable: false)] private UInt16 _battery1Inverted; // 0x105C Battery 1 inverted + [HoldingRegister(4189, writable: false)] private UInt16 _battery2NotConnected; // 0x105D Battery 2 not connected + [HoldingRegister(4190, writable: false)] private UInt16 _battery2Overvoltage; // 0x105E Battery 2 overvoltage + [HoldingRegister(4191, writable: false)] private UInt16 _battery2Undervoltage; // 0x105F Battery 2 undervoltage + [HoldingRegister(4192, writable: false)] private UInt16 _battery2DischargeEnd; // 0x1060 Battery 2 discharge end + [HoldingRegister(4193, writable: false)] private UInt16 _battery2Inverted; // 0x1061 Battery 2 inverted + [HoldingRegister(4194, writable: false)] private UInt16 _pv1NotAccessed; // 0x1062 PV1 not accessed + [HoldingRegister(4195, writable: false)] private UInt16 _pv1Overvoltage; // 0x1063 PV1 overvoltage + [HoldingRegister(4196, writable: false)] private UInt16 _abnormalPv1CurrentSharing; // 0x1064 Abnormal PV1 current sharing + [HoldingRegister(4197, writable: false)] private UInt16 _pv2NotAccessed; // 0x1065 PV2 not accessed + [HoldingRegister(4198, writable: false)] private UInt16 _pv2Overvoltage; // 0x1066 PV2 overvoltage + [HoldingRegister(4199, writable: false)] private UInt16 _abnormalPv2CurrentSharing; // 0x1067 Abnormal PV2 current sharing + [HoldingRegister(4200, writable: false)] private UInt16 _dcBusOvervoltage; // 0x1068 DC bus overvoltage + [HoldingRegister(4201, writable: false)] private UInt16 _dcBusUndervoltage; // 0x1069 DC bus undervoltage + [HoldingRegister(4202, writable: false)] private UInt16 _dcBusVoltageUnbalance; // 0x106A DC bus voltage unbalance + [HoldingRegister(4203, writable: false)] private UInt16 _pv1PowerTubeFault; // 0x106B PV1 power tube fault + [HoldingRegister(4204, writable: false)] private UInt16 _pv2PowerTubeFault; // 0x106C PV2 power tube fault + [HoldingRegister(4205, writable: false)] private UInt16 _battery1PowerTubeFault; // 0x106D Battery 1 power tube fault + [HoldingRegister(4206, writable: false)] private UInt16 _battery2PowerTubeFault; // 0x106E Battery 2 power tube fault + [HoldingRegister(4207, writable: false)] private UInt16 _inverterPowerTubeFault; // 0x106F Inverter power tube fault + [HoldingRegister(4208, writable: false)] private UInt16 _systemOutputOverload; // 0x1070 System output overload + [HoldingRegister(4209, writable: false)] private UInt16 _inverterOverload; // 0x1071 Inverter overload + [HoldingRegister(4210, writable: false)] private UInt16 _inverterOverloadTimeout; // 0x1072 Inverter overload timeout + [HoldingRegister(4211, writable: false)] private UInt16 _battery1OverloadTimeout; // 0x1073 Battery 1 overload timeout + [HoldingRegister(4212, writable: false)] private UInt16 _battery2OverloadTimeout; // 0x1074 Battery 2 overload timeout + [HoldingRegister(4213, writable: false)] private UInt16 _inverterSoftStartFailure; // 0x1075 Inverter soft start failure + [HoldingRegister(4214, writable: false)] private UInt16 _battery1SoftStartFailure; // 0x1076 Battery 1 soft start failure + [HoldingRegister(4215, writable: false)] private UInt16 _battery2SoftStartFailure; // 0x1077 Battery 2 soft start failure + [HoldingRegister(4216, writable: false)] private UInt16 _dsp1ParameterSettingFault; // 0x1078 DSP1 parameter setting fault + [HoldingRegister(4217, writable: false)] private UInt16 _dsp2ParameterSettingFault; // 0x1079 DSP2 parameter setting fault + [HoldingRegister(4218, writable: false)] private UInt16 _dspVersionCompatibilityFault; // 0x107A DSP version compatibility fault + [HoldingRegister(4219, writable: false)] private UInt16 _cpldVersionCompatibilityFault; // 0x107B CPLD version compatibility fault + [HoldingRegister(4220, writable: false)] private UInt16 _cpldCommunicationFault; // 0x107C CPLD communication fault + [HoldingRegister(4221, writable: false)] private UInt16 _dspCommunicationFault; // 0x107D DSP communication fault + [HoldingRegister(4222, writable: false)] private UInt16 _outputVoltageDcOverlimit; // 0x107E Output voltage DC overlimit + [HoldingRegister(4223, writable: false)] private UInt16 _outputCurrentDcOverlimit; // 0x107F Output current DC overlimit + [HoldingRegister(4224, writable: false)] private UInt16 _relaySelfCheckFails; // 0x1080 Relay self-check fails + [HoldingRegister(4225, writable: false)] private UInt16 _abnormalInverter; // 0x1081 Abnormal inverter + [HoldingRegister(4226, writable: false)] private UInt16 _poorGrounding; // 0x1082 Poor grounding + [HoldingRegister(4227, writable: false)] private UInt16 _pv1SoftStartFailure; // 0x1083 PV1 soft start failure + [HoldingRegister(4228, writable: false)] private UInt16 _pv2SoftStartFailure2; // 0x1084 PV2 soft start failure + [HoldingRegister(4229, writable: false)] private UInt16 _balancedCircuitOverloadTimeout; // 0x1085 Balanced circuit overload timeout + [HoldingRegister(4230, writable: false)] private UInt16 _pv1OverloadTimeout; // 0x1086 PV1 overload timeout + [HoldingRegister(4231, writable: false)] private UInt16 _pv2OverloadTimeout; // 0x1087 PV2 overload timeout + [HoldingRegister(4232, writable: false)] private UInt16 _pcbOvertemperature; // 0x1088 PCB overtemperature + [HoldingRegister(4233, writable: false)] private UInt16 _dcConverterOvertemperature; // 0x1089 DC converter overtemperature + [HoldingRegister(4234, writable: false)] private UInt16 _busSlowOvervoltage; // 0x108A Bus slow overvoltage + [HoldingRegister(4235, writable: false)] private UInt16 _abnormalOffGridOutputVoltage; // 0x108B Abnormal off-grid output voltage + [HoldingRegister(4236, writable: false)] private UInt16 _hardwareBusOvervoltage; // 0x108C Hardware bus overvoltage + [HoldingRegister(4237, writable: false)] private UInt16 _hardwareOvercurrent; // 0x108D Hardware overcurrent + [HoldingRegister(4238, writable: false)] private UInt16 _dcConverterOvervoltage; // 0x108E DC converter overvoltage + [HoldingRegister(4239, writable: false)] private UInt16 _dcConverterHardwareOvervoltage; // 0x108F DC converter hardware overvoltage + [HoldingRegister(4240, writable: false)] private UInt16 _dcConverterOvercurrent; // 0x1090 DC converter overcurrent + [HoldingRegister(4241, writable: false)] private UInt16 _dcConverterHardwareOvercurrent; // 0x1091 DC converter hardware overcurrent + [HoldingRegister(4242, writable: false)] private UInt16 _dcConverterResonatorOvercurrent; // 0x1092 DC converter resonator overcurrent + [HoldingRegister(4243, writable: false)] private UInt16 _pv1InsufficientPower; // 0x1093 PV1 insufficient power + [HoldingRegister(4244, writable: false)] private UInt16 _pv2InsufficientPower; // 0x1094 PV2 insufficient power + [HoldingRegister(4245, writable: false)] private UInt16 _battery1InsufficientPower; // 0x1095 Battery 1 insufficient power + [HoldingRegister(4246, writable: false)] private UInt16 _battery2InsufficientPower; // 0x1096 Battery 2 insufficient power + [HoldingRegister(4247, writable: false)] private UInt16 _lithiumBattery1ChargeForbidden; // 0x1097 Lithium battery 1 charge forbidden + [HoldingRegister(4248, writable: false)] private UInt16 _lithiumBattery1DischargeForbidden; // 0x1098 Lithium battery 1 discharge forbidden + [HoldingRegister(4249, writable: false)] private UInt16 _lithiumBattery2ChargeForbidden; // 0x1099 Lithium battery 2 charge forbidden + [HoldingRegister(4250, writable: false)] private UInt16 _lithiumBattery2DischargeForbidden; // 0x109A Lithium battery 2 discharge forbidden + [HoldingRegister(4251, writable: false)] private UInt16 _lithiumBattery1Full; // 0x109B Lithium battery 1 full + [HoldingRegister(4252, writable: false)] private UInt16 _lithiumBattery1DischargeEnd; // 0x109C Lithium battery 1 discharge end + [HoldingRegister(4253, writable: false)] private UInt16 _lithiumBattery2Full; // 0x109D LithiumBattery2 full + [HoldingRegister(4254, writable: false)] private UInt16 _lithiumBattery2DischargeEnd; // 0x109E Lithium battery 2 discharge end + [HoldingRegister(4255, writable: false)] private UInt16 _loadPowerOverload; // 0x109F Load power overload + [HoldingRegister(4256, writable: false)] private UInt16 _abnormalLeakageSelfCheck; // 0x10A0 Abnormal leakage self-check + [HoldingRegister(4257, writable: false)] private UInt16 _inverterOvertemperatureAlarm; // 0x10A1 Inverter overtemperature alarm + [HoldingRegister(4258, writable: false)] private UInt16 _inverterOvertemperature; // 0x10A2 Inverter overtemperature + [HoldingRegister(4259, writable: false)] private UInt16 _dcConverterOvertemperatureAlarm; // 0x10A3 DC converter overtemperature alarm + [HoldingRegister(4260, writable: false)] private UInt16 _parallelCommunicationAlarm; // 0x10A4 Parallel communication alarm + [HoldingRegister(4261, writable: false)] private UInt16 _systemDerating; // 0x10A5 System derating + [HoldingRegister(4262, writable: false)] private UInt16 _inverterRelayOpen; // 0x10A6 Inverter relay open + [HoldingRegister(4263, writable: false)] private UInt16 _inverterRelayShortCircuit; // 0x10A7 Inverter relay short circuit + [HoldingRegister(4264, writable: false)] private UInt16 _pvAccessMethodErrorAlarm; // 0x10A8 PV access method error alarm + [HoldingRegister(4265, writable: false)] private UInt16 _parallelModuleMissing; // 0x10A9 Parallel module missing + [HoldingRegister(4266, writable: false)] private UInt16 _duplicateMachineNumbersForParallelModules; // 0x10AA Duplicate machine numbers for parallel modules + [HoldingRegister(4267, writable: false)] private UInt16 _parameterConflictInParallelModule; // 0x10AB Parameter conflict in parallel module + [HoldingRegister(4268, writable: false)] private UInt16 _reservedAlarms4; // 0x10AC Reserved alarms4 + [HoldingRegister(4269, writable: false)] private UInt16 _reverseMeterConnection; // 0x10AD Reverse meter connection + [HoldingRegister(4270, writable: false)] private UInt16 _inverterSealPulse; // 0x10AE Inverter Seal Pulse + [HoldingRegister(4271, writable: false)] private UInt16 _pv3NotConnected; // 0x10AF PV3 not connected + [HoldingRegister(4272, writable: false)] private UInt16 _pv3Overvoltage; // 0x10B0 PV3 overvoltage + [HoldingRegister(4273, writable: false)] private UInt16 _pv3AverageCurrentAnomaly; // 0x10B1 PV3 average current anomaly + [HoldingRegister(4274, writable: false)] private UInt16 _pv4NotConnected; // 0x10B2 PV4 not connected + [HoldingRegister(4275, writable: false)] private UInt16 _pv4Overvoltage; // 0x10B3 PV4 overvoltage + [HoldingRegister(4276, writable: false)] private UInt16 _pv4AverageCurrentAnomaly; // 0x10B4 PV4 average current anomaly + [HoldingRegister(4277, writable: false)] private UInt16 _pv3PowerTubeFailure; // 0x10B5 PV3 power tube failure + [HoldingRegister(4278, writable: false)] private UInt16 _pv4PowerTubeFailure; // 0x10B6 PV4 power tube failure + [HoldingRegister(4279, writable: false)] private UInt16 _pv3SoftStartFailure; // 0x10B7 PV3 soft start failure + [HoldingRegister(4280, writable: false)] private UInt16 _pv4SoftStartFailure; // 0x10B8 PV4 soft start failure + [HoldingRegister(4281, writable: false)] private UInt16 _pv3OverloadTimeout; // 0x10B9 PV3 overload timeout + [HoldingRegister(4282, writable: false)] private UInt16 _pv4OverloadTimeout; // 0x10BA PV4 overload timeout + [HoldingRegister(4283, writable: false)] private UInt16 _pv3ReverseConnection; // 0x10BB PV3 reverse connection + [HoldingRegister(4284, writable: false)] private UInt16 _pv4ReverseConnection; // 0x10BC PV4 reverse connection + [HoldingRegister(4285, writable: false)] private UInt16 _abnormalDieselGeneratorVoltage; // 0x10BD Abnormal diesel generator voltage + [HoldingRegister(4286, writable: false)] private UInt16 _abnormalDieselGeneratorFrequency; // 0x10BE Abnormal diesel generator frequency + [HoldingRegister(4287, writable: false)] private UInt16 _dieselGeneratorVoltageReverseSequence; // 0x10BF Diesel generator voltage reverse sequence + [HoldingRegister(4288, writable: false)] private UInt16 _dieselGeneratorVoltageOutOfPhase; // 0x10C0 Diesel generator voltage out of phase + [HoldingRegister(4289, writable: false)] private UInt16 _leadBatteryTemperatureAbnormality; // 0x10C1 Lead battery temperature abnormality + [HoldingRegister(4290, writable: false)] private UInt16 _batteryAccessMethodError; // 0x10C2 Battery access method error + [HoldingRegister(4291, writable: false)] private UInt16 _reservedAlarms5; // 0x10C3 Reserved alarms5 + [HoldingRegister(4292, writable: false)] private UInt16 _battery1BackupProhibited; // 0x10C4 Battery 1 backup prohibited + [HoldingRegister(4293, writable: false)] private UInt16 _battery2BackupProhibited; // 0x10C5 Battery 2 backup prohibited + [HoldingRegister(4294, writable: false)] private UInt16 _abnormalGridCurrent; // 0x10C6 Abnormal grid current + [HoldingRegister(4295, writable: false)] private UInt16 _generatorOverload; // 0x10C7 Generator overload + [HoldingRegister(4296, writable: false)] private UInt16 _busSoftStartFailure; // 0x10C8 Bus soft start failure + [HoldingRegister(4297, writable: false)] private UInt16 _openCircuitOfPowerGridRelay; // 0x10C9 Open circuit of power grid relay + [HoldingRegister(4298, writable: false)] private UInt16 _shortCircuitOfPowerGridRelay; // 0x10CA Short circuit of power grid relay + [HoldingRegister(4299, writable: false)] private UInt16 _generatorRelayOpenCircuit; // 0x10CB Generator relay open circuit + [HoldingRegister(4300, writable: false)] private UInt16 _generatorRelayShortCircuit; // 0x10CC Generator relay short circuit + [HoldingRegister(4301, writable: false)] private UInt16 _insufficientPhotovoltaicPower; // 0x10CD Insufficient photovoltaic power + [HoldingRegister(4302, writable: false)] private UInt16 _photovoltaic1Overcurrent; // 0x10CE Photovoltaic 1 overcurrent*/ + + /****************************** Holding registers ****************************/ // Voltages [HoldingRegister(4096)] public UInt32 _gridAPhaseVoltage; // 0x1000 [HoldingRegister(4098)] private UInt32 _grid_B_Phase_Voltage; // 0x1002 @@ -206,6 +377,7 @@ public partial class SinexcelRecord [HoldingRegister(4740)] private UInt32 _pv4Current; // 0x1284 [HoldingRegister(4742)] private UInt32 _pv4Power; // 0x1286 [HoldingRegister(4744)] private UInt32 _generatorTotalPower; // 0x128C + // ─────────────────────────────────────────────── // Manufacturer Information & Software Versions // ─────────────────────────────────────────────── @@ -226,15 +398,15 @@ public partial class SinexcelRecord // ─────────────────────────────────────────────── // System configuration / operation registers // ─────────────────────────────────────────────── - //[HoldingRegister(12294, writable: true)] private UInt32 _threePhaseWireSystem; // 0x3006 + [HoldingRegister(12294, writable: true)] private UInt32 _threePhaseWireSystem; // 0x3006 //[HoldingRegister(12296, writable: true)] private UInt32 _remainnotused; // 0x3008 - //[HoldingRegister(12298, writable: true)] private UInt32 _inputFrequencyClass; // 0x300A + [HoldingRegister(12298, writable: true)] private UInt32 _inputFrequencyClass; // 0x300A [HoldingRegister(12300, writable: true)] private UInt32 _workingMode; // 0x300C - //[HoldingRegister(12302, writable: true)] private UInt32 _methodSwitchMode; // 0x300E + [HoldingRegister(12302, writable: true)] private UInt32 _methodSwitchMode; // 0x300E // ─────────────────────────────────────────────── // Inverter Control and Protection Configuration // ─────────────────────────────────────────────── - //[HoldingRegister(12304, writable: true)] private UInt32 _enableOnGridUnbalanceCompensation; // 0x3010 + [HoldingRegister(12304, writable: true)] private UInt32 _enableOnGridUnbalanceCompensation; // 0x3010 //[HoldingRegister(12306, writable: true)] private UInt32 _temperatureDrop; // 0x3012 //[HoldingRegister(12308, writable: true)] private UInt32 _hvrt; // 0x3014 //[HoldingRegister(12310, writable: true)] private UInt32 _lvrt; // 0x3016 @@ -243,53 +415,60 @@ public partial class SinexcelRecord // ─────────────────────────────────────────────── // Battery & PV Configuration // ─────────────────────────────────────────────── - //[HoldingRegister(12336, writable: true)] private UInt32 _batteryAccessMethod; // 0x3030 - //[HoldingRegister(12338, writable: true)] private UInt32 _meterAccessEnable; // 0x3032 - //[HoldingRegister(12340, writable: true)] private UInt32 _enableBattery1; // 0x3034 - //[HoldingRegister(12342, writable: true)] private UInt32 _enableBattery2; // 0x3036 - //[HoldingRegister(12344, writable: true)] private UInt32 _enablePv1; // 0x3038 - //[HoldingRegister(12346, writable: true)] private UInt32 _enablePv2; // 0x303A - //[HoldingRegister(12348, writable: true)] private UInt32 _batteryType; // 0x303C - //[HoldingRegister(12350, writable: true)] private UInt32 _batteryCapacity1; // 0x303E - //[HoldingRegister(12352, writable: true)] private UInt32 _maxChargingCurrentBattery1; // 0x3040 - //[HoldingRegister(12354, writable: true)] private UInt32 _maxDischargingCurrentBattery1; // 0x3042 - //[HoldingRegister(12362, writable: true)] private UInt32 _ratedBatteryVoltage1; // 0x304A - //[HoldingRegister(12358, writable: true)] private UInt32 _minSocBattery1; // 0x3046 - //[HoldingRegister(12360, writable: true)] private UInt32 _setValueBattery1; // 0x3048 - //[HoldingRegister(12364, writable: true)] private UInt32 _activeChargeDischarge; // 0x304A - //[HoldingRegister(12366, writable: true)] private UInt32 _activeChargeDischargePower; // 0x304C - //[HoldingRegister(12380, writable: true)] private UInt32 _enableIslandProtection; // 0x305C - //[HoldingRegister(12382, writable: true)] private UInt32 _pvAccessMode; // 0x305E + [HoldingRegister(12336, writable: true)] private UInt32 _batteryAccessMethod; // 0x3030 + [HoldingRegister(12338, writable: true)] private UInt32 _meterAccessEnable; // 0x3032 + [HoldingRegister(12340, writable: true)] private UInt32 _enableBattery1; // 0x3034 + [HoldingRegister(12342, writable: true)] private UInt32 _enableBattery2; // 0x3036 + [HoldingRegister(12344, writable: true)] private UInt32 _enablePv1; // 0x3038 + [HoldingRegister(12346, writable: true)] private UInt32 _enablePv2; // 0x303A + [HoldingRegister(12348, writable: true)] private UInt32 _batteryType; // 0x303C + [HoldingRegister(12350, writable: true)] private UInt32 _batteryCapacity1; // 0x303E + [HoldingRegister(12352, writable: true)] private UInt32 _maxChargingCurrentBattery1; // 0x3040 + [HoldingRegister(12354, writable: true)] private UInt32 _maxDischargingCurrentBattery1; // 0x3042 + [HoldingRegister(12356, writable: true)] private UInt32 _ratedBatteryVoltage1; // 0x304A + [HoldingRegister(12358, writable: true)] private UInt32 _minSocBattery1; // 0x3046 + [HoldingRegister(12360, writable: true)] private UInt32 _setValueBattery1; // 0x3048 + //[HoldingRegister(12362, writable: true)] private UInt32 _activeChargeDischarge; // 0x304A // this + [HoldingRegister(12364, writable: true)] private UInt32 _activeChargeDischargePower; // 0x304C + [HoldingRegister(12380, writable: true)] private UInt32 _enableIslandProtection; // 0x305C + [HoldingRegister(12382, writable: true)] private UInt32 _pvAccessMode; // 0x305E // ─────────────────────────────────────────────── // System & Battery-2 Configuration // ─────────────────────────────────────────────── - //[HoldingRegister(12384, writable: true)] private UInt32 _outputVoltageAdjustmentFactor; // 0x3060 - //[HoldingRegister(12386, writable: true)] private UInt32 _setValueBatteryUndervoltage1; // 0x3062 - //[HoldingRegister(12388, writable: true)] private UInt32 _inverterPowerLimit; // 0x3064 - //[HoldingRegister(12400, writable: true)] private UInt32 _battery2Capacity; // 0x30B0 - //[HoldingRegister(12402, writable: true)] private UInt32 _maxChargingCurrentBattery2; // 0x30B2 - //[HoldingRegister(12404, writable: true)] private UInt32 _maxDischargingCurrentBattery2; // 0x30B4 - //[HoldingRegister(12406, writable: true)] private UInt32 _battery2RatedVoltage; // 0x30B6 - //[HoldingRegister(12408, writable: true)] private UInt32 _battery2MinSoc; // 0x30B8 - //[HoldingRegister(12410, writable: true)] private UInt32 _battery2OverVoltageSetting; // 0x30BA - //[HoldingRegister(12412, writable: true)] private UInt32 _battery2UnderVoltageSetpoint; // 0x30BC + [HoldingRegister(12384, writable: true)] private UInt32 _outputVoltageAdjustmentFactor; // 0x3060 + [HoldingRegister(12386, writable: true)] private UInt32 _setValueBatteryUndervoltage1; // 0x3062 + [HoldingRegister(12388, writable: true)] private UInt32 _inverterPowerLimit; // 0x3064 + [HoldingRegister(12400, writable: true)] private UInt32 _battery2Capacity; // 0x30B0 + [HoldingRegister(12402, writable: true)] private UInt32 _maxChargingCurrentBattery2; // 0x30B2 + [HoldingRegister(12404, writable: true)] private UInt32 _maxDischargingCurrentBattery2; // 0x30B4 + [HoldingRegister(12406, writable: true)] private UInt32 _battery2RatedVoltage; // 0x30B6 + [HoldingRegister(12408, writable: true)] private UInt32 _battery2MinSoc; // 0x30B8 + [HoldingRegister(12410, writable: true)] private UInt32 _battery2OverVoltageSetting; // 0x30BA + [HoldingRegister(12412, writable: true)] private UInt32 _battery2UnderVoltageSetpoint; // 0x30BC // - //[HoldingRegister(12414, writable: true)] private UInt32 _singleOrParallelMachine; // 0x30BE - //[HoldingRegister(12416, writable: true)] private UInt32 _numberOfSystemModules; // 0x30C0 - //[HoldingRegister(12418, writable: true)] private UInt32 _parallelModuleMachineNumber; // 0x30C2 - //[HoldingRegister(12420, writable: true)] private UInt32 _accreditedCountries; // 0x30C4 - + [HoldingRegister(12414, writable: true)] private UInt32 _singleOrParallelMachine; // 0x30BE + [HoldingRegister(12416, writable: true)] private UInt32 _numberOfSystemModules; // 0x30C0 + [HoldingRegister(12418, writable: true)] private UInt32 _parallelModuleMachineNumber; // 0x30C2 + [HoldingRegister(12420, writable: true)] private UInt32 _accreditedCountries; // 0x30C4 + + [HoldingRegister(12618, writable: true)] private UInt32 _battery1BackupSOC; // 0x314A + [HoldingRegister(12620, writable: true)] private UInt32 _battery2BackupSOC; // 0x314C + + [HoldingRegister(12746, writable: true)] private UInt32 _enableGridExport; // 0x314A + [HoldingRegister(12748, writable: true)] private UInt32 _powerGridExportLimit; // 0x314C + + // ─────────────────────────────────────────────── // System Control & Diagnostic Registers // ─────────────────────────────────────────────── [HoldingRegister(15426, writable: true)] private UInt32 _powerOn; // 0x3C42 [HoldingRegister(15428, writable: true)] private UInt32 _powerOff; // 0x3C44 - //[HoldingRegister(15430, writable: true)] private UInt32 _faultClearing; // 0x3C46 - //[HoldingRegister(15518, writable: true)] private UInt32 _meterReverseManualDetection; // 0x3C9E - //[HoldingRegister(15520, writable: true)] private UInt32 _batteryVoltageRating; // 0x3CA0 - //[HoldingRegister(15524, writable: true)] private UInt32 _battery1Activation; // 0x3CA4 - //[HoldingRegister(15526, writable: true)] private UInt32 _battery2Activation; // 0x3CA6 + [HoldingRegister(15430, writable: true)] private UInt32 _faultClearing; // 0x3C46 + [HoldingRegister(15518, writable: true)] private UInt32 _meterReverseManualDetection; // 0x3C9E + //[HoldingRegister(15520, writable: true)] private UInt32 _batteryVoltageRating; // 0x3CA0 This causing the inverter to switch off, please consider testing it first before uncommenting + [HoldingRegister(15522, writable: true)] private UInt32 _battery1Activation; // 0x3CA2 + [HoldingRegister(15524, writable: true)] private UInt32 _battery2Activation; // 0x3CA4 // ─────────────────────────────────────────────── @@ -337,8 +516,6 @@ public partial class SinexcelRecord // Time-based scheduling (period 1) configuration // ─────────────────────────────────────────────── - //[HoldingRegister(49328, writable: true)] private UInt32 _Timed_Charge_and_Discharge_Off; // 0xC0B4, bit flags Sun–Sat - //[HoldingRegister(49330, writable: true)] private UInt32 _Other_time_period_mode; // 0xC0B4, bit flags Sun–Sat [HoldingRegister(49332, writable: true)] private UInt32 _repetitiveWeeks; // 0xC0B4, bit flags Sun–Sat [HoldingRegister(49334, writable: true)] private UInt32 _effectiveStartDate; // 0xC0B6, UNIX timestamp (UTC+offset) [HoldingRegister(49336, writable: true)] private UInt32 _effectiveEndDate; // 0xC0B8, UNIX timestamp (UTC+offset)