GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Test unit 1 with unit 3 IF ABS(_fbUnit1.rCurrentVoltage - _fbUnit3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Test unit 1 with unit 4 IF ABS(_fbUnit1.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Test unit 2 with unit 3 IF ABS(_fbUnit2.rCurrentVoltage - _fbUnit3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Test unit 2 with unit 4 IF ABS(_fbUnit2.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Test unit 3 with unit 4 IF ABS(_fbUnit3.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN _xBalanceOk := FALSE; END_IF // Release signal for balance not ok _fbBalanceNotOkSignal( xSignal:= NOT _xBalanceOk, xRelease:= xEnable AND _xAllUnitsReady, timOnDelay:= T#10S, timOffDelay:= T#5S, xReleaseSignal=> ); // Signal an error if all units are ready and module is out of balance IF _xAllUnitsReady AND _fbBalanceNotOkSignal.xReleaseSignal THEN xError := TRUE; END_IF // Raise error IF _fbBalanceNotOkSignal.xReleaseSignal AND (NOT _fbUnitsOutOfBalanceAlarm.bRaised) THEN _fbUnitsOutOfBalanceAlarm.Raise(0); END_IF // Clear error only with confirmation because of voltage ripple event spam IF (NOT _fbBalanceNotOkSignal.xReleaseSignal) AND _fbUnitsOutOfBalanceAlarm.bRaised AND xConfirmAlarms THEN _fbUnitsOutOfBalanceAlarm.Clear(0, FALSE); END_IF // Confirm error IF _fbUnitsOutOfBalanceAlarm.eConfirmationState = TcEventConfirmationState.WaitForConfirmation AND xConfirmAlarms THEN _fbUnitsOutOfBalanceAlarm.Confirm(0); END_IF // =============================== // Module ready validation check // =============================== IF _xAllUnitsReady AND _xBalanceOk THEN xReady := TRUE; ELSE xReady := FALSE; END_IF // =============================== // Get the smallest segment Voltage // for balancing // =============================== rSmallestSegmentVoltage := MIN(_fbUnit1.rCurrentVoltage, _fbUnit2.rCurrentVoltage, _fbUnit3.rCurrentVoltage, _fbUnit4.rCurrentVoltage); rHighestSegmentVoltage := MAX(_fbUnit1.rCurrentVoltage, _fbUnit2.rCurrentVoltage, _fbUnit3.rCurrentVoltage, _fbUnit4.rCurrentVoltage); // =============================== // Copy string current to module current // =============================== refstHMIInterface.rCurrent := rCurrent; // =============================== // Module status sum // =============================== // Module ready IF xReady AND (NOT xError) THEN refstHMIInterface.eStatus := E_COMPONENT_STATUS.ON; END_IF // Module starting IF (NOT xOff) AND (NOT xReady) AND xEnable AND (NOT xError) THEN refstHMIInterface.eStatus := E_COMPONENT_STATUS.STARTING; END_IF // Module shutdown IF (NOT xOff) AND (NOT xReady) AND (NOT xEnable) AND (NOT xError) THEN refstHMIInterface.eStatus := E_COMPONENT_STATUS.SHUTDOWN; END_IF // Module off IF xOff AND (NOT xError) THEN refstHMIInterface.eStatus := E_COMPONENT_STATUS.OFF; END_IF // Module error IF xError THEN refstHMIInterface.eStatus := E_COMPONENT_STATUS.ERROR; END_IF ]]>