eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.57k stars 1.43k forks source link

Request for Enhanced Dynamic Bus Stop Management in TraCI #14415

Closed kendo2 closed 8 months ago

kendo2 commented 8 months ago

I am currently working on a works that involves simulating public transport dynamics with SUMO and managing these simulations dynamically using TraCI. My project specifically requires dynamically adjusting bus routes and stops in response to real-time conditions..

Current Implementation As part of my simulation setup, I dynamically try to create this setup:

traci.route.add("0", ["164685644#15", "164685644#15"])
traci.vehicle.add(routeID="0", vehID="00_1", typeID="bus", depart=j)
traci.vehicle.setBusStop("00_1", "0_3", 60)
traci.vehicle.setBusStop("00_1", "0_1", 60)
traci.vehicle.setBusStop("00_1", "0_2", 60)
traci.vehicle.setBusStop("00_1", "0_4", 60)

with vehicle type and bus stop declared in an "additional" file:

 <vType id="bus" accel="2.6" decel="4.5" sigma="0" length="12" minGap="3" maxSpeed="70" color="1,1,0" guiShape="bus" vClass="bus" personCapacity="52"/>
  <busStop id="0_1" lane="547243064#2_0" lines="001"/>
  <busStop id="0_2" lane="-547243056#2_0" lines="002"/>
  <busStop id="0_3" lane="547245644#1_0" lines="003"/>
  <busStop id="0_4" lane="547243053_0" lines="004"/>

But it does not work. Explanation: I want to make a bus route from "164685644#15" to "164685644#15" edge and stopping 0_3, 0_1, 0_2, 0_4 in order

namdre commented 8 months ago
kendo2 commented 8 months ago

I am sorry for the inconvinent, What I am working on is not an ordniary public transport, it is for evacuation purpose. Therefore, I need to define the bus stop point.

I try to find the best way to defind this:

traci.route.add("0", ["164685644#15", "164685644#15"])
traci.vehicle.add(routeID="0", vehID="00_1", typeID="bus", depart=j)
traci.vehicle.setBusStop("00_1", "0_3", 60)
traci.vehicle.setBusStop("00_1", "0_1", 60)
traci.vehicle.setBusStop("00_1", "0_2", 60)
traci.vehicle.setBusStop("00_1", "0_4", 60)

The result mention: Error: Answered with error to command 0xc4: busStop '0_3' for vehicle '00_1' on lane '547245644#1_0' is not downstream the current route.

namdre commented 8 months ago

the command setBusStop does not change the route to fit a stop (if the route doesn't pass the stop edge, the not downstream error results).

If you use the command vehicle.insertStop instead, then the route will be adapted to the fastest possible route that includes the respective stop edge (and all other stops added so far).