Node virtualisation for a WSN; Static variable encapsulation in NSC, DCE or MPI all not ideal

28 views
Skip to first unread message

Rob Kers

unread,
Sep 14, 2018, 4:56:56 AM9/14/18
to ns-3-users
Hello!

I've got the following idea: I want to make a mesh network in NS3 that is going to run on an embedded platform. This embedded platform runs just pure C code. In embedded environment it is normal to declare static variables. Lets say each node has to have its own static variable X with its own unique value. Implementing this in the default NS3 setting is not possible since these statics in C would collide.

I've got several options. 

1) Use Direct Code Execution. This is possible, but I have problems with installing it. So far the best option. I'm working on MacOs now, I will switch to Ubuntu to see how it goes there. 
2) Use some MPI distributed computing setup. However, I have a shared spectrum channel and not a point-to-point interface. It's a wireless sensor network. In the documentation it is made clear that the current implementation is " .. for distributed purposes in ns-3 can only occur across point-to-point links". 
3) Write my own sub-process implementation with inter process communication (pipes probably). Cumbersome solution but will probably work. 
4) Dont use statics. This means porting and full code testing in ns3 is therefore not possible.


Cheers!

pdbarnes

unread,
Sep 16, 2018, 7:32:06 PM9/16/18
to ns-3-users
Could you encapsulate your statics in a struct? For multi node ns-3 simulation allocate a static array of these structs, then use the Simulator context to associate one entry with each Node. When you move to the embedded platform the access will be unchanged; just use ‘0’ as the index everywhere. (An optimizing compiler should implement a[0].var as fast as ((struct)a).var. so there won’t even be a penalty from the residual array reference.)

Peter

Rob Kers

unread,
Sep 22, 2018, 8:29:37 AM9/22/18
to ns-3-users
Hi Peter,

Thanks for your suggestion. I decided I want a no-compromises approach to simulating the sensor software and compile as close to the final code as possible. I'm developing my software for a company with a big embedded system software platform. Using your approach I still have to port all the code to an "array" approach. 

I'm constructing a separate process framework now in which each node lives in a separate process. This means inter process communication so I'll spend my time on developing a named pipe communication between NS3 and a stand alone process.

Cheers!


Op maandag 17 september 2018 01:32:06 UTC+2 schreef pdbarnes:
Reply all
Reply to author
Forward
0 new messages