0

I am trying to run Omnet++ and matlab software in parallel and want them to communicate. When Omnet++ is running, I want to update the position of the node and for that I want to edit the .ned and .int files with matlab results continuously. During simulation I want to generate the result file using the updated files. I want just to update the position and don't want to add or delete any node. Please suggest me a way for proceeding?

matlab_loop
{
 matlab_writes_position_in_ned_file;
 delay(100ms);
 }
omnet_loop
 {
   omnet_loads_ned_and_simulates;
   //sca and vec should update;
   delay(100ms);
 }    

Thank you.

sgk
  • 19
  • 8
  • how does this question differ from the previous one you asked? http://stackoverflow.com/questions/31418184/how-to-edit-the-source-code-of-omnet ... Please delete the other question if you don't need it!. please provide some more info about the example and the specific `.ned` files and `.ini` files you want to use. Wouldn't it work for you if you run all the simulations with the different positions and then load you results to matlab once the simulations are all over, is there a specific purpose for the parallelism that you want to achieve. – user4786271 Jul 16 '15 at 13:02
  • what you are looking for is a rather complicated task, and almost impossible to provide help about, given the little amount of information that you provide us... – user4786271 Jul 16 '15 at 13:04
  • I want to run V-REP, matlab and omnet++ in parallel. It will be like co-simulation framework. Matlab is the has to be main driving software. matlab can read the position from V-REP, based on the positions of the nodes in V-REP, I want invoke Omnet++ and update the position of the nodes in Omnet++ . But the position of the nodes in V-REP is continuously changing and I want to set that change in position of my nodes in Omnet++ using matlab. As the position is changing of nodes in V-REP is changing, I don't know all the positions in beginning, so I can't set them at start of simulation in Omnet++ – sgk Jul 16 '15 at 17:44
  • And hence I want them(software) all to run in parallel. So that all this setup will work like a co-simulation framework. At this stage, the .ned and .ini files are the simple one(without any modifications). I hope this is clear. If need more explanation please let me know I will try to more clarify them. Thank you – sgk Jul 16 '15 at 17:49
  • make sure to include to your original question (by editing it) the additional information which you provide in the comments sections. That will make it easier for future readers to understand the overall task and provide more of a complete answer. – user4786271 Jul 17 '15 at 13:34

2 Answers2

0

NED and Ini files are read only during initialization of the model. You can't "read" them again after the simulation started. On the other hand, you are free to modify your parameters and create/delete modules using OMNeT++'s C++ API. What you want to achieve is basicaly: set your node position based on some calculations carried out by matlab code. The proper way to do it:

  • Generate C code from your matlab code.
  • Link that code to your OMNeT++ model
  • Create a new mobility model (assuming you are using INET) that is using the matlab code
Rudi
  • 6,418
  • 1
  • 16
  • 20
  • Thanks Rudi. I am trying to understand your answer. I am using MiXiM. I have added some more point in the comment above. I want to use Matlab in background for analyzing results so converting C code may limit my option to work. Instead I think the first option which you suggested can work better. I am working on it now but I am not getting much useful help from internet about Omnet++ API. Can you please suggest some document that I should read for API? – sgk Jul 16 '15 at 20:17
  • Also, if I am using the Omnet++'s C++ API, is it possible to update the parameters(like position of nodes) while simulation is running? And I need to generate the results as per this changes after every specific time interval during the running simulartion, can I do that? – sgk Jul 16 '15 at 22:01
  • I was not suggesting to do one of those points, rather they need to be done ALL in that order. I was not suggesting to rewrite your code in C but rather to convert your existing matlab code to C. There are tools for that AFAIK (never used matlab), but the conversion can be done automatically. – Rudi Jul 17 '15 at 08:44
  • Also note that parameters specify the *initial* position of the node. Changing parameters will not affect the position of the node. To position a node according to your own criteria (probably based on some calculation in matab) you have to create a new mobility algorithm implementing the IMobility interface. And a final thought: I would seriously look into INET 3.0 and see if it fits your needs. Almost all of MiXiM features were merged/reimplemented and MiXiM is no longer maintained. – Rudi Jul 17 '15 at 08:46
  • Updating position is actually I want to change the position in .ned file(e.g. in this code I want to update the display ----node1[numNodes]: Host802154A { @display("p=92,66");). I want to use remote API just to edit that display in .ned file. And all this has to be done during running simulation. – sgk Jul 20 '15 at 19:45
  • One more thing even if I create a new mobility algorithm implementing the IMobility interface, can I edit edit it during running simulation? – sgk Jul 20 '15 at 19:47
0

What you are looking for seems to be more of a project rather than a question/problem which can be solved in Q&A site like stackoverflow.

Unfortunately, I have little understanding of matlab and V-REP to provide you a satisfactory answer. However, it seems that you will need to play around with APIs in lower levels.

As an example of coupling different simulation tools to form a simulation framework in case of need consider reading this paper and this

Also note the answer given by @Rudi. He seems to know what he is talking about.

user4786271
  • 1,555
  • 13
  • 18