A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDCAST
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 * Amine Ismail <amine.ismail@sophia.inria.fr>
19 */
20
21#ifndef WIMAX_HELPER_H
22#define WIMAX_HELPER_H
23
24#include "ns3/bs-net-device.h"
25#include "ns3/bs-scheduler-rtps.h"
26#include "ns3/bs-scheduler-simple.h"
27#include "ns3/bs-scheduler.h"
28#include "ns3/bs-uplink-scheduler-mbqos.h"
29#include "ns3/bs-uplink-scheduler-rtps.h"
30#include "ns3/bs-uplink-scheduler-simple.h"
31#include "ns3/bs-uplink-scheduler.h"
32#include "ns3/net-device-container.h"
33#include "ns3/node-container.h"
34#include "ns3/object-factory.h"
35#include "ns3/propagation-loss-model.h"
36#include "ns3/service-flow.h"
37#include "ns3/simple-ofdm-wimax-channel.h"
38#include "ns3/ss-net-device.h"
39#include "ns3/trace-helper.h"
40
41#include <string>
42
43namespace ns3
44{
45
46class WimaxChannel;
47class WimaxPhy;
48class UplinkScheduler;
49
50/**
51 * \brief helps to manage and create WimaxNetDevice objects
52 *
53 * This class can help to create a large set of similar
54 * WimaxNetDevice objects and to configure their attributes
55 * during creation.
56 */
57
59{
60 public:
61 /**
62 * Net Device Type
63 * Distinguish a subscriber station(SS) device from base station(BS) device
64 */
66 {
67 DEVICE_TYPE_SUBSCRIBER_STATION, /**< Subscriber station(SS) device */
69 /**< Base station(BS) device */
70 };
71
72 /**
73 * WiMAX Physical layer
74 * WiMAX Physical layers with different levels of detail
75 */
77 {
79 };
80
81 /**
82 * Scheduler Type
83 * Different implementations of uplink/downlink scheduler
84 */
86 {
87 SCHED_TYPE_SIMPLE, /**< A simple priority-based FCFS scheduler */
88 SCHED_TYPE_RTPS, /**< A simple scheduler - rtPS based scheduler */
90 /**< An migration-based uplink scheduler */
91 };
92
93 /**
94 * \brief Create a Wimax helper in an empty state.
95 */
97 ~WimaxHelper() override;
98 /**
99 * \brief Enable ascii trace output on the indicated net device for a given connection
100 * \param oss The output stream object to use when logging ascii traces.
101 * \param nodeid the id of the node for which you want to enable tracing.
102 * \param deviceid the id of the net device for which you want to enable tracing.
103 * \param netdevice the type of net device for which you want to enable tracing
104 * (SubscriberStationNetDevice, BaseStationNetDevice or WimaxNetDevice)
105 * \param connection the connection for which you want to enable tracing
106 * (InitialRangingConnection, BroadcastConnection, BasicConnection, PrimaryConnection).
107 */
109 uint32_t nodeid,
110 uint32_t deviceid,
111 char* netdevice,
112 char* connection);
113
114 /**
115 * \param phyType WiMAX Physical layer type
116 * \return WiMAX Phy object
117 *
118 * Creates a physical layer object to be used in simulation.
119 */
121
122 /**
123 * \param schedulerType Scheduling mechanism
124 * \return Uplink scheduler
125 *
126 * Creates a uplink scheduler to be used by base station
127 * according to selected scheduling mechanism.
128 */
130
131 /**
132 * \param schedulerType Scheduling mechanism
133 * \return Downlink scheduler
134 *
135 * Creates a downlink scheduler to be used by base station
136 * according to selected scheduling mechanism.
137 */
139
140 /**
141 * \param c a set of nodes
142 * \param type device type to create
143 * \param phyType a phy to use
144 * \param schedulerType the type of the scheduling algorithm to install
145 * \return NetDeviceContainer
146 *
147 * For each of the input nodes, a new WiMAX net device (either
148 * ns3::SubscriberStationNetDevice or ns3::BaseStationNetDevice
149 * depending on the type parameter) is attached to the shared input channel.
150 */
152 NetDeviceType type,
153 PhyType phyType,
154 SchedulerType schedulerType);
155
156 /**
157 * \param c A set of nodes.
158 * \param deviceType Device type to create.
159 * \param phyType PHY type to create.
160 * \param channel A channel to use.
161 * \param schedulerType The scheduling mechanism.
162 * \return NetDeviceContainer
163 *
164 * For each of the input nodes, a new WiMAX net device (either
165 * ns3::SubscriberStationNetDevice or ns3::BaseStationNetDevice
166 * depending on the type parameter) is attached to the shared input channel.
167 */
169 NetDeviceType deviceType,
170 PhyType phyType,
171 Ptr<WimaxChannel> channel,
172 SchedulerType schedulerType);
173 /**
174 * \param c A set of nodes.
175 * \param deviceType Device type to create.
176 * \param phyType PHY type to create.
177 * \param schedulerType The scheduling mechanism.
178 * \param frameDuration the farme duration in seconds
179 * \return NetDeviceContainer
180 *
181 * For each of the input nodes, a new WiMAX net device (either
182 * ns3::SubscriberStationNetDevice or ns3::BaseStationNetDevice
183 * depending on the type parameter) is attached to the shared input channel.
184 */
186 NetDeviceType deviceType,
187 PhyType phyType,
188 SchedulerType schedulerType,
189 double frameDuration);
190
191 /**
192 * \brief Set the propagation and loss model of the channel. By default the channel
193 * uses a COST231 propagation and loss model.
194 * \param propagationModel The propagation and loss model to set
195 */
197
198 /**
199 * \param phyType WiMAX Physical layer type
200 * \return WiMAX Phy object
201 *
202 * Creates a physical layer without a channel
203 */
205
206 /**
207 * \param phyType WiMAX Physical layer type
208 * \param SNRTraceFilePath of the repository containing the SNR traces files
209 * \param activateLoss set to 1 to activate losses 0 otherwise
210 * \return WiMAX Phy object
211 *
212 * Creates a physical layer without creating a channel
213 */
215 char* SNRTraceFilePath,
216 bool activateLoss);
217
218 /**
219 * \param phyType WiMAX Physical layer type
220 * \param SNRTraceFilePath the path to the repository containing the SNR traces files
221 * \param activateLoss set to 1 if you want ton activate losses 0 otherwise
222 * \return WiMAX Phy object
223 *
224 * Creates a physical layer
225 */
226 Ptr<WimaxPhy> CreatePhy(PhyType phyType, char* SNRTraceFilePath, bool activateLoss);
227 /**
228 * \param node Node to be installed.
229 * \param deviceType Device type to create.
230 * \param phyType PHY type to create.
231 * \param channel A channel to use.
232 * \param schedulerType The scheduling mechanism to install on the device.
233 * \return Ptr<WimaxNetDevice>
234 *
235 * For each of the input nodes, a new WiMAX net device (either
236 * ns3::SubscriberStationNetDevice or ns3::BaseStationNetDevice
237 * depending on the type parameter) is attached to the shared input channel.
238 */
240 NetDeviceType deviceType,
241 PhyType phyType,
242 Ptr<WimaxChannel> channel,
243 SchedulerType schedulerType);
244
245 /**
246 * \brief Creates a transport service flow.
247 * \param direction the direction of the service flow: UP or DOWN.
248 * \param schedulinType The service scheduling type to be used: UGS, RTPS, NRTPS, BE
249 * \param classifier The classifier to be used for this service flow
250 * \return ServiceFlow
251 *
252 */
254 ServiceFlow::SchedulingType schedulinType,
255 IpcsClassifierRecord classifier);
256
257 /**
258 * Helper to enable all WimaxNetDevice log components with one statement
259 */
260 static void EnableLogComponents();
261
262 /**
263 * Assign a fixed random variable stream number to the random variables
264 * used by this model. Return the number of streams (possibly zero) that
265 * have been assigned.
266 *
267 * \param stream first stream index to use
268 * \return the number of stream indices assigned by this model
269 */
270 int64_t AssignStreams(int64_t stream);
271
272 /**
273 * Assign a fixed random variable stream number to the random variables
274 * used by this model. Return the number of streams (possibly zero) that
275 * have been assigned. The Install() method should have previously been
276 * called by the user.
277 *
278 * \param c NetDeviceContainer of the set of net devices for which the
279 * WimaxNetDevice should be modified to use a fixed stream
280 * \param stream first stream index to use
281 * \return the number of stream indices assigned by this helper
282 */
283 int64_t AssignStreams(NetDeviceContainer c, int64_t stream);
284
285 private:
286 /**
287 * ASCII trace receive event
288 * \param stream the output stream
289 * \param path the path name
290 * \param packet the packet
291 * \param source the source MAC address
292 */
293 static void AsciiRxEvent(Ptr<OutputStreamWrapper> stream,
294 std::string path,
295 Ptr<const Packet> packet,
296 const Mac48Address& source);
297 /**
298 * ASCII trace transmit event
299 * \param stream the output stream
300 * \param path the path
301 * \param packet the packet
302 * \param dest the destination MAC address
303 */
304 static void AsciiTxEvent(Ptr<OutputStreamWrapper> stream,
305 std::string path,
306 Ptr<const Packet> packet,
307 const Mac48Address& dest);
308 /**
309 * \brief Enable pcap output on the indicated net device.
310 *
311 * NetDevice-specific implementation mechanism for hooking the trace and
312 * writing to the trace file.
313 *
314 * \param prefix Filename prefix to use for pcap files.
315 * \param nd Net device for which you want to enable tracing.
316 * \param explicitFilename Treat the prefix as an explicit filename if true
317 * \param promiscuous If true capture all possible packets available at the device.
318 */
319 void EnablePcapInternal(std::string prefix,
321 bool explicitFilename,
322 bool promiscuous) override;
323
324 /**
325 * \brief Enable ascii trace output on the indicated net device.
326 *
327 * NetDevice-specific implementation mechanism for hooking the trace and
328 * writing to the trace file.
329 *
330 * \param stream The output stream object to use when logging ascii traces.
331 * \param prefix Filename prefix to use for ascii trace files.
332 * \param nd Net device for which you want to enable tracing.
333 * \param explicitFilename Treat the prefix as an explicit filename if true
334 */
336 std::string prefix,
338 bool explicitFilename) override;
339
340 Ptr<WimaxChannel> m_channel; ///< wifi channel
341};
342
343} // namespace ns3
344
345#endif /* WIMAX_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition: trace-helper.h:729
IpcsClassifierRecord class.
an EUI-48 address
Definition: mac48-address.h:46
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Base class providing common user-level pcap operations for helpers representing net devices.
Definition: trace-helper.h:624
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:62
Direction
Direction enumeration.
Definition: service-flow.h:47
helps to manage and create WimaxNetDevice objects
Definition: wimax-helper.h:59
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Definition: wimax-helper.h:86
@ SCHED_TYPE_RTPS
A simple scheduler - rtPS based scheduler.
Definition: wimax-helper.h:88
@ SCHED_TYPE_MBQOS
An migration-based uplink scheduler.
Definition: wimax-helper.h:89
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
Definition: wimax-helper.h:87
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device.
Definition: wimax-helper.h:66
@ DEVICE_TYPE_SUBSCRIBER_STATION
Subscriber station(SS) device.
Definition: wimax-helper.h:67
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
Definition: wimax-helper.h:68
Ptr< WimaxChannel > m_channel
wifi channel
Definition: wimax-helper.h:340
Ptr< WimaxPhy > CreatePhyWithoutChannel(PhyType phyType)
Ptr< UplinkScheduler > CreateUplinkScheduler(SchedulerType schedulerType)
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
PhyType
WiMAX Physical layer WiMAX Physical layers with different levels of detail.
Definition: wimax-helper.h:77
~WimaxHelper() override
Definition: wimax-helper.cc:49
Ptr< BSScheduler > CreateBSScheduler(SchedulerType schedulerType)
Ptr< WimaxPhy > CreatePhy(PhyType phyType)
Definition: wimax-helper.cc:80
WimaxHelper()
Create a Wimax helper in an empty state.
Definition: wimax-helper.cc:44
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
ASCII trace transmit event.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static void EnableAsciiForConnection(Ptr< OutputStreamWrapper > oss, uint32_t nodeid, uint32_t deviceid, char *netdevice, char *connection)
Enable ascii trace output on the indicated net device for a given connection.
Definition: wimax-helper.cc:54
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
static void EnableLogComponents()
Helper to enable all WimaxNetDevice log components with one statement.
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous) override
Enable pcap output on the indicated net device.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
Every class exported by the ns3 library is enclosed in the ns3 namespace.