Hi, Ha ha,I also thought of what you just said.However, the transmission power for the sender is predetermined in the simulator. That‘s to say, the sender transmit the packet by the default power. What's the default? You can see Ns-default.tcl (tcl\lib):Phy/WirelessPhy set Pt_ 0.28183815. ------------------ 原始邮件 ------------------ 发件人: "salahedin rehan"<s_l_...@yahoo.es>; 发送时间: 2011年4月2日(星期六) 晚上6:26 收件人: "¤終於aware"<250716...@qq.com>; 主题: Re: [ns] [my possible resolution]How to get the mobile node's signal strength?!!
Hi, Is there anyway to calculate the signal strenght by the sender before sending the packet out???? Thanks, De: ¤終於aware <250716...@qq.com> Para: ns-users <ns-users@ISI.EDU> Enviado: sáb,2 abril, 2011 08:17 Asunto: [ns] [my possible resolution]How to get the mobile node's signal strength?!! you can refer to the file mac/wireless-phy.cc, including a function --WirelessPhy::sendUp(Packet *p) in which there are a few lines as follows: if(propagation_) { s.stamp((MobileNode*)node(), ant_, 0, lambda_); Pr = propagation_->Pr(&p->txinfo_, &s, this); /******my code*****/ struct hdr_ip *ih = HDR_IP(p); fprintf(fp,"%f %d->%d[%d->%d] %e=====%s\n",Scheduler::instance().clock(), p->txinfo_.getNode()->nodeid(),node()->nodeid(),ih->saddr(),ih->daddr(),Pr, Pr<CSThresh_ ? "detect fail": ((Pr<RXThresh_ ? "recv error" : "success recv"))); ....... } The receiver calculate the power with which the packet are received according to the attenuation algorithm in ns2 simulator, so the @Pr = propagation_->Pr(&p->txinfo_, &s, this);@ maybe help us to judge the sender's signal strength influenced by the sender's hardware and software environment. You could tell me if you had a better resolution.