MATES 3.0-rc2

org.mates.sim.models.link
Class QuadraticLinkModel

java.lang.Object
  extended byorg.mates.sim.models.link.QuadraticLinkModel
All Implemented Interfaces:
LinkModel
Direct Known Subclasses:
GridLinkModel

public class QuadraticLinkModel
extends java.lang.Object
implements LinkModel

A link model that defines link quality in an inverse exponential relationship with the Euclidean distance between hosts.

Author:
Evan Sultanik

Constructor Summary
QuadraticLinkModel()
          Default constructor.
 
Method Summary
 double getLinkQuality(Host host1, Host host2)
          Determines the link quality of the directed connection between two hosts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadraticLinkModel

public QuadraticLinkModel()
Default constructor.

Method Detail

getLinkQuality

public double getLinkQuality(Host host1,
                             Host host2)
Determines the link quality of the directed connection between two hosts. Link quality is calculated using Position.distanceTo(org.mates.util.Position), which is usually implemented as a function of the euclidean distance between the hosts and the radio range of host1.

Note that getLinkQuality(host1, host2) == getLinkQuality(host2, host1) if and only if host1.getRadioRange() == host2.getRadioRange() or if the hosts are not communicable.

When both hosts are using Position2D, the general formula used for calculating link quality is as follows:

((host1's radio range)2 - (euclidean distance between the hosts)2) / (host1's radio range)2

This function always returns a link quality of 0.0 if host1 == host2.

Specified by:
getLinkQuality in interface LinkModel
Returns:
a double in the range [0, 1] corresponding to the link quality with which host1 can transmit to host2.

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik