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

question for speed limit for multiple edges #13648

Closed SongKun2023 closed 1 year ago

SongKun2023 commented 1 year ago

Add your issue description here. Hello sir. If I want to set the speed limit for multiple edges with traci, how can I do? For instance, I set the max speed for the two edges as is shown in the screenshot in below. I find that first is working, but the second is useless. I don't know the reason. I'll appreciate it if you can give me some suggestions.

59703606daedb9909fa31f61c29418d

SUMO-version: 1.17

operating system: Windows

SongKun2023 commented 1 year ago

Hello? Could you give me some help?

m-kro commented 1 year ago

No reason to scream just because it's weekend and people do other stuff.

Please define useless. Where did you check the speed limit?

SongKun2023 commented 1 year ago

Hi, I'm so sorry to get back to you so late. there is a simple test in the zip file. And I set speed limits for several edges in code called "runner.py". As I have said that that the speed limit for the first edge is working ,the others are invalid.

SongKun2023 commented 1 year ago

test.zip

SongKun2023 commented 1 year ago

Thanks a lot.

SongKun2023 commented 1 year ago

Hello sir?

m-kro commented 1 year ago

You have defined vehicle class specific speed limits as part of edge types which override the general speed limit, see an excerpt of your net file below:

    <type id="G0512" priority="14" numLanes="3" speed="33.33">
        <restriction vClass="bus" speed="27.78"/>
        <restriction vClass="trailer" speed="27.78"/>
    </type>
    <type id="G5" priority="14" numLanes="3" speed="33.33">
        <restriction vClass="private" speed="30.00"/>
        <restriction vClass="bus" speed="27.78"/>
        <restriction vClass="truck" speed="28.00"/>
        <restriction vClass="trailer" speed="27.78"/>
    </type>
    <type id="SA2" priority="14" numLanes="3" speed="27.78">
        <restriction vClass="private" speed="30.56"/>
        <restriction vClass="bus" speed="22.22"/>
        <restriction vClass="truck" speed="30.56"/>
        <restriction vClass="trailer" speed="22.22"/>
    </type>

So you cannot have both at the same time. If you want to use traci.edge.setMaxSpeed, please remove the speed restrictions.

SongKun2023 commented 1 year ago

OK, thank you sir. Can this conflict be resolved in the future, as both are important in my project.

SongKun2023 commented 1 year ago

what other methods can achieve the same goal?

m-kro commented 1 year ago

A workaround: You can define multiple vehicle types and change the vehicles' type using a calibrator item at the begin and the end of the section previously using edge types. Define a different max. speed for the vehicle type you want to use inside this segment.

SongKun2023 commented 1 year ago

Thank you very much. I will try. And I want to know if the priority can be defined between different speed limit functions including dynamics and constants .