Skip to content

Commit

Permalink
Merge branch 'master' into zoneBasedRebalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuehnel authored Dec 6, 2024
2 parents 1c9bf2f + 14f15b2 commit fd82b8f
Show file tree
Hide file tree
Showing 291 changed files with 1,909 additions and 3,313 deletions.
6 changes: 3 additions & 3 deletions contribs/accessibility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>matrixbasedptrouter</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>roadpricing</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
Expand Down Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>analysis</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.matsim.contrib</groupId>-->
Expand Down
2 changes: 1 addition & 1 deletion contribs/analysis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>roadpricing</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.osgeo</groupId>
Expand Down
18 changes: 9 additions & 9 deletions contribs/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,37 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>otfvis</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>osm</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>sumo</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>analysis</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>emissions</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>noise</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>freight</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<exclusions>
<!-- Logging levels are all messed up without this exclusion -->
<exclusion>
Expand All @@ -87,7 +87,7 @@
<dependency>
<groupId>com.github.matsim-org</groupId>
<artifactId>gtfs2matsim</artifactId>
<version>47b0802a29</version>
<version>19f1676fc6</version>
<exclusions>
<!-- Exclude unneeded dependencies and these with known CVE -->
<exclusion>
Expand Down Expand Up @@ -151,7 +151,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>dvrp</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
import org.matsim.core.utils.io.IOUtils;
import org.matsim.pt.transitSchedule.api.*;
import org.matsim.pt.utils.CreatePseudoNetwork;
import org.matsim.pt.utils.CreatePseudoNetworkWithLoopLinks;
import org.matsim.pt.utils.TransitScheduleValidator;
import org.matsim.vehicles.*;
import picocli.CommandLine;

import java.io.File;
import java.nio.file.Path;
import java.time.LocalDate;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;

Expand Down Expand Up @@ -85,8 +89,8 @@ public class CreateTransitScheduleFromGtfs implements MATSimAppCommand {
@CommandLine.Option(names = "--transform-schedule", description = "Fully qualified class name to a Consumer<TransitSchedule> to be executed after the schedule was created", arity = "0..*", split = ",")
private List<Class<?>> transformSchedule;

@CommandLine.Option(names = "--merge-stops", description = "Whether stops should be merged by coordinate")
private boolean mergeStops;
@CommandLine.Option(names = "--merge-stops", description = "Whether stops should be merged by coordinate", defaultValue = "doNotMerge")
private GtfsConverter.MergeGtfsStops mergeStops;

@CommandLine.Option(names = "--prefix", description = "Prefixes to add to the gtfs ids. Required if multiple inputs are used and ids are not unique.", split = ",")
private List<String> prefixes = new ArrayList<>();
Expand All @@ -100,10 +104,29 @@ public class CreateTransitScheduleFromGtfs implements MATSimAppCommand {
@CommandLine.Option(names = "--shp-crs", description = "Overwrite coordinate system of the shape file")
private String shpCrs;

@CommandLine.Option(names = "--pseudo-network", description = "Define how the pseudo network should be created", defaultValue = "singleLinkBetweenStops")
private PseudoNetwork pseudoNetwork;


public static void main(String[] args) {
System.exit(new CommandLine(new CreateTransitScheduleFromGtfs()).execute(args));
}

private static void addHbefaMapping(VehicleType vehicleType, HbefaVehicleCategory category) {
EngineInformation carEngineInformation = vehicleType.getEngineInformation();
VehicleUtils.setHbefaVehicleCategory(carEngineInformation, String.valueOf(category));
VehicleUtils.setHbefaTechnology(carEngineInformation, "average");
VehicleUtils.setHbefaSizeClass(carEngineInformation, "average");
VehicleUtils.setHbefaEmissionsConcept(carEngineInformation, "average");
vehicleType.setNetworkMode(TransportMode.pt);
}

private static void increaseLinkFreespeedIfLower(Link link, double newFreespeed) {
if (link.getFreespeed() < newFreespeed) {
link.setFreespeed(newFreespeed);
}
}

@Override
public Integer call() throws Exception {

Expand Down Expand Up @@ -237,14 +260,19 @@ private Predicate<Stop> createFilter(int i) throws Exception {
/**
* Creates the pt scenario and network.
*/
private static Scenario getScenarioWithPseudoPtNetworkAndTransitVehicles(Network network, TransitSchedule schedule, String ptNetworkIdentifier) {
private Scenario getScenarioWithPseudoPtNetworkAndTransitVehicles(Network network, TransitSchedule schedule, String ptNetworkIdentifier) {
ScenarioUtils.ScenarioBuilder builder = new ScenarioUtils.ScenarioBuilder(ConfigUtils.createConfig());
builder.setNetwork(network);
builder.setTransitSchedule(schedule);
Scenario scenario = builder.build();

// add pseudo network for pt
new CreatePseudoNetwork(scenario.getTransitSchedule(), scenario.getNetwork(), ptNetworkIdentifier, 0.1, 100000.0).createNetwork();
switch (pseudoNetwork) {
case singleLinkBetweenStops ->
new CreatePseudoNetwork(scenario.getTransitSchedule(), scenario.getNetwork(), ptNetworkIdentifier, 0.1, 100000.0).createNetwork();
case withLoopLinks ->
new CreatePseudoNetworkWithLoopLinks(scenario.getTransitSchedule(), scenario.getNetwork(), ptNetworkIdentifier, 0.1, 100000.0).createNetwork();
}

// create TransitVehicle types
// see https://svn.vsp.tu-berlin.de/repos/public-svn/publications/vspwp/2014/14-24/ for veh capacities
Expand Down Expand Up @@ -481,20 +509,15 @@ private static Scenario getScenarioWithPseudoPtNetworkAndTransitVehicles(Network
return scenario;
}

private static void addHbefaMapping(VehicleType vehicleType, HbefaVehicleCategory category) {
EngineInformation carEngineInformation = vehicleType.getEngineInformation();
VehicleUtils.setHbefaVehicleCategory(carEngineInformation, String.valueOf(category));
VehicleUtils.setHbefaTechnology(carEngineInformation, "average");
VehicleUtils.setHbefaSizeClass(carEngineInformation, "average");
VehicleUtils.setHbefaEmissionsConcept(carEngineInformation, "average");
vehicleType.setNetworkMode(TransportMode.pt);
}

private static void increaseLinkFreespeedIfLower(Link link, double newFreespeed) {
if (link.getFreespeed() < newFreespeed) {
link.setFreespeed(newFreespeed);
}
public enum PseudoNetwork {
/**
* Create links between all stops and possibly duplicate stops.
*/
singleLinkBetweenStops,
/**
* Create a pseudo network with loop links at each stop.
*/
withLoopLinks,
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.core.utils.geometry.CoordinateTransformation;
import org.matsim.freight.carriers.*;
import org.matsim.freight.carriers.controler.CarrierModule;
import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory;
import org.matsim.freight.carriers.controller.CarrierModule;
import org.matsim.freight.carriers.controller.CarrierScoringFunctionFactory;
import org.matsim.freight.carriers.usecases.chessboard.CarrierScoringFunctionFactoryImpl;
import picocli.CommandLine;

Expand Down
6 changes: 3 additions & 3 deletions contribs/av/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>dvrp</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>taxi</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>drt</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion contribs/bicycle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>osm</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion contribs/cadytsIntegration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>analysis</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
<inceptionYear>2012</inceptionYear>
Expand Down
2 changes: 1 addition & 1 deletion contribs/carsharing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>dvrp</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions contribs/commercialTrafficApplications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>freight</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>drt</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ private static CarrierVehicle getLightVehicle(Id<?> id, VehicleType type, Id<Lin
CarrierVehicle.Builder vBuilder = CarrierVehicle.Builder.newInstance(Id.create((id.toString() + "_lightVehicle_" + depot), Vehicle.class), homeId, type );
vBuilder.setEarliestStart(6 * 60 * 60);
vBuilder.setLatestEnd(16 * 60 * 60);
vBuilder.setType(type);
vBuilder.setTypeId(type.getId());
return vBuilder.build();
}

Expand Down
10 changes: 5 additions & 5 deletions contribs/drt-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>drt</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>ev</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>informed-mode-choice</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>simwrapper</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>

<dependency>
Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>vsp</artifactId>
<version>2025.0-SNAPSHOT</version>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.matsim.contrib.dvrp.schedule.ScheduleTimingUpdater;
import org.matsim.contrib.dvrp.vrpagent.VrpAgentLogic;
import org.matsim.contrib.dvrp.vrpagent.VrpLegFactory;
import org.matsim.contrib.ev.charging.ChargingStrategy;
import org.matsim.contrib.ev.infrastructure.ChargingInfrastructure;
import org.matsim.contrib.ev.infrastructure.ChargingInfrastructureUtils;
import org.matsim.core.api.experimental.events.EventsManager;
Expand Down Expand Up @@ -116,7 +117,8 @@ protected void configureQSim() {
public EmptyVehicleChargingScheduler get() {
var taskFactory = getModalInstance(DrtTaskFactory.class);
var chargingInfrastructure = getModalInstance(ChargingInfrastructure.class);
return new EmptyVehicleChargingScheduler(timer, taskFactory, chargingInfrastructure);
ChargingStrategy.Factory chargingStrategyFactory = getModalInstance(ChargingStrategy.Factory.class);
return new EmptyVehicleChargingScheduler(timer, taskFactory, chargingInfrastructure, chargingStrategyFactory);
}
}).asEagerSingleton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@

import java.net.URL;

import org.matsim.contrib.drt.extension.edrt.optimizer.EDrtVehicleDataEntryFactory.EDrtVehicleDataEntryFactoryProvider;
import org.matsim.contrib.drt.run.DrtConfigGroup;
import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup;
import org.matsim.contrib.dvrp.run.AbstractDvrpModeModule;
import org.matsim.contrib.dvrp.run.DvrpConfigGroup;
import org.matsim.contrib.drt.extension.edrt.optimizer.EDrtVehicleDataEntryFactory.EDrtVehicleDataEntryFactoryProvider;
import org.matsim.contrib.dvrp.run.DvrpModes;
import org.matsim.contrib.ev.EvConfigGroup;
import org.matsim.contrib.ev.charging.ChargeUpToMaxSocStrategy;
import org.matsim.contrib.ev.charging.ChargingLogic;
import org.matsim.contrib.ev.charging.ChargingPower;
import org.matsim.contrib.ev.charging.ChargingStrategy;
import org.matsim.contrib.ev.charging.ChargingWithQueueingAndAssignmentLogic;
import org.matsim.contrib.ev.charging.FixedSpeedCharging;
import org.matsim.contrib.ev.temperature.TemperatureService;
Expand All @@ -40,6 +42,8 @@
import org.matsim.core.controler.Controler;
import org.matsim.vis.otfvis.OTFVisConfigGroup;

import com.google.inject.Key;

/**
* @author Michal Maciejewski (michalm)
*/
Expand Down Expand Up @@ -69,10 +73,13 @@ public void install() {
controler.addOverridingModule(new AbstractModule() {
@Override
public void install() {
bind(ChargingLogic.Factory.class).toProvider(new ChargingWithQueueingAndAssignmentLogic.FactoryProvider(
charger -> new ChargeUpToMaxSocStrategy(charger, MAX_RELATIVE_SOC)));
bind(ChargingLogic.Factory.class).to(ChargingWithQueueingAndAssignmentLogic.Factory.class);
bind(ChargingPower.Factory.class).toInstance(ev -> new FixedSpeedCharging(ev, CHARGING_SPEED_FACTOR));
bind(TemperatureService.class).toInstance(linkId -> TEMPERATURE);

for (DrtConfigGroup drtCfg : MultiModeDrtConfigGroup.get(config).getModalElements()) {
bind(Key.get(ChargingStrategy.Factory.class, DvrpModes.mode(drtCfg.mode))).toInstance(new ChargeUpToMaxSocStrategy.Factory(MAX_RELATIVE_SOC));
}
}
});

Expand Down
Loading

0 comments on commit fd82b8f

Please sign in to comment.