Hi, About the problem I had, it was just a question of having the antennas gain in the variable distCST_, to to it I just made: First the changes:
In the file wireless-phy.h, add the last two lines described bellow : /* -NEW- */ inline double getAntennaZ() { return ant_->getZ(); } inline double getPt() { return Pt_; } inline double getRXThresh() { return RXThresh_; } inline double getCSThresh() { return CSThresh_; } inline double getFreq() { return freq_; } /*Sugestion just to get the gain Gr_ and Gt_*/ inline double getTxGainGt() { return ant_->getTxGain(0,0,0,lambda_); } inline double getRxGainGr() { return ant_->getRxGain(0,0,0,lambda_); } /* End -NEW- */ In the file channel.cc: Substitute the following expression where the antennas have the gain 1: distCST_ = wifp->getDist(wifp->getCSThresh(), wifp->getPt(), 1.0, 1.0, highestZ , highestZ, wifp->getL(), wifp->getLambda()); for the expression that considers the gain of the antennas: distCST_ = wifp->getDist(wifp->getCSThresh(), wifp->getPt(), wifp->getTxGainGt(), wifp->getRxGainGr(), highestZ , highestZ, wifp->getL(), wifp->getLambda()); ----------------Where the problem came from: I was getting problems with the following 2 simulations: Phy/WirelessPhy set CSThresh_ 630e-15 and i also added the following lines: Antenna/OmniAntenna set Gt_ 25.0 Antenna/OmniAntenna set Gr_ 50.0 I was using the FreeSpace model, and a distance of 880 m with Gr=50 and Gt=25. After running the script for a Pt_ = 0.0158 W (12 dBm), the power received using the Friis formula or the result printed by the function gives: 0.031842: d: 880.000000, Pr: 1.199811e-09 highestAntennaZ_ = 1.5, distCST_ = 1086.2 But if I run the script for Pt= 0.01 W (10 dBm), there is no packet received, and Pr is not printed, but it should be more or less 7.2e-10, but the variable highestAntennaZ_ = 1.5, distCST_ = 862.8. My question is the received power should be 7.2e-10 >> 6.30e-13, that means that the packet should be received. ---------------------------- Thanks for your help, Tiago Junqueira