Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | |
2 /* | |
3 * Copyright (c) 2008 INRIA | |
4 * Copyright (c) 2009 MIRKO BANCHI | |
5 * Copyright (c) 2013 Dalian University of Technology | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License version 2 as | |
9 * published by the Free Software Foundation; | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | |
21 * Author: Mirko Banchi <mk.banchi@gmail.com> | |
22 * Author: Junling Bu <linlinjavaer@gmail.com> | |
23 */ | |
24 #include "ns3/wifi-helper.h" | |
25 #include "ns3/wifi-net-device.h" | |
26 #include "ns3/wifi-mac.h" | |
27 #include "ns3/regular-wifi-mac.h" | |
28 #include "ns3/dca-txop.h" | |
29 #include "ns3/edca-txop-n.h" | |
30 #include "ns3/minstrel-wifi-manager.h" | |
31 #include "ns3/wifi-phy.h" | |
32 #include "ns3/wifi-remote-station-manager.h" | |
33 #include "ns3/wifi-channel.h" | |
34 #include "ns3/yans-wifi-channel.h" | |
35 #include "ns3/msdu-aggregator.h" | |
36 #include "ns3/log.h" | |
37 #include "ns3/config.h" | |
38 #include "ns3/pointer.h" | |
39 #include "ns3/simulator.h" | |
40 #include "ns3/names.h" | |
41 #include "ns3/boolean.h" | |
42 #include "ns3/string.h" | |
43 #include "ns3/ocb-wifi-mac.h" | |
44 #include "wifi-80211p-helper.h" | |
45 | |
46 namespace ns3 { | |
47 | |
48 Wifi80211pHelper::Wifi80211pHelper () | |
49 { | |
50 } | |
51 | |
52 Wifi80211pHelper::~Wifi80211pHelper () | |
53 { | |
54 } | |
55 | |
56 Wifi80211pHelper | |
57 Wifi80211pHelper::Default (void) | |
58 { | |
59 Wifi80211pHelper helper; | |
60 helper.SetRemoteStationManager ("ns3::ConstantRateWifiManager", | |
61 "DataMode", StringValue ("OfdmRate 6MbpsBW10MHz"), | |
62 "ControlMode",StringValue ("OfdmRa te6MbpsBW10MHz")); | |
63 return helper; | |
64 } | |
65 | |
66 void | |
67 Wifi80211pHelper::SetRemoteStationManager (std::string type, | |
68 std::string n0, const AttributeValue &v0, | |
69 std::string n1, const AttributeValue &v1, | |
70 std::string n2, const AttributeValue &v2, | |
71 std::string n3, const AttributeValue &v3, | |
72 std::string n4, const AttributeValue &v4, | |
73 std::string n5, const AttributeValue &v5, | |
74 std::string n6, const AttributeValue &v6, | |
75 std::string n7, const AttributeValue &v7) | |
76 { | |
77 m_stationManager.SetTypeId (type); | |
78 m_stationManager.Set (n0, v0); | |
79 m_stationManager.Set (n1, v1); | |
80 m_stationManager.Set (n2, v2); | |
81 m_stationManager.Set (n3, v3); | |
82 m_stationManager.Set (n4, v4); | |
83 m_stationManager.Set (n5, v5); | |
84 m_stationManager.Set (n6, v6); | |
85 m_stationManager.Set (n7, v7); | |
86 } | |
87 | |
88 void | |
89 Wifi80211pHelper::EnableLogComponents (void) | |
90 { | |
91 WifiHelper::EnableLogComponents(); | |
92 | |
93 LogComponentEnable ("OcbWifiMac", LOG_LEVEL_ALL); | |
94 LogComponentEnable ("VendorSpecificAction", LOG_LEVEL_ALL); | |
95 } | |
96 | |
97 /* Need REDO */ | |
Tom Henderson
2013/07/28 15:22:29
can you clarify what is the open issue here?
Junling Bu
2013/07/30 16:52:01
No, the "REDO" is used when I copy code from WifiH
| |
98 NetDeviceContainer | |
99 Wifi80211pHelper::Install (const WifiPhyHelper &phyHelper, const WaveMacHelper & macHelper, NodeContainer c) const | |
100 { | |
101 NetDeviceContainer devices; | |
102 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) | |
103 { | |
104 Ptr<Node> node = *i; | |
105 Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> (); | |
106 Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemot eStationManager> (); | |
107 Ptr<WifiMac> mac = macHelper.Create (); | |
108 Ptr<WifiPhy> phy = phyHelper.Create (node, device); | |
109 mac->SetAddress (Mac48Address::Allocate ()); | |
110 mac->ConfigureStandard (WIFI_PHY_STANDARD_80211_10MHZ); | |
111 phy->ConfigureStandard (WIFI_PHY_STANDARD_80211_10MHZ); | |
112 device->SetMac (mac); | |
113 device->SetPhy (phy); | |
114 device->SetRemoteStationManager (manager); | |
115 node->AddDevice (device); | |
116 devices.Add (device); | |
117 } | |
118 return devices; | |
119 } | |
120 | |
121 NetDeviceContainer | |
122 Wifi80211pHelper::Install (const WifiPhyHelper &phy, const WaveMacHelper &mac, P tr<Node> node) const | |
123 { | |
124 return Install (phy, mac, NodeContainer (node)); | |
125 } | |
126 | |
127 NetDeviceContainer | |
128 Wifi80211pHelper::Install (const WifiPhyHelper &phy, const WaveMacHelper &mac, s td::string nodeName) const | |
129 { | |
130 Ptr<Node> node = Names::Find<Node> (nodeName); | |
131 return Install (phy, mac, NodeContainer (node)); | |
132 } | |
133 | |
134 int64_t | |
135 Wifi80211pHelper::AssignStreams (NetDeviceContainer c, int64_t stream) | |
136 { | |
137 int64_t currentStream = stream; | |
138 Ptr<NetDevice> netDevice; | |
139 for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i) | |
140 { | |
141 netDevice = (*i); | |
142 Ptr<WifiNetDevice> wifi = DynamicCast<WifiNetDevice> (netDevice); | |
143 if (wifi) | |
144 { | |
145 // Handle any random numbers in the PHY objects. | |
146 currentStream += wifi->GetPhy ()->AssignStreams (currentStream); | |
147 | |
148 // Handle any random numbers in the station managers. | |
149 Ptr<WifiRemoteStationManager> manager = wifi->GetRemoteStationManager (); | |
150 Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> ( manager); | |
151 if (minstrel) | |
152 { | |
153 currentStream += minstrel->AssignStreams (currentStream); | |
154 } | |
155 | |
156 // Handle any random numbers in the MAC objects. | |
157 Ptr<WifiMac> mac = wifi->GetMac (); | |
158 Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac); | |
159 if (rmac) | |
160 { | |
161 PointerValue ptr; | |
162 rmac->GetAttribute ("DcaTxop", ptr); | |
163 Ptr<DcaTxop> dcaTxop = ptr.Get<DcaTxop> (); | |
164 currentStream += dcaTxop->AssignStreams (currentStream); | |
165 | |
166 rmac->GetAttribute ("VO_EdcaTxopN", ptr); | |
167 Ptr<EdcaTxopN> vo_edcaTxopN = ptr.Get<EdcaTxopN> (); | |
168 currentStream += vo_edcaTxopN->AssignStreams (currentStream); | |
169 | |
170 rmac->GetAttribute ("VI_EdcaTxopN", ptr); | |
171 Ptr<EdcaTxopN> vi_edcaTxopN = ptr.Get<EdcaTxopN> (); | |
172 currentStream += vi_edcaTxopN->AssignStreams (currentStream); | |
173 | |
174 rmac->GetAttribute ("BE_EdcaTxopN", ptr); | |
175 Ptr<EdcaTxopN> be_edcaTxopN = ptr.Get<EdcaTxopN> (); | |
176 currentStream += be_edcaTxopN->AssignStreams (currentStream); | |
177 | |
178 rmac->GetAttribute ("BK_EdcaTxopN", ptr); | |
179 Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> (); | |
180 currentStream += bk_edcaTxopN->AssignStreams (currentStream); | |
181 } | |
182 } | |
183 } | |
184 return (currentStream - stream); | |
185 } | |
186 | |
187 } // namespace ns3 | |
OLD | NEW |