OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Marco Miozzo <marco.miozzo@cttc.es> | 18 * Author: Marco Miozzo <marco.miozzo@cttc.es> |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #include "ns3/propagation-loss-model.h" | 22 #include "ns3/propagation-loss-model.h" |
23 #include "ns3/log.h" | 23 #include "ns3/log.h" |
24 #include "ns3/mobility-model.h" | 24 #include "ns3/mobility-model.h" |
25 #include "ns3/double.h" | 25 #include "ns3/double.h" |
26 #include "ns3/pointer.h" | 26 #include "ns3/pointer.h" |
27 #include <cmath> | 27 #include <cmath> |
28 #include "oh-buildings-propagation-loss-model.h" | 28 #include "oh-buildings-propagation-loss-model.h" |
29 #include <ns3/mobility-building-info.h> | 29 #include <ns3/mobility-building-info.h> |
(...skipping 15 matching lines...) Expand all Loading... |
45 } | 45 } |
46 | 46 |
47 OhBuildingsPropagationLossModel::~OhBuildingsPropagationLossModel () | 47 OhBuildingsPropagationLossModel::~OhBuildingsPropagationLossModel () |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 TypeId | 51 TypeId |
52 OhBuildingsPropagationLossModel::GetTypeId (void) | 52 OhBuildingsPropagationLossModel::GetTypeId (void) |
53 { | 53 { |
54 static TypeId tid = TypeId ("ns3::OhBuildingsPropagationLossModel") | 54 static TypeId tid = TypeId ("ns3::OhBuildingsPropagationLossModel") |
55 | 55 |
56 .SetParent<BuildingsPropagationLossModel> () | 56 .SetParent<BuildingsPropagationLossModel> () |
57 .SetGroupName ("Buildings") | 57 .SetGroupName ("Buildings") |
58 | 58 |
59 .AddConstructor<OhBuildingsPropagationLossModel> (); | 59 .AddConstructor<OhBuildingsPropagationLossModel> (); |
60 | 60 |
61 return tid; | 61 return tid; |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 double | 65 double |
66 OhBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityMode
l> b) const | 66 OhBuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityMode
l> b) const |
67 { | 67 { |
68 NS_LOG_FUNCTION (this << a << b); | 68 NS_LOG_FUNCTION (this << a << b); |
69 | 69 |
70 // get the MobilityBuildingInfo pointers | 70 // get the MobilityBuildingInfo pointers |
(...skipping 18 matching lines...) Expand all Loading... |
89 } // end b1->isIndoor () | 89 } // end b1->isIndoor () |
90 } | 90 } |
91 else | 91 else |
92 { | 92 { |
93 // a is indoor | 93 // a is indoor |
94 if (b1->IsIndoor ()) | 94 if (b1->IsIndoor ()) |
95 { | 95 { |
96 if (a1->GetBuilding () == b1->GetBuilding ()) | 96 if (a1->GetBuilding () == b1->GetBuilding ()) |
97 { | 97 { |
98 // nodes are in same building -> indoor communication ITU-R P.1238 | 98 // nodes are in same building -> indoor communication ITU-R P.1238 |
99 loss = m_okumuraHata->GetLoss (a, b) + InternalWallsLoss (a1, b1);
; | 99 loss = m_okumuraHata->GetLoss (a, b) + InternalWallsLoss (a1, b1); |
100 NS_LOG_INFO (this << " I-I (same building)" << loss); | 100 NS_LOG_INFO (this << " I-I (same building)" << loss); |
101 | 101 |
102 } | 102 } |
103 else | 103 else |
104 { | 104 { |
105 // nodes are in different buildings | 105 // nodes are in different buildings |
106 loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1) + Ext
ernalWallLoss (b1); | 106 loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1) + Ext
ernalWallLoss (b1); |
107 NS_LOG_INFO (this << " I-O-I (different buildings): " << loss); | 107 NS_LOG_INFO (this << " I-O-I (different buildings): " << loss); |
108 } | 108 } |
109 } | 109 } |
110 else | 110 else |
111 { | 111 { |
112 loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1); | 112 loss = m_okumuraHata->GetLoss (a, b) + ExternalWallLoss (a1); |
113 NS_LOG_INFO (this << " I-O : " << loss); | 113 NS_LOG_INFO (this << " I-O : " << loss); |
114 } // end b1->IsIndoor () | 114 } // end b1->IsIndoor () |
115 } // end a1->IsOutdoor () | 115 } // end a1->IsOutdoor () |
116 | 116 |
117 loss = std::max (0.0, loss); | 117 loss = std::max (0.0, loss); |
118 return loss; | 118 return loss; |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 } // namespace ns3 | 122 } // namespace ns3 |
OLD | NEW |