在ns-default.tcl可以發現到: # Initialize the SharedMedia interface with parameters to make # it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 1.559e-11 Phy/WirelessPhy set RXThresh_ 3.652e-10 Phy/WirelessPhy set bandwidth_ 2e6 Phy/WirelessPhy set Pt_ 0.28183815 Phy/WirelessPhy set freq_ 914e+6 Phy/WirelessPhy set L_ 1.0
double TwoRay(double Pt, double Gt, double Gr, double ht, double hr, double L, double d, double lambda) { /* * if d < crossover_dist, use Friis free space model * if d >= crossover_dist, use two ray model * * Two-ray ground reflection model. * * Pt * Gt * Gr * (ht^2 * hr^2) * Pr = ---------------------------- * d^4 * L * * The original equation in Rappaport's book assumes L = 1. * To be consistant with the free space equation, L is added here. */
double Pr; // received power double crossover_dist = (4 * M_PI * ht * hr) / lambda;
if (d < crossover_dist) Pr = Friis(Pt, Gt, Gr, lambda, L, d); else Pr = Pt * Gt * Gr * (hr * hr * ht * ht) / (d * d * d * d * L);
return Pr; }
沒錯這就是我們的公式,其中: Pr就是我們要的RXThresh,它代表的就是我們要的傳輸距離 Pt = transmit power Gt = transmit antenna gain Gr = receive antenna gain ht = transmit antenna height hr = receive antenna height d = distance (例如250m)