You can define routes either with an id and reference them in your vehicle
or as a child element of the vehicle.
Likewise you can define routeDistributions with an id and reference them in
your vehicle (also with the route attribute) or as a child element of the
vehicle.
Note, that not all of these variants are mentioned in the documentation but
they are working and part of our nightly tests (
https://github.com/eclipse/sumo/tree/master/tests/sumo/spec/distribution)
However, the format proposed in your first question had an issue that I
missed on first reading
To reference an already defined route within a routeDistribution the
attribute 'refId' must be used:
<route id="route_0" edges="beg middle end rend" />
<route id="route_1" edges="beg middle2 end rend" />
<routeDistribution>
<route refId="route_0" probability="0.1" />
<route refId="route_1" probability="0.9" />
</routeDistribution>
regards,
Jakob
Am Mo., 9. Nov. 2020 um 16:03 Uhr schrieb Theophile Cabannes <
[email protected]>:
> Maybe this xml format would be more correct:
> "" <routes>
> <route id="route_0" edges="beg middle end rend" />
> <route id="route_1" edges="beg middle2 end rend" />
> <vehicle id="0" type="type1" depart="0">
> <routeDistribution>
> <route route="route_0" probability="0.1" />
> <route route="route_1" probability="0.9" />
> </routeDistribution>
> </routes> ""
>
> On Mon, Nov 9, 2020 at 4:02 PM Theophile Cabannes <[email protected]>
> wrote:
>
>> Thank you a lot Maria,
>> Then I am a little bit confused, Why would
>> "" <routes>
>> <route id="route_0" edges="beg middle end rend" />
>> <route id="route_1" edges="beg middle2 end rend" />
>> <vehicle id="0" type="type1" depart="0">
>> <routeDistribution>
>> <route id="route_0" probability="0.1" />
>> <route id="route_1" probability="0.9" />
>> </routeDistribution>
>> </routes> ""
>> work (as Jakob mentioned)?
>>
>> Restating my question: can I use route distribution using routes that
>> have been already defined in the route file?
>>
>> In other works, is there a route attribute in the route element to not
>> have to redefine the edges attribute used by the route element everytime I
>> would like to assign a different probability attribute to the given route
>> element?
>>
>> Thank you a lot for your help!
>>
>> On Mon, Nov 9, 2020 at 3:56 PM <[email protected]> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> no, it is not the same. Your second option is not right. If you already
>>> defined a route, then you only need to add the “route” attribute to your
>>> vehicle element.
>>>
>>> <routes>
>>>
>>> <route id="route0" color="1,1,0" edges="beg middle end rend"/>
>>>
>>> <vehicle id="0" route="route0" depart="0" color="1,0,0"/>
>>>
>>> </routes>
>>>
>>>
>>>
>>> Your second example would be possible, if you are defining a new route
>>> as a child of your vehicle, like this:
>>>
>>> <routes>
>>>
>>> <vehicle id="0" depart="0" color="1,0,0">
>>>
>>> <route edges="beg middle end rend"/>
>>>
>>> </vehicle>
>>>
>>> </routes>
>>>
>>>
>>>
>>> See
>>> https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#vehicles_and_routes
>>>
>>>
>>>
>>> With routeDistribution, the definition of the routes according to the
>>> docu would be:
>>>
>>>
>>>
>>> <routes>
>>>
>>> <routeDistribution id="routedist1">
>>>
>>> <route id="route_0" edges="beg middle end rend"
>>> probability="0.1" />
>>>
>>> <route id="route_1" edges="beg middle2 end rend"
>>> probability="0.9" />
>>>
>>> </routeDistribution>
>>>
>>> <vehicle id="0" depart="0" route="routedist1"/>
>>>
>>> </routes>
>>>
>>>
>>>
>>> Regards,
>>>
>>> Giuliana
>>>
>>>
>>>
>>> *Von:* [email protected] <[email protected]> *Im
>>> Auftrag von *Theophile Cabannes
>>> *Gesendet:* Montag, 9. November 2020 15:10
>>> *An:* Sumo project User discussions <[email protected]>
>>> *Betreff:* Re: [sumo-user] Use predefined routes in route distribution
>>>
>>>
>>>
>>> Thank you Giuliana,
>>>
>>> However
>>> https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#route_distributions
>>> is a little bit different as the routes in the route distributions in the
>>> example is not predefined outside the route distribution itself (i.e. the
>>> routes contain the attribute edges).
>>>
>>>
>>>
>>> If I can do what I have suggested, then I guess that the two following
>>> route files will be understand the same way:
>>>
>>> <routes>
>>>
>>> <route id="route0" color="1,1,0" edges="beg middle end rend"/>
>>>
>>> <vehicle id="0" route="route0" depart="0" color="1,0,0"/>
>>>
>>> </routes>
>>>
>>>
>>>
>>> end
>>>
>>>
>>>
>>> <routes>
>>>
>>> <route id="route0" color="1,1,0" edges="beg middle end rend"/>
>>>
>>> <vehicle id="0" depart="0" color="1,0,0">
>>>
>>> <route id="route0" />
>>>
>>> </vehicle>
>>>
>>> </routes>
>>>
>>>
>>>
>>> Is this correct?
>>>
>>>
>>>
>>> Thank you a lot!
>>>
>>>
>>>
>>> On Mon, Nov 9, 2020 at 3:05 PM <[email protected]> wrote:
>>>
>>> Hi Theo,
>>>
>>>
>>>
>>> Yes it is possible, see
>>> https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#route_distributions
>>> .
>>>
>>>
>>>
>>> Regards,
>>>
>>> Giuliana
>>>
>>> *Von:* [email protected] <[email protected]> *Im
>>> Auftrag von *Theophile Cabannes
>>> *Gesendet:* Montag, 9. November 2020 13:39
>>> *An:* [email protected]
>>> *Betreff:* [sumo-user] Use predefined routes in route distribution
>>>
>>>
>>>
>>> Hi,
>>>
>>> I would like to use route distribution using routes that have been
>>> already defined in the route file. Is this possible?
>>> I was thinking about writting something like:
>>> <routes>
>>> <route id="route_0" edges="beg middle end rend" />
>>> <route id="route_1" edges="beg middle2 end rend" />
>>> <vehicle id="0" type="type1" depart="0">
>>> <routeDistribution>
>>> <route id="route_0" probability="0.1" />
>>> <route id="route_1" probability="0.9" />
>>> </routeDistribution>
>>> </routes>
>>> Would that work?
>>>
>>> Thank you a lot!
>>> Theo
>>>
>>> _______________________________________________
>>> sumo-user mailing list
>>> [email protected]
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>
>>> _______________________________________________
>>> sumo-user mailing list
>>> [email protected]
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>>
>> _______________________________________________
> sumo-user mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user