Skip to content

Commit

Permalink
Merge pull request #2950 from matsim-org/evRoutingModule
Browse files Browse the repository at this point in the history
ev: make a reasonable assumption about power compatibility during routing
  • Loading branch information
tschlenther authored Nov 20, 2023
2 parents 7bfa5f4 + 4b5805d commit 18d5a95
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
* *********************************************************************** */
package org.matsim.contrib.ev.routing;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
Expand All @@ -32,14 +26,17 @@
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.Person;
import org.matsim.api.core.v01.population.PlanElement;
import org.matsim.contrib.common.util.StraightLineKnnFinder;
import org.matsim.contrib.ev.EvConfigGroup;
import org.matsim.contrib.ev.charging.VehicleChargingHandler;
import org.matsim.contrib.ev.discharging.AuxEnergyConsumption;
import org.matsim.contrib.ev.discharging.DriveEnergyConsumption;
import org.matsim.contrib.ev.fleet.*;
import org.matsim.contrib.ev.fleet.ElectricFleetSpecification;
import org.matsim.contrib.ev.fleet.ElectricFleetUtils;
import org.matsim.contrib.ev.fleet.ElectricVehicle;
import org.matsim.contrib.ev.fleet.ElectricVehicleSpecification;
import org.matsim.contrib.ev.infrastructure.ChargerSpecification;
import org.matsim.contrib.ev.infrastructure.ChargingInfrastructureSpecification;
import org.matsim.contrib.common.util.StraightLineKnnFinder;
import org.matsim.core.gbl.Gbl;
import org.matsim.core.gbl.MatsimRandom;
import org.matsim.core.network.NetworkUtils;
Expand All @@ -54,6 +51,8 @@
import org.matsim.facilities.Facility;
import org.matsim.vehicles.Vehicle;

import java.util.*;

/**
* This network Routing module adds stages for re-charging into the Route.
* This wraps a "computer science" {@link LeastCostPathCalculator}, which routes from a node to another node, into something that
Expand Down Expand Up @@ -156,8 +155,10 @@ public List<? extends PlanElement> calcRoute(RoutingRequest request) {
stagedRoute.add(lastLeg);
Activity chargeAct = PopulationUtils.createStageActivityFromCoordLinkIdAndModePrefix(selectedChargerLink.getCoord(),
selectedChargerLink.getId(), stageActivityModePrefix);
chargeAct = PopulationUtils.createActivity(chargeAct); // createStageActivity... creates a InteractionActivity where duration cannot be set.
double maxPowerEstimate = Math.min(selectedCharger.getPlugPower(), ev.getBatteryCapacity() / 3.6);
// createStageActivity... creates a InteractionActivity where duration cannot be set.
chargeAct = PopulationUtils.createActivity(chargeAct);
// assume that the battery is compatible with a power that allows for full charge within one hour (cf. FixedSpeedCharging)
double maxPowerEstimate = Math.min(selectedCharger.getPlugPower(), ev.getBatteryCapacity() / 3600);
double estimatedChargingTime = (ev.getBatteryCapacity() * 1.5) / maxPowerEstimate;
chargeAct.setMaximumDuration(Math.max(evConfigGroup.minimumChargeTime, estimatedChargingTime));
lastArrivaltime += chargeAct.getMaximumDuration().seconds();
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 18d5a95

Please sign in to comment.