fix working mode and all specfic data

This commit is contained in:
atef 2025-11-18 02:30:28 +01:00
parent 29166e1ada
commit 5db53006c3
2 changed files with 392 additions and 359 deletions

View File

@ -215,268 +215,269 @@ public partial class SinexcelRecord
public ApparentPower RatedPowerKva => _ratedPower / 100f; // 0x2008 (value / 100) public ApparentPower RatedPowerKva => _ratedPower / 100f; // 0x2008 (value / 100)
public SinexcelModel Model => (SinexcelModel)_model; // 0x200D public SinexcelModel Model => (SinexcelModel)_model; // 0x200D
public ThreePhaseWireSystem ThreePhaseWireSystem //public ThreePhaseWireSystem ThreePhaseWireSystem
{ //{
get => (ThreePhaseWireSystem)_threePhaseWireSystem; // get => (ThreePhaseWireSystem)_threePhaseWireSystem;
set => _threePhaseWireSystem = (UInt32)value; // //set => _threePhaseWireSystem = (UInt32)value;
} //}
//
public InputFrequency InputFrequencyClass //public InputFrequency InputFrequencyClass
{ //{
get => (InputFrequency)_inputFrequencyClass; // get => (InputFrequency)_inputFrequencyClass;
set => _inputFrequencyClass = (UInt32)value; // //set => _inputFrequencyClass = (UInt32)value;
} //}
//
public WorkingMode WorkingMode public WorkingMode WorkingMode
{ {
get => (WorkingMode)ConvertBitPatternToFloat(_workingMode); get => (WorkingMode)(int)BitConverter.Int32BitsToSingle(unchecked((int)_workingMode));
set => _workingMode = (UInt32)value; set => _workingMode = BitConverter.ToUInt32(BitConverter.GetBytes((float)value), 0);
} }
public GridSwitchMethod GridSwitchMethod //
{ //public GridSwitchMethod GridSwitchMethod
get => (GridSwitchMethod)_methodSwitchMode; //{
set => _methodSwitchMode = (UInt32)value; // get => (GridSwitchMethod)_methodSwitchMode;
} // //set => _methodSwitchMode = (UInt32)value;
//}
// ─────────────────────────────────────────────── //
// Inverter Control Configuration //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Inverter Control Configuration
public SinexcelUnbalanceCompensation EnableOnGridUnbalanceCompensation //// ───────────────────────────────────────────────
{ //public SinexcelUnbalanceCompensation EnableOnGridUnbalanceCompensation
get => (SinexcelUnbalanceCompensation)_enableOnGridUnbalanceCompensation; //{
set => _enableOnGridUnbalanceCompensation = (UInt32)value; // get => (SinexcelUnbalanceCompensation)_enableOnGridUnbalanceCompensation;
} // //set => _enableOnGridUnbalanceCompensation = (UInt32)value;
//}
public SinexcelTemperatureDrop TemperatureDrop //
{ //public SinexcelTemperatureDrop TemperatureDrop
get => (SinexcelTemperatureDrop)ConvertBitPatternToFloat(_temperatureDrop); //{
set => _temperatureDrop = (UInt32)value; // get => (SinexcelTemperatureDrop)ConvertBitPatternToFloat(_temperatureDrop);
} // //set => _temperatureDrop = (UInt32)value;
//}
public SinexcelHvrt Hvrt //
{ //public SinexcelHvrt Hvrt
get => (SinexcelHvrt)_hvrt; //{
set => _hvrt = (UInt32)value; // get => (SinexcelHvrt)_hvrt;
} // //set => _hvrt = (UInt32)value;
//}
public SinexcelLvrt Lvrt //
{ //public SinexcelLvrt Lvrt
get => (SinexcelLvrt)_lvrt; //{
set => _lvrt = (UInt32)value; // get => (SinexcelLvrt)_lvrt;
} // //set => _lvrt = (UInt32)value;
//}
// Fan Gear — numeric [0.5 ~ 1.0], default 1.0 //
public float FanGear // 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); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_fanGear));
} // //set => _fanGear = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
// ─────────────────────────────────────────────── //
// Battery Configuration //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Battery Configuration
public SinexcelBatteryAccessMethod BatteryAccessMethod //// ───────────────────────────────────────────────
{ //public SinexcelBatteryAccessMethod BatteryAccessMethod
get => (SinexcelBatteryAccessMethod)_batteryAccessMethod; //{
set => _batteryAccessMethod = (UInt32)value; // get => (SinexcelBatteryAccessMethod)_batteryAccessMethod;
} // //set => _batteryAccessMethod = (UInt32)value;
//}
public SinexcelMeterAccessEnable MeterAccessEnable //
{ //public SinexcelMeterAccessEnable MeterAccessEnable
get => (SinexcelMeterAccessEnable)ConvertBitPatternToFloat(_meterAccessEnable); //{
set => _meterAccessEnable = (UInt32)value; // get => (SinexcelMeterAccessEnable)ConvertBitPatternToFloat(_meterAccessEnable);
} // //set => _meterAccessEnable = (UInt32)value;
//}
public SinexcelBatteryEnable EnableBattery1 //
{ //public SinexcelBatteryEnable EnableBattery1
get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery1); //{
set => _enableBattery1 = (UInt32)value; // get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery1);
} // //set => _enableBattery1 = (UInt32)value;
//}
public SinexcelBatteryEnable EnableBattery2 //
{ //public SinexcelBatteryEnable EnableBattery2
get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery2); //{
set => _enableBattery2 = (UInt32)value; // get => (SinexcelBatteryEnable)ConvertBitPatternToFloat(_enableBattery2);
} // //set => _enableBattery2 = (UInt32)value;
//}
public SinexcelPvEnable EnablePv1 //
{ //public SinexcelPvEnable EnablePv1
get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv1); //{
set => _enablePv1 = (UInt32)value; // get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv1);
} // //set => _enablePv1 = (UInt32)value;
//}
public SinexcelPvEnable EnablePv2 //
{ //public SinexcelPvEnable EnablePv2
get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv2); //{
set => _enablePv2 = (UInt32)value; // get => (SinexcelPvEnable)ConvertBitPatternToFloat(_enablePv2);
} // //set => _enablePv2 = (UInt32)value;
//}
public SinexcelBatteryType BatteryType //
{ //public SinexcelBatteryType BatteryType
get => (SinexcelBatteryType)_batteryType; //{
set => _batteryType = (UInt32)value; // get => (SinexcelBatteryType)_batteryType;
} // //set => _batteryType = (UInt32)value;
//}
public float BatteryCapacity1 //
{ //public float BatteryCapacity1
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCapacity1)); //{
set => _batteryCapacity1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCapacity1));
} // //set => _batteryCapacity1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery1MaxChargingCurrent //
{ //public float Battery1MaxChargingCurrent
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxChargingCurrentBattery1)); //{
set => _maxChargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxChargingCurrentBattery1));
} // //set => _maxChargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery1MaxDischargingCurrent //
{ //public float Battery1MaxDischargingCurrent
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxDischargingCurrentBattery1)); //{
set => _maxDischargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_maxDischargingCurrentBattery1));
} // //set => _maxDischargingCurrentBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float RatedBatteryVoltage1 //
{ //public float RatedBatteryVoltage1
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_ratedBatteryVoltage1)); //{
set => _ratedBatteryVoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_ratedBatteryVoltage1));
} // //set => _ratedBatteryVoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery1MinSoc //
{ //public float Battery1MinSoc
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_minSocBattery1)); //{
set => _minSocBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_minSocBattery1));
} // //set => _minSocBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float SetValueBattery1 //
{ //public float SetValueBattery1
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_setValueBattery1)); //{
set => _setValueBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_setValueBattery1));
} // //set => _setValueBattery1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public SinexcelActiveChargeDischarge ActiveChargeDischarge //
{ //public SinexcelActiveChargeDischarge ActiveChargeDischarge
get => (SinexcelActiveChargeDischarge)ConvertBitPatternToFloat(_activeChargeDischarge); //{
set => _activeChargeDischarge = (UInt32)value; // get => (SinexcelActiveChargeDischarge)ConvertBitPatternToFloat(_activeChargeDischarge);
} // //set => _activeChargeDischarge = (UInt32)value;
//}
public float ActiveChargeDischargePower //
{ //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 // 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 //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Protection & PV Mode
public SinexcelIslandProtection EnableIslandProtection //// ───────────────────────────────────────────────
{ //public SinexcelIslandProtection EnableIslandProtection
get => (SinexcelIslandProtection)_enableIslandProtection; //{
set => _enableIslandProtection = (UInt32)value; // get => (SinexcelIslandProtection)_enableIslandProtection;
} // //set => _enableIslandProtection = (UInt32)value;
//}
public SinexcelPvAccessMode PvAccessMode //
{ //public SinexcelPvAccessMode PvAccessMode
get => (SinexcelPvAccessMode)_pvAccessMode; //{
set => _pvAccessMode = (UInt32)value; // get => (SinexcelPvAccessMode)_pvAccessMode;
} // //set => _pvAccessMode = (UInt32)value;
//}
// ─────────────────────────────────────────────── //
// System-Level Parameters //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// System-Level Parameters
public float OutputVoltageAdjustmentFactor //// ───────────────────────────────────────────────
{ //public float OutputVoltageAdjustmentFactor
get => BitConverter.Int32BitsToSingle(unchecked((int)_outputVoltageAdjustmentFactor)); //{
set => _outputVoltageAdjustmentFactor = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_outputVoltageAdjustmentFactor));
} // //set => _outputVoltageAdjustmentFactor = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float SetValueBatteryUndervoltage1 //
{ //public float SetValueBatteryUndervoltage1
get => BitConverter.Int32BitsToSingle(unchecked((int)_setValueBatteryUndervoltage1)); //{
set => _setValueBatteryUndervoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_setValueBatteryUndervoltage1));
} // //set => _setValueBatteryUndervoltage1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float InverterPowerLimit //
{ //public float InverterPowerLimit
get => BitConverter.Int32BitsToSingle(unchecked((int)_inverterPowerLimit)); //{
set => _inverterPowerLimit = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_inverterPowerLimit));
} // //set => _inverterPowerLimit = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
// ─────────────────────────────────────────────── //
// Battery 2 Parameters //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Battery 2 Parameters
public float Battery2Capacity //// ───────────────────────────────────────────────
{ //public float Battery2Capacity
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2Capacity)); //{
set => _battery2Capacity = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2Capacity));
} // //set => _battery2Capacity = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2MaxChargingCurrent //
{ //public float Battery2MaxChargingCurrent
get => BitConverter.Int32BitsToSingle(unchecked((int)_maxChargingCurrentBattery2)); //{
set => _maxChargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_maxChargingCurrentBattery2));
} // //set => _maxChargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2MaxDischargingCurrent //
{ //public float Battery2MaxDischargingCurrent
get => BitConverter.Int32BitsToSingle(unchecked((int)_maxDischargingCurrentBattery2)); //{
set => _maxDischargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_maxDischargingCurrentBattery2));
} // //set => _maxDischargingCurrentBattery2 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2RatedVoltage //
{ //public float Battery2RatedVoltage
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2RatedVoltage)); //{
set => _battery2RatedVoltage = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2RatedVoltage));
} // //set => _battery2RatedVoltage = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2MinSoc //
{ //public float Battery2MinSoc
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2MinSoc)); //{
set => _battery2MinSoc = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2MinSoc));
} // //set => _battery2MinSoc = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2OverVoltageSetting //
{ //public float Battery2OverVoltageSetting
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2OverVoltageSetting)); //{
set => _battery2OverVoltageSetting = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2OverVoltageSetting));
} // //set => _battery2OverVoltageSetting = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
public float Battery2UnderVoltageSetpoint //
{ //public float Battery2UnderVoltageSetpoint
get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2UnderVoltageSetpoint)); //{
set => _battery2UnderVoltageSetpoint = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // get => BitConverter.Int32BitsToSingle(unchecked((int)_battery2UnderVoltageSetpoint));
} // //set => _battery2UnderVoltageSetpoint = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
//}
// ─────────────────────────────────────────────── //
// Parallel / System Settings //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Parallel / System Settings
public SinexcelMachineMode MachineMode //// ───────────────────────────────────────────────
{ //public SinexcelMachineMode MachineMode
get => (SinexcelMachineMode)ConvertBitPatternToFloat(_singleOrParallelMachine); //{
set => _singleOrParallelMachine = (UInt32)value; // get => (SinexcelMachineMode)ConvertBitPatternToFloat(_singleOrParallelMachine);
} // //set => _singleOrParallelMachine = (UInt32)value;
//}
public UInt32 NumberOfSystemModules //
{ //public UInt32 NumberOfSystemModules
get => (UInt32)ConvertBitPatternToFloat(_numberOfSystemModules); //{
set => _numberOfSystemModules = value; // get => (UInt32)ConvertBitPatternToFloat(_numberOfSystemModules);
} // //set => _numberOfSystemModules = value;
//}
public UInt32 ParallelModuleMachineNumber //
{ //public UInt32 ParallelModuleMachineNumber
get => (UInt32)ConvertBitPatternToFloat(_parallelModuleMachineNumber); //{
set => _parallelModuleMachineNumber = value; // get => (UInt32)ConvertBitPatternToFloat(_parallelModuleMachineNumber);
} // //set => _parallelModuleMachineNumber = value;
//}
public AccreditedCountry AccreditedCountry //
{ //public AccreditedCountry AccreditedCountry
get => (AccreditedCountry)ConvertBitPatternToFloat(_accreditedCountries); //{
set => _accreditedCountries = (UInt32)value; // get => (AccreditedCountry)ConvertBitPatternToFloat(_accreditedCountries);
} // //set => _accreditedCountries = (UInt32)value;
//}
// ─────────────────────────────────────────────── //
// Control Commands //// ───────────────────────────────────────────────
// ─────────────────────────────────────────────── //// Control Commands
//// ───────────────────────────────────────────────
public float PowerOn public float PowerOn
{ {
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOn)); get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOn));
@ -488,39 +489,39 @@ public partial class SinexcelRecord
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOff)); get => BitConverter.Int32BitsToSingle(unchecked((Int32)_powerOff));
set => _powerOff = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); set => _powerOff = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} }
//
public float FaultClearing //public float FaultClearingf
{ //{
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_faultClearing)); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_faultClearing));
set => _faultClearing = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // // //set => _faultClearing = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} //}
//
// ─────────────────────────────────────────────── //// ───────────────────────────────────────────────
// Meter & Battery Control //// Meter & Battery Control
// ─────────────────────────────────────────────── //// ───────────────────────────────────────────────
public float MeterReverseManualDetection //public float MeterReverseManualDetection
{ //{
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_meterReverseManualDetection)); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_meterReverseManualDetection));
set => _meterReverseManualDetection = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // //set => _meterReverseManualDetection = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} //}
//
public SinexcelBatteryRating BatteryVoltageRating //public SinexcelBatteryRating BatteryVoltageRating
{ //{
get => (SinexcelBatteryRating)ConvertBitPatternToFloat(_batteryVoltageRating); // get => (SinexcelBatteryRating)ConvertBitPatternToFloat(_batteryVoltageRating);
set => _batteryVoltageRating = (UInt32)value; // //set => _batteryVoltageRating = (UInt32)value;
} //}
//
public float Battery1Activation //public float Battery1Activation
{ //{
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery1Activation)); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery1Activation));
set => _battery1Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // //set => _battery1Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} //}
//
public float Battery2Activation //public float Battery2Activation
{ //{
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery2Activation)); // get => BitConverter.Int32BitsToSingle(unchecked((Int32)_battery2Activation));
set => _battery2Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); // //set => _battery2Activation = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} //}
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Electric Meter Operating State // Electric Meter Operating State
@ -589,7 +590,7 @@ public partial class SinexcelRecord
get => ElectricMeterAPhaseActivePower + ElectricMeterBPhaseActivePower + ElectricMeterCPhaseActivePower; get => ElectricMeterAPhaseActivePower + ElectricMeterBPhaseActivePower + ElectricMeterCPhaseActivePower;
} }
/*
// Energy (kW·h) // Energy (kW·h)
public Energy Battery1TotalChargingEnergy => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab1TotalChargingEnergy)); // 0xB0FC public Energy Battery1TotalChargingEnergy => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab1TotalChargingEnergy)); // 0xB0FC
public Energy Battery1TotalDischargedEnergy => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab1TotalDischargedEnergy)); // 0xB0FE public Energy Battery1TotalDischargedEnergy => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab1TotalDischargedEnergy)); // 0xB0FE
@ -611,33 +612,54 @@ public partial class SinexcelRecord
public Temperature Battery2Socsecondvalue => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soc)); // 0xB206 % public Temperature Battery2Socsecondvalue => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soc)); // 0xB206 %
public Percent Battery2Soh => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soh)); // 0xB208 % public Percent Battery2Soh => BitConverter.Int32BitsToSingle(unchecked((Int32)_batteryCab2Soh)); // 0xB208 %
// Repetitive-week mask (bit-mapped 06 = SunSat)
//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 06 = SunSat)
/* public float OtherTimePeriodMode
{
get => _Other_time_period_mode ; // only 7 bits used
//set => _Other_time_period_mode = (UInt32)value;
}*/
// Repetitive-week mask (bit-mapped 06 = SunSat) // Repetitive-week mask (bit-mapped 06 = SunSat)
public SinexcelWeekDays RepetitiveWeeks public SinexcelWeekDays RepetitiveWeeks
{ {
get => (SinexcelWeekDays)(_repetitiveWeeks & 0x7F); // only 7 bits used get => (SinexcelWeekDays)(_repetitiveWeeks & 0x7F); // only 7 bits used
set => _repetitiveWeeks = (UInt32)value; set => _repetitiveWeeks = (UInt32)value;
} }
//
// Effective start / end as UNIX timestamps // Effective start / end as UNIX timestamps
public DateTime EffectiveStartDate public DateTime EffectiveStartDate
{ {
get => DateTimeOffset.FromUnixTimeSeconds(_effectiveStartDate).DateTime; get => DateTimeOffset.FromUnixTimeSeconds(_effectiveStartDate).DateTime;
set => _effectiveStartDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds(); set => _effectiveStartDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds();
} }
//
public DateTime EffectiveEndDate public DateTime EffectiveEndDate
{ {
get => DateTimeOffset.FromUnixTimeSeconds(_effectiveEndDate).DateTime; get => DateTimeOffset.FromUnixTimeSeconds(_effectiveEndDate).DateTime;
set => _effectiveEndDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds(); set => _effectiveEndDate = (UInt32)new DateTimeOffset(value).ToUnixTimeSeconds();
} }
// // Charging power during time period 1 (kW)
// Charging power during time period 1 (kW)
public float ChargingPowerPeriod1 public float ChargingPowerPeriod1
{ {
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_chargingPowerPeriod1)); get => BitConverter.Int32BitsToSingle(unchecked((Int32)_chargingPowerPeriod1));
set => _chargingPowerPeriod1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0); set => _chargingPowerPeriod1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
} }
public float DishargingPowerPeriod1
{
get => BitConverter.Int32BitsToSingle(unchecked((Int32)_dischargingPowerPeriod1));
set => _dischargingPowerPeriod1 = BitConverter.ToUInt32(BitConverter.GetBytes(value), 0);
}
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Charging period 1 // Charging period 1
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
@ -646,7 +668,6 @@ public partial class SinexcelRecord
get => ConvertToTimeSpan(_chargeStartTimePeriod1); get => ConvertToTimeSpan(_chargeStartTimePeriod1);
set => _chargeStartTimePeriod1 = ConvertFromTimeSpan(value); set => _chargeStartTimePeriod1 = ConvertFromTimeSpan(value);
} }
public TimeSpan ChargeEndTimePeriod1 public TimeSpan ChargeEndTimePeriod1
{ {
get => ConvertToTimeSpan(_chargeEndTimePeriod1); get => ConvertToTimeSpan(_chargeEndTimePeriod1);
@ -661,32 +682,39 @@ public partial class SinexcelRecord
get => ConvertToTimeSpan(_dischargeStartTimePeriod1); get => ConvertToTimeSpan(_dischargeStartTimePeriod1);
set => _dischargeStartTimePeriod1 = ConvertFromTimeSpan(value); set => _dischargeStartTimePeriod1 = ConvertFromTimeSpan(value);
} }
//
public TimeSpan DischargeEndTimePeriod1 public TimeSpan DischargeEndTimePeriod1
{ {
get => ConvertToTimeSpan(_dischargeEndTimePeriod1); get => ConvertToTimeSpan(_dischargeEndTimePeriod1);
set => _dischargeEndTimePeriod1 = ConvertFromTimeSpan(value); set => _dischargeEndTimePeriod1 = ConvertFromTimeSpan(value);
}*/ }
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Conversion methodes // Conversion methodes
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
private static TimeSpan ConvertToTimeSpan(UInt32 value) private static TimeSpan ConvertToTimeSpan(UInt32 raw)
{ {
int hhmm = (int)value; // raw is IEEE754 float bits, e.g. 0x44640000 for 912.0
float f = BitConverter.Int32BitsToSingle(unchecked((int)raw));
int hhmm = (int)Math.Round(f);
int hours = hhmm / 100; int hours = hhmm / 100;
int minutes = hhmm % 100; int minutes = hhmm % 100;
return new TimeSpan(hours, minutes, 0); return new TimeSpan(hours, minutes, 0);
} }
private static UInt32 ConvertFromTimeSpan(TimeSpan time) private static UInt32 ConvertFromTimeSpan(TimeSpan time)
{ {
int hhmm = time.Hours * 100 + time.Minutes; int hhmm = time.Hours * 100 + time.Minutes; // e.g. 9*100+12 = 912
return (UInt32)hhmm; float f = (float)hhmm; // 912.0f
// convert float to raw IEEE754 bits
return BitConverter.ToUInt32(BitConverter.GetBytes(f), 0); // e.g. 0x44640000
} }
private static Single IntToFloat(Int32 intValue) private static Single IntToFloat(Int32 intValue)
{ {
byte[] intBytes = BitConverter.GetBytes(intValue); byte[] intBytes = BitConverter.GetBytes(intValue);

View File

@ -226,70 +226,70 @@ public partial class SinexcelRecord
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// System configuration / operation registers // System configuration / operation registers
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
[HoldingRegister<UInt32>(12294, writable: true)] private UInt32 _threePhaseWireSystem; // 0x3006 //[HoldingRegister<UInt32>(12294, writable: true)] private UInt32 _threePhaseWireSystem; // 0x3006
[HoldingRegister<UInt32>(12296, writable: true)] private UInt32 _remainnotused; // 0x3008 //[HoldingRegister<UInt32>(12296, writable: true)] private UInt32 _remainnotused; // 0x3008
[HoldingRegister<UInt32>(12298, writable: true)] private UInt32 _inputFrequencyClass; // 0x300A //[HoldingRegister<UInt32>(12298, writable: true)] private UInt32 _inputFrequencyClass; // 0x300A
[HoldingRegister<UInt32>(12300, writable: true)] private UInt32 _workingMode; // 0x300C [HoldingRegister<UInt32>(12300, writable: true)] private UInt32 _workingMode; // 0x300C
[HoldingRegister<UInt32>(12302, writable: true)] private UInt32 _methodSwitchMode; // 0x300E //[HoldingRegister<UInt32>(12302, writable: true)] private UInt32 _methodSwitchMode; // 0x300E
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Inverter Control and Protection Configuration // Inverter Control and Protection Configuration
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
[HoldingRegister<UInt32>(12304, writable: true)] private UInt32 _enableOnGridUnbalanceCompensation; // 0x3010 //[HoldingRegister<UInt32>(12304, writable: true)] private UInt32 _enableOnGridUnbalanceCompensation; // 0x3010
[HoldingRegister<UInt32>(12306, writable: true)] private UInt32 _temperatureDrop; // 0x3012 //[HoldingRegister<UInt32>(12306, writable: true)] private UInt32 _temperatureDrop; // 0x3012
[HoldingRegister<UInt32>(12308, writable: true)] private UInt32 _hvrt; // 0x3014 //[HoldingRegister<UInt32>(12308, writable: true)] private UInt32 _hvrt; // 0x3014
[HoldingRegister<UInt32>(12310, writable: true)] private UInt32 _lvrt; // 0x3016 //[HoldingRegister<UInt32>(12310, writable: true)] private UInt32 _lvrt; // 0x3016
[HoldingRegister<UInt32>(12312, writable: true)] private UInt32 _fanGear; // 0x3018 //[HoldingRegister<UInt32>(12312, writable: true)] private UInt32 _fanGear; // 0x3018
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Battery & PV Configuration // Battery & PV Configuration
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
[HoldingRegister<UInt32>(12336, writable: true)] private UInt32 _batteryAccessMethod; // 0x3030 //[HoldingRegister<UInt32>(12336, writable: true)] private UInt32 _batteryAccessMethod; // 0x3030
[HoldingRegister<UInt32>(12338, writable: true)] private UInt32 _meterAccessEnable; // 0x3032 //[HoldingRegister<UInt32>(12338, writable: true)] private UInt32 _meterAccessEnable; // 0x3032
[HoldingRegister<UInt32>(12340, writable: true)] private UInt32 _enableBattery1; // 0x3034 //[HoldingRegister<UInt32>(12340, writable: true)] private UInt32 _enableBattery1; // 0x3034
[HoldingRegister<UInt32>(12342, writable: true)] private UInt32 _enableBattery2; // 0x3036 //[HoldingRegister<UInt32>(12342, writable: true)] private UInt32 _enableBattery2; // 0x3036
[HoldingRegister<UInt32>(12344, writable: true)] private UInt32 _enablePv1; // 0x3038 //[HoldingRegister<UInt32>(12344, writable: true)] private UInt32 _enablePv1; // 0x3038
[HoldingRegister<UInt32>(12346, writable: true)] private UInt32 _enablePv2; // 0x303A //[HoldingRegister<UInt32>(12346, writable: true)] private UInt32 _enablePv2; // 0x303A
[HoldingRegister<UInt32>(12348, writable: true)] private UInt32 _batteryType; // 0x303C //[HoldingRegister<UInt32>(12348, writable: true)] private UInt32 _batteryType; // 0x303C
[HoldingRegister<UInt32>(12350, writable: true)] private UInt32 _batteryCapacity1; // 0x303E //[HoldingRegister<UInt32>(12350, writable: true)] private UInt32 _batteryCapacity1; // 0x303E
[HoldingRegister<UInt32>(12352, writable: true)] private UInt32 _maxChargingCurrentBattery1; // 0x3040 //[HoldingRegister<UInt32>(12352, writable: true)] private UInt32 _maxChargingCurrentBattery1; // 0x3040
[HoldingRegister<UInt32>(12354, writable: true)] private UInt32 _maxDischargingCurrentBattery1; // 0x3042 //[HoldingRegister<UInt32>(12354, writable: true)] private UInt32 _maxDischargingCurrentBattery1; // 0x3042
[HoldingRegister<UInt32>(12362, writable: true)] private UInt32 _ratedBatteryVoltage1; // 0x304A //[HoldingRegister<UInt32>(12362, writable: true)] private UInt32 _ratedBatteryVoltage1; // 0x304A
[HoldingRegister<UInt32>(12358, writable: true)] private UInt32 _minSocBattery1; // 0x3046 //[HoldingRegister<UInt32>(12358, writable: true)] private UInt32 _minSocBattery1; // 0x3046
[HoldingRegister<UInt32>(12360, writable: true)] private UInt32 _setValueBattery1; // 0x3048 //[HoldingRegister<UInt32>(12360, writable: true)] private UInt32 _setValueBattery1; // 0x3048
[HoldingRegister<UInt32>(12364, writable: true)] private UInt32 _activeChargeDischarge; // 0x304A //[HoldingRegister<UInt32>(12364, writable: true)] private UInt32 _activeChargeDischarge; // 0x304A
[HoldingRegister<UInt32>(12366, writable: true)] private UInt32 _activeChargeDischargePower; // 0x304C //[HoldingRegister<UInt32>(12366, writable: true)] private UInt32 _activeChargeDischargePower; // 0x304C
[HoldingRegister<UInt32>(12380, writable: true)] private UInt32 _enableIslandProtection; // 0x305C //[HoldingRegister<UInt32>(12380, writable: true)] private UInt32 _enableIslandProtection; // 0x305C
[HoldingRegister<UInt32>(12382, writable: true)] private UInt32 _pvAccessMode; // 0x305E //[HoldingRegister<UInt32>(12382, writable: true)] private UInt32 _pvAccessMode; // 0x305E
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// System & Battery-2 Configuration // System & Battery-2 Configuration
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
[HoldingRegister<UInt32>(12384, writable: true)] private UInt32 _outputVoltageAdjustmentFactor; // 0x3060 //[HoldingRegister<UInt32>(12384, writable: true)] private UInt32 _outputVoltageAdjustmentFactor; // 0x3060
[HoldingRegister<UInt32>(12386, writable: true)] private UInt32 _setValueBatteryUndervoltage1; // 0x3062 //[HoldingRegister<UInt32>(12386, writable: true)] private UInt32 _setValueBatteryUndervoltage1; // 0x3062
[HoldingRegister<UInt32>(12388, writable: true)] private UInt32 _inverterPowerLimit; // 0x3064 //[HoldingRegister<UInt32>(12388, writable: true)] private UInt32 _inverterPowerLimit; // 0x3064
[HoldingRegister<UInt32>(12400, writable: true)] private UInt32 _battery2Capacity; // 0x30B0 //[HoldingRegister<UInt32>(12400, writable: true)] private UInt32 _battery2Capacity; // 0x30B0
[HoldingRegister<UInt32>(12402, writable: true)] private UInt32 _maxChargingCurrentBattery2; // 0x30B2 //[HoldingRegister<UInt32>(12402, writable: true)] private UInt32 _maxChargingCurrentBattery2; // 0x30B2
[HoldingRegister<UInt32>(12404, writable: true)] private UInt32 _maxDischargingCurrentBattery2; // 0x30B4 //[HoldingRegister<UInt32>(12404, writable: true)] private UInt32 _maxDischargingCurrentBattery2; // 0x30B4
[HoldingRegister<UInt32>(12406, writable: true)] private UInt32 _battery2RatedVoltage; // 0x30B6 //[HoldingRegister<UInt32>(12406, writable: true)] private UInt32 _battery2RatedVoltage; // 0x30B6
[HoldingRegister<UInt32>(12408, writable: true)] private UInt32 _battery2MinSoc; // 0x30B8 //[HoldingRegister<UInt32>(12408, writable: true)] private UInt32 _battery2MinSoc; // 0x30B8
[HoldingRegister<UInt32>(12410, writable: true)] private UInt32 _battery2OverVoltageSetting; // 0x30BA //[HoldingRegister<UInt32>(12410, writable: true)] private UInt32 _battery2OverVoltageSetting; // 0x30BA
[HoldingRegister<UInt32>(12412, writable: true)] private UInt32 _battery2UnderVoltageSetpoint; // 0x30BC //[HoldingRegister<UInt32>(12412, writable: true)] private UInt32 _battery2UnderVoltageSetpoint; // 0x30BC
//
[HoldingRegister<UInt32>(12414, writable: true)] private UInt32 _singleOrParallelMachine; // 0x30BE //[HoldingRegister<UInt32>(12414, writable: true)] private UInt32 _singleOrParallelMachine; // 0x30BE
[HoldingRegister<UInt32>(12416, writable: true)] private UInt32 _numberOfSystemModules; // 0x30C0 //[HoldingRegister<UInt32>(12416, writable: true)] private UInt32 _numberOfSystemModules; // 0x30C0
[HoldingRegister<UInt32>(12418, writable: true)] private UInt32 _parallelModuleMachineNumber; // 0x30C2 //[HoldingRegister<UInt32>(12418, writable: true)] private UInt32 _parallelModuleMachineNumber; // 0x30C2
[HoldingRegister<UInt32>(12420, writable: true)] private UInt32 _accreditedCountries; // 0x30C4 //[HoldingRegister<UInt32>(12420, writable: true)] private UInt32 _accreditedCountries; // 0x30C4
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// System Control & Diagnostic Registers // System Control & Diagnostic Registers
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
[HoldingRegister<UInt32>(15426, writable: true)] private UInt32 _powerOn; // 0x3C42 [HoldingRegister<UInt32>(15426, writable: true)] private UInt32 _powerOn; // 0x3C42
[HoldingRegister<UInt32>(15428, writable: true)] private UInt32 _powerOff; // 0x3C44 [HoldingRegister<UInt32>(15428, writable: true)] private UInt32 _powerOff; // 0x3C44
[HoldingRegister<UInt32>(15430, writable: true)] private UInt32 _faultClearing; // 0x3C46 //[HoldingRegister<UInt32>(15430, writable: true)] private UInt32 _faultClearing; // 0x3C46
[HoldingRegister<UInt32>(15518, writable: true)] private UInt32 _meterReverseManualDetection; // 0x3C9E //[HoldingRegister<UInt32>(15518, writable: true)] private UInt32 _meterReverseManualDetection; // 0x3C9E
[HoldingRegister<UInt32>(15520, writable: true)] private UInt32 _batteryVoltageRating; // 0x3CA0 //[HoldingRegister<UInt32>(15520, writable: true)] private UInt32 _batteryVoltageRating; // 0x3CA0
[HoldingRegister<UInt32>(15524, writable: true)] private UInt32 _battery1Activation; // 0x3CA4 //[HoldingRegister<UInt32>(15524, writable: true)] private UInt32 _battery1Activation; // 0x3CA4
[HoldingRegister<UInt32>(15526, writable: true)] private UInt32 _battery2Activation; // 0x3CA6 //[HoldingRegister<UInt32>(15526, writable: true)] private UInt32 _battery2Activation; // 0x3CA6
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
@ -308,7 +308,7 @@ public partial class SinexcelRecord
[HoldingRegister<UInt32>(41234)] private UInt32 _electricMeterAPhaseActivePower; // 0xA112 [HoldingRegister<UInt32>(41234)] private UInt32 _electricMeterAPhaseActivePower; // 0xA112
[HoldingRegister<UInt32>(41236)] private UInt32 _electricMeterBPhaseActivePower; // 0xA114 [HoldingRegister<UInt32>(41236)] private UInt32 _electricMeterBPhaseActivePower; // 0xA114
[HoldingRegister<UInt32>(41238)] private UInt32 _electricMeterCPhaseActivePower; // 0xA116 [HoldingRegister<UInt32>(41238)] private UInt32 _electricMeterCPhaseActivePower; // 0xA116
/*
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Battery Cabinet 1 — Energy / Pack measurements (read-only) // Battery Cabinet 1 — Energy / Pack measurements (read-only)
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
@ -336,10 +336,15 @@ public partial class SinexcelRecord
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Time-based scheduling (period 1) configuration // Time-based scheduling (period 1) configuration
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
//[HoldingRegister<UInt32>(49328, writable: true)] private UInt32 _Timed_Charge_and_Discharge_Off; // 0xC0B4, bit flags SunSat
//[HoldingRegister<UInt32>(49330, writable: true)] private UInt32 _Other_time_period_mode; // 0xC0B4, bit flags SunSat
[HoldingRegister<UInt32>(49332, writable: true)] private UInt32 _repetitiveWeeks; // 0xC0B4, bit flags SunSat [HoldingRegister<UInt32>(49332, writable: true)] private UInt32 _repetitiveWeeks; // 0xC0B4, bit flags SunSat
[HoldingRegister<UInt32>(49334, writable: true)] private UInt32 _effectiveStartDate; // 0xC0B6, UNIX timestamp (UTC+offset) [HoldingRegister<UInt32>(49334, writable: true)] private UInt32 _effectiveStartDate; // 0xC0B6, UNIX timestamp (UTC+offset)
[HoldingRegister<UInt32>(49336, writable: true)] private UInt32 _effectiveEndDate; // 0xC0B8, UNIX timestamp (UTC+offset) [HoldingRegister<UInt32>(49336, writable: true)] private UInt32 _effectiveEndDate; // 0xC0B8, UNIX timestamp (UTC+offset)
[HoldingRegister<UInt32>(49338, writable: true)] private UInt32 _chargingPowerPeriod1; // 0xC0BA, float [050] kW, default 5 [HoldingRegister<UInt32>(49338, writable: true)] private UInt32 _chargingPowerPeriod1; // 0xC0BA, float [050] kW, default 5
[HoldingRegister<UInt32>(49340, writable: true)] private UInt32 _dischargingPowerPeriod1; // 0xC0BA, float [050] kW, default 5
// ─────────────────────────────────────────────── // ───────────────────────────────────────────────
// Time-based charge/discharge schedule period 1 // Time-based charge/discharge schedule period 1
@ -348,5 +353,5 @@ public partial class SinexcelRecord
[HoldingRegister<UInt32>(49174, writable: true)] private UInt32 _chargeEndTimePeriod1; // 0xC016 [0-2359] (end) [HoldingRegister<UInt32>(49174, writable: true)] private UInt32 _chargeEndTimePeriod1; // 0xC016 [0-2359] (end)
[HoldingRegister<UInt32>(49176, writable: true)] private UInt32 _dischargeStartTimePeriod1; // 0xC018 [0-2359] (start) [HoldingRegister<UInt32>(49176, writable: true)] private UInt32 _dischargeStartTimePeriod1; // 0xC018 [0-2359] (start)
[HoldingRegister<UInt32>(49178, writable: true)] private UInt32 _dischargeEndTimePeriod1; // 0xC01A [0-2359] (end) [HoldingRegister<UInt32>(49178, writable: true)] private UInt32 _dischargeEndTimePeriod1; // 0xC01A [0-2359] (end)
*/
} }