Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
schumifabi committed Feb 27, 2024
1 parent df4d447 commit 6fd52ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public double calcRemainingTimeToCharge(ElectricVehicle ev) {

public static double getMaxRelativeSoc(Charger charger)
{
final Map<String,Double> maxRelativeSocByChargerType = Stream.of(new Object[][] {{ "private_ac", 0.8 },{ "public_dc", 0.8 }, { "public_ac", 0.9 }, { "default", 0.5 }}).collect(Collectors.toMap(data -> (String) data[0], data -> (double) data[1]));
final Map<String,Double> maxRelativeSocByChargerType = Stream.of(new Object[][] {{ "private_ac", 0.8 },{ "public_dc", 0.8 }, { "dc", 0.8 },{ "public_ac", 0.9 }, { "default", 0.5 }}).collect(Collectors.toMap(data -> (String) data[0], data -> (double) data[1]));
return maxRelativeSocByChargerType.getOrDefault(charger.getChargerType(), 1.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public void removeVehicle(ElectricVehicle ev, double now) {
if (pluggedVehicles.remove(ev.getId()) != null) {// successfully removed
eventsManager.processEvent(new ChargingEndEvent(now, charger.getId(), ev.getId(), ev.getBattery().getSoc()/ ev.getBattery().getCapacity(),now-plugInTimestamps.get(ev.getId())));
listeners.remove(ev.getId()).notifyChargingEnded(ev, now);
eventsManager.processEvent(new UnpluggingEvent(now, charger.getId(), ev.getId(), now-plugInTimestamps.get(ev.getId())));

if (!queuedVehicles.isEmpty()) {
plugVehicle(queuedVehicles.poll(), now);
}
} else {
// make sure ev was in the queue
Preconditions.checkState(queuedVehicles.remove(ev), "Vehicle (%s) is neither queued nor plugged at charger (%s)", ev.getId(),
charger.getId());
Preconditions.checkState(queuedVehicles.remove(ev), "Vehicle (%s) is neither queued nor plugged at charger (%s)", ev.getId(), charger.getId());
eventsManager.processEvent(new QuitQueueAtChargerEvent(now, charger.getId(), ev.getId()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import de.tum.mw.ftm.matsim.contrib.urban_ev.scoring.ChargingBehaviourScoringEvent;
import de.tum.mw.ftm.matsim.contrib.urban_ev.scoring.ChargingBehaviourScoringEvent.ScoreTrigger;
import de.tum.mw.ftm.matsim.contrib.urban_ev.utils.PlanUtils;
import de.tum.mw.ftm.matsim.contrib.urban_ev.charging.ChargeUpToTypeMaxSocStrategy;
//import de.tum.mw.ftm.matsim.contrib.urban_ev.charging.ChargeUpToTypeMaxSocStrategy;

import org.apache.log4j.Logger;
import org.matsim.api.core.v01.Coord;
Expand Down Expand Up @@ -247,7 +247,8 @@ public void handleEvent(ActivityEndEvent event) {
ChargingWithQueueingLogic chargingLogic = (ChargingWithQueueingLogic) charger.getLogic();
double plugInTS = chargingLogic.getPlugInTimestamps().get(evId);

unplugVehicle(evId, event.getTime());
// unplug after issung the event!
//unplugVehicle(evId, event.getTime());

double walkingDistance = DistanceUtils.calculateDistance(activityCoord, charger.getCoord());
double pluggedDuration = event.getTime()-plugInTS;
Expand Down Expand Up @@ -310,6 +311,8 @@ public void handleEvent(ActivityEndEvent event) {
ScoreTrigger.ACTIVITYEND
)
);

unplugVehicle(evId, event.getTime());
}
else
{
Expand Down

0 comments on commit 6fd52ed

Please sign in to comment.