src/devices/wifi/composite-propagation-loss-model.cc
changeset 3907 56e477db65b2
parent 3906 01acc159ffb1
child 3908 232d52317a18
equal deleted inserted replaced
3906:01acc159ffb1 3907:56e477db65b2
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2005,2006,2007 INRIA
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License version 2 as 
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Federico Maguolo <maguolof@dei.unipd.it>
       
    19  */
       
    20 
       
    21 #include "ns3/simulator.h"
       
    22 #include "ns3/uinteger.h"
       
    23 #include "ns3/double.h"
       
    24 #include "ns3/random-variable.h"
       
    25 #include "ns3/mobility-model.h"
       
    26 #include "composite-propagation-loss-model.h"
       
    27 #include <math.h>
       
    28 
       
    29 namespace ns3 {
       
    30 
       
    31 
       
    32 
       
    33 NS_OBJECT_ENSURE_REGISTERED (CompositePropagationLossModel);
       
    34 
       
    35 TypeId
       
    36 CompositePropagationLossModel::GetTypeId (void)
       
    37 {
       
    38   static TypeId tid = TypeId ("ns3::CompositePropagationLossModel")
       
    39     .SetParent<PropagationLossModel> ()
       
    40     .AddConstructor<CompositePropagationLossModel> ()
       
    41     ;
       
    42   return tid;
       
    43 }
       
    44 
       
    45 CompositePropagationLossModel::CompositePropagationLossModel ()
       
    46 {
       
    47   AddDefaults ();
       
    48 }
       
    49 
       
    50 CompositePropagationLossModel::~CompositePropagationLossModel ()
       
    51 {}
       
    52 
       
    53 void
       
    54 CompositePropagationLossModel::AddDefaults ()
       
    55 {}
       
    56 
       
    57 void
       
    58 CompositePropagationLossModel::AddPropagationLossModel (Ptr<PropagationLossModel> pl)
       
    59 {
       
    60   m_propagationModels.push_back (pl);
       
    61 }
       
    62 
       
    63 double
       
    64 CompositePropagationLossModel::GetLoss (Ptr<MobilityModel> a,
       
    65 				        Ptr<MobilityModel> b) const
       
    66 {
       
    67   double rxc = 0.0;
       
    68   for(PropagationModelList::const_iterator i = m_propagationModels.begin (); 
       
    69                                            i != m_propagationModels.end (); 
       
    70 					   i++) {
       
    71     rxc += (*i)->GetLoss (a, b);
       
    72   }
       
    73   
       
    74   return rxc;
       
    75 }
       
    76 
       
    77 } // namespace ns3
       
    78