Skip to content

Commit

Permalink
Merge branch '6.x' into endlessCircleLine
Browse files Browse the repository at this point in the history
  • Loading branch information
vsp-gleich committed Dec 13, 2024
2 parents 95449f6 + df66c8f commit 0994fbf
Show file tree
Hide file tree
Showing 45 changed files with 6,113 additions and 4,360 deletions.
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@

All notable changes to this project will be documented in this file.

### 6.4 (WIP)
### 6.4 (2024-12)
- Improved facility locations
- OSM tag filtering has been improved to reduce number of wrongly assigned facility types
- Update work location assignment within Berlin
- Work locations now use weighted sampling during location choice
- The weight is based on an attraction factor and zone specific probabilities determined from survey data
- Update GTFS schedule
- TODO
- Updated GTFS schedule
- The schedule is now based on the 2024-11-19
- Note that there are major changes how stops and links between them are created
- Stops having the same gtfs parent_id and route types are merged together, allowing agents to find better PT connections
- The PT network is created with loop links (on each PT stop) instead of duplicating stops, which also improves connections
- Bike mode updated and recalibrated
- Bike is now routed on the network, which provides better travel times
- Bikes are not simulated on the network, and no link events generated yet. This will likely be added in future versions.
- The road network includes bike infrastructure and corresponding attributes
- The bike infrastructure is not fully complete yet, and has to be carefully evaluated first for bike centric studies
- The avg. bike speed has been set to match Srv2018 survey data
- New dashboards
- PT Transit viewer
- Emissions
- Noise

### 6.3 (2024-07)
- Include additional trip analysis and updated dashboard
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ input/network.osm: input/brandenburg.osm.pbf

# Detailed network includes bikes as well
$(osmosis) --rb file=$<\
--tf accept-ways bicycle=yes,designated highway=motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary_link,secondary,tertiary,motorway_junction,residential,living_street,unclassified,cycleway\
--tf accept-ways bicycle=designated highway=motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary_link,secondary,tertiary,motorway_junction,residential,living_street,unclassified,cycleway\
--bounding-polygon file="$p/area/area.poly"\
--used-node --wb input/network-detailed.osm.pbf

Expand Down Expand Up @@ -90,7 +90,7 @@ input/sumo.net.xml: input/network.osm
--output.original-names --output.street-names\
--osm.lane-access false --osm.bike-access false\
--osm.all-attributes\
--osm.extra-attributes tunnel,highway,traffic_sign,bus:lanes,bus:lanes:forward,bus:lanes:backward,cycleway,cycleway:right,cycleway:left\
--osm.extra-attributes smoothness,surface,crossing,tunnel,traffic_sign,bus:lanes,bus:lanes:forward,bus:lanes:backward,cycleway,cycleway:right,cycleway:left,bicycle\
--proj "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"\
--osm-files $< -o=$@

Expand Down Expand Up @@ -121,8 +121,14 @@ $p/berlin-$V-network.xml.gz: input/sumo.net.xml

$p/berlin-$V-network-with-pt.xml.gz: $p/berlin-$V-network.xml.gz
$(sc) prepare transit-from-gtfs --network $< --output=$p\
--name berlin-$V --date "2023-06-07" --target-crs $(CRS) \
$(germany)/gtfs/complete-pt-2023-06-06.zip\
--name berlin-$V --date "2024-11-19" --target-crs $(CRS) \
$(germany)/gtfs/complete-pt-2024-10-27.zip\
--copy-late-early\
--transform-stops org.matsim.prepare.pt.CorrectStopLocations\
--transform-routes org.matsim.prepare.pt.CorrectRouteTypes\
--transform-schedule org.matsim.application.prepare.pt.AdjustSameDepartureTimes\
--pseudo-network withLoopLinks\
--merge-stops mergeToParentAndRouteTypes\
--shp $p/pt-area/pt-area.shp

$(sc) prepare endless-circle-line\
Expand Down Expand Up @@ -294,11 +300,15 @@ $p/berlin-$V-25pct.plans_cadyts.xml.gz:

# These depend on the output of optimization runs
$p/berlin-$V-25pct.plans-initial.xml.gz: $p/berlin-$V-facilities.xml.gz $p/berlin-$V-network.xml.gz $p/berlin-longHaulFreight-$V-25pct.plans.xml.gz
$(sc) prepare filter-relevant-agents\
--input $p/berlin-$V-25pct.plans_cadyts.xml.gz --output $@\
--shp input/$V/area/area.shp\
$(sc) prepare scenario-cutout\
--population $p/berlin-$V-25pct.plans_cadyts.xml.gz\
--facilities $<\
--network $(word 2,$^)
--network $(word 2,$^)\
--output-population $@\
--output-network $p/network-cutout.xml.gz\
--output-facilities $p/facilities-cutout.xml.gz\
--input-crs $(CRS)\
--shp input/$V/area/area.shp

$(sc) prepare split-activity-types-duration\
--exclude commercial_start,commercial_end,freight_start,freight_end\
Expand Down
1 change: 1 addition & 0 deletions input/v6.4/area/area.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file modified input/v6.4/area/area.dbf
Binary file not shown.
2 changes: 1 addition & 1 deletion input/v6.4/area/area.prj
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
27 changes: 27 additions & 0 deletions input/v6.4/area/area.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="3.38.2-Grenoble">
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type></type>
<title></title>
<abstract></abstract>
<links/>
<dates/>
<fees></fees>
<encoding></encoding>
<crs>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</crs>
<extent/>
</qgis>
Binary file modified input/v6.4/area/area.shp
Binary file not shown.
Binary file modified input/v6.4/area/area.shx
Binary file not shown.
9 changes: 7 additions & 2 deletions input/v6.4/berlin-v6.4-vehicleTypes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
</attributes>
<length meter="2.0"/>
<width meter="1.0"/>
<!-- 15 kmh -->
<maximumVelocity meterPerSecond="4.16"/>

<!-- The speed was set such that the obtained avg. speed per trip matches the one reported in the SrV survey -->
<!-- Note that this speed includes all the effects of delays that might occur, such as waiting for traffic lights -->
<!-- The reported data is 10.29 km/h, it needs to set higher here (+0.4) because this includes access/egress as well -->
<maximumVelocity meterPerSecond="2.98"/>
<passengerCarEquivalents pce="0.2"/>
<networkMode networkMode="bike"/>
</vehicleType>

<vehicleType id="ride">
Expand All @@ -36,6 +40,7 @@
<length meter="7.5"/>
<width meter="1.0"/>
<passengerCarEquivalents pce="1.0"/>
<networkMode networkMode="car"/>
</vehicleType>

<vehicleType id="freight">
Expand Down
9 changes: 7 additions & 2 deletions input/v6.4/berlin-v6.4.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<module name="routing">
<param name="networkModes" value="car,truck,freight,ride,bike"/>
<param name="accessEgressType" value="accessEgressModeToLink"/>
<param name="clearDefaultTeleportedModeParams" value="true"/>
<parameterset type="teleportedModeParameters">
<param name="beelineDistanceFactor" value="1.3"/>
<param name="mode" value="walk"/>
Expand All @@ -57,6 +58,7 @@
<param name="endTime" value="36:00:00"/>
<param name="stuckTime" value="30.0"/>
<param name="trafficDynamics" value="kinematicWaves"/>
<param name="linkDynamics" value="PassingQ"/>
<param name="vehiclesSource" value="modeVehicleTypesFromVehiclesData"/>
<param name="insertingWaitingVehiclesBeforeDrivingVehicles" value="true"/>
<param name="usePersonIdForMissingVehicleId" value="false"/>
Expand All @@ -78,11 +80,12 @@
-->

<module name="simwrapper" >
<param name="sampleSize" value="0.1" />

<parameterset type="params" >
<param name="context" value="" />
<param name="mapCenter" value="13.39,52.51" />
<param name="mapZoomLevel" value="9.1" />
<param name="sampleSize" value="0.1" />
<param name="shp" value="./area/area.shp" />
</parameterset>
</module>
Expand All @@ -101,6 +104,8 @@

<module name="scoring">
<param name="fractionOfIterationsToStartScoreMSA" value="0.9"/>
<param name="pathSizeLogitBeta" value="0"/>

<parameterset type="scoringParameters">
<param name="marginalUtilityOfMoney" value="1.0"/>
<!-- car prices 2012->2022: inflation (110.2-91.7)/91.7 = 0.2017448
Expand Down Expand Up @@ -190,7 +195,7 @@
<param name="countsScaleFactor" value="0.1"/>
</module>

<module name="ReplanningAnnealer">
<module name="replanningAnnealer">
<param name="activateAnnealingModule" value="true" />
<parameterset type="AnnealingVariable" >
<param name="annealParameter" value="globalInnovationRate" />
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>matsim-all</artifactId>

<!-- PR-labelled release -->
<version>2025.0-PR3501</version>
<version>2025.0-PR3628</version>

<!-- snapshot == not recommended: rather use PR-labelled release!-->
<!-- <version>2025.0-SNAPSHOT</version>-->
Expand Down Expand Up @@ -128,7 +128,7 @@
<dependency>
<groupId>com.github.matsim-org</groupId>
<artifactId>gtfs2matsim</artifactId>
<version>fc8b13954d</version>
<version>19f1676fc6</version>
<exclusions>
<exclusion>
<groupId>org.matsim</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.matsim.simwrapper.Dashboard;
import org.matsim.simwrapper.DashboardProvider;
import org.matsim.simwrapper.SimWrapper;
import org.matsim.simwrapper.dashboard.EmissionsDashboard;
import org.matsim.simwrapper.dashboard.TrafficCountsDashboard;
import org.matsim.simwrapper.dashboard.TravelTimeComparisonDashboard;
import org.matsim.simwrapper.dashboard.TripDashboard;
Expand All @@ -30,6 +31,7 @@ public List<Dashboard> getDashboards(Config config, SimWrapper simWrapper) {
return List.of(
trips,
new TravelTimeComparisonDashboard(ApplicationUtils.resolve(config.getContext(), "berlin-v" + OpenBerlinScenario.VERSION + "-routes-ref.csv.gz")),
new EmissionsDashboard(config.global().getCoordinateSystem()),
new TrafficCountsDashboard()
.withModes(TransportMode.car, Set.of(TransportMode.car))
.withModes(TransportMode.truck, Set.of(TransportMode.truck, "freight"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@
*/
package org.matsim.legacy.prepare.transit.schedule;

import java.io.File;
import java.time.LocalDate;
import java.util.List;

import ch.sbb.matsim.routing.pt.raptor.SwissRailRaptorModule;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.network.Node;
import org.matsim.contrib.gtfs.GtfsConverter;
import org.matsim.contrib.gtfs.RunGTFS2MATSim;
import org.matsim.contrib.gtfs.TransitSchedulePostProcessTools;
import org.matsim.core.config.Config;
Expand All @@ -48,27 +46,19 @@
import org.matsim.core.network.io.NetworkWriter;
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.core.utils.geometry.CoordinateTransformation;
import org.matsim.core.utils.geometry.transformations.IdentityTransformation;
import org.matsim.core.utils.geometry.transformations.TransformationFactory;
import org.matsim.legacy.prepare.transit.schedule.CheckPtDelays.DelayRecord;
import org.matsim.pt.transitSchedule.api.Departure;
import org.matsim.pt.transitSchedule.api.TransitLine;
import org.matsim.pt.transitSchedule.api.TransitRoute;
import org.matsim.pt.transitSchedule.api.TransitRouteStop;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
import org.matsim.pt.transitSchedule.api.TransitScheduleReader;
import org.matsim.pt.transitSchedule.api.TransitScheduleWriter;
import org.matsim.pt.transitSchedule.api.*;
import org.matsim.pt.utils.CreatePseudoNetwork;
import org.matsim.pt.utils.TransitScheduleValidator;
import org.matsim.pt.utils.TransitScheduleValidator.ValidationResult;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleCapacity;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.MatsimVehicleWriter;
import org.matsim.vehicles.VehiclesFactory;
import org.matsim.vehicles.*;
import org.matsim.vehicles.VehicleType.DoorOperationMode;
import org.matsim.vehicles.VehicleUtils;

import ch.sbb.matsim.routing.pt.raptor.SwissRailRaptorModule;
import java.io.File;
import java.time.LocalDate;
import java.util.List;

/**
* @author vsp-gleich
Expand All @@ -80,7 +70,7 @@
* TODO: Theoretically we would have to increase the boarding/alighting time and reduce the capacity of the transit vehicle types
* according to the sample size.
*/

@Deprecated
public class RunGTFS2MATSimOpenBerlin {

private static final Logger log = LogManager.getLogger(RunGTFS2MATSimOpenBerlin.class);
Expand Down Expand Up @@ -113,7 +103,8 @@ public static void main(String[] args) {
}

//Convert GTFS
RunGTFS2MATSim.convertGtfs(gtfsZipFile, scheduleFile, date, ct, false);
RunGTFS2MATSim.convertGtfs(gtfsZipFile, scheduleFile, date, date, new IdentityTransformation(),
false, GtfsConverter.MergeGtfsStops.doNotMerge);

//Parse the schedule again
Scenario scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ private static void defineCarriersChessboard(Carriers carriers, CarrierVehicle v
carrierChessboard.setCarrierCapabilities(carrierCapabilities);

// Fahrzeugtypen den Anbietern zuordenen
new CarrierVehicleTypeLoader(carriers).loadVehicleTypes(carrierVehicleTypes);
// new CarrierVehicleTypeLoader(carriers).loadVehicleTypes(carrierVehicleTypes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.matsim.core.utils.geometry.transformations.TransformationFactory;
import org.matsim.freight.carriers.*;
import org.matsim.freight.carriers.Tour.TourElement;
import org.matsim.freight.carriers.controler.CarrierModule;
import org.matsim.freight.carriers.jsprit.MatsimJspritFactory;
import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts;
import org.matsim.freight.carriers.jsprit.NetworkRouter;
Expand Down Expand Up @@ -604,8 +603,8 @@ static void solveWithJsprit(Scenario scenario, Carriers carriers, HashMap<String
scenario.getConfig().controller().getOutputDirectory() + "/jsprit_CarrierPlans_Test01.png",
"bestSolution");
}
new CarrierPlanXmlWriterV2(carriers)
.write(scenario.getConfig().controller().getOutputDirectory() + "/jsprit_CarrierPlans.xml");
// new CarrierPlanXmlWriterV2(carriers)
// .write(scenario.getConfig().controller().getOutputDirectory() + "/jsprit_CarrierPlans.xml");

}

Expand All @@ -625,7 +624,7 @@ static void solveWithJsprit(Scenario scenario, Carriers carriers, HashMap<String
static Controler prepareControler(Scenario scenario) {
Controler controler = new Controler(scenario);

controler.addOverridingModule( new CarrierModule() );
// controler.addOverridingModule( new CarrierModule() );

controler.addOverridingModule(new AbstractModule() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ public static void main(String[] args) throws Exception {

controler.run();

new CarrierPlanXmlWriterV2(carriers)
.write(scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierPlans.xml");
// new CarrierPlanXmlWriterV2(carriers)
// .write(scenario.getConfig().controller().getOutputDirectory() + "/output_CarrierPlans.xml");

AbfallUtils.outputSummary(districtsWithGarbage, scenario, carrierMap, day, volumeDustbinInLiters,
secondsServiceTimePerDustbin);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/matsim/prepare/FilterRelevantAgents.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
name = "filter-relevant-agents",
description = "Filter agents that have any activities or routes within the shp file."
)
@Deprecated
public class FilterRelevantAgents implements MATSimAppCommand, PersonAlgorithm {

private static final Logger log = LogManager.getLogger(FilterRelevantAgents.class);
Expand Down
Loading

0 comments on commit 0994fbf

Please sign in to comment.