Link Search Menu Expand Document

Generate a SUMO scenario with Trucks trips in the province of Brescia


mostlogo

SUMO Scenario generation: Trucks in the province of Brescia

More Details
  1. SUMO Scenario generation: Trucks in the province of Brescia
    1. Visum to SUMO network Conversion
    2. Demand: define trips starting from OD matrix
    3. Demand: from counting devices
    4. Running Simulation

Visum to SUMO network Conversion

netconvert -v \
  --visum-file $BSPROV/traffic_data/visum/visum.net \
  --visum.language-file=$SUMO_HOME/data/lang/visumEN.txt \
  --proj.utm \
  -o $BSPROV/sumocfg/bsprov.net.xml.gz \
  --taz-output $BSPROV/sumocfg/bsprov.taz.xml

Demand: define trips starting from OD matrix

https://sumo.dlr.de/docs/Demand/Introduction_to_demand_modelling_in_SUMO.html

od2trips

od2trips -v \
  --taz-files $BSPROV/sumocfg/bsprov.taz.xml \
  --od-matrix-files $BSPROV/traffic_data/visum/bsprovOD.vmat \
  --vtype truck \
  --human-readable-time true \
  --begin 25200 \
  --end 28800 \
  -o $BSPROV/sumocfg/bsprov.trips.xml

duarouter

duarouter -v \
  --net-file $BSPROV/sumocfg/bsprov.net.xml \
  --additional-files $BSPROV/sumocfg/bsprov.taz.xml \
  --route-files $BSPROV/sumocfg/vtypes.rou.xml,$BSPROV/sumocfg/bsprov.trips.xml \
  --with-taz true \
  --repair true \
  --ignore-errors true \
  -o $BSPROV/sumocfg/duarouter.out.xml
Loading net ... done.
Loading additional file '/home/lorenzo/Documents/dev/bsprov_sumo/sumocfg/bsprov.taz.xml'  ... done.
Skipped until: 25200.77

Routes found between time steps 25200.77 and 28799.23.
DijkstraRouter answered 5510 queries and explored 57410.27 edges on average.
DijkstraRouter spent 196.54s answering queries (35.67ms on average).
Success.

204.04s user 0.33s system 99% cpu 3:24.40 total

marouter

marouter -v \
  --net-file $BSPROV/sumocfg/bsprov.net.xml \
  --additional-files $BSPROV/sumocfg/bsprov.taz.xml \
  --route-files $BSPROV/sumocfg/vtypes.rou.xml,$BSPROV/sumocfg/bsprov.trips.xml \
  --with-taz true \
  --max-iterations 20 \
  -o $BSPROV/sumocfg/marouter.out.xml
Loading net ... done.
Loading additional file 'bsprov.taz.xml'  ... done.
Loading routes and trips from 'vtypes.rou.xml' ... done.
Loading routes and trips from 'bsprov.trips.xml' ... done.
5510.00 valid vehicles loaded (total seen: 5510.00).
 starting interval 25200.00
  starting iteration 0
  starting iteration 1
  starting iteration 2
  starting iteration 3
  starting iteration 4
  starting iteration 5
  starting iteration 6
  starting iteration 7
  starting iteration 8
  starting iteration 9
  starting iteration 10
  starting iteration 11
  starting iteration 12
  starting iteration 13
  starting iteration 14
  starting iteration 15
  starting iteration 16
  starting iteration 17
  starting iteration 18
  starting iteration 19
DijkstraRouter answered 16644 queries and explored 4399.18 edges on average.
DijkstraRouter spent 23.00s answering queries (1.38ms on average).
Success.

31.74s user 0.29s system 99% cpu 32.055 total

Demand: from counting devices

mapDetectors.py

python $SUMO_TOOLS/detector/mapDetectors.py \
  -n $BSPROV/sumocfg/bsprov.net.xml.gz \
  -d $BSPROV/traffic_data/detcoord.csv \
  -o $BSPROV/sumocfg/det.add.xml
Could not find road for detector BSSP02_01 within 1000.0m radius
Could not find road for detector BSSP08_01 within 1000.0m radius
Could not find road for detector BSSPEXSS237_02 within 1000.0m radius
Could not find road for detector BSSPEXSS510_01 within 1000.0m radius
Could not find road for detector BSSPEXSS510_02 within 1000.0m radius
Could not find road for detector BSSPEXSS573_01 within 1000.0m radius
Could not find road for detector BSSPEXSS11_01 within 1000.0m radius
Could not find road for detector BSSPEXSS11_06 within 1000.0m radius
Could not find road for detector BSSPIX_03 within 1000.0m radius
Could not find road for detector BSSPXI_01 within 1000.0m radius
Could not find road for detector SS42_01 within 1000.0m radius
Could not find road for detector SS42_03 within 1000.0m radius
Could not find road for detector SS45B_02 within 1000.0m radius
Could not find road for detector SS45B_03 within 1000.0m radius
python edgeDataCreator.py \
  $BSPROV/traffic_data/2015_2019_Tabella\ indagine\ del\ traffico.xlsx \
  $BSPROV/sumocfg/det.add.xml \
  > $BSPROV/sumocfg/myedgestats.xml

routeSampler.py

python $SUMO_TOOLS/routeSampler.py \
  -r $BSPROV/sumocfg/sampleRoutes.rou.xml \
  --edgedata-files $BSPROV/sumocfg/myedgestats.xml \
  --threads $(nproc) \
  --verbose \
  -s 1234 \
  --write-flows probability \
  --attributes="departLane=\"best\" departSpeed=\"max\" departPos=\"random\" type=\"truck\"" \
  -o $BSPROV/sumocfg/sampledflows.rou.xml
Warning: no routes pass edge '32574' (count 30217)
Warning: no routes pass edge '21480' (count 43355)
Warning: no routes pass edge '16817' (count 45686)
Warning: no routes pass edge '10846' (count 13910)
Warning: no routes pass edge '-43048' (count 49546)
Loaded 3537 routes (3537 distinct)
Edge '16817' occurs more than once in interval 0-86400
Ignored 2733 routes which do not pass any counting location
0: Wrote 380561 routes (804 distinct) achieving total count 418059 (69.59%) at 22 locations. GEH<5 for 77.27%
Warning: underflow locations: count 5, min 13910.00 (('10846',)), max 49546.00 (('-43048',)), mean 36542.80, Q1 30217.00, median 43355.00, Q3 45686.00 (total 182714)

Running Simulation

sumo-gui -c \
  $BSPROV/bsprov.sumocfg \
  --output-prefix bsprovout/bs$(date +"%d-%m-%y_%T")_
Step #26800.00Warning: Vehicle '832' performs emergency braking on lane '23502_0' with decel=7.00, wished=4.00, severity=1.00, time=26800.00.
Warning: Vehicle '5426' performs emergency braking on lane '43801_0' with decel=7.00, wished=4.00, severity=1.00, time=27858.00.
Warning: Vehicle '4025' performs emergency braking on lane '-57080_0' with decel=7.00, wished=4.00, severity=1.00, time=27967.00.
Warning: Vehicle '137' performs emergency braking on lane '23502_0' with decel=7.00, wished=4.00, severity=1.00, time=28047.00.
Warning: Vehicle '4017' performs emergency braking on lane '-57080_0' with decel=7.00, wished=4.00, severity=1.00, time=28193.00.
Warning: Teleporting vehicle '4812'; waited too long (wrong lane), lane='45902_1', time=28255.00.
Warning: Vehicle '4812' ends teleporting on edge '21621', time=28255.00.
Warning: Teleporting vehicle '3090'; waited too long (wrong lane), lane='45902_0', time=28567.00.
Warning: Teleporting vehicle '3670'; waited too long (wrong lane), lane='45902_1', time=28567.00.
Warning: Vehicle '3670' ends teleporting on edge '21621', time=28567.00.
Warning: Vehicle '3090' ends teleporting on edge '28898', time=28567.00.
Step #86400.00 (0ms ?*RT. ?UPS, vehicles TOT 5510 ACT 0 BUF 0)

106.70s user 0.78s system 99% cpu 1:47.51 total

NB: edit bsprov.sumocfg to choose to chose rou.xml as demand-definition