generated from matsim-scenarios/matsim-scenario-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
142 lines (104 loc) · 4.88 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
N := kyoto
V := v1.0
CRS := EPSG:32653
MEMORY ?= 20G
JAR := matsim-$(N)-*.jar
kyoto := ../public-svn/matsim/scenarios/countries/jp/kyoto
confidential := ../shared-svn/projects/matsim-kyoto
osmosis := osmosis/bin/osmosis
# Scenario creation tool
sc := java -Xmx$(MEMORY) -XX:+UseParallelGC -cp $(JAR) org.matsim.prepare.RunOpenKyotoCalibration
.PHONY: prepare
$(JAR):
mvn package
# Required files
input/kansai.osm.pbf:
curl https://download.geofabrik.de/asia/japan/kansai-240101.osm.pbf -o $@
input/network.osm: input/kansai.osm.pbf
$(osmosis) --rb file=$<\
--tf accept-ways bicycle=yes highway=motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary_link,secondary,tertiary,motorway_junction,residential,unclassified,living_street\
--bounding-polygon file="input/area.poly"\
--used-node --wb input/network-detailed.osm.pbf
$(osmosis) --rb file=$<\
--tf accept-ways highway=motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary_link,secondary,tertiary,motorway_junction\
--used-node --wb input/network-coarse.osm.pbf
$(osmosis) --rb file=input/network-coarse.osm.pbf --rb file=input/network-detailed.osm.pbf\
--merge\
--tag-transform file=input/remove-railway.xml\
--wx $@
rm input/network-detailed.osm.pbf
rm input/network-coarse.osm.pbf
input/sumo.net.xml: input/network.osm
$(SUMO_HOME)/bin/netconvert --geometry.remove --ramps.guess --ramps.no-split\
--type-files $(SUMO_HOME)/data/typemap/osmNetconvert.typ.xml\
--tls.guess-signals true --tls.discard-simple --tls.join --tls.default-type actuated\
--junctions.join --junctions.corner-detail 5\
--roundabouts.guess --remove-edges.isolated\
--no-internal-links --keep-edges.by-vclass passenger,bicycle\
--remove-edges.by-vclass hov,tram,rail,rail_urban,rail_fast,pedestrian\
--output.original-names --output.street-names\
--proj "+proj=utm +zone=53 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"\
--lefthand true\
--osm-files $< -o=$@
input/$V/$N-$V-network.xml.gz: input/sumo.net.xml
$(sc) prepare network-from-sumo $< --target-crs $(CRS) --output $@
$(sc) prepare clean-network $@ --output $@ --modes car,ride,truck --remove-turn-restrictions
input/$V/$N-$V-network-with-pt.xml.gz: input/$V/$N-$V-network.xml.gz
# FIXME: Adjust GTFS
$(sc) prepare transit-from-gtfs --network $<\
--output=input/$V\
--name $N-$V --date "2021-08-18" --target-crs $(CRS) \
../shared-svn/projects/$N/data/20210816_regio.zip\
../shared-svn/projects/$N/data/20210816_train_short.zip\
../shared-svn/projects/$N/data/20210816_train_long.zip\
--prefix regio_,short_,long_\
--shp ../shared-svn/projects/$N/data/pt-area/pt-area.shp\
--shp ../shared-svn/projects/$N/data/Bayern.zip\
--shp ../shared-svn/projects/$N/data/germany-area/germany-area.shp\
input/facilities.gpkg: input/kansai.osm.pbf
$(sc) prepare facility-shp\
--activity-mapping input/activity_mapping.json\
--input $<\
--target-crs $(CRS)\
--output $@
input/$V/$N-$V-facilities.xml.gz: input/$V/$N-$V-network.xml.gz input/facilities.gpkg
$(sc) prepare facilities --network $< --shp $(word 2,$^)\
--facility-mapping input/facility_mapping.json\
--output $@
# Static population only contains the home locations
input/$V/$N-static-$V-10pct.plans.xml.gz: input/facilities.gpkg
$(sc) prepare kansai-population\
--input $(kyoto)/data/census_kansai_region.csv\
--shp $(kyoto)/data/kansai-region.gpkg\
--postal-shp $(kyoto)/data/postalcodes.gpkg\
--income $(confidential)/data/income_distribution.csv\
--facilities $< --facilities-attr all\
--output $@
# Assigns daily activity chains including locations
input/$V/$N-activities-$V-10pct.plans.xml.gz: input/$V/$N-static-$V-10pct.plans.xml.gz input/$V/$N-$V-facilities.xml.gz input/$V/$N-$V-network.xml.gz
$(sc) prepare create-daily-plans --input $< --output $@\
--persons src/main/python/table-persons.csv\
--activities src/main/python/table-activities.csv\
--commuter src/main/python/work-commuter.csv\
--shp $(kyoto)/data/postalcodes.gpkg\
--facilities $(word 2,$^)\
--network $(word 3,$^)\
input/$V/$N-$V-10pct.plans-initial.xml.gz: input/$V/$N-activities-$V-10pct.plans.xml.gz input/$V/$N-$V-facilities.xml.gz input/$V/$N-$V-network.xml.gz
$(sc) prepare filter-relevant-agents\
--input $< --output $@\
--input-crs $(CRS)\
--shp input/area.gpkg\
--facilities $(word 2,$^)\
--network $(word 3,$^)
$(sc) prepare split-activity-types-duration\
--exclude commercial_start,commercial_end,freight_start,freight_end\
--input $@ --output $@
$(sc) prepare set-car-avail --input $@ --output $@
$(sc) prepare check-car-avail --input $@ --output $@ --mode walk
$(sc) prepare fix-subtour-modes --input $@ --output $@ --coord-dist 100
$(sc) prepare downsample-population $@\
--sample-size 0.1\
--samples 0.03 0.01\
# Aggregated target for input plans to calibration
prepare: input/$V/$N-$V-10pct.plans-initial.xml.gz input/$V/$N-$V-network-with-pt.xml.gz
echo "Done"