I generated vehicles using jtrrouter in Sumo by turning probability. I first define a vehicle flow and turning probability as below:
<routes>
<flow id="0" from="e1" begin="0" end="1200" number="180"/>
<flow id="1" from="e3" begin="0" end="1200" number="180"/>
<flow id="3" from="e5" begin="0" end="1200" number="180"/>
<flow id="4" from="e7" begin="0" end="1200" number="180"/>
</routes>
<turns>
<interval begin="0" end="1200">
<fromEdge id="e3">
<toEdge id="e6" probability="0.2"/>
<toEdge id="e8" probability="0.4"/>
<toEdge id="e2" probability="0.4"/>
</fromEdge>
<fromEdge id="e1">
<toEdge id="e4" probability="0.3"/>
<toEdge id="e6" probability="0.2"/>
<toEdge id="e8" probability="0.5"/>
</fromEdge>
<fromEdge id="e7">
<toEdge id="e2" probability="0.28"/>
<toEdge id="e4" probability="0.55"/>
<toEdge id="e6" probability="0.17"/>
</fromEdge>
<fromEdge id="e5">
<toEdge id="e8" probability="0.06"/>
<toEdge id="e2" probability="0.69"/>
<toEdge id="e4" probability="0.25"/>
</fromEdge>
</interval>
</turns>
Then it will generate s sequence of vehicles like this:
<routes>
<vehicle id="0.0" depart="0.00" departSpeed="10">
<route edges="e1 e8"/>
</vehicle>
<vehicle id="1.0" depart="0.00" departSpeed="10">
<route edges="e3 e8"/>
</vehicle>
<vehicle id="3.0" depart="0.00" departSpeed="10">
<route edges="e5 e2"/>
</vehicle>
.
.
.
<routes>
But what should we do if we want to define the max speed for such vehicles using this method? Where do we need to include the speed. Thanks
Max speed is a property of vehicle type definition
vType
. I suggest you create a filemy_vType_definition.add.xml
where you createvType
withmaxSpeed
. It will look something like this:Then your
flow
definitions can include the vehicle type like this:The file with new
vType
needs to be added to your config file (sumocfg) as additional file. It might be necessary to add it also tojtrouter
with-d <FILE>
or--additional-files <FILE>
params.Then
jtrrouter
should generate vehicles with maximum speed.