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