Implemented a better balancing algorith for string balancing
* Added error logging to inverter fb * Changed HMI actual power feedback from dc to ac power * Small config adjustments
This commit is contained in:
@@ -131,6 +131,7 @@ VAR
|
||||
|
||||
// Sum of voltage of all active strings
|
||||
_rStringsSumVoltage : REAL;
|
||||
_rDeltaUm : REAL;
|
||||
_arPowerString : ARRAY[0..(GVL_CONFIG.uiNumberOfStrings-1)] OF REAL;
|
||||
|
||||
_ui : UINT := 0;
|
||||
@@ -607,7 +608,7 @@ GVL_SCADA.xCanChangeControlMode := _xCanChangeMode;
|
||||
GVL_SCADA.eCurrentControlMode := _eBMSControlMode;
|
||||
|
||||
// Calculate current battery dc power
|
||||
GVL_SCADA.diCurrentBatteryPower := REAL_TO_DINT(_afbStrings[0].stInverterData.rActDCPower + _afbStrings[1].stInverterData.rActDCPower);
|
||||
GVL_SCADA.diCurrentBatteryPower := REAL_TO_DINT(_afbStrings[0].stInverterData.rActACPower + _afbStrings[1].stInverterData.rActACPower);
|
||||
|
||||
// Read power values if commanded
|
||||
_fbPowerMeterPower(
|
||||
@@ -927,14 +928,17 @@ _fbPowerMeter24V();]]></ST>
|
||||
END_CASE
|
||||
|
||||
// Calculate string power balancing
|
||||
IF _rStringsSumVoltage <> 0 THEN
|
||||
IF _rStringsSumVoltage <> 0 AND (GVL_CONFIG.uiNumberOfStrings <> 0) THEN
|
||||
FOR _ui := 0 TO (GVL_CONFIG.uiNumberOfStrings-1) DO
|
||||
// Calculate delta u to middle voltage
|
||||
_rDeltaUm := (_afbStrings[_ui].rCurrentVoltage * GVL_CONFIG.uiNumberOfStrings - _rStringsSumVoltage) / _rStringsSumVoltage;
|
||||
|
||||
// Discharging
|
||||
IF _rPowerInverter > 0 THEN
|
||||
_arPowerString[_ui] := _rPowerInverter * (_afbStrings[_ui].rCurrentVoltage / _rStringsSumVoltage);
|
||||
_arPowerString[_ui] := (_rPowerInverter / GVL_CONFIG.uiNumberOfStrings) * ( 1 + (_rDeltaUm * GVL_CONFIG.rBalancingFactor));
|
||||
// Charging
|
||||
ELSIF _rPowerInverter < 0 THEN
|
||||
_arPowerString[_ui] := _rPowerInverter * (1.0 - (_afbStrings[_ui].rCurrentVoltage / _rStringsSumVoltage));
|
||||
_arPowerString[_ui] := (_rPowerInverter / GVL_CONFIG.uiNumberOfStrings) * ( 1 - (_rDeltaUm * GVL_CONFIG.rBalancingFactor));
|
||||
// Nothing
|
||||
ELSE
|
||||
_arPowerString[_ui] := 0.0;
|
||||
|
||||
Reference in New Issue
Block a user