[Ns-developers] ns-3 position models
Mathieu Lacage
Mathieu.Lacage at sophia.inria.fr
Tue Jul 3 06:12:06 PDT 2007
On Tue, 2007-07-03 at 14:00 +0100, Gustavo Carneiro wrote:
> I have two concerns with this:
>
> 1. IMHO it would be much simpler to have a Node::Position class or
> structure. Most of the time you do not pass around individual
> coordinates, so why triple the number of parameters of the APIS?
> 2. I generally hate out parameters. It obfuscates the purpose of
I do not like them much either.
> the parameters. Why not simply return a structure instead?
How would you name it ?
>
> >
> > - I have a "mobile node" and I want to change the current
> position:
> > node->QueryInterface<StaticPosition> (StaticPosition::iid)->Set (x,
> y,
> > z); if this mobile node contains a "StaticPosition" model.
> >
> > - I want to make a node "mobile": node->AddInterface
> > (Create<StaticPosition> (0.0, 0.0, 0.0));
> >
>
> Regarding position-set-notifier.h, it seems like my proposed Signal
> template class would fit nicely here and avoid one interface. I think
> it would be simpler to just add signals to the Position class rather
> than add one interface. Like this:
The idea is that with the extra interface PositionSetNotifier, those who
do not use it pay no cost for it while if you add an extra member to the
Position base class, you pay the cost for it all the time, even if you
do not use it.
>
> class Position : public Object
> {
> [...]
>
> public:
> typedef Signal<Ptr<Position> > SetPositionSignal;
> virtual SetPositionSignal& GetSetPositionSignal () const;
> };
>
> This will save you one interface object, thereby making code smaller
> and simpler. In any case, I will be able to use this mobility model
> for my work, and it's all I need for the time being.
Even simpler would be to merge the content of the PositionSetNotifier
class into the Position class if we do not care about the extra
per-position overhead.
>
> random-walk-position looks good, I guess, but I must admit to not
> having much experience with the ns-2 mobility models.
>
> One thing that is not (easily) supported, and which I'll need in the
> (distant) future, is relative mobility models. Think of a vehicle
> ( e.g. a train) that is moving. Inside, people with PDAs may be
> moving as well. The mobility model specified for the passengers is
> relative to the train wagon, and the absolute mobility model should be
> the composite of the mobility model of the train and passenger. We
> should be able to retrieve position of a person either relative to the
> vehicle or relative to the world itself. Anyway, just an idea for
> future work; no need to support this right away :)
Interesting: I will keep this in mind even though it does not sound
straightforward.
>
> To summarize, overall looks good, though I would prefer to simplify
> and eliminate PositionSetNotifier, and to work with a 3D vector
> structure rather than individual coordinates.
ok.
Mathieu
--
More information about the Ns-developers
mailing list