Added cabinet temperature and modbus registers
added cabinet temperature to each module, scs and bms cabinet, added corresponding config, hmi interface, hardware & links. Added corresponding warning bits to modbus registers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
|
||||
<POU Name="FB_Module" Id="{87be924f-018d-4c09-997b-f0c0054414cc}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Module
|
||||
VAR_INPUT
|
||||
@@ -86,6 +86,9 @@ VAR_OUTPUT
|
||||
// One unit has a warning
|
||||
xWarning : BOOL;
|
||||
|
||||
// Temperature control cabinet above 40 °C
|
||||
xTempCabinetWarning : BOOL;
|
||||
|
||||
// All modules in automatic mode
|
||||
xAllUnitsInAutomatic : BOOL;
|
||||
|
||||
@@ -104,6 +107,9 @@ VAR
|
||||
_fbUnit3 : FB_Unit(CONCAT(Name, ' - Unit 3'));
|
||||
_fbUnit4 : FB_Unit(CONCAT(Name, ' - Unit 4'));
|
||||
|
||||
// Temperature sensor cabinet
|
||||
_fbTempSensorCabinet : FB_AnalogInput(CONCAT(Name, ' - T1_Cabinet'));
|
||||
|
||||
// Flag for unit balance checking
|
||||
_xBalanceOk : BOOL;
|
||||
|
||||
@@ -143,6 +149,8 @@ END_VAR
|
||||
_fbUnit2.Name := CONCAT(Name, ' - Unit 2');
|
||||
_fbUnit3.Name := CONCAT(Name, ' - Unit 3');
|
||||
_fbUnit4.Name := CONCAT(Name, ' - Unit 4');
|
||||
|
||||
_fbTempSensorCabinet.Name := CONCAT(Name, ' - T1_Cabinet');
|
||||
END_IF
|
||||
|
||||
// Reset error and warning flag
|
||||
@@ -384,6 +392,33 @@ IF NOT _fbUnit4.xAllComponentsInAuto THEN
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor control cabinet
|
||||
// ===============================
|
||||
_fbTempSensorCabinet(
|
||||
stScalingConfig:= GVL_CONFIG.stConfigCabinetTemp,
|
||||
stEWConfig:= GVL_CONFIG.stEWLCabinetTemp,
|
||||
stEWDelayConfig:= GVL_CONFIG.stEWDCabinetTemp,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface=> refstHMIInterface.stTempCabinet);
|
||||
|
||||
// Set warning output for modbus register bits
|
||||
IF _fbTempSensorCabinet.xWarningHigh THEN
|
||||
xTempCabinetWarning := TRUE;
|
||||
END_IF
|
||||
|
||||
IF _fbTempSensorCabinet.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
IF _fbTempSensorCabinet.xWarning THEN
|
||||
xWarning := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units ready check
|
||||
// ===============================
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
|
||||
<POU Name="FB_String" Id="{46501225-f446-4674-bfed-3be64273e576}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_String
|
||||
VAR_INPUT
|
||||
@@ -100,6 +100,15 @@ VAR_OUTPUT
|
||||
xError : BOOL;
|
||||
xWarning : BOOL;
|
||||
|
||||
// Temperature control cabinet module 1 above 40 °C
|
||||
xTempCabinetModule1Warning : BOOL;
|
||||
|
||||
// Temperature control cabinet module 2 above 40 °C
|
||||
xTempCabinetModule2Warning : BOOL;
|
||||
|
||||
// Temperature control cabinet module 3 above 40 °C
|
||||
xTempCabinetModule3Warning : BOOL;
|
||||
|
||||
eStatus : E_COMPONENT_STATUS;
|
||||
|
||||
// Inverter status data
|
||||
@@ -275,7 +284,8 @@ _fbModule1(
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage,
|
||||
xTempCabinetWarning => xTempCabinetModule1Warning);
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -296,7 +306,8 @@ _fbModule2(
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage,
|
||||
xTempCabinetWarning => xTempCabinetModule2Warning);
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -317,7 +328,8 @@ _fbModule3(
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage,
|
||||
xTempCabinetWarning => xTempCabinetModule3Warning);
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -966,7 +978,6 @@ END_IF
|
||||
_xIsoError := ((NOT xIsoErrorL1) OR (NOT xIsoErrorL2)) AND (NOT _fbInverter.xActive) AND (xDCCBOpen);
|
||||
_fbTONIsoError(IN := _xIsoError, PT := GVL_CONFIG.timIsoErrorTimeout);
|
||||
|
||||
// _fbInverter
|
||||
IF _fbTONIsoError.Q AND (NOT _fbIsolationAlarm.bRaised) AND xReleaseErrors THEN
|
||||
_fbIsolationAlarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
|
||||
<POU Name="FB_Unit" Id="{e9bb815b-eb46-4920-800d-910484e58b22}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Unit
|
||||
VAR_INPUT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
|
||||
<POU Name="MAIN" Id="{bbd7302c-91ce-4697-9f4b-743f57ca5819}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
@@ -149,6 +149,15 @@ VAR
|
||||
_rDeltaUm : REAL;
|
||||
_arPowerString : ARRAY[0..(GVL_CONFIG.uiNumberOfStrings-1)] OF REAL;
|
||||
|
||||
// Temperature sensor SCS String 1
|
||||
_fbTempCabinetSCSString1 : FB_AnalogInput('String 1 - SCS - T1_Cabinet');
|
||||
|
||||
// Temperature sensor SCS String 1
|
||||
_fbTempCabinetSCSString2 : FB_AnalogInput('String 2 - SCS - T1_Cabinet');
|
||||
|
||||
// Temperature sensor BMS cabinet
|
||||
_fbTempCabinetBMS : FB_AnalogInput('BMS - T1_Cabinet');
|
||||
|
||||
_ui : UINT := 0;
|
||||
_xStringsReady : BOOL;
|
||||
_xStringsErrorActive : BOOL;
|
||||
@@ -328,6 +337,28 @@ END_IF
|
||||
// Dely release of errors during PLC startup phase
|
||||
_tonStartupDelay(IN := TRUE);
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor control cabinet BMS
|
||||
// ===============================
|
||||
_fbTempCabinetBMS(
|
||||
stScalingConfig:= GVL_CONFIG.stConfigCabinetTemp,
|
||||
stEWConfig:= GVL_CONFIG.stEWLCabinetTemp,
|
||||
stEWDelayConfig:= GVL_CONFIG.stEWDCabinetTemp,
|
||||
xReleaseErrors:= _xReleaseErrors,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors,
|
||||
xReleaseHardwareErrors:= _xReleaseErrors,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
stHMIInterface=> GVL_SCADA.stTempCabinetBMS);
|
||||
|
||||
// Set modbus error register bit
|
||||
IF _fbTempCabinetBMS.xWarningHigh THEN
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetBMSHigh := TRUE;
|
||||
END_IF
|
||||
|
||||
IF _fbTempCabinetBMS.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Call string 1
|
||||
_afbStrings[0](
|
||||
xEnable := _xEnableString AND GVL_CONFIG.axStringEnabled[0],
|
||||
@@ -351,11 +382,33 @@ IF _afbStrings[0].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor control cabinet SCS string 1
|
||||
// ===============================
|
||||
_fbTempCabinetSCSString1(
|
||||
stScalingConfig:= GVL_CONFIG.stConfigCabinetTemp,
|
||||
stEWConfig:= GVL_CONFIG.stEWLCabinetTemp,
|
||||
stEWDelayConfig:= GVL_CONFIG.stEWDCabinetTemp,
|
||||
xReleaseErrors:= _xReleaseErrors,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors,
|
||||
xReleaseHardwareErrors:= _xReleaseErrors,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
stHMIInterface=> GVL_SCADA.stHMIInterface[0].stTempCabinetSCS);
|
||||
|
||||
IF _fbTempCabinetSCSString1.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
// Handle string 1 modbus error and warning
|
||||
GVL_MODBUS.stBMSErrorReg.wStringErrorActive.0 := _afbStrings[0].xError;
|
||||
GVL_MODBUS.stBMSErrorReg.wStringWarningActive.0 := _afbStrings[0].xWarning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bDCSwitchS1 := (NOT _afbStrings[0].xRepairSwitchOk);
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bSafetyIntlkString1 := (NOT _afbStrings[0].xSafetyIntlksOk);
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module1High := _afbStrings[0].xTempCabinetModule1Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module2High := _afbStrings[0].xTempCabinetModule2Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module3High := _afbStrings[0].xTempCabinetModule3Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString1High := _fbTempCabinetSCSString1.xWarningHigh;
|
||||
|
||||
|
||||
// Call string 2
|
||||
@@ -381,11 +434,32 @@ IF _afbStrings[1].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor control cabinet SCS string 2
|
||||
// ===============================
|
||||
_fbTempCabinetSCSString2(
|
||||
stScalingConfig:= GVL_CONFIG.stConfigCabinetTemp,
|
||||
stEWConfig:= GVL_CONFIG.stEWLCabinetTemp,
|
||||
stEWDelayConfig:= GVL_CONFIG.stEWDCabinetTemp,
|
||||
xReleaseErrors:= _xReleaseErrors,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors,
|
||||
xReleaseHardwareErrors:= _xReleaseErrors,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
stHMIInterface=> GVL_SCADA.stHMIInterface[1].stTempCabinetSCS);
|
||||
|
||||
IF _fbTempCabinetSCSString2.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Handle string 1 modbus error and warning
|
||||
GVL_MODBUS.stBMSErrorReg.wStringErrorActive.1 := _afbStrings[1].xError;
|
||||
GVL_MODBUS.stBMSErrorReg.wStringWarningActive.1 := _afbStrings[1].xWarning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bDCSwitchS2 := (NOT _afbStrings[1].xRepairSwitchOk);
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bSafetyIntlkString2 := (NOT _afbStrings[1].xSafetyIntlksOk);
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module1High := _afbStrings[1].xTempCabinetModule1Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module2High := _afbStrings[1].xTempCabinetModule2Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module3High := _afbStrings[1].xTempCabinetModule3Warning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString2High := _fbTempCabinetSCSString2.xWarningHigh;
|
||||
|
||||
// Copy general error to modbus error register
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bError := _xErrorActive;
|
||||
|
||||
Reference in New Issue
Block a user