Added functionality in IEVController and DummyEVController which enables a predefined number of loops for ChargingStatusReq/-Res and CurrentDemandReq/-Res message pairs
This commit is contained in:
parent
777a2934ba
commit
d933ba39ad
|
@ -54,10 +54,12 @@ public class DummyEVController implements IACEVController, IDCEVController {
|
|||
private Logger logger = LogManager.getLogger(this.getClass().getSimpleName());
|
||||
private V2GCommunicationSessionEVCC commSessionContext;
|
||||
private CPStates cpState;
|
||||
private int chargingLoopCounter;
|
||||
|
||||
public DummyEVController(V2GCommunicationSessionEVCC commSessionContext) {
|
||||
setCommSessionContext(commSessionContext);
|
||||
setCPState(CPStates.STATE_B); // should be signaled before ISO/IEC 15118 stack initializes
|
||||
setChargingLoopCounter((short) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -299,4 +301,22 @@ public class DummyEVController implements IACEVController, IDCEVController {
|
|||
short multiplier = (short) (evseMaxCurrent.getMultiplier() & 0xFF);
|
||||
getLogger().info("Adjusting max current to " + evseMaxCurrent.getValue() * Math.pow(10, multiplier) + " A");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChargingLoopActive() {
|
||||
// Keep charging until 10 charging loops are finished
|
||||
if (getChargingLoopCounter() < 10) {
|
||||
setChargingLoopCounter(getChargingLoopCounter() + 1);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getChargingLoopCounter() {
|
||||
return chargingLoopCounter;
|
||||
}
|
||||
|
||||
public void setChargingLoopCounter(int chargingLoopCounter) {
|
||||
this.chargingLoopCounter = chargingLoopCounter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,4 +76,12 @@ public interface IEVController {
|
|||
* @return The respective CP state
|
||||
*/
|
||||
public CPStates getCPState();
|
||||
|
||||
|
||||
/**
|
||||
* Provides information on whether the charging loop should be active to charge the EV's battery, or not
|
||||
*
|
||||
* @return True, if charging process should be continued, false otherwise
|
||||
*/
|
||||
public boolean isChargingLoopActive();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.v2gclarity.risev2g.shared.messageHandling.ReactionToIncomingMessage;
|
|||
import org.v2gclarity.risev2g.shared.messageHandling.TerminateSession;
|
||||
import org.v2gclarity.risev2g.shared.utils.SecurityUtils;
|
||||
import org.v2gclarity.risev2g.shared.v2gMessages.msgDef.ChargeProgressType;
|
||||
import org.v2gclarity.risev2g.shared.v2gMessages.msgDef.ChargingStatusReqType;
|
||||
import org.v2gclarity.risev2g.shared.v2gMessages.msgDef.ChargingStatusResType;
|
||||
import org.v2gclarity.risev2g.shared.v2gMessages.msgDef.MeteringReceiptReqType;
|
||||
import org.v2gclarity.risev2g.shared.v2gMessages.msgDef.V2GMessage;
|
||||
|
@ -102,11 +103,15 @@ public class WaitForChargingStatusRes extends ClientState {
|
|||
default:
|
||||
// TODO regard [V2G2-305] (new SalesTariff if EAmount not yet met and tariff finished)
|
||||
|
||||
// TODO check somehow if charging is stopped by EV, otherwise send new ChargingStatusReq
|
||||
getCommSessionContext().setStopChargingRequested(true);
|
||||
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),
|
||||
V2GMessages.POWER_DELIVERY_RES,
|
||||
" (ChargeProgress = STOP_CHARGING)");
|
||||
if (getCommSessionContext().getEvController().isChargingLoopActive()) {
|
||||
ChargingStatusReqType chargingStatusReq = new ChargingStatusReqType();
|
||||
return getSendMessage(chargingStatusReq, V2GMessages.CHARGING_STATUS_RES);
|
||||
} else {
|
||||
getCommSessionContext().setStopChargingRequested(true);
|
||||
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),
|
||||
V2GMessages.POWER_DELIVERY_RES,
|
||||
" (ChargeProgress = STOP_CHARGING)");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return new TerminateSession("Incoming message raised an error");
|
||||
|
|
|
@ -96,12 +96,14 @@ public class WaitForCurrentDemandRes extends ClientState {
|
|||
default:
|
||||
// TODO regard [V2G2-305] (new SalesTariff if EAmount not yet met and tariff finished)
|
||||
|
||||
// TODO check somehow if charging is stopped by EV, otherwise send new CurrentDemandReq
|
||||
|
||||
getCommSessionContext().setStopChargingRequested(true);
|
||||
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),
|
||||
V2GMessages.POWER_DELIVERY_RES,
|
||||
" (ChargeProgress = STOP_CHARGING)");
|
||||
if (getCommSessionContext().getEvController().isChargingLoopActive()) {
|
||||
return getSendMessage(getCurrentDemandReq(), V2GMessages.CURRENT_DEMAND_RES);
|
||||
} else {
|
||||
getCommSessionContext().setStopChargingRequested(true);
|
||||
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),
|
||||
V2GMessages.POWER_DELIVERY_RES,
|
||||
" (ChargeProgress = STOP_CHARGING)");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return new TerminateSession("Incoming message raised an error");
|
||||
|
|
Loading…
Reference in New Issue