Skip to content

Commit

Permalink
Merge pull request #3084 from steffenaxer/DriveDischargingHandlerFix
Browse files Browse the repository at this point in the history
Fix DriveDischargingHandler
  • Loading branch information
steffenaxer authored Jan 31, 2024
2 parents 56e60eb + a54776d commit 70b6748
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.events.MobsimScopeEventHandler;
import org.matsim.core.mobsim.qsim.InternalInterface;
import org.matsim.core.mobsim.qsim.QSim;
import org.matsim.core.mobsim.qsim.interfaces.MobsimEngine;
import org.matsim.vehicles.Vehicle;

Expand Down Expand Up @@ -77,9 +78,10 @@ private boolean isOnFirstLink() {

private final Queue<LinkLeaveEvent> linkLeaveEvents = new ConcurrentLinkedQueue<>();
private final Queue<VehicleLeavesTrafficEvent> trafficLeaveEvents = new ConcurrentLinkedQueue<>();

private final QSim qsim;
@Inject
DriveDischargingHandler(ElectricFleet data, Network network, EventsManager eventsManager) {
DriveDischargingHandler(QSim qsim, ElectricFleet data, Network network, EventsManager eventsManager) {
this.qsim = qsim;
this.network = network;
this.eventsManager = eventsManager;
eVehicles = data.getElectricVehicles();
Expand Down Expand Up @@ -116,7 +118,7 @@ public void onPrepareSim() {
@Override
public void afterSim() {
// process remaining events
doSimStep(Double.POSITIVE_INFINITY);
doSimStep(this.qsim.getSimTimer().getTimeOfDay());
}

@Override
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions contribs/vsp/src/test/java/playground/vsp/ev/UrbanEVIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.EventsFileComparator;

import java.net.URL;

public class UrbanEVIT {
@RegisterExtension private MatsimTestUtils utils = new MatsimTestUtils();

Expand Down
Binary file not shown.

0 comments on commit 70b6748

Please sign in to comment.