Added mechanism in DummyEVController to trigger a renegotiation after 50 charging loops. Modified WaitForChargingStatusRes, WaitForCurrentDemandRes, and WaitForMeteringReceiptRes accordingly.

This commit is contained in:
Marc Mültin 2019-08-17 18:58:36 +02:00
parent 5d27f228f3
commit e4cc39807e
4 changed files with 46 additions and 6 deletions

View File

@ -308,6 +308,16 @@ public class DummyEVController implements IACEVController, IDCEVController {
// Keep charging until 100 charging loops are finished
if (getChargingLoopCounter() < 100) {
setChargingLoopCounter(getChargingLoopCounter() + 1);
/*
* OPTIONAL:
* Trigger a renegotiation after 50 charging loops (for testing purposes); you can comment this out if you do not want to test an EV-triggered renegotiation
*/
if (getChargingLoopCounter() == 50) {
getCommSessionContext().setRenegotiationRequested(true);
getLogger().debug("EV triggered a renegotiation (for testing purposes)");
}
return true;
} else
return false;

View File

@ -99,6 +99,7 @@ public class WaitForChargingStatusRes extends ClientState {
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = STOP_CHARGING)");
case RE_NEGOTIATION:
getCommSessionContext().setRenegotiationRequested(true);
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.RENEGOTIATE),
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = RE_NEGOTIATION)");
@ -106,8 +107,15 @@ public class WaitForChargingStatusRes extends ClientState {
// TODO regard [V2G2-305] (new SalesTariff if EAmount not yet met and tariff finished)
if (getCommSessionContext().getEvController().isChargingLoopActive()) {
ChargingStatusReqType chargingStatusReq = new ChargingStatusReqType();
return getSendMessage(chargingStatusReq, V2GMessages.CHARGING_STATUS_RES);
// Check whether or not the EV controller triggered a renegotiation
if (getCommSessionContext().isRenegotiationRequested()) {
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.RENEGOTIATE),
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = RE_NEGOTIATION)");
} else {
ChargingStatusReqType chargingStatusReq = new ChargingStatusReqType();
return getSendMessage(chargingStatusReq, V2GMessages.CHARGING_STATUS_RES);
}
} else {
getCommSessionContext().setStopChargingRequested(true);
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),

View File

@ -30,6 +30,7 @@ import com.v2gclarity.risev2g.shared.messageHandling.ReactionToIncomingMessage;
import com.v2gclarity.risev2g.shared.messageHandling.TerminateSession;
import com.v2gclarity.risev2g.shared.utils.SecurityUtils;
import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.ChargeProgressType;
import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.ChargingStatusReqType;
import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.CurrentDemandResType;
import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.DCEVSEStatusType;
import com.v2gclarity.risev2g.shared.v2gMessages.msgDef.EVSENotificationType;
@ -100,7 +101,14 @@ public class WaitForCurrentDemandRes extends ClientState {
// TODO regard [V2G2-305] (new SalesTariff if EAmount not yet met and tariff finished)
if (getCommSessionContext().getEvController().isChargingLoopActive()) {
return getSendMessage(getCurrentDemandReq(), V2GMessages.CURRENT_DEMAND_RES);
// Check whether or not the EV controller triggered a renegotiation
if (getCommSessionContext().isRenegotiationRequested()) {
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.RENEGOTIATE),
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = RE_NEGOTIATION)");
} else {
return getSendMessage(getCurrentDemandReq(), V2GMessages.CURRENT_DEMAND_RES);
}
} else {
getCommSessionContext().setStopChargingRequested(true);
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),

View File

@ -78,10 +78,24 @@ public class WaitForMeteringReceiptRes extends ClientState {
// TODO regard [V2G2-305] (new SalesTariff if EAmount not yet met and tariff finished)
if (isAcCharging() && getCommSessionContext().getEvController().isChargingLoopActive()) {
ChargingStatusReqType chargingStatusReq = new ChargingStatusReqType();
return getSendMessage(chargingStatusReq, V2GMessages.CHARGING_STATUS_RES);
// Check whether or not the EV controller triggered a renegotiation
if (getCommSessionContext().isRenegotiationRequested()) {
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.RENEGOTIATE),
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = RE_NEGOTIATION)");
} else {
ChargingStatusReqType chargingStatusReq = new ChargingStatusReqType();
return getSendMessage(chargingStatusReq, V2GMessages.CHARGING_STATUS_RES);
}
} else if (getCommSessionContext().getEvController().isChargingLoopActive()) {
return getSendMessage(getCurrentDemandReq(), V2GMessages.CURRENT_DEMAND_RES);
// Check whether or not the EV controller triggered a renegotiation
if (getCommSessionContext().isRenegotiationRequested()) {
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.RENEGOTIATE),
V2GMessages.POWER_DELIVERY_RES,
" (ChargeProgress = RE_NEGOTIATION)");
} else {
return getSendMessage(getCurrentDemandReq(), V2GMessages.CURRENT_DEMAND_RES);
}
} else {
getCommSessionContext().setStopChargingRequested(true);
return getSendMessage(getPowerDeliveryReq(ChargeProgressType.STOP),