Dynamic module creation for each junction in SUMO

673 views
Skip to first unread message

Dave Mck

unread,
Nov 22, 2012, 8:19:12 PM11/22/12
to omn...@googlegroups.com
Hello Everyone,

I am new to omnet++, but have previous experience using SUMO. I'm finally starting to figure out how to use omnet, but am having an issue accomplishing my current goal. I've searched the mailing list and haven't seen anything yet dealing with this problem, so hopefully I am not duplicating anything.

What I want is to dynamically create a RSU module at each junction within SUMO (or even a single RSU at a single junction within sumo, as this is currently just for investigative purposes). I will outline what I have done so far, and then explain what my problem currently is.

What I have done:
1. Implemented an RSU module based on the Car module included within the Veins tutorial package
2. Placed RSUs manually within the simulation by setting x/y coordinates
3. Run the erlangen scenario with RSUs and Cars operating as expected

To achieve dynamic module creation, I edited my scenario's NED file to have RSUs be dynamic. I then sub-classed TraCIScenarioManagerLaunchd and added the module creation into a new initialization method within the sub-class. The sub-class initialize method calls the super-classes (TraCIScenarioManagerLaunchd) initialize method and then I attempt to get the list of junctions through TraCI so I can add an RSU module for each junction. When I make the call to TraCI, however, a crash occurs with the following message:
Error in module (MyTraCIScenarioManagerLaunchd) myscenario.manager (id=6) during network initialization: Model error: Connection to TraCI server lost.

My best guess is that this has something to do with TraCI/SUMO not being initialized or ready for queries at the time I call commandGetJunctionIds(). I tried moving the TraCI call to a later 'stage' of initialization, but there was no change.

My questions then are:
1. Is this the proper/good way of going about what I want to accomplish, which is mainly to query SUMO for junction locations so I can set RSU positions within the simulation. If it is a valid approach, what could I possibly be doing wrong?
2. If this is a bad way of going about things, what is a better way of going about it (I considered adding a submodule for RSU creation, to ensure the parent module initialization finished first, but am not sure if this is a good idea either)?

Thanks for any help/resources/etc.

-Dave

Dave Mck

unread,
Nov 25, 2012, 1:37:37 PM11/25/12
to omn...@googlegroups.com
After a few more days of reading/learning/experimenting I have re-arranged my code into what I believe is a more 'proper' form. I now create a single RSU module through my ini file and added code to the initialization which will generate more RSUs and add them to the simulation environment. This way, RSU creation is done within the RSU class, as opposed to randomly placed in the TraCI control code (which was only done because it was the only place I could think to put it originally).

My problem still remains, however, in that I get "Model error: Connection to TraCI server lost." when I try to query TraCI from within the RSU initialization method. Is there anyway to check if TraCI has initialized, or to force the TraCI control to load/initialize before the RSU? I have tried using the initialized() method within the TraCIScenarioManager class, and it returns false from within the RSU initialization method. I have tried forcing initialization of TraCI using the callInitialize() method, but that didn't change anything.

Any tips/advice/resources would be much appreciated.
Thanks,

-Dave

Dave Mck

unread,
Nov 25, 2012, 3:59:35 PM11/25/12
to omn...@googlegroups.com
Spamming my own thread, but perhaps this will be useful to somebody else. After looking at the TraCIScenarioManager class a bit more, it connects when it receives a self-message at connectAt seconds (0 by default). So I modified my RSU class to send a self-message after 0.1 seconds, at which point the statically created RSU will spawn additional units within the network using information that can now be queried through TraCI.

Christoph Sommer

unread,
Nov 26, 2012, 12:06:01 PM11/26/12
to omn...@googlegroups.com
Dear Dave,

I apologize for not documenting this more clearly. I'm glad that you
managed to figure out the right order of initialization. I'll make sure
to document this more clearly in the next release of Veins.

Cheers,

Christoph


--
Dr.-Ing. Christoph Sommer
Institute of Computer Science
University of Innsbruck, Austria
Phone: +43 512 507-53285 / Fax: -53079
http://ccs.uibk.ac.at/~sommer/

raju

unread,
Dec 31, 2012, 8:07:19 AM12/31/12
to omn...@googlegroups.com
dear sir 

pls tell me again the procedure how to create RSUs in details . Thanks u advance

MohRos

unread,
Jul 23, 2013, 6:53:43 AM7/23/13
to omn...@googlegroups.com, christop...@uibk.ac.at
Dear Christoph,

I still have problem with getting my junction position from sumo to omnet and got following error, here I found above comment on the same problem but I need more explanation about the place where I should modify in order to send a self message at the connectAt which Dave mentioned as solution for this problem 
  
This is the error ;

<!> Error in module (MyTestWaveApplLayer) netw.host[1].appl (id=240) at event #23, t=0.518793604988: Model error: Connection to TraCI server lost. Check your server's log. Error message: 10038: Unknown error.

Thanks,

Christoph Sommer

unread,
Jul 23, 2013, 6:59:14 AM7/23/13
to omn...@googlegroups.com
MohRos wrote:
> This is the error ;
>
> <!> Error in module (MyTestWaveApplLayer) netw.host[1].appl (id=240)
> at event #23, t=0.518793604988: Model error: Connection to TraCI server
> lost. Check your server's log

Simulations using Veins run three programs in parallel: OMNeT++ runs
the network simulation, SUMO runs the road traffic simulation, and
sumo-launchd acts as a proxy between both. Consequently, the first step
should be finding out which program crashed.

Debug output for sumo-launchd can be found on the console, as well as in
its log file. Please refer to its --verbose and --logfile parameters for
controlling how much (and where) information is written.

Debug output for SUMO (both stdout and stderr) is captured by
sumo-launchd and stored in its log files (see above).

Finally, debug output for OMNeT++ can be found on the console
(immediately before the "simulation terminated" line). You can get more
in-depth information by enabling debug-on-errors and running the
simulation with a debugger attached (see below).

For more information, please refer to the FAQ at
<http://veins.car2x.org/documentation/faq/>.

Best,

TALBI Elhadi

unread,
Aug 4, 2013, 2:34:55 AM8/4/13
to omn...@googlegroups.com
Hi everyone

can you please explain to me why i got an error in the second instruction

cModuleType *TypeModule = cModuleType::get("org.mixim.examples.veins.rsu");

cModule *module = TypeModule->create("rsu",this);

i have created a ned file in the mixim\examples\veins folder

rsu.ned is a submodule of Highway.ned

i declared in omnetpp.ini

*.RSU.TypeModule = "org.mixim.examples.veins.rsu"
*.RSU.NomModule = "rsu"





Rehab Shaheen

unread,
Oct 26, 2017, 6:15:35 PM10/26/17
to OMNeT++ Users
Hello, I need to do something that is similar to your problem. Could you please mention the steps you followed more clearly?
Reply all
Reply to author
Forward
0 new messages