def __init__(self, bpdist=None, n=3.5, **kwargs): """Constructor. :param bpdist: Breakpoint distance (in meters) [default = 5.0]. :param n: Pathloss exponent [default = 3.5]. :param kwargs: Additional keyword arguments passed to `Propagation` constructor. """ cls = self.__class__ if bpdist is None: bpdist = cls.bpdist self.bpdist = bpdist Propagation.__init__(self, n=n, **kwargs)
def __init__(self, refdist=None, refloss=None, **kwargs): """Constructor. :param refdist: Reference distance (in meters) [default = 1.0]. :param refloss: Pathloss at reference distance (in dB) [default = None]. If `refloss` is not specified, the default value of `refloss` is set to the freespace pathloss at `refdist` with a pathloss exponent of 2. """ cls = self.__class__ if refdist is None: refdist = cls.refdist if refloss is None: refloss = cls.refloss self.refdist = refdist self.refloss = refloss Propagation.__init__(self, **kwargs)
def apply(self, p, u, v): """Apply breakpoint pathloss model. :param p: Packet to modify. :param u: Transmitting `ChannelInterface`. :param v: Receiving `ChannelInterface`. :return: Modified packet. This method resets the 'pathloss' annotations after calling `Propagation.apply()`. """ pkt = Propagation.apply(self, p, u, v) # overwrite pathloss dist = self.distance(u,v) pl = self.pathloss(dist, bpdist=self.bpdist, fc=self.fc, n=self.n) pkt.setanno('pathloss', pl) return pkt
def __str__(self): return Propagation.__str__(self) + \ "{bpdist: %.2f, n: %.1f, fc: %.1f GHz}"%(self.bpdist, self.n, self.fc*1e-9)
def __str__(self): return Propagation.__str__(self) + \ "{n: %.1f, fc: %.1f GHz}"%(self.n, self.fc*1e-9)