A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uan-cw-example.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Leonard Tracy <lentracy@gmail.com>
7 */
8
9#ifndef UAN_CW_EXAMPLE_H
10#define UAN_CW_EXAMPLE_H
11
12#include "ns3/network-module.h"
13#include "ns3/stats-module.h"
14#include "ns3/uan-module.h"
15
16using namespace ns3;
17
18/**
19 * @ingroup uan
20 * @brief Helper class for UAN CW MAC example.
21 *
22 * An experiment measures the average throughput for a series of CW values.
23 *
24 * @see uan-cw-example.cc
25 */
26class Experiment
27{
28 public:
29 /**
30 * Run an experiment across a range of congestion window values.
31 *
32 * @param uan The Uan stack helper to configure nodes in the model.
33 * @return The data set of CW values and measured throughput
34 */
36 /**
37 * Receive all available packets from a socket.
38 *
39 * @param socket The receive socket.
40 */
42 /**
43 * Assign new random positions to a set of nodes. New positions
44 * are randomly assigned within the bounding box.
45 *
46 * @param nodes The nodes to reposition.
47 */
49 /** Save the throughput from a single run. */
50 void ResetData();
51 /**
52 * Compute average throughput for a set of runs, then increment CW.
53 *
54 * @param cw CW value for completed runs.
55 */
56 void IncrementCw(uint32_t cw);
57
58 uint32_t m_numNodes; //!< Number of transmitting nodes.
59 uint32_t m_dataRate; //!< DataRate in bps.
60 double m_depth; //!< Depth of transmitting and sink nodes.
61 double m_boundary; //!< Size of boundary in meters.
62 uint32_t m_packetSize; //!< Generated packet size in bytes.
63 uint32_t m_bytesTotal; //!< Total bytes received.
64 uint32_t m_cwMin; //!< Min CW to simulate.
65 uint32_t m_cwMax; //!< Max CW to simulate.
66 uint32_t m_cwStep; //!< CW step size, default 10.
67 uint32_t m_avgs; //!< Number of topologies to test for each cw point.
68
69 Time m_slotTime; //!< Slot time duration.
70 Time m_simTime; //!< Simulation run time, default 1000 s.
71
72 std::string m_gnudatfile; //!< Name for GNU Plot output, default uan-cw-example.gpl.
73 std::string m_asciitracefile; //!< Name for ascii trace file, default uan-cw-example.asc.
74 std::string m_bhCfgFile; //!< (Unused)
75
76 Gnuplot2dDataset m_data; //!< Container for the simulation data.
77 std::vector<double> m_throughputs; //!< Throughput for each run.
78
79 /** Default constructor. */
81};
82
83#endif /* UAN_CW_EXAMPLE_H */
WiFi adhoc experiment class.
Definition wifi-adhoc.cc:34
uint32_t m_packetSize
Packet size.
double m_depth
Depth of transmitting and sink nodes.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
Run an experiment.
std::string m_asciitracefile
Name for ascii trace file, default uan-cw-example.asc.
uint32_t m_cwMin
Min CW to simulate.
uint32_t m_bytesTotal
The number of received bytes.
Definition wifi-adhoc.cc:86
Experiment()
Default constructor.
Time m_simTime
Simulation run time, default 1000 s.
uint32_t m_cwMax
Max CW to simulate.
uint32_t m_avgs
Number of topologies to test for each cw point.
void ResetData()
Save the throughput from a single run.
uint32_t m_dataRate
DataRate in bps.
Gnuplot2dDataset m_data
Container for the simulation data.
void ReceivePacket(Ptr< Socket > socket)
Receive all available packets from a socket.
Time m_slotTime
Slot time duration.
std::string m_bhCfgFile
(Unused)
std::string m_gnudatfile
Name for GNU Plot output, default uan-cw-example.gpl.
std::vector< double > m_throughputs
Throughput for each run.
void IncrementCw(uint32_t cw)
Compute average throughput for a set of runs, then increment CW.
uint32_t m_numNodes
Number of transmitting nodes.
double m_boundary
Size of boundary in meters.
void UpdatePositions(NodeContainer &nodes) const
Assign new random positions to a set of nodes.
uint32_t m_cwStep
CW step size, default 10.
Class to represent a 2D points plot.
Definition gnuplot.h:105
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
UAN configuration helper.
Definition uan-helper.h:31
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.