Search code examples
veinssumo

Get junction 'type' field and others?


I'm trying to implement some 'neighbors aware' broadcast techniques, in particular eSBR and NJL. I'd like to filter the junctionIDs list to be able to work with the best scenario possible (some junctions are car generator points and therefore I'd like to remove those from my list). In most cases the junction type to be discarded is 'unregulated' but it appears veins doesn't implement anything to get that field. I'm asking you if I'm missing something (maybe I've to implement a fresh one myself using some CMD_GET for sumo) or there's a better way to accomplish this task. Thank you in advance.


Solution

  • The junction type is a static property of the network, so you can simply parse the network xml file and store all junction types. There is already python code available to do so but maybe this does not help in the veins context. But to get the idea, here it is:

    import sumolib
    net = sumolib.net.readNet("my.net.xml")
    types = {}
    for junction in net.getNodes():
        types[junction.getID()] = junction.getType()