Added precharging to SafetyCheck

This commit is contained in:
Matthias Heisig
2025-02-10 08:44:52 +01:00
parent 0345f57a3f
commit f9df0a5180
27 changed files with 2469 additions and 2586 deletions

View File

@@ -269,12 +269,12 @@ VAR_GLOBAL PERSISTENT
diMinimumAbsPowerForEnable : DINT := 100;
// Maximum allowed charging power (Watt) per String
// 60.000 W -> 5.000 W per Unit
diMaxStringChargingPower : DINT := -60_000;
// 24.000 W -> 2.000 W per Unit
diMaxStringChargingPower : DINT := -24_000;
// Maximum allowed discharging power (Watt) per String
// 60.000 W -> 5.000 W per Unit
diMaxStringDischargePower : DINT := 60_000;
// 24.000 W -> 2.000 W per Unit
diMaxStringDischargePower : DINT := 24_000;
// Inverter ip address for string 1
sInverterIpString1 : STRING := '192.168.42.10';

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
<GVL Name="GVL_MODBUS" Id="{913a9222-1338-4c08-b758-91c1bd26dcd9}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL
@@ -10,7 +10,8 @@ VAR_GLOBAL
sModelname := 'all liquid',
sSerialnumber := '202312151643',
sBMSVersion := '0.8.0',
uiTotalParallelMembers := 1),
uiTotalParallelMembers := 2,
uiActiveParallelMembers := 0),
stModbusReg11 := (
eChargeStatus := E_CHARGE_STATUS.UNDEFINED,
eBatteryStatus := E_BATTERY_STATUS.OFF)

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
<GVL Name="GVL_PowerDistribution" Id="{59a6cd50-20bf-488e-9d38-00b4a9565d56}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL
END_VAR]]></Declaration>
</GVL>
</TcPlcObject>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
<POU Name="FB_PowerDistribution" Id="{b382f09a-3dcd-41a8-aaaf-4ba50c3b8bb9}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_PowerDistribution
VAR_INPUT
uiMaxActiveStrings : UINT;
uiActiveStrings : UINT;
END_VAR
VAR_OUTPUT
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</POU>
</TcPlcObject>

View File

@@ -510,7 +510,11 @@ CASE _iState OF
IF xEnable AND (NOT xStartBalancing) AND xAllModulesInAutoMode AND xRepairSwitchOk THEN
_xEnable := TRUE;
eStatus := E_COMPONENT_STATUS.STARTING;
_iState := 5;
IF xInSafetyCheckMode THEN
_iState := 1;
ELSE
_iState := 5;
END_IF
END_IF
// Start in balancing mode
@@ -521,6 +525,13 @@ CASE _iState OF
_iState := 7;
END_IF
1: // Wait for ready in safety check mode
IF _xAllModulesReady THEN
xResetSafetyDCCB := TRUE;
_tonResetPulseLength.IN := TRUE;
_iState := 10;
END_IF
5: // Wait for all modules to be ready in normal mode
IF _xAllModulesReady AND _xBalanceOk THEN
xResetSafetyDCCB := TRUE;
@@ -596,7 +607,11 @@ CASE _iState OF
_xEnableInverter := TRUE;
_rPowerInverterInternal := rPowerInverter;
//_rPowerInverterInternal := 0.0;
_iState := 21;
IF xInSafetyCheckMode THEN
_iState := 29;
ELSE
_iState := 21;
END_IF
END_IF
IF _tonErrorDCCBNotClosed.Q THEN
_xEnable := FALSE;
@@ -648,6 +663,14 @@ CASE _iState OF
_xEnable := FALSE;
_tonInverterStartupTimeout(IN := FALSE);
END_IF
29: // Ready in safety check mode
IF (NOT xEnable) THEN
_xEnable := FALSE;
_xReleaseLimitErrorsInternal := FALSE;
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
_iState := 31;
END_IF
30: // All modules ready
// !!! ATTENTION !!!

View File

@@ -868,7 +868,7 @@ CASE _iState OF
_tonVoltageCheckTimeput(IN := TRUE);
// Check for minimum unit voltage
IF (_fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage) AND (NOT _xErrorActive) AND (NOT _xWarningActive) THEN
IF ((_fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage) OR xInSafetyCheckMode) AND (NOT _xErrorActive) AND (NOT _xWarningActive) THEN
_tonVoltageCheckTimeput(IN := FALSE);
xReady := TRUE;
@@ -1104,50 +1104,5 @@ CASE _iState OF
END_CASE]]></ST>
</Implementation>
</Action>
<LineIds Name="FB_Unit">
<LineId Id="3" Count="498" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Unit.FB_init">
<LineId Id="3" Count="7" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Unit.Name.Get">
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Unit.Name.Set">
<LineId Id="3" Count="2" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Unit.StateMachine">
<LineId Id="2" Count="4" />
<LineId Id="332" Count="0" />
<LineId Id="7" Count="3" />
<LineId Id="317" Count="0" />
<LineId Id="11" Count="1" />
<LineId Id="333" Count="0" />
<LineId Id="13" Count="19" />
<LineId Id="326" Count="0" />
<LineId Id="328" Count="1" />
<LineId Id="331" Count="0" />
<LineId Id="330" Count="0" />
<LineId Id="327" Count="0" />
<LineId Id="33" Count="21" />
<LineId Id="325" Count="0" />
<LineId Id="55" Count="22" />
<LineId Id="324" Count="0" />
<LineId Id="78" Count="21" />
<LineId Id="318" Count="0" />
<LineId Id="100" Count="20" />
<LineId Id="319" Count="0" />
<LineId Id="121" Count="82" />
<LineId Id="321" Count="0" />
<LineId Id="204" Count="5" />
<LineId Id="322" Count="0" />
<LineId Id="210" Count="87" />
<LineId Id="323" Count="0" />
<LineId Id="298" Count="18" />
<LineId Id="1" Count="0" />
</LineIds>
</POU>
</TcPlcObject>