[plexe] How do I inject a second platoon in a stretch of freeway?

481 views
Skip to first unread message

Divus Iulius

unread,
Oct 11, 2016, 10:07:19 AM10/11/16
to OMNeT++ Users
Hi!

I have recently installed Plexe and run the sinusoidal sub-scenario in Example 1 - Running Plexe, without problems. After some (unsuccessful) tinkering I have been left wondering for sometime now the following things:

1. How do I inject a second platoon
after the first one? (I tried copy/pasting or adding additional lines to the "omnetpp.ini" file, but nothing happens).
2. How do I add normal (non platoon) background traffic? (I tried by injecting an additional platoon of size 1, but I don't even know how to inject a second platoon).

It is not my first use of SUMO... but it is indeed my first use of OMNET++ or VEINS. I would be very grateful if someone could point me in the right direction at least! :)

Regards,
Divus

Michele Segata

unread,
Oct 12, 2016, 11:53:50 AM10/12/16
to omn...@googlegroups.com
Hi Divus,

my reply inline

On 11/10/16 16:07, Divus Iulius wrote:
> Hi!
>
> I have recently installed Plexe and run the /sinusoidal/ sub-scenario in
> Example 1 - Running Plexe <http://plexe.car2x.org/tutorial/>, without
> problems. After some (unsuccessful) tinkering I have been left wondering
> for sometime now the following things:
>
> 1. How do I inject a second platoon after the first one? (I tried
> copy/pasting or adding additional lines to the "omnetpp.ini" file, but
> nothing happens).

Please refer to the documentation for the PlatoonsTrafficManager class
[1]. By setting nCars = 16, platoonSize = 8, nLanes = 1 you will inject
two platoons one after the other.

> 2. How do I add normal (non platoon) background traffic? (I tried by
> injecting an additional platoon of size 1, but I don't even know how to
> inject a second platoon).

To do that you will need to create a different vehicle type in the sumo
route file (examples/platooning/sumocfg/freeway.rou.xml). Then you will
need to modify the PlatoonsTrafficManager class (or to create your own)
to inject that particular vehicle type as well. As an alternative, you
can make SUMO inject that vehicle by putting it into a SUMO flow (again
in the route file).
The quickest thing then is to discriminate between the platooning and
non platooning vehicles inside veins modules using the API

traciVehicle->getVType()

although this is not the most elegant solution. This is, however, the
quickest.

>
> It is not my first use of SUMO... but it is indeed my first use of
> OMNET++ or VEINS. I would be very grateful if someone could point me in
> the right direction at least! :)

I recommend you getting used with OMNeT++ and Veins in the first place.
You need to understand OMNeT++ concepts to successfully deal with Veins
and Plexe.

>
> Regards,
> Divus

Best,
Michele

[1] http://plexe.car2x.org/documentation

>
> --
> You received this message because you are subscribed to the Google
> Groups "OMNeT++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to omnetpp+u...@googlegroups.com
> <mailto:omnetpp+u...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/omnetpp.
> For more options, visit https://groups.google.com/d/optout.


--
Michele Segata, PhD
Department of Information Engineering and Computer Science
University of Trento, Italy
http://ccs-labs.org/~segata/

Divus Iulius

unread,
Oct 14, 2016, 7:12:06 AM10/14/16
to OMNeT++ Users

Hello Michele:

Thank you so much for the speedy reply. :)

Following your indications I was able to add a second platoon—I discovered that I did not read the documentation for the PlatoonsTrafficManager by oversight, and now I understand that the injected platoons will have all the same size.

Still, with my limited knowledge I still don't quit catch what you mean by "discriminate between the platooning and non platooning vehicles inside veins modules." My guess is, inside the veins modules (SinusoidalScenario.cc .h .ned? or maybe the PlatoonsTrafficManager.cc) the logic programmed should only be used when the traciVehicle->getVType() is equal to the platoonType, instead of everytime.

My current issue is how positioning all the cars of the platoon in a specific lane. So far tried adding the following code at the end of the inside "if (stage == 1) {" "void SinusoidalScenario::initialize(int stage)" at "SinusoidalScenario.cc" and then "make -j 2 MODE=release" with two plattons of 8 cars each one:

void SinusoidalScenario::initialize(int stage) {

    BaseScenario::initialize(stage);

    if (stage == 1) {
        //all the code is identical except for the following two lines at the end of the if clause
//...   
 
        int platoonLane = 1;
        traciVehicle->setFixedLane(platoonLane);
        positionHelper->setPlatoonLane(platoonLane);
   

    }
   

}

But the result is that every car starts at lane 1, but the leader of the second platoon, which starts at lane 0. (Nevertheless, the code doesn't work for platoonLane=2, 3, 4, 5...). So far very puzzling. :)


Thank you again. :)

Regards,
Divus



On Wednesday, October 12, 2016 at 5:53:50 PM UTC+2, Michele Segata wrote:
Hi Divus,

my reply inline


Message has been deleted

Michele Segata

unread,
Oct 17, 2016, 3:58:21 AM10/17/16
to omn...@googlegroups.com
Hi Divus,

my reply inline

On 14/10/16 13:12, Divus Iulius wrote:
> <https://s17.postimg.org/65lgi20j3/2platoons.png>
>
> Hello Michele:
>
> Thank you so much for the speedy reply. :)
>
> Following your indications I was able to add a second platoon—I
> discovered that I did not read the documentation for the
> PlatoonsTrafficManager by oversight, and now I understand that the
> injected platoons will have all the same size.

Yes you are right. PlatoonsTrafficManager is given as an example, so it
simply injects same size platoons. Obviously, you can personalize it
according to your needs, but together with this you will need to modify
the PositionHelper (located in the "utilities" folder). The position
helper gives you some functionalities to understand who is the leader,
who is your front vehicle, which platoon a vehicle is in, etc. As
written in the website, the position helper gives you answers for
platoons injected by the sample traffic manager, so if you change it,
you need to touch the position helper as well.

>
> Still, with my limited knowledge I still don't quit catch what you mean
> by "discriminate between the platooning and non platooning vehicles
> inside veins modules." My guess is, inside the veins modules
> (SinusoidalScenario.cc .h .ned? or maybe the PlatoonsTrafficManager.cc)
> the logic programmed should only be used when the
> traciVehicle->getVType() is equal to the platoonType, instead of everytime.

Exactly. You should do this for every module involved, including the
scenario (scenarios folder), the protocol (protocols folder), and the
application (apps folder).
There is another (more elegant) way to do this, which is to create a set
of different modules for your non-platooning vehicles (e.g., a new
beaconing module that simply sends beacons to interfere with your
platoons), and create a new type of OMNeT++ node like Car.ned in
examples/platooning. You can create, for example, InterferingCar.ned and
change the modules inside to use the ones you created. Finally, you will
need to change the omnetpp.ini file to tell Veins that a module with a
certain vehicle type should be instantiated as an InterferingCar. To do
so, you will need to change

*.manager.moduleType = "Car"
*.manager.moduleName = "node"

to something like

*.manager.moduleType = "vtypeauto=Car yourvtype=InterferingCar"
*.manager.moduleName = "vtypeauto=node yourvtype=inode"

where yourvtype is the vehicle type you defined in your SUMO config file
(freeway.rou.xml) and inode is a symbolic name that you use in the
omnetpp.ini to set the parameters. For example, for "node" you already
find something like

*.node[*].mobility.x = 0
*.node[*].mobility.y = 0
*.node[*].mobility.z = 1.895

If you want to configure your new vehicle as well, you will need to add

*.inode[*].mobility.x = 0
*.inode[*].mobility.y = 0
*.inode[*].mobility.z = 1.895

for all the parameters you need.

I know this might look complicated but it's the way (very elegant, in my
opinion) Veins works. I am still preparing the tutorials on these
advanced features, but it will take me some more time.

>
> My current issue is how positioning all the cars of the platoon in a
> specific lane. So far tried adding the following code at the end of the
> inside "if (stage == 1) {" "void SinusoidalScenario::initialize(int
> stage)" at "SinusoidalScenario.cc" and then "make -j 2 MODE=release"
> with two plattons of 8 cars each one:
>
> void SinusoidalScenario::initialize(int stage) {
>
> BaseScenario::initialize(stage);
>
> if (stage == 1) {
> //all the code is identical except for the following two lines
> at the end of the if clause
> //...
>
> int platoonLane = 1;
> traciVehicle->setFixedLane(platoonLane);
> positionHelper->setPlatoonLane(platoonLane);
>
>
> }
>
>
> }
>
> But the result is that every car starts at lane 1, but the leader of the
> second platoon, which starts at lane 0. (Nevertheless, the code doesn't
> work for platoonLane=2, 3, 4, 5...). So far very puzzling. :)

I guess the problem is that the PlatoonsTrafficManager class injects
vehicles in a specific lane. If you later change lane you might face
problems with the SUMO lane change logic, which says that if you are too
close to a vehicle on the lane you want to move, you can't change lane
because it would be "unsafe" in a real-world situation. I'm already
working on this, trying to ignore the safety logic if the vehicle is a
platooning vehicle.
For the time being, try to change the PlatoonsTrafficManager class to
inject the vehicles in the lane you want, and keep also the changes you
made to the SinusoidalScenario class.

>
>
> Thank you again. :)
>
> Regards,
> Divus

Best,
Michele
> > an email to omnetpp+u...@googlegroups.com <javascript:>
> > <mailto:omnetpp+u...@googlegroups.com <javascript:>>.
> <https://groups.google.com/group/omnetpp>.
> > For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.

Divus Iulius

unread,
Oct 18, 2016, 9:47:14 AM10/18/16
to OMNeT++ Users


On Monday, October 17, 2016 at 9:58:21 AM UTC+2, Michele Segata wrote:

> But the result is that every car starts at lane 1, but the leader of the
> second platoon, which starts at lane 0. (Nevertheless, the code doesn't
> work for platoonLane=2, 3, 4, 5...). So far very puzzling. :)

I guess the problem is that the PlatoonsTrafficManager class injects
vehicles in a specific lane. If you later change lane you might face
problems with the SUMO lane change logic, which says that if you are too
close to a vehicle on the lane you want to move, you can't change lane
because it would be "unsafe" in a real-world situation. I'm already
working on this, trying to ignore the safety logic if the vehicle is a
platooning vehicle.
For the time being, try to change the PlatoonsTrafficManager class to
inject the vehicles in the lane you want, and keep also the changes you
made to the SinusoidalScenario class.


Exactly. It was SUMO's blame. Following your advice I have managed to solve this problem tentatively by increasing the inter-platoon distance at "void PlatoonsTrafficManager::insertPlatoons()" in file "PlatoonsTrafficManager.cc"

//inter-platoon distance
    double platoonDistance = platoonInsertSpeed / 2.6 * platoonLeaderHeadway; //3.6 * platoonLeaderHeadway;


I have not yet started to code the set of different modules for my non-platooning vehicles, but you have provided me with very valuable insights. Thanks again! :)
Reply all
Reply to author
Forward
0 new messages