Skip to content

Commit

Permalink
Merge branch 'master' into scaleInflowCapBoundAccordingToFlowCapFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tthunig authored Mar 10, 2025
2 parents d6ba805 + 2d41090 commit a15976f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ public EDrtAssignShiftToVehicleLogic(AssignShiftToVehicleLogic delegate, ShiftsP
@Override
public boolean canAssignVehicleToShift(ShiftDvrpVehicle vehicle, DrtShift shift) {

// no, if charging
if(vehicle.getSchedule().getStatus() == Schedule.ScheduleStatus.STARTED) {
final Task currentTask = vehicle.getSchedule().getCurrentTask();
if (currentTask instanceof EDrtWaitForShiftTask) {
if (((EDrtWaitForShiftTask) currentTask).getChargingTask() != null) {
if (currentTask.getEndTime() > shift.getStartTime()) {
return false;
}
}
}
}

// no, if below battery threshold
if (vehicle instanceof EvShiftDvrpVehicle) {
final Battery battery = ((EvShiftDvrpVehicle) vehicle).getElectricVehicle().getBattery();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.matsim.contrib.drt.extension.operations.eshifts.run;

import com.google.inject.Singleton;
import org.matsim.api.core.v01.network.Network;
import org.matsim.contrib.drt.extension.DrtWithExtensionsConfigGroup;
import org.matsim.contrib.drt.extension.edrt.EDrtActionCreator;
Expand All @@ -9,18 +10,13 @@
import org.matsim.contrib.drt.extension.operations.DrtOperationsParams;
import org.matsim.contrib.drt.extension.operations.eshifts.dispatcher.EDrtAssignShiftToVehicleLogic;
import org.matsim.contrib.drt.extension.operations.eshifts.dispatcher.EDrtShiftDispatcherImpl;
import org.matsim.contrib.drt.extension.operations.eshifts.dispatcher.EDrtShiftStartLogic;
import org.matsim.contrib.drt.extension.operations.eshifts.schedule.ShiftEDrtActionCreator;
import org.matsim.contrib.drt.extension.operations.eshifts.schedule.ShiftEDrtTaskFactoryImpl;
import org.matsim.contrib.drt.extension.operations.eshifts.scheduler.EShiftTaskScheduler;
import org.matsim.contrib.drt.extension.operations.operationFacilities.OperationFacilities;
import org.matsim.contrib.drt.extension.operations.operationFacilities.OperationFacilityFinder;
import org.matsim.contrib.drt.extension.operations.shifts.config.ShiftsParams;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.DefaultAssignShiftToVehicleLogic;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.DefaultShiftStartLogic;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.DrtShiftDispatcher;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.DrtShiftDispatcherImpl;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.ShiftScheduler;
import org.matsim.contrib.drt.extension.operations.shifts.dispatcher.*;
import org.matsim.contrib.drt.extension.operations.shifts.optimizer.ShiftVehicleDataEntryFactory;
import org.matsim.contrib.drt.extension.operations.shifts.schedule.ShiftDrtActionCreator;
import org.matsim.contrib.drt.extension.operations.shifts.schedule.ShiftDrtTaskFactory;
Expand All @@ -44,8 +40,6 @@
import org.matsim.core.router.costcalculators.TravelDisutilityFactory;
import org.matsim.core.router.util.TravelTime;

import com.google.inject.Singleton;

/**
* @author nkuehnel / MOIA
*/
Expand Down Expand Up @@ -75,7 +69,7 @@ protected void configureQSim() {
new DrtShiftDispatcherImpl(getMode(), getter.getModal(Fleet.class), getter.get(MobsimTimer.class),
getter.getModal(OperationFacilities.class), getter.getModal(OperationFacilityFinder.class),
getter.getModal(ShiftTaskScheduler.class), getter.getModal(Network.class), getter.get(EventsManager.class),
drtShiftParams, new EDrtShiftStartLogic(new DefaultShiftStartLogic()),
drtShiftParams, new DefaultShiftStartLogic(),
new EDrtAssignShiftToVehicleLogic(new DefaultAssignShiftToVehicleLogic(drtShiftParams), drtShiftParams),
getter.getModal(ShiftScheduler.class)),
getter.getModal(Fleet.class), getter.getModal(ChargingStrategy.Factory.class)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ public void startShift(ShiftDvrpVehicle vehicle, double now, DrtShift shift) {
if (stayTask instanceof WaitForShiftTask) {
((WaitForShiftTask) stayTask).getFacility().deregisterVehicle(vehicle.getId());
stayTask.setEndTime(now);
if(stayTask instanceof EDrtWaitForShiftTask eTask) {
if(eTask.getChargingTask() != null) {
eTask.getChargingTask().getChargingLogic().removeVehicle(eTask.getChargingTask().getElectricVehicle(), now);
eTask.setEndTime(now);
}
}
if (Schedules.getLastTask(schedule).equals(stayTask)) {
//nothing planned yet.
schedule.addTask(taskFactory.createStayTask(vehicle, now, shift.getEndTime(), stayTask.getLink()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ConflictWriter provideConflictWriter(OutputDirectoryHierarchy outputDirectoryHie
@Provides
@Singleton
ConflictManager provideConflictManager(Set<ConflictResolver> resolvers, ConflictWriter writer) {
if (!getConfig().replanning().getPlanSelectorForRemoval()
if (resolvers.size() > 0 && !getConfig().replanning().getPlanSelectorForRemoval()
.equals(WorstPlanForRemovalSelectorWithConflicts.SELECTOR_NAME)) {
logger.warn("The replanning.planSelectorForRemoval is not set to "
+ WorstPlanForRemovalSelectorWithConflicts.SELECTOR_NAME
Expand Down

0 comments on commit a15976f

Please sign in to comment.