Implemented fixes and improvements during comissioning
- New Balancing mode - HMI Interface for Inverterdata implemented - Adjusted GVL_CONFIG values - Read inverter data even when inverter is off - Added OPC UA settings to inverter data hmi interface - Added multisettings to safety project for strings
This commit is contained in:
@@ -9,7 +9,8 @@ TYPE E_BMS_CONTROL_MODE :
|
||||
AUTO_LOCAL := 2,
|
||||
SAFETY_CHECK := 3,
|
||||
CAPACITY_TEST := 4,
|
||||
MANUAL := 5
|
||||
MANUAL := 5,
|
||||
BALANCING := 6
|
||||
);
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
|
||||
@@ -14,6 +14,15 @@ STRUCT
|
||||
// Current status
|
||||
// ====================================
|
||||
eStatus : E_COMPONENT_STATUS;
|
||||
|
||||
// Current string current
|
||||
// ==============================
|
||||
stStringCurrent : ST_HMI_ANALOG_VALUE;
|
||||
|
||||
// Current inverter data
|
||||
// ==============================
|
||||
stInverterData : ST_SUNSPEC_CURRENT_VALUES;
|
||||
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
|
||||
@@ -13,10 +13,10 @@ VAR_GLOBAL PERSISTENT
|
||||
(
|
||||
rTargetMin := 0.0,
|
||||
rTargetMax := 100.0,
|
||||
timRampUpTime := T#5S,
|
||||
timRampDownTime := T#5S,
|
||||
stAnalogInputConfig := (iAIMax := 32767, iAIMin := 0, rPVMax := 100, rPVMin := 0, sUnit := '%'),
|
||||
stAnalogOutputConfig := (iAIMax := 32767, iAIMin := 0, rPVMax := 100, rPVMin := 0),
|
||||
timRampUpTime := T#10S,
|
||||
timRampDownTime := T#10S,
|
||||
stAnalogInputConfig := (iAIMax := 108, iAIMin := 0, rPVMax := 100, rPVMin := 0, sUnit := '%'),
|
||||
stAnalogOutputConfig := (iAIMax := 29490, iAIMin := 0, rPVMax := 100, rPVMin := 4.807),
|
||||
xHasAnalogFeedback := TRUE,
|
||||
xHasMCBFeedback := TRUE,
|
||||
xHasRepairSwitchFeedback := FALSE
|
||||
@@ -29,8 +29,8 @@ VAR_GLOBAL PERSISTENT
|
||||
rTargetMax := 100.0,
|
||||
timRampUpTime := T#5S,
|
||||
timRampDownTime := T#5S,
|
||||
stAnalogInputConfig := (iAIMax := 32767, iAIMin := 0, rPVMax := 100, rPVMin := 0, sUnit := '%'),
|
||||
stAnalogOutputConfig := (iAIMax := 32767, iAIMin := 0, rPVMax := 100, rPVMin := 0),
|
||||
stAnalogInputConfig := (iAIMax := 108, iAIMin := 0, rPVMax := 100, rPVMin := 0, sUnit := '%'),
|
||||
stAnalogOutputConfig := (iAIMax := 29490, iAIMin := 0, rPVMax := 100, rPVMin := 4.807),
|
||||
xHasAnalogFeedback := TRUE,
|
||||
xHasMCBFeedback := TRUE,
|
||||
xHasRepairSwitchFeedback := FALSE
|
||||
@@ -44,103 +44,103 @@ VAR_GLOBAL PERSISTENT
|
||||
|
||||
// Pressure posolyt segment inlet
|
||||
stConfigPosolytPressureSegmentInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 2000, rPVMin := 0, sUnit := 'mbar'),
|
||||
stEWLPosolytPressureSegmentInlet := (rErrorMin := 170, rWarningMin := 200, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWLPosolytPressureSegmentInlet := (rErrorMin := 200, rWarningMin := 250, rWarningMax := 550, rErrorMax := 600),
|
||||
stEWDPosolytPressureSegmentInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure negolyt segment inlet
|
||||
stConfigNegolytPressureSegmentInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 2000, rPVMin := 0, sUnit := 'mbar'),
|
||||
stEWLNegolytPressureSegmentInlet := (rErrorMin := 170, rWarningMin := 200, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWLNegolytPressureSegmentInlet := (rErrorMin := 200, rWarningMin := 250, rWarningMax := 550, rErrorMax := 600),
|
||||
stEWDNegolytPressureSegmentInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure posolyt tank inlet
|
||||
stConfigPosolytPressureTankInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 2000, rPVMin := 0, sUnit := 'mbar'),
|
||||
stEWLPosolytPressureTankInlet := (rErrorMin := -100, rWarningMin := -50, rWarningMax := 100, rErrorMax := 120),
|
||||
stEWLPosolytPressureTankInlet := (rErrorMin := -20, rWarningMin := -10, rWarningMax := 15, rErrorMax := 25),
|
||||
stEWDPosolytPressureTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure negolyt tank inlet
|
||||
stConfigNegolytPressureTankInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 2000, rPVMin := 0, sUnit := 'mbar'),
|
||||
stEWLNegolytPressureTankInlet := (rErrorMin := -100, rWarningMin := -50, rWarningMax := 100, rErrorMax := 120),
|
||||
stEWLNegolytPressureTankInlet := (rErrorMin := -20, rWarningMin := -10, rWarningMax := 15, rErrorMax := 25),
|
||||
stEWDNegolytPressureTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Temperature sensor posolyt tank inlet
|
||||
stConfigPosolytTempTankInlet := (iAIMax := 32767, iAIMin := -32768, rPVMax := 3276.7, rPVMin := -3276.8, sUnit := '°C'),
|
||||
stEWLPosolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWLPosolytTempTankInlet := (rErrorMin := 10, rWarningMin := 15, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWDPosolytTempTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Temperature sensor negolyt tank inlet
|
||||
stConfigNegolytTempTankInlet := (iAIMax := 32767, iAIMin := -32768, rPVMax := 3276.7, rPVMin := -3276.8, sUnit := '°C'),
|
||||
stEWLNegolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWLNegolytTempTankInlet := (rErrorMin := 15, rWarningMin := 15, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWDNegolytTempTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
@@ -149,24 +149,31 @@ VAR_GLOBAL PERSISTENT
|
||||
// Index 0x80n0:02 "Presentation" = Signed(0) -> Resolution 1/10°C
|
||||
// Index 0x80n0:19 "RTD Element" = PT100(0)
|
||||
stConfigVoltageSegment := (iAIMax := 32767, iAIMin := 0, rPVMax := 150, rPVMin := 0, sUnit := 'V'),
|
||||
stEWLVoltageSegment := (rErrorMin := 50, rWarningMin := 55, rWarningMax := 75, rErrorMax := 79),
|
||||
stEWLVoltageSegment := (rErrorMin := 50, rWarningMin := 55, rWarningMax := 77, rErrorMax := 80),
|
||||
stEWDVoltageSegment :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
rMaxDeltaPSegmentInlet := 100.0
|
||||
rMaxDeltaPSegmentInlet := 50.0
|
||||
);
|
||||
|
||||
// ===========================
|
||||
// SCS Current measurement settings
|
||||
// ===========================
|
||||
stConfigSCSCurrent : ST_ANALOG_IO_CONFIG := (iAIMax := 32767, iAIMin := 0, rPVMax := 200, rPVMin := 0, sUnit := 'A');
|
||||
stEWLSCSCurrent : ST_ANALOG_EW_LEVELS;
|
||||
stEWDSCSCurrent : ST_ANALOG_EW_DELAYS;
|
||||
|
||||
// ===========================
|
||||
// Part shortage workaround
|
||||
// ===========================
|
||||
@@ -197,6 +204,33 @@ VAR_GLOBAL PERSISTENT
|
||||
xUnit4Is1500V := TRUE
|
||||
)
|
||||
);
|
||||
|
||||
stString2VoltageConfig : ST_STRING_VOLT_CONFIG :=
|
||||
(
|
||||
stModule1VoltConfig :=
|
||||
(
|
||||
xUnit1Is1500V := FALSE,
|
||||
xUnit2Is1500V := TRUE,
|
||||
xUnit3Is1500V := TRUE,
|
||||
xUnit4Is1500V := TRUE
|
||||
),
|
||||
|
||||
stModule2VoltConfig :=
|
||||
(
|
||||
xUnit1Is1500V := FALSE,
|
||||
xUnit2Is1500V := TRUE,
|
||||
xUnit3Is1500V := TRUE,
|
||||
xUnit4Is1500V := TRUE
|
||||
),
|
||||
|
||||
stModule3VoltConfig :=
|
||||
(
|
||||
xUnit1Is1500V := FALSE,
|
||||
xUnit2Is1500V := TRUE,
|
||||
xUnit3Is1500V := TRUE,
|
||||
xUnit4Is1500V := TRUE
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// ===========================
|
||||
@@ -204,8 +238,8 @@ VAR_GLOBAL PERSISTENT
|
||||
// ===========================
|
||||
|
||||
// Pump on power (%)
|
||||
rPumpPosolytOnPower : REAL := 70.0;
|
||||
rPumpNegolytOnPower : REAL := 70.0;
|
||||
rPumpPosolytOnPower : REAL := 65.0;
|
||||
rPumpNegolytOnPower : REAL := 65.0;
|
||||
|
||||
// Pump discharge segment without inverter power (%)
|
||||
rPumpPosolytDisChrgPower : REAL := 35.0;
|
||||
@@ -215,18 +249,18 @@ VAR_GLOBAL PERSISTENT
|
||||
rPumpshutoffThreshold : REAL := 15.0;
|
||||
|
||||
// Minimum unit voltage required for inverter startup (Volt)
|
||||
rMinimumUnitVoltage : REAL := 50.0;
|
||||
rMinimumUnitVoltage : REAL := 55.0;
|
||||
|
||||
// Delta value to minimum unit voltage for shutdown discharge (Volt)
|
||||
rDeltaUnitVoltageShutdownDischarge : REAL := 5.0;
|
||||
|
||||
// Maximum absolute voltage difference
|
||||
// between units in the same module
|
||||
rMaxAbsDiffVoltageUnitsOnModule : REAL := 5.0;
|
||||
rMaxAbsDiffVoltageUnitsOnModule : REAL := 10.0;
|
||||
|
||||
// Maximum absolute voltage difference
|
||||
// between Modules (Volt)
|
||||
rMaxAbsDiffVoltageModulesInString : REAL := 10.0;
|
||||
rMaxAbsDiffVoltageModulesInString : REAL := 20.0;
|
||||
|
||||
// Minimum absolute power command to enable battery (Watt)
|
||||
diMinimumAbsPowerForEnable : DINT := 100;
|
||||
@@ -239,26 +273,34 @@ VAR_GLOBAL PERSISTENT
|
||||
// 60.000 W -> 5.000 W per Unit
|
||||
diMaxStringDischargePower : DINT := 60_000;
|
||||
|
||||
// Inverter ip address
|
||||
sInverterIp : STRING := '192.168.42.10';
|
||||
// Inverter ip address for string 1
|
||||
sInverterIpString1 : STRING := '192.168.42.10';
|
||||
|
||||
// Inverter ip address for string 2
|
||||
sInverterIpString2 : STRING := '192.168.42.20';
|
||||
|
||||
// Absolute shutdown discharge power (Watt)
|
||||
// 12.000 W -> 1.000 W per unit
|
||||
rAbsShutdownDischargePower : REAL := 12_000;
|
||||
rAbsShutdownDischargePower : REAL := 6_500;
|
||||
|
||||
// Allow inverter fast shutdown discharge
|
||||
xShutdownDischargeWithInverter : BOOL := FALSE;
|
||||
|
||||
// String fully charged voltage (Volt)
|
||||
// 960 V -> 80 V per Unit
|
||||
rStringFullyChargedVoltage : REAL := 960.0;
|
||||
rStringFullyChargedVoltage : REAL := 950.0;
|
||||
|
||||
// String empty voltage (Volt) (585V is needed for the inverter to start up -> 50V per Segment)
|
||||
// 600 V -> 50 V per Unit
|
||||
rStringEmptyVoltage : REAL := 600.0;
|
||||
// String empty voltage (Volt) (617V is needed for the inverter to start up -> 51.4V per Segment)
|
||||
rStringEmptyVoltage : REAL := 630.0;
|
||||
|
||||
// Unit wait startup time
|
||||
timUnitStartupTime : TIME := T#5S;
|
||||
timUnitStartupTime : TIME := T#1M;
|
||||
|
||||
// Unit balancing wait startup time
|
||||
timUnitBalancingStartupTime : TIME := T#3M;
|
||||
|
||||
// Dummy to deactivate functions
|
||||
xDummy : BOOL := FALSE;
|
||||
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
|
||||
@@ -17,6 +17,9 @@ VAR_GLOBAL
|
||||
|
||||
// Can change current control mode
|
||||
xCanChangeControlMode : BOOL;
|
||||
|
||||
// Current battery power
|
||||
diCurrentBatteryPower : DINT;
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
@@ -161,11 +161,6 @@
|
||||
<SubType>Content</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PlaceholderResolution Include="BaseLib">
|
||||
<Resolution>BaseLib, * (cmblu)</Resolution>
|
||||
</PlaceholderResolution>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<PlcProjectOptions>
|
||||
<XmlArchive>
|
||||
|
||||
451
PLC/PLC.tmc
451
PLC/PLC.tmc
File diff suppressed because one or more lines are too long
@@ -9,18 +9,21 @@ VAR_INPUT
|
||||
// Enable
|
||||
xEnable : BOOL;
|
||||
|
||||
// Start balancing
|
||||
xStartBalancing : BOOL;
|
||||
|
||||
// Component shortage workaround
|
||||
stModuleVoltageConfig : ST_MODULE_VOLT_CONFIG;
|
||||
|
||||
// Module in safety check mode
|
||||
xInSafetyCheckMode : BOOL;
|
||||
|
||||
// Module completely off
|
||||
xOff : BOOL := TRUE;
|
||||
|
||||
// All safetyinterlocks are ok
|
||||
xSafetyIntlksOk : BOOL;
|
||||
|
||||
// Module completely off
|
||||
xOff : BOOL := TRUE;
|
||||
|
||||
// HMI Interface
|
||||
stHMIInterface : REFERENCE TO ST_MODULE_HMI_INTERFACE;
|
||||
|
||||
@@ -35,6 +38,12 @@ VAR_INPUT
|
||||
|
||||
// Input to confirm all errors
|
||||
xConfirmAlarms : BOOL;
|
||||
|
||||
// Balancing target Voltage
|
||||
rBalancingTargetVoltage : REAL;
|
||||
|
||||
// Inverter enabled status
|
||||
xInverterEnabled : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Module voltage
|
||||
@@ -57,6 +66,12 @@ VAR_OUTPUT
|
||||
|
||||
// All modules in automatic mode
|
||||
xAllUnitsInAutomatic : BOOL;
|
||||
|
||||
// Smallest segment voltage
|
||||
rSmallestSegmentVoltage : REAL;
|
||||
|
||||
// Balancing done
|
||||
xBalancingDone : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_fbUnit1 : FB_Unit(CONCAT(Name, ' - Unit 1'));
|
||||
@@ -80,6 +95,11 @@ VAR
|
||||
_sName : STRING;
|
||||
|
||||
_fbBalanceNotOkSignal : FB_ReleaseSignal;
|
||||
|
||||
xDebug1 : BOOL;
|
||||
xDebug2 : BOOL;
|
||||
xDebug3 : BOOL;
|
||||
xDebug4 : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -99,6 +119,8 @@ xSafetyIntlksOk := TRUE;
|
||||
// ===============================
|
||||
_fbUnit1(
|
||||
xEnable := xEnable,
|
||||
xStartBalancing := xStartBalancing,
|
||||
xInverterEnabled := xInverterEnabled,
|
||||
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit1Is1500V,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
@@ -107,7 +129,8 @@ _fbUnit1(
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
rBalancingTargetVoltage := rBalancingTargetVoltage,
|
||||
_xWarningConfirmPending=> );
|
||||
|
||||
IF _fbUnit1.xWarning THEN
|
||||
@@ -116,6 +139,7 @@ END_IF
|
||||
|
||||
IF _fbUnit1.xError THEN
|
||||
xError := TRUE;
|
||||
xDebug1 := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbUnit1.xSafetyIntlksOk THEN
|
||||
@@ -132,6 +156,8 @@ END_IF
|
||||
// ===============================
|
||||
_fbUnit2(
|
||||
xEnable := xEnable,
|
||||
xStartBalancing := xStartBalancing,
|
||||
xInverterEnabled := xInverterEnabled,
|
||||
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit2Is1500V,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
@@ -140,7 +166,8 @@ _fbUnit2(
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
rBalancingTargetVoltage := rBalancingTargetVoltage,
|
||||
_xWarningConfirmPending=> );
|
||||
|
||||
IF _fbUnit2.xWarning THEN
|
||||
@@ -149,6 +176,7 @@ END_IF
|
||||
|
||||
IF _fbUnit2.xError THEN
|
||||
xError := TRUE;
|
||||
xDebug2 := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbUnit2.xSafetyIntlksOk THEN
|
||||
@@ -165,6 +193,8 @@ END_IF
|
||||
// ===============================
|
||||
_fbUnit3(
|
||||
xEnable := xEnable,
|
||||
xStartBalancing := xStartBalancing,
|
||||
xInverterEnabled := xInverterEnabled,
|
||||
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit3Is1500V,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
@@ -173,7 +203,8 @@ _fbUnit3(
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
rBalancingTargetVoltage := rBalancingTargetVoltage,
|
||||
_xWarningConfirmPending=> );
|
||||
|
||||
IF _fbUnit3.xWarning THEN
|
||||
@@ -182,6 +213,7 @@ END_IF
|
||||
|
||||
IF _fbUnit3.xError THEN
|
||||
xError := TRUE;
|
||||
xDebug3 := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbUnit3.xSafetyIntlksOk THEN
|
||||
@@ -198,6 +230,8 @@ END_IF
|
||||
// ===============================
|
||||
_fbUnit4(
|
||||
xEnable := xEnable,
|
||||
xStartBalancing := xStartBalancing,
|
||||
xInverterEnabled := xInverterEnabled,
|
||||
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit4Is1500V,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
@@ -207,6 +241,7 @@ _fbUnit4(
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
rBalancingTargetVoltage := rBalancingTargetVoltage,
|
||||
_xWarningConfirmPending=> );
|
||||
|
||||
IF _fbUnit4.xWarning THEN
|
||||
@@ -215,6 +250,7 @@ END_IF
|
||||
|
||||
IF _fbUnit4.xError THEN
|
||||
xError := TRUE;
|
||||
xDebug4 := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbUnit4.xSafetyIntlksOk THEN
|
||||
@@ -232,6 +268,12 @@ END_IF
|
||||
_xAllUnitsReady := _fbUnit1.xReady AND _fbUnit2.xReady AND _fbUnit3.xReady AND _fbUnit4.xReady;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Balancing done check
|
||||
// ===============================
|
||||
xBalancingDone := _fbUnit1.xBalancingDone AND _fbUnit2.xBalancingDone AND _fbUnit3.xBalancingDone AND _fbUnit4.xBalancingDone;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units in shutdown discharge mode
|
||||
// ===============================
|
||||
@@ -294,24 +336,24 @@ END_IF
|
||||
|
||||
// Release signal for balance not ok
|
||||
_fbBalanceNotOkSignal(
|
||||
xSignal:= _xBalanceOk OR (NOT xEnable),
|
||||
xRelease:= TRUE,
|
||||
timOnDelay:= T#5S,
|
||||
timOffDelay:= T#60S,
|
||||
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 (NOT _fbBalanceNotOkSignal.xReleaseSignal) THEN
|
||||
IF _xAllUnitsReady AND _fbBalanceNotOkSignal.xReleaseSignal THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
// Raise error
|
||||
IF (NOT _xBalanceOk) AND (NOT _fbUnitsOutOfBalanceAlarm.bRaised) THEN
|
||||
IF _fbBalanceNotOkSignal.xReleaseSignal AND (NOT _fbUnitsOutOfBalanceAlarm.bRaised) THEN
|
||||
_fbUnitsOutOfBalanceAlarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
// Clear error
|
||||
IF _xBalanceOk AND _fbUnitsOutOfBalanceAlarm.bRaised THEN
|
||||
// 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
|
||||
|
||||
@@ -329,6 +371,14 @@ ELSE
|
||||
xReady := FALSE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Get the smallest segment Voltage
|
||||
// for balancing
|
||||
// ===============================
|
||||
rSmallestSegmentVoltage := MIN(_fbUnit1.rCurrentVoltage, _fbUnit2.rCurrentVoltage, _fbUnit3.rCurrentVoltage, _fbUnit4.rCurrentVoltage);
|
||||
|
||||
|
||||
// ===============================
|
||||
// Module status sum
|
||||
// ===============================
|
||||
@@ -399,27 +449,61 @@ _fbUnitsOutOfBalanceAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
</Property>
|
||||
<LineIds Name="FB_Module">
|
||||
<LineId Id="903" Count="15" />
|
||||
<LineId Id="1601" Count="0" />
|
||||
<LineId Id="1706" Count="0" />
|
||||
<LineId Id="1305" Count="0" />
|
||||
<LineId Id="1226" Count="0" />
|
||||
<LineId Id="919" Count="2" />
|
||||
<LineId Id="924" Count="27" />
|
||||
<LineId Id="924" Count="3" />
|
||||
<LineId Id="1588" Count="0" />
|
||||
<LineId Id="928" Count="7" />
|
||||
<LineId Id="1482" Count="0" />
|
||||
<LineId Id="936" Count="15" />
|
||||
<LineId Id="1602" Count="0" />
|
||||
<LineId Id="1707" Count="0" />
|
||||
<LineId Id="1306" Count="0" />
|
||||
<LineId Id="1227" Count="0" />
|
||||
<LineId Id="952" Count="2" />
|
||||
<LineId Id="957" Count="27" />
|
||||
<LineId Id="957" Count="3" />
|
||||
<LineId Id="1589" Count="0" />
|
||||
<LineId Id="961" Count="7" />
|
||||
<LineId Id="1483" Count="0" />
|
||||
<LineId Id="969" Count="15" />
|
||||
<LineId Id="1603" Count="0" />
|
||||
<LineId Id="1708" Count="0" />
|
||||
<LineId Id="1307" Count="0" />
|
||||
<LineId Id="1228" Count="0" />
|
||||
<LineId Id="985" Count="2" />
|
||||
<LineId Id="990" Count="27" />
|
||||
<LineId Id="990" Count="3" />
|
||||
<LineId Id="1590" Count="0" />
|
||||
<LineId Id="994" Count="7" />
|
||||
<LineId Id="1484" Count="0" />
|
||||
<LineId Id="1002" Count="15" />
|
||||
<LineId Id="1604" Count="0" />
|
||||
<LineId Id="1709" Count="0" />
|
||||
<LineId Id="1308" Count="0" />
|
||||
<LineId Id="1229" Count="0" />
|
||||
<LineId Id="1018" Count="2" />
|
||||
<LineId Id="1023" Count="87" />
|
||||
<LineId Id="1023" Count="3" />
|
||||
<LineId Id="1702" Count="0" />
|
||||
<LineId Id="1027" Count="7" />
|
||||
<LineId Id="1485" Count="0" />
|
||||
<LineId Id="1035" Count="14" />
|
||||
<LineId Id="1597" Count="3" />
|
||||
<LineId Id="1596" Count="0" />
|
||||
<LineId Id="1594" Count="0" />
|
||||
<LineId Id="1050" Count="60" />
|
||||
<LineId Id="1387" Count="0" />
|
||||
<LineId Id="1386" Count="0" />
|
||||
<LineId Id="1389" Count="4" />
|
||||
<LineId Id="1388" Count="0" />
|
||||
<LineId Id="1111" Count="42" />
|
||||
<LineId Id="1111" Count="28" />
|
||||
<LineId Id="1578" Count="1" />
|
||||
<LineId Id="1577" Count="0" />
|
||||
<LineId Id="1580" Count="0" />
|
||||
<LineId Id="1584" Count="0" />
|
||||
<LineId Id="1581" Count="2" />
|
||||
<LineId Id="1140" Count="13" />
|
||||
<LineId Id="674" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_Module.FB_init">
|
||||
|
||||
@@ -6,9 +6,15 @@ VAR_INPUT
|
||||
// Enable
|
||||
xEnable : BOOL;
|
||||
|
||||
// Start in balancing mode
|
||||
xStartBalancing : BOOL;
|
||||
|
||||
// String in safety check mode
|
||||
xInSafetyCheckMode : BOOL;
|
||||
|
||||
// Requested inverter power
|
||||
rPowerInverter : REAL;
|
||||
|
||||
// Components shortage workaround
|
||||
stStringModuleVoltageConfig : ST_STRING_VOLT_CONFIG;
|
||||
|
||||
@@ -21,6 +27,9 @@ VAR_INPUT
|
||||
// Reset Safety
|
||||
xResetSafety : BOOL;
|
||||
|
||||
// All safetyinterlocks from safety plc are ok
|
||||
xSafetyIntlksOk AT %I* : BOOL;
|
||||
|
||||
// Release alarms
|
||||
xReleaseErrors : BOOL;
|
||||
|
||||
@@ -32,6 +41,13 @@ VAR_INPUT
|
||||
|
||||
// Input to confirm all errors
|
||||
xConfirmAlarms : BOOL;
|
||||
|
||||
// Repair switch closed
|
||||
xRepairSwitchOk AT %I* : BOOL;
|
||||
|
||||
// String inverter ip
|
||||
sInverterIP : STRING;
|
||||
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Current string voltage
|
||||
@@ -58,9 +74,6 @@ VAR_OUTPUT
|
||||
// Reset signal for safety dc circuit breaker
|
||||
xResetSafetyDCCB AT %Q* : BOOL;
|
||||
|
||||
// All safetyinterlocks are ok
|
||||
xSafetyIntlksOk : BOOL;
|
||||
|
||||
// All modules in automatic mode
|
||||
xAllModulesInAutoMode : BOOL;
|
||||
|
||||
@@ -68,6 +81,12 @@ VAR_OUTPUT
|
||||
xWarning : BOOL;
|
||||
|
||||
eStatus : E_COMPONENT_STATUS;
|
||||
|
||||
// Inverter status data
|
||||
stInverterData : ST_SUNSPEC_CURRENT_VALUES;
|
||||
|
||||
// Balancing done
|
||||
xBalancingDone : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_fbModule1 : FB_Module(CONCAT(Name,' - Module 1'));
|
||||
@@ -89,6 +108,16 @@ VAR
|
||||
// Safetyinterlocks pending alarm
|
||||
_fbSafetyInterlocksNotOkAlarm : FB_TcAlarm;
|
||||
|
||||
// Inverter startup error
|
||||
_fbInverterStartupTimeoutAlarm : FB_TcAlarm;
|
||||
|
||||
// DC Main switch not closed
|
||||
_fbDCMainSwitchNotClosed : FB_TcAlarm;
|
||||
|
||||
// Shutdown discharge stopped messages
|
||||
_fbSDDCLevel : FB_TcMessage;
|
||||
_fbSDUnitThreshold : FB_TcMessage;
|
||||
|
||||
// State for start and stop
|
||||
_iState : INT := 0;
|
||||
|
||||
@@ -103,6 +132,49 @@ VAR
|
||||
|
||||
// String name
|
||||
_sName : STRING;
|
||||
|
||||
// String inverter
|
||||
_fbInverter : FB_PowerSupplySunspec(Name);
|
||||
|
||||
// Internal inverter power command
|
||||
_rPowerInverterInternal : REAL;
|
||||
|
||||
// Enable inverter flag
|
||||
_xEnableInverter : BOOL;
|
||||
|
||||
// Fault timer for inverter startup
|
||||
_tonInverterStartupTimeout : TON := (PT := T#2M);
|
||||
|
||||
// Deabug delay timer for inverter shutdown
|
||||
_tonInverterShutdownDelay : TON := (PT := T#10S);
|
||||
|
||||
// Timer for Safety ok timeout
|
||||
_tonSafetyOkTimeout : TON := (PT := T#2M);
|
||||
|
||||
// Analog input for string current measurement
|
||||
_fbStringCurrent : FB_AnalogInput(CONCAT(Name,' - Current'));
|
||||
|
||||
xErrorInverter : BOOL;
|
||||
|
||||
_xReleaseLimitErrorsInternal : BOOL;
|
||||
|
||||
// Smallest segment voltage
|
||||
_rSmallestSegmentVoltage : REAL;
|
||||
|
||||
// Balancing done
|
||||
_xBalancingDone : BOOL;
|
||||
|
||||
// Enable modules internal signal
|
||||
_xEnable : BOOL;
|
||||
|
||||
// Start balancing internal signal
|
||||
_xStartBalancing : BOOL;
|
||||
|
||||
END_VAR
|
||||
|
||||
VAR PERSISTENT
|
||||
rCapacityWH : REAL;
|
||||
rCapacityAH : REAL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -113,24 +185,61 @@ xError := FALSE;
|
||||
xAllModulesInAutoMode := TRUE;
|
||||
|
||||
// Reset safety interlocks flag
|
||||
xSafetyIntlksOk := TRUE;
|
||||
//xSafetyIntlksOk := TRUE;
|
||||
|
||||
// Reset Safety
|
||||
xResetSafetyDCCB := xResetSafety;
|
||||
|
||||
// ===============================
|
||||
// DC Main switch error handling
|
||||
// ===============================
|
||||
IF (NOT xRepairSwitchOk) AND (NOT _fbDCMainSwitchNotClosed.bRaised) THEN
|
||||
_fbDCMainSwitchNotClosed.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF xRepairSwitchOk AND _fbDCMainSwitchNotClosed.bRaised THEN
|
||||
_fbDCMainSwitchNotClosed.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// DC current measurement
|
||||
// ===============================
|
||||
_fbStringCurrent(
|
||||
stScalingConfig:= GVL_CONFIG.stConfigSCSCurrent,
|
||||
stEWConfig:= GVL_CONFIG.stEWLSCSCurrent,
|
||||
stEWDelayConfig:= GVL_CONFIG.stEWDSCSCurrent,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= FALSE,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xError=> ,
|
||||
xWarning=> ,
|
||||
rScaledValue=> ,
|
||||
xErrorLow=> ,
|
||||
xWarningLow=> ,
|
||||
xWarningHigh=> ,
|
||||
xErrorHigh=> ,
|
||||
stHMIInterface=> stHMIInterface.stStringCurrent);
|
||||
|
||||
|
||||
|
||||
// ===============================
|
||||
// Module 1
|
||||
// ===============================
|
||||
_fbModule1(
|
||||
xEnable := xEnable,
|
||||
xEnable := _xEnable,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule1VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule1,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms);
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
|
||||
|
||||
IF _fbModule1.xWarning THEN
|
||||
xWarning := TRUE;
|
||||
@@ -140,10 +249,6 @@ IF _fbModule1.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule1.xSafetyIntlksOk THEN
|
||||
xSafetyIntlksOk := FALSE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule1.xAllUnitsInAutomatic THEN
|
||||
xAllModulesInAutoMode := FALSE;
|
||||
END_IF
|
||||
@@ -154,15 +259,18 @@ END_IF
|
||||
// ===============================
|
||||
|
||||
_fbModule2(
|
||||
xEnable := xEnable,
|
||||
xEnable := _xEnable,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule2VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule2,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms);
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
|
||||
|
||||
IF _fbModule2.xWarning THEN
|
||||
xWarning := TRUE;
|
||||
@@ -172,10 +280,6 @@ IF _fbModule2.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule2.xSafetyIntlksOk THEN
|
||||
xSafetyIntlksOk := FALSE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule2.xAllUnitsInAutomatic THEN
|
||||
xAllModulesInAutoMode := FALSE;
|
||||
END_IF
|
||||
@@ -185,15 +289,18 @@ END_IF
|
||||
// Module 3
|
||||
// ===============================
|
||||
_fbModule3(
|
||||
xEnable := xEnable,
|
||||
xEnable := _xEnable,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule3VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule3,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _xReleaseLimitErrorsInternal,
|
||||
xReleaseManualMode := xReleaseManualMode,
|
||||
xConfirmAlarms:= xConfirmAlarms);
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
rBalancingTargetVoltage := _rSmallestSegmentVoltage);
|
||||
|
||||
IF _fbModule3.xWarning THEN
|
||||
xWarning := TRUE;
|
||||
@@ -203,15 +310,17 @@ IF _fbModule3.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule3.xSafetyIntlksOk THEN
|
||||
xSafetyIntlksOk := FALSE;
|
||||
END_IF
|
||||
|
||||
IF NOT _fbModule3.xAllUnitsInAutomatic THEN
|
||||
xAllModulesInAutoMode := FALSE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Handle shutdown discharge mode
|
||||
// ===============================
|
||||
_xAllModulesInShutdownDischargeMode := _fbModule1.xInShutdownDischargeMode AND _fbModule2.xInShutdownDischargeMode AND _fbModule3.xInShutdownDischargeMode;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Handle safety interlock alarm
|
||||
// ===============================
|
||||
@@ -230,6 +339,12 @@ END_IF
|
||||
_xAllModulesReady := _fbModule1.xReady AND _fbModule2.xReady AND _fbModule3.xReady;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Balancing done check
|
||||
// ===============================
|
||||
_xBalancingDone := _fbModule1.xBalancingDone AND _fbModule2.xBalancingDone AND _fbModule3.xBalancingDone;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Modules in shutdown discharge mode
|
||||
// ===============================
|
||||
@@ -241,7 +356,6 @@ xInShutdownDischargeMode := _fbModule1.xInShutdownDischargeMode AND _fbModule2.x
|
||||
// ===============================
|
||||
xShutdownDischargeAllowed := _fbModule1.xShutdownDischargeAllowed AND _fbModule2.xShutdownDischargeAllowed AND _fbModule3.xShutdownDischargeAllowed;
|
||||
|
||||
|
||||
// ===============================
|
||||
// All modules off
|
||||
// ===============================
|
||||
@@ -276,24 +390,24 @@ END_IF
|
||||
|
||||
// Release signal for balance not ok
|
||||
_fbBalanceNotOkSignal(
|
||||
xSignal:= _xBalanceOk OR (NOT xEnable),
|
||||
xRelease:= TRUE,
|
||||
timOnDelay:= T#5S,
|
||||
timOffDelay:= T#60S,
|
||||
xSignal:= NOT _xBalanceOk,
|
||||
xRelease:= xEnable AND _xAllModulesReady,
|
||||
timOnDelay:= T#10S,
|
||||
timOffDelay:= T#10S,
|
||||
xReleaseSignal=> );
|
||||
|
||||
// Signal an error if all units are ready and module is out of balance
|
||||
IF _xAllModulesReady AND (NOT _fbBalanceNotOkSignal.xReleaseSignal) THEN
|
||||
IF _fbBalanceNotOkSignal.xReleaseSignal THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
// Raise error
|
||||
IF (NOT _fbBalanceNotOkSignal.xReleaseSignal) AND (NOT _fbModulesOutOfBalanceAlarm.bRaised) THEN
|
||||
IF _fbBalanceNotOkSignal.xReleaseSignal AND (NOT _fbModulesOutOfBalanceAlarm.bRaised) THEN
|
||||
_fbModulesOutOfBalanceAlarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
// Clear error
|
||||
IF _fbBalanceNotOkSignal.xReleaseSignal AND _fbModulesOutOfBalanceAlarm.bRaised THEN
|
||||
IF (NOT _fbBalanceNotOkSignal.xReleaseSignal) AND _fbModulesOutOfBalanceAlarm.bRaised AND xConfirmAlarms THEN
|
||||
_fbModulesOutOfBalanceAlarm.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
@@ -307,28 +421,117 @@ END_IF
|
||||
// ===============================
|
||||
_tonResetPulseLength();
|
||||
_tonErrorDCCBNotClosed();
|
||||
_tonSafetyOkTimeout();
|
||||
|
||||
|
||||
// ===============================
|
||||
// Get smalles segment voltage
|
||||
// of all units
|
||||
// ===============================
|
||||
_rSmallestSegmentVoltage := MIN(_fbModule1.rSmallestSegmentVoltage, _fbModule2.rSmallestSegmentVoltage, _fbModule3.rSmallestSegmentVoltage);
|
||||
|
||||
|
||||
// Call inverter
|
||||
_fbInverter(
|
||||
sInverterIPAddr:= sInverterIP,
|
||||
xEnable:= _xEnableInverter AND xEmergencyStopOk,
|
||||
rPower:= _rPowerInverterInternal,
|
||||
xReset:= xConfirmAlarms,
|
||||
rMaxBattPower:= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower),
|
||||
stCurrentValues => stInverterData);
|
||||
|
||||
IF (_iState >= 30) AND (_iState < 40) THEN
|
||||
rCapacityAH := rCapacityAH + ((stInverterData.rActDCCurrent * 0.01) / 3600);
|
||||
rCapacityWH := rCapacityWH + ((stInverterData.rActACPower * 0.01) / 3600);
|
||||
END_IF
|
||||
|
||||
CASE _iState OF
|
||||
0: // Idle
|
||||
IF _xAllModulesReady AND _xBalanceOk AND xAllModulesInAutoMode AND xEnable THEN
|
||||
xCloseDCCB := TRUE;
|
||||
// Start in normal mode
|
||||
IF xEnable AND (NOT xStartBalancing) AND xAllModulesInAutoMode AND xRepairSwitchOk THEN
|
||||
_xEnable := TRUE;
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
// Start in balancing mode
|
||||
IF (NOT xEnable) AND xStartBalancing AND xAllModulesInAutoMode THEN
|
||||
_xStartBalancing := TRUE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
_iState := 7;
|
||||
END_IF
|
||||
|
||||
5: // Wait for all modules to be ready in normal mode
|
||||
IF _xAllModulesReady AND _xBalanceOk THEN
|
||||
xResetSafetyDCCB := TRUE;
|
||||
IF (NOT xInSafetyCheckMode) THEN
|
||||
_xReleaseLimitErrorsInternal := TRUE;
|
||||
END_IF
|
||||
_tonResetPulseLength.IN := TRUE;
|
||||
_iState := 10;
|
||||
END_IF
|
||||
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
IF xError THEN
|
||||
_xEnable := FALSE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
7: // Wait for all modules to be ready in balancing mode
|
||||
IF _xAllModulesReady THEN
|
||||
_iState := 50;
|
||||
END_IF
|
||||
|
||||
IF (NOT xStartBalancing) THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
IF xError THEN
|
||||
_xEnable := FALSE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
|
||||
10: // Reset safety from sensors
|
||||
IF _tonResetPulseLength.Q THEN
|
||||
_tonResetPulseLength.IN := FALSE;
|
||||
xResetSafetyDCCB := FALSE;
|
||||
_tonSafetyOkTimeout.IN := TRUE;
|
||||
_iState := 15;
|
||||
END_IF
|
||||
|
||||
15: // Wait for Safety to be ok
|
||||
IF xSafetyIntlksOk THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
xCloseDCCB := TRUE;
|
||||
_tonErrorDCCBNotClosed.IN := TRUE;
|
||||
_iState := 20;
|
||||
END_IF
|
||||
|
||||
IF NOT xEnable THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
_xEnable := FALSE;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
IF _tonSafetyOkTimeout.Q THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
xCloseDCCB := TRUE;
|
||||
xError := TRUE;
|
||||
xReady := FALSE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
20: // Check if DC relais closed
|
||||
20: // Check if DC relais closed and safety is ok
|
||||
IF NOT xDCCBOpen THEN
|
||||
xReady := TRUE;
|
||||
_iState := 30;
|
||||
_xEnableInverter := TRUE;
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
//_rPowerInverterInternal := 0.0;
|
||||
_iState := 21;
|
||||
END_IF
|
||||
IF _tonErrorDCCBNotClosed.Q THEN
|
||||
_tonErrorDCCBNotClosed.IN := FALSE;
|
||||
@@ -336,21 +539,127 @@ CASE _iState OF
|
||||
xReady := FALSE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
IF NOT xEnable THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
_xEnable := FALSE;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
21: // Wait for inverter to be ready
|
||||
_tonInverterStartupTimeout(IN := TRUE);
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
_iState := 30;
|
||||
xReady := TRUE;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
|
||||
IF (NOT xEnable) OR (NOT _xAllModulesReady) THEN
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnable := FALSE;
|
||||
_iState := 31;
|
||||
END_IF
|
||||
|
||||
// Inverter error or ttimeout for startup
|
||||
IF _fbInverter.xError OR (NOT xRepairSwitchOk) THEN // _tonInverterStartupTimeout.Q
|
||||
IF _tonInverterStartupTimeout.Q AND (NOT _fbInverterStartupTimeoutAlarm.bRaised) THEN
|
||||
_fbInverterStartupTimeoutAlarm.Raise(0);
|
||||
END_IF
|
||||
_iState := 1000;
|
||||
_xEnableInverter := FALSE;
|
||||
xError := TRUE;
|
||||
xErrorInverter := TRUE;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
|
||||
30: // All modules ready
|
||||
// !!! ATTENTION !!!
|
||||
// BMS HAS TO SHUT DOWN THE INVERTER BEFORE DISSABLING THE STRING
|
||||
// OTHERWISE THE DC CIRCUIT BREAKERS WILL OPEN WHILE THE INVERTER IS STILL ACTIVE
|
||||
// THIS CAN DAMAGE THE INVERTER
|
||||
IF rPowerInverter > DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower) THEN
|
||||
// Limit discharge power (> because discharging is a positive number)
|
||||
_rPowerInverterInternal := DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower);
|
||||
ELSIF rPowerInverter < DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower) THEN
|
||||
// Limit charging power (< because charging is a negative number)
|
||||
_rPowerInverterInternal := DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower);
|
||||
ELSE
|
||||
// Power command within range
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
END_IF
|
||||
|
||||
IF NOT xEnable THEN
|
||||
// xCloseDCCB := FALSE;
|
||||
_iState := 0;
|
||||
ELSIF NOT _xAllModulesReady OR NOT _xBalanceOk THEN
|
||||
// _rPowerInverterInternal := 0.0;
|
||||
// _xEnableInverter := FALSE;
|
||||
_xEnable := FALSE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_rPowerInverterInternal := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
_iState := 31;
|
||||
ELSE
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
ELSIF (NOT _xAllModulesReady) OR (NOT _xBalanceOk) OR (NOT xSafetyIntlksOk) OR (NOT xRepairSwitchOk) THEN
|
||||
xError := TRUE;
|
||||
// xCloseDCCB := FALSE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
_xEnable := FALSE;
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
31: // Wait for String to be in in shutdown discharge mode
|
||||
IF _xAllModulesInShutdownDischargeMode THEN
|
||||
_iState := 32;
|
||||
END_IF
|
||||
|
||||
32: // Shutdown discharge mode
|
||||
IF xShutdownDischargeAllowed AND GVL_CONFIG.xShutdownDischargeWithInverter AND xSafetyIntlksOk AND (stInverterData.rActDCVoltage > 620.0) THEN
|
||||
_rPowerInverterInternal := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
ELSE
|
||||
// Send shutdown message
|
||||
IF NOT xShutdownDischargeAllowed THEN
|
||||
_fbSDUnitThreshold.Send(0);
|
||||
END_IF
|
||||
|
||||
IF (stInverterData.rActDCVoltage < 620.0) THEN
|
||||
_fbSDDCLevel.Send(0);
|
||||
END_IF
|
||||
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
40: // Wait for inverter to shut down
|
||||
IF NOT _fbInverter.xActive THEN
|
||||
_iState := 41;
|
||||
END_IF
|
||||
|
||||
41: // Debug delay time for inverter shutdown
|
||||
_tonInverterShutdownDelay(IN := TRUE);
|
||||
|
||||
IF _tonInverterShutdownDelay.Q THEN
|
||||
_tonInverterShutdownDelay(IN := FALSE);
|
||||
xCloseDCCB := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
50: // Wait for balancing of all units to be done
|
||||
IF _xBalancingDone THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_iState := 51;
|
||||
END_IF
|
||||
|
||||
51: // Check if start balancing has been releases to avoid a restart
|
||||
IF (NOT xStartBalancing) THEN
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
1000: // Error state
|
||||
// Leave error state only if modules are deactivated
|
||||
IF NOT xEnable THEN
|
||||
@@ -360,6 +669,8 @@ CASE _iState OF
|
||||
END_IF
|
||||
END_CASE
|
||||
|
||||
// Copy inverter data to SCADA interface
|
||||
stHMIInterface.stInverterData := stInverterData;
|
||||
|
||||
IF _xAllModulesReady AND _xBalanceOk AND (_iState = 30) THEN
|
||||
xReady := TRUE;
|
||||
@@ -367,6 +678,11 @@ ELSE
|
||||
xReady := FALSE;
|
||||
END_IF
|
||||
|
||||
// Reset inverter startup timeout alarm
|
||||
IF _fbInverterStartupTimeoutAlarm.bRaised AND xConfirmAlarms THEN
|
||||
_fbInverterStartupTimeoutAlarm.Clear(0, TRUE);
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// String status sum
|
||||
// ===============================
|
||||
@@ -405,7 +721,22 @@ _fbModulesOutOfBalanceAlarm.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
// Create safetyinterlocks active alarm
|
||||
_fbSafetyInterlocksNotOkAlarm.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.SafetyIntlksActive, bWithConfirmation := FALSE, 0);
|
||||
_fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
_fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
// Create inverter startup timeout alarm
|
||||
_fbInverterStartupTimeoutAlarm.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.InverterStartupTimeout, bWithConfirmation := TRUE, 0);
|
||||
_fbInverterStartupTimeoutAlarm.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
// Create DC Main Switch not closed alarm
|
||||
_fbDCMainSwitchNotClosed.CreateEx(stEventEntry := TC_EVENTS.General.DCMainSwitchNotClosed, bWithConfirmation := FALSE, 0);
|
||||
_fbDCMainSwitchNotClosed.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
// Shutdown discharge messages
|
||||
_fbSDDCLevel.CreateEx(TC_EVENTS.BMSEvents.SDDCVoltage, 0);
|
||||
_fbSDDCLevel.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
_fbSDUnitThreshold.CreateEx(TC_EVENTS.BMSEvents.SDUnitThreshhold, 0);
|
||||
_fbSDUnitThreshold.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Property Name="Name" Id="{19fcb6d4-fd4b-49f9-9791-1e4c931b9e69}">
|
||||
@@ -437,155 +768,69 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
</Set>
|
||||
</Property>
|
||||
<LineIds Name="FB_String">
|
||||
<LineId Id="266" Count="0" />
|
||||
<LineId Id="268" Count="0" />
|
||||
<LineId Id="758" Count="0" />
|
||||
<LineId Id="757" Count="0" />
|
||||
<LineId Id="759" Count="0" />
|
||||
<LineId Id="335" Count="0" />
|
||||
<LineId Id="334" Count="0" />
|
||||
<LineId Id="336" Count="0" />
|
||||
<LineId Id="867" Count="0" />
|
||||
<LineId Id="866" Count="0" />
|
||||
<LineId Id="870" Count="0" />
|
||||
<LineId Id="267" Count="0" />
|
||||
<LineId Id="69" Count="0" />
|
||||
<LineId Id="67" Count="1" />
|
||||
<LineId Id="47" Count="0" />
|
||||
<LineId Id="140" Count="0" />
|
||||
<LineId Id="978" Count="0" />
|
||||
<LineId Id="875" Count="0" />
|
||||
<LineId Id="48" Count="0" />
|
||||
<LineId Id="50" Count="2" />
|
||||
<LineId Id="600" Count="0" />
|
||||
<LineId Id="53" Count="0" />
|
||||
<LineId Id="58" Count="0" />
|
||||
<LineId Id="62" Count="0" />
|
||||
<LineId Id="64" Count="0" />
|
||||
<LineId Id="66" Count="0" />
|
||||
<LineId Id="63" Count="0" />
|
||||
<LineId Id="59" Count="2" />
|
||||
<LineId Id="338" Count="0" />
|
||||
<LineId Id="337" Count="0" />
|
||||
<LineId Id="339" Count="1" />
|
||||
<LineId Id="761" Count="0" />
|
||||
<LineId Id="760" Count="0" />
|
||||
<LineId Id="762" Count="1" />
|
||||
<LineId Id="71" Count="4" />
|
||||
<LineId Id="871" Count="0" />
|
||||
<LineId Id="76" Count="0" />
|
||||
<LineId Id="141" Count="0" />
|
||||
<LineId Id="979" Count="0" />
|
||||
<LineId Id="876" Count="0" />
|
||||
<LineId Id="77" Count="3" />
|
||||
<LineId Id="601" Count="0" />
|
||||
<LineId Id="81" Count="7" />
|
||||
<LineId Id="70" Count="0" />
|
||||
<LineId Id="342" Count="2" />
|
||||
<LineId Id="341" Count="0" />
|
||||
<LineId Id="765" Count="2" />
|
||||
<LineId Id="764" Count="0" />
|
||||
<LineId Id="90" Count="5" />
|
||||
<LineId Id="142" Count="0" />
|
||||
<LineId Id="980" Count="0" />
|
||||
<LineId Id="877" Count="0" />
|
||||
<LineId Id="96" Count="3" />
|
||||
<LineId Id="602" Count="0" />
|
||||
<LineId Id="100" Count="7" />
|
||||
<LineId Id="89" Count="0" />
|
||||
<LineId Id="346" Count="2" />
|
||||
<LineId Id="345" Count="0" />
|
||||
<LineId Id="769" Count="2" />
|
||||
<LineId Id="768" Count="0" />
|
||||
<LineId Id="433" Count="1" />
|
||||
<LineId Id="432" Count="0" />
|
||||
<LineId Id="435" Count="4" />
|
||||
<LineId Id="441" Count="2" />
|
||||
<LineId Id="440" Count="0" />
|
||||
<LineId Id="183" Count="5" />
|
||||
<LineId Id="245" Count="4" />
|
||||
<LineId Id="244" Count="0" />
|
||||
<LineId Id="261" Count="4" />
|
||||
<LineId Id="260" Count="0" />
|
||||
<LineId Id="270" Count="4" />
|
||||
<LineId Id="269" Count="0" />
|
||||
<LineId Id="190" Count="3" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="199" Count="5" />
|
||||
<LineId Id="198" Count="0" />
|
||||
<LineId Id="209" Count="0" />
|
||||
<LineId Id="208" Count="0" />
|
||||
<LineId Id="230" Count="1" />
|
||||
<LineId Id="211" Count="0" />
|
||||
<LineId Id="232" Count="0" />
|
||||
<LineId Id="210" Count="0" />
|
||||
<LineId Id="234" Count="1" />
|
||||
<LineId Id="233" Count="0" />
|
||||
<LineId Id="213" Count="0" />
|
||||
<LineId Id="212" Count="0" />
|
||||
<LineId Id="237" Count="1" />
|
||||
<LineId Id="236" Count="0" />
|
||||
<LineId Id="1187" Count="6" />
|
||||
<LineId Id="215" Count="5" />
|
||||
<LineId Id="353" Count="13" />
|
||||
<LineId Id="352" Count="0" />
|
||||
<LineId Id="221" Count="3" />
|
||||
<LineId Id="704" Count="0" />
|
||||
<LineId Id="725" Count="1" />
|
||||
<LineId Id="690" Count="0" />
|
||||
<LineId Id="692" Count="0" />
|
||||
<LineId Id="694" Count="1" />
|
||||
<LineId Id="710" Count="0" />
|
||||
<LineId Id="703" Count="0" />
|
||||
<LineId Id="697" Count="0" />
|
||||
<LineId Id="696" Count="0" />
|
||||
<LineId Id="698" Count="2" />
|
||||
<LineId Id="705" Count="0" />
|
||||
<LineId Id="711" Count="0" />
|
||||
<LineId Id="735" Count="0" />
|
||||
<LineId Id="712" Count="0" />
|
||||
<LineId Id="706" Count="0" />
|
||||
<LineId Id="713" Count="0" />
|
||||
<LineId Id="719" Count="0" />
|
||||
<LineId Id="734" Count="0" />
|
||||
<LineId Id="745" Count="0" />
|
||||
<LineId Id="739" Count="1" />
|
||||
<LineId Id="720" Count="0" />
|
||||
<LineId Id="744" Count="0" />
|
||||
<LineId Id="1194" Count="0" />
|
||||
<LineId Id="746" Count="0" />
|
||||
<LineId Id="727" Count="1" />
|
||||
<LineId Id="718" Count="0" />
|
||||
<LineId Id="714" Count="0" />
|
||||
<LineId Id="750" Count="3" />
|
||||
<LineId Id="741" Count="0" />
|
||||
<LineId Id="749" Count="0" />
|
||||
<LineId Id="742" Count="1" />
|
||||
<LineId Id="716" Count="0" />
|
||||
<LineId Id="1082" Count="0" />
|
||||
<LineId Id="1081" Count="0" />
|
||||
<LineId Id="717" Count="0" />
|
||||
<LineId Id="729" Count="1" />
|
||||
<LineId Id="738" Count="0" />
|
||||
<LineId Id="731" Count="0" />
|
||||
<LineId Id="736" Count="1" />
|
||||
<LineId Id="732" Count="1" />
|
||||
<LineId Id="693" Count="0" />
|
||||
<LineId Id="691" Count="0" />
|
||||
<LineId Id="689" Count="0" />
|
||||
<LineId Id="225" Count="0" />
|
||||
<LineId Id="747" Count="0" />
|
||||
<LineId Id="239" Count="1" />
|
||||
<LineId Id="214" Count="0" />
|
||||
<LineId Id="512" Count="0" />
|
||||
<LineId Id="511" Count="0" />
|
||||
<LineId Id="513" Count="4" />
|
||||
<LineId Id="521" Count="0" />
|
||||
<LineId Id="520" Count="0" />
|
||||
<LineId Id="522" Count="1" />
|
||||
<LineId Id="525" Count="0" />
|
||||
<LineId Id="524" Count="0" />
|
||||
<LineId Id="526" Count="1" />
|
||||
<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="527" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.FB_init">
|
||||
<LineId Id="7" Count="0" />
|
||||
@@ -599,6 +844,18 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
<LineId Id="31" Count="0" />
|
||||
<LineId Id="29" Count="1" />
|
||||
<LineId Id="28" Count="0" />
|
||||
<LineId Id="45" Count="0" />
|
||||
<LineId Id="44" Count="0" />
|
||||
<LineId Id="46" Count="1" />
|
||||
<LineId Id="56" Count="0" />
|
||||
<LineId Id="55" Count="0" />
|
||||
<LineId Id="57" Count="1" />
|
||||
<LineId Id="67" Count="0" />
|
||||
<LineId Id="66" Count="0" />
|
||||
<LineId Id="68" Count="1" />
|
||||
<LineId Id="71" Count="0" />
|
||||
<LineId Id="70" Count="0" />
|
||||
<LineId Id="72" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.Name.Get">
|
||||
<LineId Id="2" Count="0" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,16 +10,13 @@ VAR
|
||||
_xReleaseLimitsErrors : BOOL := TRUE;
|
||||
_xConfirmAlarms : BOOL;
|
||||
_xEnableString : BOOL;
|
||||
_xEnableInverter : BOOL;
|
||||
_xStartBalancing : BOOL;
|
||||
|
||||
_xCanChangeMode : BOOL := TRUE;
|
||||
|
||||
{attribute 'OPC.UA.DA' := '0'}
|
||||
_afbStrings : ARRAY[0..1] OF FB_String[('String 1'), ('String 2')];
|
||||
|
||||
_fbInverter : FB_PowerSupplySunspec;
|
||||
_stInverterData : ST_SUNSPEC_CURRENT_VALUES;
|
||||
|
||||
// Variable to detect charge status change
|
||||
_eLastChargeStatus : E_CHARGE_STATUS;
|
||||
// Variable to detect battery status change
|
||||
@@ -28,6 +25,7 @@ VAR
|
||||
// State machine state
|
||||
_iState : INT;
|
||||
_iStateSafetyCheck : INT;
|
||||
_iStateBalancing : INT;
|
||||
|
||||
// Start safety check mode
|
||||
_xStartSafetyCheck : BOOL;
|
||||
@@ -50,6 +48,9 @@ VAR
|
||||
// Not all strings in automatic mode
|
||||
_fbNoAutomaticModeAlarm : Fb_TcAlarm;
|
||||
|
||||
// Emergency stop not ok alarm
|
||||
_fbEStopNotOk : FB_TcAlarm;
|
||||
|
||||
// First cycle tag
|
||||
_xFirstCycle : BOOL := TRUE;
|
||||
|
||||
@@ -90,11 +91,19 @@ VAR
|
||||
// Battery in safety check mode
|
||||
_xInSafetyCheckMode : BOOL;
|
||||
|
||||
// Battery full message
|
||||
_fbBatteryFullMessage : FB_TcMessage;
|
||||
_fbBatteryEmptyMessage : FB_TcMessage;
|
||||
|
||||
// Safety
|
||||
_fbSafety : FB_Safety;
|
||||
|
||||
// DEBUG
|
||||
_xRestart : BOOL;
|
||||
|
||||
_xDebug : BOOL;
|
||||
|
||||
_uiDebugCurrentString : UINT := 1;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -111,29 +120,58 @@ IF _xRestart AND (_iState = 0) THEN
|
||||
END_IF
|
||||
// DEBUG
|
||||
// ===============================
|
||||
|
||||
IF _xFirstCycle THEN
|
||||
_xFirstCycle := FALSE;
|
||||
|
||||
_fbBatteryFullMessage.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.BatteryFull, 0);
|
||||
_fbBatteryEmptyMessage.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.BatteryEmpty, 0);
|
||||
|
||||
_fbEStopNotOk.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.EmergencyStopNotOk, TRUE, 0);
|
||||
END_IF
|
||||
|
||||
|
||||
_xErrorActive := FALSE;
|
||||
|
||||
// Ack alarms from HMI
|
||||
_xConfirmAlarms := GVL_SCADA.stAckAlarmsButton.xRequest;
|
||||
IF GVL_SCADA.stAckAlarmsButton.xRequest THEN
|
||||
GVL_SCADA.stAckAlarmsButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Safety
|
||||
// ===============================
|
||||
xSafetyErrAck := xSafetyResterTaster;
|
||||
_xShowAckEmergencyStop := NOT _xEmergencyStopOk;
|
||||
|
||||
IF (NOT _xEmergencyStopOk) AND (NOT _fbEStopNotOk.bRaised) THEN
|
||||
_fbEStopNotOk.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF _xEmergencyStopOk AND _fbEStopNotOk.bRaised THEN
|
||||
_fbEStopNotOk.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
IF _fbEStopNotOk.eConfirmationState = TcEventConfirmationState.WaitForConfirmation AND _xConfirmAlarms THEN
|
||||
_fbEStopNotOk.Confirm(0);
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Hardware reset button part 1
|
||||
// ===============================
|
||||
_tonHardwareResetButton(IN := _xHarwareResetButton);
|
||||
_rtHardwareResetButton(CLK := _tonHardwareResetButton.Q);
|
||||
_xConfirmAlarms := TRUE;
|
||||
// _xConfirmAlarms := TRUE;
|
||||
|
||||
// ===============================
|
||||
// Handle Manual mode release
|
||||
// ===============================
|
||||
IF _iState = 0 THEN
|
||||
_xReleaseManualMode := TRUE;
|
||||
ELSE
|
||||
_xReleaseManualMode := FALSE;
|
||||
END_IF
|
||||
//IF _iState = 0 THEN
|
||||
// _xReleaseManualMode := TRUE;
|
||||
//ELSE
|
||||
// _xReleaseManualMode := FALSE;
|
||||
//END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -159,26 +197,43 @@ END_IF
|
||||
// Dely release of errors during PLC startup phase
|
||||
_tonStartupDelay(IN := TRUE);
|
||||
|
||||
// Ack alarms from HMI
|
||||
_xConfirmAlarms := GVL_SCADA.stAckAlarmsButton.xRequest;
|
||||
IF GVL_SCADA.stAckAlarmsButton.xRequest THEN
|
||||
GVL_SCADA.stAckAlarmsButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// Call string 1
|
||||
_afbStrings[0](
|
||||
stStringModuleVoltageConfig := GVL_CONFIG.stString1VoltageConfig,
|
||||
xEnable := _xEnableString,
|
||||
xEnable := _xEnableString AND GVL_CONFIG.xDummy,
|
||||
xStartBalancing := _xStartBalancing AND GVL_CONFIG.xDummy,
|
||||
sInverterIP := GVL_CONFIG.sInverterIpString1,
|
||||
rPowerInverter := _rPowerInverter,
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[0],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND GVL_CONFIG.xDummy,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
xResetSafety := xSafetyResterTaster);
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Call string 2
|
||||
_afbStrings[1](
|
||||
stStringModuleVoltageConfig := GVL_CONFIG.stString2VoltageConfig,
|
||||
xEnable := _xEnableString,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
sInverterIP := GVL_CONFIG.sInverterIpString2,
|
||||
rPowerInverter := _rPowerInverter,
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[1],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
xResetSafety := xSafetyResterTaster);
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[1].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
@@ -201,17 +256,6 @@ ELSE
|
||||
GVL_SCADA.stHMIInterface[0].eStatus :=_afbStrings[0].eStatus;
|
||||
END_IF
|
||||
|
||||
// DEACTIVATED FOR DEBUG REASONS !!!
|
||||
// Call inverter
|
||||
_fbInverter(
|
||||
sInverterIPAddr:= GVL_CONFIG.sInverterIp,
|
||||
xEnable:= _xEnableInverter,
|
||||
rPower:= _rPowerInverter,
|
||||
xReset:= _xConfirmAlarms,
|
||||
rMaxBattPower:= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower),
|
||||
stCurrentValues => _stInverterData);
|
||||
|
||||
|
||||
// ===============================
|
||||
// Read modbus request count
|
||||
// ===============================
|
||||
@@ -236,34 +280,75 @@ _fbADSReader(
|
||||
CASE _eBMSControlMode OF
|
||||
E_BMS_CONTROL_MODE.AUTO_REMOTE:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower);
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_AUTO();
|
||||
|
||||
E_BMS_CONTROL_MODE.AUTO_LOCAL:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.TESTING;
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_AUTO();
|
||||
|
||||
E_BMS_CONTROL_MODE.MANUAL:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := TRUE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.MAINTENANCE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_MANUAL();
|
||||
|
||||
E_BMS_CONTROL_MODE.SAFETY_CHECK:
|
||||
_xInSafetyCheckMode := TRUE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.MAINTENANCE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_SAFETY_CHECK();
|
||||
|
||||
E_BMS_CONTROL_MODE.CAPACITY_TEST:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.TESTING;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_CAPACITY_TEST();
|
||||
|
||||
E_BMS_CONTROL_MODE.BALANCING:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_BALANCING();
|
||||
END_CASE
|
||||
|
||||
GVL_SCADA.xCanChangeControlMode := _xCanChangeMode;
|
||||
GVL_SCADA.eCurrentControlMode := _eBMSControlMode;
|
||||
|
||||
// Calculate current battery dc power
|
||||
GVL_SCADA.diCurrentBatteryPower := REAL_TO_DINT(_afbStrings[0].stInverterData.rActDCPower + _afbStrings[1].stInverterData.rActDCPower);
|
||||
|
||||
_fbSafety();
|
||||
|
||||
// Reset automatic buttons
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest := FALSE;
|
||||
END_IF
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// Reset alarm confirmation
|
||||
IF _xConfirmAlarms OR _rtHardwareResetButton.Q THEN
|
||||
@@ -275,7 +360,7 @@ END_IF]]></ST>
|
||||
<ST><![CDATA[CASE _iState OF
|
||||
0: // Idle
|
||||
// Wait for power command
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND _afbStrings[0].xSafetyIntlksOk AND (NOT _afbStrings[0].xError) AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
_xCanChangeMode := FALSE;
|
||||
END_IF
|
||||
@@ -284,6 +369,7 @@ END_IF]]></ST>
|
||||
IF _rAutoPowerRequest < DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower)
|
||||
AND _rAutoPowerRequest > DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower) THEN
|
||||
_xEnableString := TRUE;
|
||||
_xStartBalancing := FALSE;
|
||||
_iState := 10;
|
||||
ELSE
|
||||
// Set error bitmap flag
|
||||
@@ -292,16 +378,14 @@ END_IF]]></ST>
|
||||
// Goto error state
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
|
||||
10: // Wait for string to be ready
|
||||
IF _afbStrings[0].xReady AND (NOT _afbStrings[0].xError) THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := TRUE;
|
||||
_iState := 20;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_iState := 45;
|
||||
@@ -311,22 +395,7 @@ END_IF]]></ST>
|
||||
_xEnableString := FALSE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
20: // Wait for inverter to be ready
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
// Set battery status for modbus
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.ACTIVE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg10.uiActiveParallelMembers := 1;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
30: // String and inverter enabled
|
||||
// Set inverter power to modbus requested power
|
||||
@@ -366,12 +435,18 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery fully charged
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_afbStrings[0].rCurrentVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) THEN
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_afbStrings[_uiDebugCurrentString].stInverterData.rActDCVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Send message
|
||||
_fbBatteryFullMessage.Send(0);
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
// Set local remote to zero power
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
|
||||
// Start string shutdown
|
||||
_xEnableString := FALSE;
|
||||
|
||||
@@ -382,9 +457,15 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery empty
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND (_afbStrings[0].rCurrentVoltage <= GVL_CONFIG.rStringEmptyVoltage) THEN
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND (_afbStrings[_uiDebugCurrentString].stInverterData.rActDCVoltage <= GVL_CONFIG.rStringEmptyVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Send Message
|
||||
_fbBatteryEmptyMessage.Send(0);
|
||||
|
||||
// Set local remote to zero power
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
@@ -398,8 +479,7 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR (NOT _xString1DCSafetyOk) OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
@@ -407,51 +487,53 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
35: // Wait for string to be in shutdown discharge mode
|
||||
IF _afbStrings[0].xInShutdownDischargeMode THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xInShutdownDischargeMode THEN
|
||||
// Check if we are allowed to discharge during shutdown with inverter
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_iState := 40;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
40: // Wait for inverter discharge done
|
||||
IF _afbStrings[0].xShutdownDischargeAllowed THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xShutdownDischargeAllowed THEN
|
||||
_rPowerInverter := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
// Restart if possible
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
IF (NOT _afbStrings[0].xInShutdownDischargeMode) AND _afbStrings[0].xOff THEN
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xInShutdownDischargeMode) AND _afbStrings[_uiDebugCurrentString].xOff THEN
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
// Restart if possible
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND _afbStrings[0].xSafetyIntlksOk AND (NOT _afbStrings[0].xError) AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
@@ -463,13 +545,12 @@ END_IF]]></ST>
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverter := 0.0;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.ERROR;
|
||||
_iState := 1010;
|
||||
|
||||
1010: // Wait for reset from error state
|
||||
IF (_rAutoPowerRequest = 0.0) AND (NOT _afbStrings[0].xError) AND (NOT _fbInverter.xError) THEN
|
||||
IF (_rAutoPowerRequest = 0.0) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _xConfirmAlarms THEN
|
||||
// Reset modbus error register
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.lwErrorBitmap := 0;
|
||||
|
||||
@@ -481,6 +562,50 @@ END_IF]]></ST>
|
||||
|
||||
_xCanChangeMode := TRUE;
|
||||
END_IF
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="SM_BALANCING" Id="{f1f90032-de29-468d-899c-50bfb54e48e0}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _iStateBalancing OF
|
||||
0: // Test
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
_iStateBalancing := 5;
|
||||
END_IF
|
||||
|
||||
// GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRelease := (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode;
|
||||
|
||||
5: // Check for start conditions
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_xCanChangeMode := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
_xStartBalancing := TRUE;
|
||||
_iStateBalancing := 10;
|
||||
END_IF
|
||||
|
||||
10: // Wait for balancing to be done
|
||||
IF _afbStrings[_uiDebugCurrentString].xBalancingDone THEN
|
||||
_xCanChangeMode := TRUE;
|
||||
_xStartBalancing := FALSE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iStateBalancing := 900;
|
||||
_xStartBalancing := FALSE;
|
||||
END_IF
|
||||
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
|
||||
900: // Error state
|
||||
IF _xConfirmAlarms AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_xCanChangeMode := TRUE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
@@ -496,25 +621,30 @@ END_CASE]]></ST>
|
||||
</Action>
|
||||
<Action Name="SM_SAFETY_CHECK" Id="{6d8e5993-cf32-4980-9ea3-c1fbfa4b8601}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[// wait for stop or error
|
||||
<ST><![CDATA[// Start on start button pressed
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
// Only start if everything is ok
|
||||
IF _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_xStartSafetyCheck := TRUE;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// on stop: open dc circuit breakers and close valves
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
_xStartSafetyCheck := FALSE;
|
||||
END_IF
|
||||
|
||||
// wait for voltage to drop below xx volts
|
||||
|
||||
// stop pumps
|
||||
CASE _iStateSafetyCheck OF
|
||||
0: // Idle
|
||||
// Wait for power command
|
||||
IF _xStartSafetyCheck AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
// Wait for start command
|
||||
IF _xStartSafetyCheck AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_xEnableString := TRUE;
|
||||
_xEnableInverter := FALSE;
|
||||
_iStateSafetyCheck := 10;
|
||||
_rPowerInverter := 0.0;
|
||||
_xCanChangeMode := FALSE;
|
||||
END_IF
|
||||
|
||||
10: // Wait for string to be ready
|
||||
IF _afbStrings[0].xReady AND (NOT _afbStrings[0].xError) THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_iStateSafetyCheck := 30;
|
||||
END_IF
|
||||
|
||||
@@ -524,7 +654,7 @@ CASE _iStateSafetyCheck OF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
@@ -540,28 +670,29 @@ CASE _iStateSafetyCheck OF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
IF _afbStrings[0].xOff THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xOff THEN
|
||||
_iStateSafetyCheck := 0;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverter := 0.0;
|
||||
_iStateSafetyCheck := 1010;
|
||||
|
||||
1010: // Wait for reset from error state
|
||||
IF (NOT _afbStrings[0].xError) AND NOT _xStartSafetyCheck THEN
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND (NOT _xStartSafetyCheck) THEN
|
||||
// Goto init state
|
||||
_iStateSafetyCheck := 0;
|
||||
|
||||
@@ -571,66 +702,173 @@ END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<LineIds Name="MAIN">
|
||||
<LineId Id="2032" Count="54" />
|
||||
<LineId Id="2032" Count="12" />
|
||||
<LineId Id="2803" Count="1" />
|
||||
<LineId Id="2806" Count="0" />
|
||||
<LineId Id="2808" Count="0" />
|
||||
<LineId Id="2813" Count="1" />
|
||||
<LineId Id="2917" Count="1" />
|
||||
<LineId Id="2807" Count="0" />
|
||||
<LineId Id="2805" Count="0" />
|
||||
<LineId Id="2802" Count="0" />
|
||||
<LineId Id="2045" Count="0" />
|
||||
<LineId Id="2932" Count="4" />
|
||||
<LineId Id="2931" Count="0" />
|
||||
<LineId Id="2046" Count="5" />
|
||||
<LineId Id="2920" Count="0" />
|
||||
<LineId Id="2919" Count="0" />
|
||||
<LineId Id="2921" Count="1" />
|
||||
<LineId Id="2924" Count="0" />
|
||||
<LineId Id="2923" Count="0" />
|
||||
<LineId Id="2925" Count="1" />
|
||||
<LineId Id="2928" Count="0" />
|
||||
<LineId Id="2927" Count="0" />
|
||||
<LineId Id="2929" Count="1" />
|
||||
<LineId Id="2052" Count="34" />
|
||||
<LineId Id="2197" Count="0" />
|
||||
<LineId Id="2087" Count="12" />
|
||||
<LineId Id="2087" Count="3" />
|
||||
<LineId Id="2097" Count="2" />
|
||||
<LineId Id="2287" Count="0" />
|
||||
<LineId Id="2100" Count="91" />
|
||||
<LineId Id="2100" Count="0" />
|
||||
<LineId Id="2967" Count="0" />
|
||||
<LineId Id="2702" Count="0" />
|
||||
<LineId Id="2596" Count="0" />
|
||||
<LineId Id="2101" Count="11" />
|
||||
<LineId Id="2485" Count="4" />
|
||||
<LineId Id="2966" Count="0" />
|
||||
<LineId Id="2703" Count="0" />
|
||||
<LineId Id="2597" Count="0" />
|
||||
<LineId Id="2490" Count="10" />
|
||||
<LineId Id="2484" Count="0" />
|
||||
<LineId Id="2113" Count="19" />
|
||||
<LineId Id="2144" Count="23" />
|
||||
<LineId Id="2601" Count="0" />
|
||||
<LineId Id="2168" Count="0" />
|
||||
<LineId Id="2944" Count="1" />
|
||||
<LineId Id="2943" Count="0" />
|
||||
<LineId Id="2169" Count="3" />
|
||||
<LineId Id="2602" Count="0" />
|
||||
<LineId Id="2173" Count="1" />
|
||||
<LineId Id="2937" Count="2" />
|
||||
<LineId Id="2175" Count="3" />
|
||||
<LineId Id="2600" Count="0" />
|
||||
<LineId Id="2179" Count="0" />
|
||||
<LineId Id="2941" Count="1" />
|
||||
<LineId Id="2940" Count="0" />
|
||||
<LineId Id="2180" Count="3" />
|
||||
<LineId Id="2603" Count="0" />
|
||||
<LineId Id="2184" Count="0" />
|
||||
<LineId Id="2947" Count="1" />
|
||||
<LineId Id="2946" Count="0" />
|
||||
<LineId Id="2185" Count="3" />
|
||||
<LineId Id="2604" Count="0" />
|
||||
<LineId Id="2189" Count="0" />
|
||||
<LineId Id="2950" Count="1" />
|
||||
<LineId Id="2949" Count="0" />
|
||||
<LineId Id="2190" Count="0" />
|
||||
<LineId Id="2955" Count="3" />
|
||||
<LineId Id="2961" Count="0" />
|
||||
<LineId Id="2965" Count="0" />
|
||||
<LineId Id="2962" Count="0" />
|
||||
<LineId Id="2960" Count="0" />
|
||||
<LineId Id="2959" Count="0" />
|
||||
<LineId Id="2191" Count="0" />
|
||||
<LineId Id="2383" Count="0" />
|
||||
<LineId Id="2192" Count="0" />
|
||||
<LineId Id="2606" Count="0" />
|
||||
<LineId Id="2954" Count="0" />
|
||||
<LineId Id="2953" Count="0" />
|
||||
<LineId Id="2952" Count="0" />
|
||||
<LineId Id="2388" Count="0" />
|
||||
<LineId Id="2387" Count="0" />
|
||||
<LineId Id="2970" Count="0" />
|
||||
<LineId Id="2969" Count="0" />
|
||||
<LineId Id="2972" Count="0" />
|
||||
<LineId Id="2971" Count="0" />
|
||||
<LineId Id="2973" Count="0" />
|
||||
<LineId Id="2975" Count="1" />
|
||||
<LineId Id="2974" Count="0" />
|
||||
<LineId Id="2193" Count="3" />
|
||||
<LineId Id="25" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_AUTO">
|
||||
<LineId Id="2" Count="4" />
|
||||
<LineId Id="195" Count="0" />
|
||||
<LineId Id="7" Count="16" />
|
||||
<LineId Id="183" Count="1" />
|
||||
<LineId Id="7" Count="5" />
|
||||
<LineId Id="242" Count="0" />
|
||||
<LineId Id="13" Count="10" />
|
||||
<LineId Id="183" Count="0" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="25" Count="0" />
|
||||
<LineId Id="185" Count="1" />
|
||||
<LineId Id="189" Count="0" />
|
||||
<LineId Id="205" Count="0" />
|
||||
<LineId Id="214" Count="0" />
|
||||
<LineId Id="187" Count="1" />
|
||||
<LineId Id="200" Count="1" />
|
||||
<LineId Id="203" Count="1" />
|
||||
<LineId Id="202" Count="0" />
|
||||
<LineId Id="31" Count="10" />
|
||||
<LineId Id="190" Count="0" />
|
||||
<LineId Id="216" Count="0" />
|
||||
<LineId Id="215" Count="0" />
|
||||
<LineId Id="42" Count="18" />
|
||||
<LineId Id="62" Count="54" />
|
||||
<LineId Id="191" Count="0" />
|
||||
<LineId Id="220" Count="0" />
|
||||
<LineId Id="44" Count="16" />
|
||||
<LineId Id="62" Count="23" />
|
||||
<LineId Id="230" Count="2" />
|
||||
<LineId Id="86" Count="2" />
|
||||
<LineId Id="236" Count="2" />
|
||||
<LineId Id="89" Count="12" />
|
||||
<LineId Id="233" Count="2" />
|
||||
<LineId Id="239" Count="2" />
|
||||
<LineId Id="102" Count="14" />
|
||||
<LineId Id="206" Count="0" />
|
||||
<LineId Id="117" Count="0" />
|
||||
<LineId Id="217" Count="0" />
|
||||
<LineId Id="118" Count="10" />
|
||||
<LineId Id="118" Count="9" />
|
||||
<LineId Id="207" Count="0" />
|
||||
<LineId Id="218" Count="0" />
|
||||
<LineId Id="129" Count="5" />
|
||||
<LineId Id="192" Count="0" />
|
||||
<LineId Id="135" Count="7" />
|
||||
<LineId Id="243" Count="0" />
|
||||
<LineId Id="129" Count="13" />
|
||||
<LineId Id="219" Count="0" />
|
||||
<LineId Id="143" Count="0" />
|
||||
<LineId Id="208" Count="0" />
|
||||
<LineId Id="196" Count="0" />
|
||||
<LineId Id="144" Count="4" />
|
||||
<LineId Id="193" Count="0" />
|
||||
<LineId Id="149" Count="7" />
|
||||
<LineId Id="144" Count="6" />
|
||||
<LineId Id="225" Count="0" />
|
||||
<LineId Id="227" Count="2" />
|
||||
<LineId Id="226" Count="0" />
|
||||
<LineId Id="151" Count="5" />
|
||||
<LineId Id="209" Count="0" />
|
||||
<LineId Id="213" Count="0" />
|
||||
<LineId Id="210" Count="2" />
|
||||
<LineId Id="157" Count="2" />
|
||||
<LineId Id="194" Count="0" />
|
||||
<LineId Id="160" Count="19" />
|
||||
<LineId Id="160" Count="4" />
|
||||
<LineId Id="166" Count="13" />
|
||||
<LineId Id="198" Count="1" />
|
||||
<LineId Id="180" Count="0" />
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_BALANCING">
|
||||
<LineId Id="1" Count="1" />
|
||||
<LineId Id="5" Count="2" />
|
||||
<LineId Id="15" Count="1" />
|
||||
<LineId Id="9" Count="3" />
|
||||
<LineId Id="35" Count="0" />
|
||||
<LineId Id="20" Count="0" />
|
||||
<LineId Id="14" Count="0" />
|
||||
<LineId Id="13" Count="0" />
|
||||
<LineId Id="17" Count="2" />
|
||||
<LineId Id="21" Count="0" />
|
||||
<LineId Id="23" Count="1" />
|
||||
<LineId Id="22" Count="0" />
|
||||
<LineId Id="25" Count="2" />
|
||||
<LineId Id="29" Count="0" />
|
||||
<LineId Id="28" Count="0" />
|
||||
<LineId Id="36" Count="1" />
|
||||
<LineId Id="41" Count="1" />
|
||||
<LineId Id="40" Count="0" />
|
||||
<LineId Id="39" Count="0" />
|
||||
<LineId Id="30" Count="2" />
|
||||
<LineId Id="43" Count="0" />
|
||||
<LineId Id="33" Count="1" />
|
||||
<LineId Id="3" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_CAPACITY_TEST">
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
@@ -638,15 +876,18 @@ END_CASE]]></ST>
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_SAFETY_CHECK">
|
||||
<LineId Id="8" Count="0" />
|
||||
<LineId Id="15" Count="1" />
|
||||
<LineId Id="13" Count="0" />
|
||||
<LineId Id="12" Count="0" />
|
||||
<LineId Id="18" Count="0" />
|
||||
<LineId Id="244" Count="0" />
|
||||
<LineId Id="235" Count="0" />
|
||||
<LineId Id="245" Count="0" />
|
||||
<LineId Id="242" Count="0" />
|
||||
<LineId Id="236" Count="0" />
|
||||
<LineId Id="243" Count="0" />
|
||||
<LineId Id="237" Count="4" />
|
||||
<LineId Id="17" Count="0" />
|
||||
<LineId Id="20" Count="3" />
|
||||
<LineId Id="198" Count="1" />
|
||||
<LineId Id="198" Count="0" />
|
||||
<LineId Id="24" Count="0" />
|
||||
<LineId Id="220" Count="0" />
|
||||
<LineId Id="216" Count="0" />
|
||||
<LineId Id="25" Count="0" />
|
||||
<LineId Id="39" Count="4" />
|
||||
@@ -663,9 +904,13 @@ END_CASE]]></ST>
|
||||
<LineId Id="217" Count="0" />
|
||||
<LineId Id="72" Count="0" />
|
||||
<LineId Id="131" Count="2" />
|
||||
<LineId Id="221" Count="0" />
|
||||
<LineId Id="135" Count="1" />
|
||||
<LineId Id="168" Count="2" />
|
||||
<LineId Id="172" Count="11" />
|
||||
<LineId Id="172" Count="4" />
|
||||
<LineId Id="222" Count="0" />
|
||||
<LineId Id="177" Count="4" />
|
||||
<LineId Id="183" Count="0" />
|
||||
<LineId Id="185" Count="3" />
|
||||
<LineId Id="195" Count="1" />
|
||||
<LineId Id="218" Count="1" />
|
||||
|
||||
@@ -12,7 +12,7 @@ VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Output for SCS DC-Relais
|
||||
xCloseDCRelais AT %Q*: BOOL;
|
||||
//xCloseDCRelais AT %Q*: BOOL;
|
||||
|
||||
// Inverter active
|
||||
xActive : BOOL;
|
||||
@@ -86,7 +86,7 @@ VAR
|
||||
_iErrorInState : INT;
|
||||
|
||||
// Time for polling for current dc values and check for inverter error
|
||||
_timPollingDelay : TIME := T#250MS;
|
||||
_timPollingDelay : TIME := T#500MS;
|
||||
|
||||
// Timer for polling of current values
|
||||
_tonPollingTimer : TON;
|
||||
@@ -103,6 +103,11 @@ VAR
|
||||
// Inverter reset errors command
|
||||
_uiResetInverter : UINT := 1;
|
||||
|
||||
// Inverter alarm
|
||||
_fbErrorInverterAlarm : Fb_TcAlarm;
|
||||
|
||||
_sName : STRING;
|
||||
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
// Inverter statemachine status register
|
||||
@@ -195,9 +200,120 @@ CASE _iState OF
|
||||
// If enable and INTLK Ok
|
||||
IF xEnable THEN
|
||||
_iState := 10;
|
||||
xCloseDCRelais := TRUE;
|
||||
//xCloseDCRelais := TRUE;
|
||||
_tonPollingTimer(IN := FALSE, PT := _timPollingDelay);
|
||||
ELSE
|
||||
_tonPollingTimer(IN := TRUE, PT := _timPollingDelay);
|
||||
END_IF
|
||||
|
||||
IF _tonPollingTimer.Q THEN
|
||||
_tonPollingTimer(IN := FALSE, PT := _timPollingDelay);
|
||||
_iState := 1;
|
||||
END_IF
|
||||
|
||||
1: // Read inverter status
|
||||
_fbReadRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
nTCPPort:= 502,
|
||||
nUnitID:= 16#FF, // 16#FF for Modbus TCP
|
||||
nQuantity:= 1,
|
||||
nMBAddr:= STATUS_REGISTER,
|
||||
cbLength:= SIZEOF(_uiInverterState),
|
||||
pDestAddr:= ADR(_uiInverterState),
|
||||
bExecute:= TRUE,
|
||||
tTimeout:= T#5S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
nErrId=> ,
|
||||
cbRead=> );
|
||||
|
||||
// Check if reading mudbus register is done
|
||||
IF NOT _fbReadRegister.bBusy THEN
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 2;
|
||||
ELSE
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
2: // IF inverter is not in STANDYB(8) STATE, send command to shutdown inverter
|
||||
IF (_uiInverterState = 8) OR (_uiInverterState = 1) THEN
|
||||
_iState := 3;
|
||||
ELSE
|
||||
_uiPCSSetOperation := 3;
|
||||
_iState := 200;
|
||||
END_IF
|
||||
|
||||
3: // Read current DC values
|
||||
_iErrorInState := _iState;
|
||||
_fbReadRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
nTCPPort:= 502,
|
||||
nUnitID:= 16#FF, // 16#FF for Modbus TCP
|
||||
nQuantity:= 6,
|
||||
nMBAddr:= DC_VALUES_START_REGISTER,
|
||||
cbLength:= SIZEOF(_awCurrentDCValues),
|
||||
pDestAddr:= ADR(_awCurrentDCValues),
|
||||
bExecute:= TRUE,
|
||||
tTimeout:= T#5S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
nErrId=> ,
|
||||
cbRead=> );
|
||||
|
||||
// Check if reading mudbus register is done
|
||||
IF NOT _fbReadRegister.bBusy THEN
|
||||
// If there was no error and the converter has no error continue
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 4;
|
||||
stCurrentValues.rActDCCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1])));
|
||||
stCurrentValues.rActDCVoltage := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3])));
|
||||
stCurrentValues.rActDCPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[5])));
|
||||
ELSE
|
||||
// Read error register
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
4: // Read current ac values
|
||||
_iErrorInState := _iState;
|
||||
_fbReadRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
nTCPPort:= 502,
|
||||
nUnitID:= 16#FF, // 16#FF for Modbus TCP
|
||||
nQuantity:= 10,
|
||||
nMBAddr:= AC_VALUES_START_REGISTER,
|
||||
cbLength:= SIZEOF(_awCurrentACValues),
|
||||
pDestAddr:= ADR(_awCurrentACValues),
|
||||
bExecute:= TRUE,
|
||||
tTimeout:= T#5S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
nErrId=> ,
|
||||
cbRead=> );
|
||||
|
||||
// Check if reading mudbus register is done
|
||||
IF NOT _fbReadRegister.bBusy THEN
|
||||
// If there was no error and the converter has no error continue
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
// Go back to polling state
|
||||
_iState := 0;
|
||||
stCurrentValues.rActACPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[1])));
|
||||
stCurrentValues.rActACFreq := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentACValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[3])));
|
||||
stCurrentValues.rActApparentPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[5])));
|
||||
stCurrentValues.rActReactivePower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[6]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[7])));
|
||||
stCurrentValues.rActPowerFactor := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[8]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[9])));
|
||||
ELSE
|
||||
// Read error register
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
|
||||
|
||||
10: // Wait for inverter to be online and in state STANDBY(8)
|
||||
_fbReadRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
@@ -529,8 +645,8 @@ CASE _iState OF
|
||||
IF NOT _fbWriteRegister.bBusy THEN
|
||||
// And there is no error, then continue
|
||||
IF NOT _fbWriteRegister.bError THEN
|
||||
_iState := 60;
|
||||
_uiPCSSetOperation := 1;
|
||||
_iState := 51;
|
||||
_uiPCSSetOperation := 4;
|
||||
ELSE
|
||||
xError := TRUE;
|
||||
// Goto error state
|
||||
@@ -539,6 +655,36 @@ CASE _iState OF
|
||||
_fbWriteRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
51: // Go to started
|
||||
_iErrorInState := _iState;
|
||||
_fbWriteRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
nTCPPort:= 502,
|
||||
nUnitID:= 16#FF, // 16#FF for Modbus TCP
|
||||
nQuantity:= 1,
|
||||
nMBAddr:= PCS_SET_OPERATION_REGISTER,
|
||||
cbLength:= SIZEOF(_uiPCSSetOperation),
|
||||
pSrcAddr:= ADR(_uiPCSSetOperation),
|
||||
bExecute:= TRUE,
|
||||
tTimeout:= T#5S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
nErrId=> );
|
||||
|
||||
// If writing modbus register is done
|
||||
IF NOT _fbWriteRegister.bBusy THEN
|
||||
// And there is no error, then continue
|
||||
IF NOT _fbWriteRegister.bError THEN
|
||||
_uiPCSSetOperation := 1;
|
||||
_iState := 60;
|
||||
ELSE
|
||||
// Goto error state
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
_fbWriteRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
|
||||
60: // Switch to THROTTLED mode
|
||||
_iErrorInState := _iState;
|
||||
_fbWriteRegister(
|
||||
@@ -616,8 +762,9 @@ CASE _iState OF
|
||||
END_IF
|
||||
ELSE
|
||||
xError := TRUE;
|
||||
_uiPCSSetOperation := 3;
|
||||
// Read error register
|
||||
_iState := 990;
|
||||
_iState := 200;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
@@ -644,8 +791,8 @@ CASE _iState OF
|
||||
// If there was no error and the converter has no error continue
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 85;
|
||||
stCurrentValues.rActDCCurrent := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1])));
|
||||
stCurrentValues.rActDCVoltage := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3])));
|
||||
stCurrentValues.rActDCCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1])));
|
||||
stCurrentValues.rActDCVoltage := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3])));
|
||||
stCurrentValues.rActDCPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[5])));
|
||||
ELSE
|
||||
// Read error register
|
||||
@@ -676,7 +823,7 @@ CASE _iState OF
|
||||
// If there was no error and the converter has no error continue
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
// Go back to polling state
|
||||
_iState := 65;
|
||||
_iState := 90;
|
||||
stCurrentValues.rActACPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[1])));
|
||||
stCurrentValues.rActACFreq := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentACValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[3])));
|
||||
stCurrentValues.rActApparentPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[5])));
|
||||
@@ -689,6 +836,34 @@ CASE _iState OF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
90: // Read current inverter status
|
||||
_fbReadRegister(
|
||||
sIPAddr:= sInverterIPAddr,
|
||||
nTCPPort:= 502,
|
||||
nUnitID:= 16#FF, // 16#FF for Modbus TCP
|
||||
nQuantity:= 1,
|
||||
nMBAddr:= STATUS_REGISTER,
|
||||
cbLength:= SIZEOF(_uiInverterState),
|
||||
pDestAddr:= ADR(_uiInverterState),
|
||||
bExecute:= TRUE,
|
||||
tTimeout:= T#5S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
nErrId=> ,
|
||||
cbRead=> );
|
||||
|
||||
// Check if reading mudbus register is done
|
||||
IF NOT _fbReadRegister.bBusy THEN
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 65;
|
||||
stCurrentValues.uiStatus := _uiInverterState;
|
||||
ELSE
|
||||
// Read error register
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
200: // Shutdown sequence
|
||||
_iErrorInState := _iState;
|
||||
_fbWriteRegister(
|
||||
@@ -710,8 +885,6 @@ CASE _iState OF
|
||||
// And there is no error, then continue
|
||||
IF NOT _fbWriteRegister.bError THEN
|
||||
_iState := 210;
|
||||
stCurrentValues.rActDCCurrent := 0.0;
|
||||
stCurrentValues.rActDCVoltage := 0.0;
|
||||
ELSE
|
||||
// Goto error state
|
||||
_iState := 1000;
|
||||
@@ -749,7 +922,7 @@ CASE _iState OF
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 0;
|
||||
xActive := FALSE;
|
||||
xCloseDCRelais := FALSE;
|
||||
//xCloseDCRelais := FALSE;
|
||||
END_IF
|
||||
_fbReadRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
@@ -805,13 +978,68 @@ CASE _iState OF
|
||||
xError := FALSE;
|
||||
_fbWriteRegister(bExecute := FALSE);
|
||||
END_IF
|
||||
|
||||
END_CASE]]></ST>
|
||||
END_CASE
|
||||
|
||||
IF xError AND (NOT _fbErrorInverterAlarm.bRaised) THEN
|
||||
_fbErrorInverterAlarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF (NOT xError) AND _fbErrorInverterAlarm.bRaised THEN
|
||||
_fbErrorInverterAlarm.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
IF (_fbErrorInverterAlarm.eConfirmationState = TcEventConfirmationState.WaitForConfirmation) AND xReset THEN
|
||||
_fbErrorInverterAlarm.Confirm(0);
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="FB_init" Id="{a80728a8-68c7-4f6a-87fc-246cb88104d4}">
|
||||
<Declaration><![CDATA[METHOD FB_init : BOOL
|
||||
VAR_INPUT
|
||||
bInitRetains : BOOL; // if TRUE, the retain variables are initialized (warm start / cold start)
|
||||
bInCopyCode : BOOL; // if TRUE, the instance afterwards gets moved into the copy code (online change)
|
||||
|
||||
sName : STRING;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_sName := sName;
|
||||
|
||||
// Create inverter main alarm
|
||||
_fbErrorInverterAlarm.CreateEx(stEventEntry := TC_EVENTS.Inverter.InverterError, bWithConfirmation := TRUE, 0);
|
||||
_fbErrorInverterAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<LineIds Name="FB_PowerSupplySunspec">
|
||||
<LineId Id="774" Count="10" />
|
||||
<LineId Id="1550" Count="0" />
|
||||
<LineId Id="785" Count="28" />
|
||||
<LineId Id="785" Count="4" />
|
||||
<LineId Id="2615" Count="0" />
|
||||
<LineId Id="790" Count="0" />
|
||||
<LineId Id="2614" Count="0" />
|
||||
<LineId Id="2613" Count="0" />
|
||||
<LineId Id="2616" Count="1" />
|
||||
<LineId Id="2906" Count="0" />
|
||||
<LineId Id="2618" Count="3" />
|
||||
<LineId Id="2623" Count="15" />
|
||||
<LineId Id="2622" Count="0" />
|
||||
<LineId Id="2639" Count="0" />
|
||||
<LineId Id="2644" Count="0" />
|
||||
<LineId Id="2641" Count="0" />
|
||||
<LineId Id="2643" Count="0" />
|
||||
<LineId Id="2642" Count="0" />
|
||||
<LineId Id="2721" Count="0" />
|
||||
<LineId Id="2640" Count="0" />
|
||||
<LineId Id="2645" Count="1" />
|
||||
<LineId Id="2648" Count="1" />
|
||||
<LineId Id="2651" Count="0" />
|
||||
<LineId Id="2722" Count="0" />
|
||||
<LineId Id="2652" Count="0" />
|
||||
<LineId Id="2650" Count="0" />
|
||||
<LineId Id="2653" Count="0" />
|
||||
<LineId Id="2656" Count="64" />
|
||||
<LineId Id="2654" Count="1" />
|
||||
<LineId Id="2647" Count="0" />
|
||||
<LineId Id="791" Count="22" />
|
||||
<LineId Id="1701" Count="5" />
|
||||
<LineId Id="814" Count="1" />
|
||||
<LineId Id="1714" Count="0" />
|
||||
@@ -866,7 +1094,14 @@ END_CASE]]></ST>
|
||||
<LineId Id="1493" Count="0" />
|
||||
<LineId Id="948" Count="23" />
|
||||
<LineId Id="1175" Count="0" />
|
||||
<LineId Id="972" Count="42" />
|
||||
<LineId Id="972" Count="4" />
|
||||
<LineId Id="2907" Count="1" />
|
||||
<LineId Id="2969" Count="18" />
|
||||
<LineId Id="3031" Count="0" />
|
||||
<LineId Id="2988" Count="5" />
|
||||
<LineId Id="2909" Count="0" />
|
||||
<LineId Id="2996" Count="0" />
|
||||
<LineId Id="977" Count="37" />
|
||||
<LineId Id="1560" Count="1" />
|
||||
<LineId Id="1015" Count="3" />
|
||||
<LineId Id="1127" Count="0" />
|
||||
@@ -876,6 +1111,7 @@ END_CASE]]></ST>
|
||||
<LineId Id="1099" Count="0" />
|
||||
<LineId Id="1045" Count="0" />
|
||||
<LineId Id="1176" Count="0" />
|
||||
<LineId Id="2723" Count="0" />
|
||||
<LineId Id="1046" Count="6" />
|
||||
<LineId Id="1063" Count="20" />
|
||||
<LineId Id="1090" Count="0" />
|
||||
@@ -891,10 +1127,18 @@ END_CASE]]></ST>
|
||||
<LineId Id="1776" Count="1" />
|
||||
<LineId Id="1762" Count="4" />
|
||||
<LineId Id="1738" Count="0" />
|
||||
<LineId Id="3213" Count="1" />
|
||||
<LineId Id="3216" Count="15" />
|
||||
<LineId Id="3215" Count="0" />
|
||||
<LineId Id="3232" Count="0" />
|
||||
<LineId Id="3240" Count="0" />
|
||||
<LineId Id="3234" Count="0" />
|
||||
<LineId Id="3236" Count="2" />
|
||||
<LineId Id="3235" Count="0" />
|
||||
<LineId Id="3239" Count="0" />
|
||||
<LineId Id="3233" Count="0" />
|
||||
<LineId Id="1093" Count="1" />
|
||||
<LineId Id="1102" Count="19" />
|
||||
<LineId Id="1166" Count="1" />
|
||||
<LineId Id="1122" Count="4" />
|
||||
<LineId Id="1102" Count="24" />
|
||||
<LineId Id="1054" Count="0" />
|
||||
<LineId Id="1295" Count="4" />
|
||||
<LineId Id="1128" Count="0" />
|
||||
@@ -917,8 +1161,21 @@ END_CASE]]></ST>
|
||||
<LineId Id="1293" Count="0" />
|
||||
<LineId Id="2235" Count="0" />
|
||||
<LineId Id="1291" Count="1" />
|
||||
<LineId Id="1056" Count="0" />
|
||||
<LineId Id="12" Count="0" />
|
||||
<LineId Id="2418" Count="0" />
|
||||
<LineId Id="2417" Count="0" />
|
||||
<LineId Id="2419" Count="1" />
|
||||
<LineId Id="2422" Count="0" />
|
||||
<LineId Id="2421" Count="0" />
|
||||
<LineId Id="2423" Count="1" />
|
||||
<LineId Id="2426" Count="0" />
|
||||
<LineId Id="2425" Count="0" />
|
||||
<LineId Id="2427" Count="1" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_PowerSupplySunspec.FB_init">
|
||||
<LineId Id="15" Count="1" />
|
||||
<LineId Id="11" Count="0" />
|
||||
<LineId Id="7" Count="1" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -4,28 +4,49 @@
|
||||
<Declaration><![CDATA[TYPE ST_SUNSPEC_CURRENT_VALUES :
|
||||
STRUCT
|
||||
// Current DC current (A)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActDCCurrent : REAL;
|
||||
|
||||
// Current DC voltage (V)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActDCVoltage : REAL;
|
||||
|
||||
// Current DC power (W)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActDCPower : REAL;
|
||||
|
||||
// Current AC power (W)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActACPower : REAL;
|
||||
|
||||
// Current AC frequency (Hz)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActACFreq : REAL;
|
||||
|
||||
// Current AC apparent power (VA)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActApparentPower : REAL;
|
||||
|
||||
// Current AC reactive power (VAr)
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActReactivePower : REAL;
|
||||
|
||||
// Current AC power factor
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
rActPowerFactor : REAL;
|
||||
|
||||
// Current inverter status
|
||||
{attribute 'OPC.UA.DA' := '1'}
|
||||
{attribute 'OPC.UA.DA.Access' := '1'}
|
||||
uiStatus : UINT;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
|
||||
Reference in New Issue
Block a user