• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/mobile/propagation.h

00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
00002 /*
00003  * Copyright (c) 1997 Regents of the University of California.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. All advertising materials mentioning features or use of this software
00015  *    must display the following acknowledgement:
00016  *      This product includes software developed by the Computer Systems
00017  *      Engineering Group at Lawrence Berkeley Laboratory.
00018  * 4. Neither the name of the University nor of the Laboratory may be used
00019  *    to endorse or promote products derived from this software without
00020  *    specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  */
00034 /* Ported from CMU/Monarch's code, nov'98 -Padma.
00035    propagation.h
00036 
00037    superclass of all propagation models
00038 */
00039 
00040 #ifndef ns_propagation_h
00041 #define ns_propagation_h
00042 
00043 #define SPEED_OF_LIGHT  300000000               // 3 * 10^8 m/s
00044 #define PI              3.1415926535897
00045 
00046 
00047 #include <topography.h>
00048 #include <phy.h>
00049 #include <wireless-phy.h>
00050 #include <packet-stamp.h>
00051 
00052 class PacketStamp;
00053 class WirelessPhy;
00054 /*======================================================================
00055    Progpagation Models
00056 
00057         Using postion and wireless transmission interface properties,
00058         propagation models compute the power with which a given
00059         packet will be received.
00060 
00061         Not all propagation models will be implemented for all interface
00062         types, since a propagation model may only be appropriate for
00063         certain types of interfaces.
00064 
00065    ====================================================================== */
00066 
00067 class Propagation : public TclObject {
00068 
00069 public:
00070   Propagation() : name(NULL), topo(NULL) {}
00071 
00072   // calculate the Pr by which the receiver will get a packet sent by
00073   // the node that applied the tx PacketStamp for a given inteface 
00074   // type
00075   virtual double Pr(PacketStamp *tx, PacketStamp *rx, Phy *);
00076   virtual double Pr(PacketStamp *tx, PacketStamp *rx, WirelessPhy *);
00077   virtual int command(int argc, const char*const* argv);
00078 
00079   // get interference distance
00080   virtual double getDist(double Pr, double Pt, double Gt, double Gr,
00081                          double hr, double ht, double L, double lambda);
00082 
00083 
00084   // Friis free space equation, likely to be used by other propagation models.
00085   double Friis(double Pt, double Gt, double Gr, double lambda, double L, double d);
00086         // Pt -- transmitted signal power
00087         // Gt -- transmitter antenna gain
00088         // Gr -- receiver antenna gain
00089         // lambda -- wavelength
00090         // L -- system loss (L >= 1)
00091         // d -- distance between transmitter and receiver
00092         // return -- received signal power
00093 
00094 protected:
00095   char *name;
00096   Topography *topo;
00097 };
00098 
00099 
00100 // Friis free space propagation model
00101 class FreeSpace : public Propagation {
00102 public:
00103 //      FreeSpace();
00104         virtual double Pr(PacketStamp *tx, PacketStamp *rx, WirelessPhy *ifp);
00105         virtual double getDist(double Pr, double Pt, double Gt, double Gr,
00106                                double ht, double hr, double L, double lambda);
00107 };
00108 
00109 #endif /* __propagation_h__ */
00110 

Generated on Tue Aug 10 2010 16:16:07 for ns-2.33 by  doxygen 1.7.1