﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-伊落丹矩阵_Revolution-随笔分类-ns2</title><link>http://www.blogjava.net/illidan/category/38840.html</link><description>Illidan's Marix::Wireless Component</description><language>zh-cn</language><lastBuildDate>Mon, 06 Apr 2009 14:42:26 GMT</lastBuildDate><pubDate>Mon, 06 Apr 2009 14:42:26 GMT</pubDate><ttl>60</ttl><item><title>自由空间路损在ns2中的应用</title><link>http://www.blogjava.net/illidan/archive/2009/04/06/264142.html</link><dc:creator>伊落丹</dc:creator><author>伊落丹</author><pubDate>Mon, 06 Apr 2009 12:01:00 GMT</pubDate><guid>http://www.blogjava.net/illidan/archive/2009/04/06/264142.html</guid><wfw:comment>http://www.blogjava.net/illidan/comments/264142.html</wfw:comment><comments>http://www.blogjava.net/illidan/archive/2009/04/06/264142.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/illidan/comments/commentRss/264142.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/illidan/services/trackbacks/264142.html</trackback:ping><description><![CDATA[Free Space Path-loss as in ns2<br />
<br />
&lt;伊落丹&gt; illidan.modeler [at] gmail.com <br />
Northern Capital, <a href="http://www.battle.net/war3/neutral/pandarenbrewmaster.shtml" target="_blank">Republic of Pandaren</a><br />
<div><a target="_blank" href="https://docs.google.com/File?id=dhvjwfr_237c9xjszd7_b"><img class="blogimg" src="https://docs.google.com/File?id=dhvjwfr_237c9xjszd7_b" height="21" width="187" border="0"  alt="" /></a></div>
<br />
<div>Of the Net, by the Net, for the Net<br />
<br />
</div>
<br />
Free space
path-loss is a major factor when considering the attenuation of EM
signal strength. Basically it's defined by the following equation:<br />
<font class="contentwithhtml"><br />
<table class="zeroBorder" bgcolor="#eeeed0" cellpadding="2">
    <tbody>
        <tr>
            <td>
            <pre class="prettyprint">Pt/Pr = (4*Pi*d*f/c)^2</pre>
            </td>
        </tr>
    </tbody>
</table>
</font><br />
Pt: transmitted power<br />
Pr: received power<br />
d: the distance between transmitter and receiver<br />
f: the signal frequency<br />
c: light speed<br />
<br />
<br />
Recast the equation in dB form, we get<br />
<font class="contentwithhtml"><br />
<table class="zeroBorder" bgcolor="#eeeed0" cellpadding="2">
    <tbody>
        <tr>
            <td>
            <pre class="prettyprint">FSPL (dB) = -147.56 + 20*log10(d) + 20*log10(f)</pre>
            </td>
        </tr>
    </tbody>
</table>
</font><br />
Take the FSPL of a IEEE 802.11 WLAN signal for example. The relation between FSPL and distance is depicted below:
<div id="crer" style="text-align: left;"><img src="https://docs.google.com/File?id=dhvjwfr_323mn43swdp_b" height="324" width="430"  alt="" /></div>
<br />
where the transmission power is about 10 mW, without considering antenna gain and other attenuation.<br />
<br />
In ns2, path loss, which is an effect of the physical layer, is handled by class <strong>WirelessPhy</strong> (mac/wirelss-phy.{h,cc}). <strong>WirelessPhy</strong> calculates the path loss in its method sendUp(), by calling FreeSpace::Pr(PacketStamp *t, PacketStamp *r, WirelessPhy *ifp). <strong>FreeSpace</strong> and its parent <strong>Propagation</strong> are defined in mobile/propagation.{h, cc}.<br />
<br />
The code snipit carrying out the call to FreeSpace's method is given below (wireless-phy.cc):<font class="contentwithhtml"><br />
<table class="zeroBorder" bgcolor="#eeeed0" cellpadding="2">
    <tbody>
        <tr>
            <td>
            <pre class="prettyprint"> if(propagation_) {<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s.stamp((MobileNode*)node(), ant_, 0, lambda_);<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Pr = propagation_-&gt;Pr(&amp;p-&gt;txinfo_, &amp;s, this);<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (Pr &lt; CSThresh_) {<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pkt_recvd = 0;<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;goto DONE;<br />
            &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</pre>
            </td>
        </tr>
    </tbody>
</table>
</font><br />
The real meat of the path loss calculation is <strong>Propagation</strong>'s
method Friis(), which not only deals with free-space path loss but also
considers antenna gains. (Note: By my obervation, antenna gain is
actually 0 dB by default, revealed in Antenna::getTxGain().)<br />
<br />
For a description of path loss and link budget analysis, turn to sub-section 5.2 of [Sklar 2001].<br />
<br />
<a title="References" href="../archive/2009/04/03/263644.html" id="wqwz">References</a> <br />
1. [Book] [Sklar 2001]<br />
<br />
&nbsp;&nbsp; <br />
<br />
<img src ="http://www.blogjava.net/illidan/aggbug/264142.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/illidan/" target="_blank">伊落丹</a> 2009-04-06 20:01 <a href="http://www.blogjava.net/illidan/archive/2009/04/06/264142.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>