Change E-Stop so that it can also work with one string
- Also optimized CV charging
This commit is contained in:
@@ -214,12 +214,17 @@ VAR
|
||||
_fbLimit : FB_Limit;
|
||||
_xCVChargingLatched : BOOL;
|
||||
_rCVSetpoint : REAL;
|
||||
_xStringsFullCV : BOOL;
|
||||
|
||||
_rPowerDH : REAL;
|
||||
_xDHActive : BOOL;
|
||||
_fbTONDHCycleTime : TON := (PT := T#15M);
|
||||
|
||||
_xFullByVoltage : BOOL;
|
||||
_xFullByCV : BOOL;
|
||||
_fbTONCVLow : TON;
|
||||
_xCVCurrentLimitReached : BOOL;
|
||||
_fbPT1CVAntiAliasFilter : FB_PT1Filter;
|
||||
|
||||
// tower light
|
||||
_fbTowerLight : FB_TowerLight;
|
||||
END_VAR
|
||||
@@ -1116,7 +1121,7 @@ _fbTowerLight(
|
||||
_xBatteryActive := TRUE;
|
||||
|
||||
// Check if the battery should still be active
|
||||
IF (_rAutoPowerRequest = 0.0) AND ((NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) OR (NOT _xDHActive)) THEN
|
||||
IF (_rAutoPowerRequest = 0.0) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND (NOT _xDHActive) THEN
|
||||
_xNoPowerRequested := TRUE;
|
||||
ELSE
|
||||
_xNoPowerRequested := FALSE;
|
||||
@@ -1164,10 +1169,7 @@ _fbTowerLight(
|
||||
_xCVChargingLatched := TRUE;
|
||||
END_IF
|
||||
|
||||
// Delatch if charging power requested is lower than cv power
|
||||
//IF _xCVChargingLatched AND (_rAutoPowerRequest > _rPowerInverter) THEN
|
||||
// _xCVChargingLatched := FALSE;
|
||||
//END_IF
|
||||
|
||||
|
||||
IF _xCVChargingLatched THEN
|
||||
// Reglerfreigabe
|
||||
@@ -1177,31 +1179,43 @@ _fbTowerLight(
|
||||
_rCVSetpoint := _rHighestSegmentVoltage;
|
||||
END_IF
|
||||
|
||||
_fbPT1CVAntiAliasFilter(rInput := _rHighestSegmentVoltage, timT := T#200MS);
|
||||
|
||||
_fbPIControl(
|
||||
xEnable := _xCVChargingLatched,
|
||||
rSP:= _rCVSetpoint,
|
||||
rPV:= _rHighestSegmentVoltage,
|
||||
rPV:= _fbPT1CVAntiAliasFilter.rOutput,
|
||||
rKp:= GVL_CONFIG.rCVKp,
|
||||
rTn:= GVL_CONFIG.rCVTn,
|
||||
xSaturated:= _fbLimit.xClamped);
|
||||
|
||||
_rPowerInverter := _rAutoPowerRequest - _fbPIControl.rMV;
|
||||
_rPowerInverter := _rAutoPowerRequest - _fbPIControl.rMV;
|
||||
|
||||
_fbLimit(
|
||||
rIn := _rPowerInverter,
|
||||
rMin := _rMinPower,
|
||||
rMax := _rMaxPower,
|
||||
rOut => _rPowerInverter);
|
||||
|
||||
IF ((GVL_SCADA.stHMIInterface[0].stInverterData.rActDCCurrent > GVL_CONFIG.rMinCVCurrentForFull) AND GVL_CONFIG.axStringEnabled[0]) OR ((GVL_SCADA.stHMIInterface[1].stInverterData.rActDCCurrent > GVL_CONFIG.rMinCVCurrentForFull) AND GVL_CONFIG.axStringEnabled[1]) THEN
|
||||
_xStringsFullCV := TRUE;
|
||||
ELSE
|
||||
_xStringsFullCV := FALSE;
|
||||
|
||||
// Delatch if charging power requested is lower than cv power
|
||||
IF _xCVChargingLatched AND (_rAutoPowerRequest > _rPowerInverter) THEN
|
||||
_xCVChargingLatched := FALSE;
|
||||
END_IF
|
||||
|
||||
_xFullByVoltage := (NOT GVL_CONFIG.xCVCharging)
|
||||
AND (_rPowerInverter < 0)
|
||||
AND ((_rMaxCurrentInverterDCVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) OR (_rHighestSegmentVoltage >= GVL_CONFIG.rMaximumUnitVoltage));
|
||||
|
||||
_xCVCurrentLimitReached := ((GVL_SCADA.stHMIInterface[0].stInverterData.rActDCCurrent > GVL_CONFIG.rMinCVCurrentForFull) AND GVL_CONFIG.axStringEnabled[0]) OR ((GVL_SCADA.stHMIInterface[1].stInverterData.rActDCCurrent > GVL_CONFIG.rMinCVCurrentForFull) AND GVL_CONFIG.axStringEnabled[1]);
|
||||
_fbTONCVLow(
|
||||
IN := (_rPowerInverter < 0) AND _xCVCurrentLimitReached AND _xCVChargingLatched,
|
||||
PT := GVL_CONFIG.timCVCurrentReached
|
||||
);
|
||||
|
||||
_xFullByCV := GVL_CONFIG.xCVCharging AND _fbTONCVLow.Q;
|
||||
|
||||
// Shutdown triggered by battery fully charged
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING
|
||||
AND ((_rMaxCurrentInverterDCVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) OR (_rHighestSegmentVoltage >= GVL_CONFIG.rMaximumUnitVoltage AND (NOT _xCVChargingLatched)) OR _xStringsFullCV) THEN
|
||||
//OR (_xCVChargingLatched AND ((ABS(GVL_SCADA.stHMIInterface[0].rCurrent) < 8.0) OR (ABS(GVL_SCADA.stHMIInterface[0].rCurrent) < 8.0)))
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_xFullByVoltage OR _xFullByCV) THEN
|
||||
_xGetPowerMeterData := TRUE;
|
||||
IF (_eBMSControlMode = E_BMS_CONTROL_MODE.CYCLING) THEN
|
||||
GVL_SCADA.eCycleStatus := E_CYCLE_STATUS.DISCHARGE_STARTED;
|
||||
@@ -1209,6 +1223,7 @@ _fbTowerLight(
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := REAL_TO_DINT(_rAutoPowerRequest);
|
||||
ELSE
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
_fbTONCVLow(In := FALSE);
|
||||
|
||||
// Send message
|
||||
_fbBatteryFullMessage.Send(0);
|
||||
|
||||
Reference in New Issue
Block a user