[Ns-developers] [ns3] Vector and different coordinates system (Federico Guerra) (Nicola Baldo)

Nicola Baldo nbaldo at cttc.es
Wed Apr 18 05:25:48 PDT 2012


Federico Guerra wrote:
 > Nicola Baldo wrote:
 >> 4) the coordinate system of point 1) is also expected to be used by the
 >> user writing the simulation program, to specify the position of the
 >> nodes in the simulation. Is this correct?
 >>
 >
 > Correct, all mobility models that places nodes in some box or in a 
vector list would be affected.

I don't understand. We are talking about requirements here. Are you 
asking that, if the user changes the coordinate system from cartesian to 
geographical, then, for example, RandomRectanglePositionAllocator will 
allocate positions using random latitude and longitude instead of random 
x and y?



 > The main question remains open, though, how integrate a new 
coordinates system within the ns3 framework, without disrupting existing 
code.

My suggestion is to:

1) stick with maintaining the positions as cartesian coordinates only

2) provide conversion tools from/to your custom coordinate system

3) your underwater propagation model will just use the conversion tools 
to work with the desired coordinate system

4) you should develop new PositionAllocators that allow the end-user to 
use your coordinates, but leave the PositionAllocators::GetNext () API 
as-is (i.e., returning cartesian coordinates). Example: you could write 
a RandomMercatorRectanglePositionAllocator that allocates position in a 
rectangle on earth surface as defined by the Mercator projection.

5) as for random mobility models: RandomWaypointMobilityModel can work 
as-is (using your new PositionAllocator for the waypoints), though it 
can generate artifacts (e.g., a node moving between two points close to 
the sea floor might travel below the sea floor itself).
Other mobility models probably just can't be reused (e.g., 
RandomDirection2dMobilityModel works with a rectangle lying on the X-Y 
plane).
My suggestion is to develop custom mobility models that updates the 
(cartesian) position of the nodes according to some equation of 
realistic movement on the earth's surface.

Finally, as for the conversion of coordinates, please also have a look 
to the recently-merged antenna model, there are already conversion for 
the theta and phi of a spherical coordinate system (not the radius, 
since it is not needed for antenna radiation patterns). By the way, the 
AntennaModel is an example of model that works with a non-cartesian
system without needing to modify the core ns-3 cartesian mobility model.

Regards,

Nicola




More information about the Ns-developers mailing list