Fixed some bugs and added inverter status to modbus register
- Safety now has a tof of 0,5s for Temp, Voltage and Pressure - Doppelhöcker now switches powercommand during second phase
This commit is contained in:
@@ -496,7 +496,7 @@ END_IF
|
||||
_fbBalanceNotOkSignal(
|
||||
xSignal:= NOT _xBalanceOk,
|
||||
xRelease:= xEnable AND _xAllUnitsReady,
|
||||
timOnDelay:= T#10S,
|
||||
timOnDelay:= T#5S,
|
||||
timOffDelay:= T#5S,
|
||||
xReleaseSignal=> );
|
||||
|
||||
@@ -523,7 +523,7 @@ END_IF
|
||||
// ===============================
|
||||
// Module ready validation check
|
||||
// ===============================
|
||||
IF _xAllUnitsReady AND _xBalanceOk THEN
|
||||
IF _xAllUnitsReady AND (NOT _fbBalanceNotOkSignal.xReleaseSignal) THEN
|
||||
xReady := TRUE;
|
||||
ELSE
|
||||
xReady := FALSE;
|
||||
|
||||
@@ -129,6 +129,9 @@ VAR_OUTPUT
|
||||
|
||||
// Balancing done
|
||||
xBalancingDone : BOOL;
|
||||
|
||||
// Inverter infos for EMS display
|
||||
stInverterInfos : ST_KACO_INFOS;
|
||||
END_VAR
|
||||
VAR
|
||||
_fbModule1 : FB_Module(CONCAT(Name,' - Module 1'));
|
||||
@@ -390,7 +393,8 @@ _fbInverter(
|
||||
rPower:= _rPowerInverterInternal,
|
||||
xReset:= xConfirmAlarms,
|
||||
rMaxBattPower:= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower),
|
||||
stCurrentValues => stInverterData);
|
||||
stCurrentValues => stInverterData,
|
||||
stInverterInfos => stInverterInfos);
|
||||
|
||||
refuStringErrorsModbus.stBitmap.bInverterError := _fbInverter.xError;
|
||||
|
||||
@@ -679,7 +683,7 @@ CASE _iState OF
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
ELSIF (NOT _xAllModulesReady) OR (NOT _xBalanceOk) OR (NOT xSafetyIntlksOk) OR (NOT xRepairSwitchOk) OR (_xErrorInternal) THEN
|
||||
ELSIF (NOT _xAllModulesReady) OR (_fbBalanceNotOkSignal.xReleaseSignal) OR (NOT xSafetyIntlksOk) OR (NOT xRepairSwitchOk) OR (_xErrorInternal) THEN
|
||||
xError := TRUE;
|
||||
_xEnable := FALSE;
|
||||
_rPowerInverterInternal := 0.0;
|
||||
@@ -1079,8 +1083,8 @@ END_IF
|
||||
_fbBalanceNotOkSignal(
|
||||
xSignal:= NOT _xBalanceOk,
|
||||
xRelease:= xEnable AND _xAllModulesReady,
|
||||
timOnDelay:= T#10S,
|
||||
timOffDelay:= T#10S,
|
||||
timOnDelay:= T#5S,
|
||||
timOffDelay:= T#5S,
|
||||
xReleaseSignal=> );
|
||||
|
||||
// Signal an error if all units are ready and module is out of balance
|
||||
|
||||
@@ -207,6 +207,7 @@ VAR
|
||||
_xGetPowerMeterData : BOOL;
|
||||
|
||||
_rPowerDH : REAL;
|
||||
_xDHActive : BOOL;
|
||||
_fbTONDHCycleTime : TON := (PT := T#15M);
|
||||
|
||||
// tower light
|
||||
@@ -486,6 +487,11 @@ GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module2High
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module3High := _afbStrings[0].xTempCabinetModule3Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString1High := _fbTempCabinetSCSString1.xWarningHigh;
|
||||
|
||||
// Copy inverter data to Modbus registers
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1CurrentState := _afbStrings[0].stInverterInfos.eCurrentState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1RequestedState := _afbStrings[0].stInverterInfos.eRequestedState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1PCUState := _afbStrings[0].stInverterInfos.ePCUState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1PCUError := _afbStrings[0].stInverterInfos.ePCUError;
|
||||
|
||||
// Call string 2
|
||||
_afbStrings[1](
|
||||
@@ -548,6 +554,12 @@ GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module2High
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module3High := _afbStrings[1].xTempCabinetModule3Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString2High := _fbTempCabinetSCSString2.xWarningHigh;
|
||||
|
||||
// Copy inverter data to Modbus registers
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2CurrentState := _afbStrings[1].stInverterInfos.eCurrentState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2RequestedState := _afbStrings[1].stInverterInfos.eRequestedState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2PCUState := _afbStrings[1].stInverterInfos.ePCUState;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2PCUError := _afbStrings[1].stInverterInfos.ePCUError;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Get global string status information
|
||||
@@ -880,14 +892,21 @@ CASE _eBMSControlMode OF
|
||||
|
||||
// Goto error state if a string has an error
|
||||
IF _xStringsErrorActive THEN
|
||||
_xDHActive := FALSE;
|
||||
_iStateDH := 1000;
|
||||
END_IF
|
||||
|
||||
CASE _iStateDH OF
|
||||
0: // Idle, wait for command
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
||||
IF (ABS(_rAutoPowerRequest) > 100.0) THEN
|
||||
_rPowerDH := _rAutoPowerRequest;
|
||||
_rPowerDH := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
||||
IF (ABS(_rPowerDH) > 100.0) THEN
|
||||
_xDHActive := TRUE;
|
||||
_iStateDH := 5;
|
||||
END_IF
|
||||
|
||||
5: // Wait for pre startup
|
||||
IF _xBatteryActive THEN
|
||||
_rAutoPowerRequest := _rPowerDH;
|
||||
_fbTONDHCycleTime(IN := TRUE);
|
||||
_iStateDH := 10;
|
||||
END_IF
|
||||
@@ -904,7 +923,7 @@ CASE _eBMSControlMode OF
|
||||
20: // First pause
|
||||
_fbTONDHCycleTime(IN := TRUE);
|
||||
IF _fbTONDHCycleTime.Q THEN
|
||||
_rAutoPowerRequest := _rPowerDH;
|
||||
_rAutoPowerRequest := _rPowerDH * -1;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := REAL_TO_DINT(_rAutoPowerRequest);
|
||||
_fbTONDHCycleTime(IN := FALSE);
|
||||
_iStateDH := 30;
|
||||
@@ -916,6 +935,7 @@ CASE _eBMSControlMode OF
|
||||
_rAutoPowerRequest := 0;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_fbTONDHCycleTime(IN := FALSE);
|
||||
_xDHActive := FALSE;
|
||||
_iStateDH := 0;
|
||||
END_IF
|
||||
|
||||
@@ -1019,7 +1039,7 @@ _fbTowerLight(
|
||||
END_IF
|
||||
|
||||
// Wait for power command
|
||||
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive)
|
||||
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive OR _xDHActive)
|
||||
AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode AND (NOT _xEMSHeartbeatNotOK) THEN
|
||||
_iState := 5;
|
||||
_xReleaseInverterPower := FALSE;
|
||||
@@ -1065,7 +1085,7 @@ _fbTowerLight(
|
||||
END_IF
|
||||
|
||||
|
||||
IF ((ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) THEN
|
||||
IF ((ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND (NOT _xDHActive) THEN
|
||||
_fbStringReadyTimeout(IN := FALSE);
|
||||
_xEnableString := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
@@ -1080,7 +1100,7 @@ _fbTowerLight(
|
||||
_xBatteryActive := TRUE;
|
||||
|
||||
// Check if the battery should still be active
|
||||
IF (_rAutoPowerRequest = 0.0) AND NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive THEN
|
||||
IF (_rAutoPowerRequest = 0.0) AND ((NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) OR (NOT _xDHActive)) THEN
|
||||
_xNoPowerRequested := TRUE;
|
||||
ELSE
|
||||
_xNoPowerRequested := FALSE;
|
||||
@@ -1248,6 +1268,7 @@ _fbTowerLight(
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
_xCanChangeMode := TRUE;
|
||||
IF (NOT _xStringsInSchutdownDischargeMode) AND _xStringsOff THEN
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.OFF;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus := E_CHARGE_STATUS.UNDEFINED;
|
||||
@@ -1256,7 +1277,7 @@ _fbTowerLight(
|
||||
END_IF
|
||||
|
||||
// Restart if possible
|
||||
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive)
|
||||
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive OR _xDHActive)
|
||||
AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
|
||||
_xCanChangeMode := FALSE;
|
||||
IF (_rAutoPowerRequest < 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL THEN
|
||||
@@ -1267,6 +1288,10 @@ _fbTowerLight(
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
IF _xDHActive THEN
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
IF (_rAutoPowerRequest <> 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) THEN
|
||||
IF (_rAutoPowerRequest <= 0 AND (GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL))
|
||||
OR (_rAutoPowerRequest >= 0) AND (GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.EMPTY) THEN
|
||||
|
||||
@@ -22,6 +22,9 @@ VAR_OUTPUT
|
||||
|
||||
// Current inverter values
|
||||
stCurrentValues : ST_SUNSPEC_CURRENT_VALUES;
|
||||
|
||||
// Inverter infos for EMS display
|
||||
stInverterInfos : ST_KACO_INFOS;
|
||||
END_VAR
|
||||
VAR
|
||||
// Battery limits
|
||||
@@ -247,6 +250,13 @@ END_IF
|
||||
|
||||
HandleCyclicData();
|
||||
|
||||
// Copy inverter states to output
|
||||
stInverterInfos.eRequestedState := _eRequestedState;
|
||||
stInverterInfos.eCurrentState := _eCurrentState;
|
||||
stInverterInfos.ePCUState := _stPCUState.ePCUState;
|
||||
stInverterInfos.ePCUError := _stPCUState.ePCUError;
|
||||
|
||||
// Run state machine
|
||||
CASE _iState OF
|
||||
0: // Pre-init phase (no battery limits set)
|
||||
_fbTONSetBatteryLimits(IN := TRUE);
|
||||
|
||||
14
PLC/POUs/Sunspec/Kaco/ST_KACO_INFOS.TcDUT
Normal file
14
PLC/POUs/Sunspec/Kaco/ST_KACO_INFOS.TcDUT
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<DUT Name="ST_KACO_INFOS" Id="{8a89bb74-fd34-4e8d-a03d-9fc814aadf52}">
|
||||
<Declaration><![CDATA[TYPE ST_KACO_INFOS :
|
||||
STRUCT
|
||||
eRequestedState : E_KACO_PCU_REQUESTED_STATE;
|
||||
eCurrentState : E_KACO_CURRENT_STATE;
|
||||
ePCUState : E_KACO_PCU_STATE;
|
||||
ePCUError : E_KACO_PCU_ERROR;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user