EMS communication and Voltage optimizations

- Added data for EMS communication
- Added highest segment voltage for charging check
- Added lowest segment voltage for discharging check
This commit is contained in:
Matthias Heisig
2024-05-07 17:10:29 +02:00
parent 327f324be8
commit 0ffff9be2a
11 changed files with 660 additions and 383 deletions

View File

@@ -85,6 +85,12 @@ VAR_OUTPUT
// Inverter status data
stInverterData : ST_SUNSPEC_CURRENT_VALUES;
// Smallest segment voltage
rSmallestSegmentVoltage : REAL;
// Highest segment voltage
rHighestSegmentVoltage : REAL;
// Balancing done
xBalancingDone : BOOL;
END_VAR
@@ -158,9 +164,6 @@ VAR
_xReleaseLimitErrorsInternal : BOOL;
// Smallest segment voltage
_rSmallestSegmentVoltage : REAL;
// Balancing done
_xBalancingDone : BOOL;
@@ -239,7 +242,7 @@ _fbModule1(
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule1.xWarning THEN
xWarning := TRUE;
@@ -270,7 +273,7 @@ _fbModule2(
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule2.xWarning THEN
xWarning := TRUE;
@@ -300,7 +303,7 @@ _fbModule3(
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule3.xWarning THEN
xWarning := TRUE;
@@ -428,7 +431,8 @@ _tonSafetyOkTimeout();
// Get smalles segment voltage
// of all units
// ===============================
_rSmallestSegmentVoltage := MIN(_fbModule1.rSmallestSegmentVoltage, _fbModule2.rSmallestSegmentVoltage, _fbModule3.rSmallestSegmentVoltage);
rSmallestSegmentVoltage := MIN(_fbModule1.rSmallestSegmentVoltage, _fbModule2.rSmallestSegmentVoltage, _fbModule3.rSmallestSegmentVoltage);
rHighestSegmentVoltage := MAX(_fbModule1.rSmallestSegmentVoltage, _fbModule2.rSmallestSegmentVoltage, _fbModule3.rSmallestSegmentVoltage);
// Call inverter
@@ -635,6 +639,13 @@ CASE _iState OF
_iState := 40;
END_IF
// Restart on Enable or StartBalancing
IF xEnable OR xStartBalancing THEN
_rPowerInverterInternal := 0.0;
_xEnableInverter := FALSE;
_iState := 40;
END_IF
40: // Wait for inverter to shut down
IF NOT _fbInverter.xActive THEN
_iState := 41;
@@ -768,68 +779,7 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
</Set>
</Property>
<LineIds Name="FB_String">
<LineId Id="3089" Count="50" />
<LineId Id="3540" Count="0" />
<LineId Id="3784" Count="0" />
<LineId Id="3140" Count="28" />
<LineId Id="3541" Count="0" />
<LineId Id="3785" Count="0" />
<LineId Id="3169" Count="7" />
<LineId Id="3532" Count="0" />
<LineId Id="3177" Count="18" />
<LineId Id="3542" Count="0" />
<LineId Id="3786" Count="0" />
<LineId Id="3196" Count="7" />
<LineId Id="3533" Count="0" />
<LineId Id="3204" Count="35" />
<LineId Id="3552" Count="0" />
<LineId Id="3545" Count="2" />
<LineId Id="3544" Count="0" />
<LineId Id="3548" Count="0" />
<LineId Id="3240" Count="104" />
<LineId Id="3536" Count="0" />
<LineId Id="3584" Count="0" />
<LineId Id="3348" Count="1" />
<LineId Id="3534" Count="1" />
<LineId Id="3537" Count="0" />
<LineId Id="3562" Count="0" />
<LineId Id="3538" Count="0" />
<LineId Id="3543" Count="0" />
<LineId Id="3539" Count="0" />
<LineId Id="3573" Count="2" />
<LineId Id="3606" Count="0" />
<LineId Id="3787" Count="0" />
<LineId Id="3607" Count="0" />
<LineId Id="3788" Count="0" />
<LineId Id="3605" Count="0" />
<LineId Id="3576" Count="3" />
<LineId Id="3585" Count="0" />
<LineId Id="3580" Count="1" />
<LineId Id="3586" Count="1" />
<LineId Id="3590" Count="0" />
<LineId Id="3588" Count="1" />
<LineId Id="3582" Count="1" />
<LineId Id="3593" Count="11" />
<LineId Id="3592" Count="0" />
<LineId Id="3591" Count="0" />
<LineId Id="3350" Count="18" />
<LineId Id="3791" Count="0" />
<LineId Id="3369" Count="23" />
<LineId Id="3792" Count="0" />
<LineId Id="3794" Count="3" />
<LineId Id="3793" Count="0" />
<LineId Id="3393" Count="11" />
<LineId Id="3798" Count="0" />
<LineId Id="3405" Count="33" />
<LineId Id="3608" Count="0" />
<LineId Id="3439" Count="12" />
<LineId Id="3790" Count="0" />
<LineId Id="3452" Count="42" />
<LineId Id="3553" Count="0" />
<LineId Id="3569" Count="0" />
<LineId Id="3554" Count="1" />
<LineId Id="3564" Count="4" />
<LineId Id="3495" Count="36" />
<LineId Id="4873" Count="525" />
<LineId Id="527" Count="0" />
</LineIds>
<LineIds Name="FB_String.FB_init">