A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tgax-virtual-desktop.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 DERONNE SOFTWARE ENGINEERING
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#ifndef TGAX_VIRTUAL_DESKTOP_H
10#define TGAX_VIRTUAL_DESKTOP_H
11
12#include "source-application.h"
13
14#include "ns3/address.h"
15#include "ns3/event-id.h"
16#include "ns3/ptr.h"
17
18#include <utility>
19#include <vector>
20
21namespace ns3
22{
23
28
29/**
30 * @ingroup applications
31 * @brief Generate Virtual Desktop Infrastructure (VDI) traffic.
32 *
33 * This VDI traffic generator follows requirements from IEEE 802.11-14/0571r12 - 11ax Evaluation
34 * Methodology (Appendix 2 – Traffic model descriptions: Virtual Desktop Infrastructure Traffic
35 * Model) (see applications documentation for full citation).
36 *
37 * In this model, desktop application packet arrival interval obeys an exponential distribution and
38 * packet size obeys a normal distribution.
39 */
41{
42 public:
43 /**
44 * @brief Get the type ID.
45 * @return the object TypeId
46 */
47 static TypeId GetTypeId();
48
50 ~TgaxVirtualDesktop() override;
51
52 /// Model presets enumeration
53 enum class ModelPresets : uint8_t
54 {
55 CUSTOM = 0, //< Custom traffic model (by default, load parameters of DL model presets)
56 DOWNLINK, //< DL model presets
57 UPLINK //< UL model presets
58 };
59
60 int64_t AssignStreams(int64_t stream) override;
61
62 protected:
63 void DoInitialize() override;
64
65 private:
66 void DoStartApplication() override;
67 void DoConnectionSucceeded(Ptr<Socket> socket) override;
68 void CancelEvents() override;
69
70 /**
71 * @brief Set the parameters of the normal random variable used to generate the VDI packet
72 * sizes.
73 *
74 * @param params a vector of pairs (mean, standard deviation) for each mode of the normal
75 * distribution used to generate the VDI packet sizes
76 */
77 void SetParametersPacketSize(const std::vector<std::pair<double, double>>& params);
78
79 /**
80 * @brief Get the duration to use to schedule the TX of the next VDI packet.
81 *
82 * @return Get the duration to use to schedule the TX of the next VDI packet
83 */
84 Time GetInterArrival() const;
85
86 /**
87 * @brief Get the size in bytes of the next VDI packet to send.
88 *
89 * @return Get the size in bytes of the next VDI packet to send
90 */
91 uint32_t GetPacketSize() const;
92
93 /**
94 * Schedule the next TX
95 */
96 void ScheduleNext();
97
98 /**
99 * Transmit the next VDI packet
100 */
101 void SendPacket();
102
103 /**
104 * Handle a Data Sent event
105 *
106 * @param socket the connected socket
107 * @param size the amount of transmitted bytes
108 */
109 void TxDone(Ptr<Socket> socket, uint32_t size);
110
111 /**
112 * Handle a Send event
113 *
114 * @param socket the connected socket
115 * @param available the amount of available bytes for transmission
116 */
117 void TxAvailable(Ptr<Socket> socket, uint32_t available);
118
119 bool m_initialPacket{true}; //!< True if the next packet to send is the initial packet
120
121 ModelPresets
122 m_modelPresets; //!< Model presets to use to configure the VDI traffic model parameters
123 Ptr<UniformRandomVariable> m_initialArrivalUniform; //!< Uniform random variable to generate
124 //!< initial packet arrival in nanoseconds
126 m_interArrivalExponential; //!< Exponential random variable to generate packet arrival times
127 //!< in nanoseconds
128 Ptr<BernoulliRandomVariable> m_dlModeSelection; //!< Uniform random variable to select mode for
129 //!< downlink bimodal distribution
130 std::vector<Ptr<NormalRandomVariable>>
131 m_pktSizeDistributions; //!< Single or multi modal normal random variables to generate
132 //!< packet sizes in bytes
133
134 EventId m_txEvent; //!< Event id of pending TX event
135 Ptr<Packet> m_unsentPacket; //!< Unsent packet cached for future attempt
136};
137
138} // namespace ns3
139
140#endif /* TGAX_VIRTUAL_DESKTOP_H */
The Bernoulli distribution Random Number Generator (RNG).
An identifier for simulation events.
Definition event-id.h:45
The exponential distribution Random Number Generator (RNG).
The normal (Gaussian) distribution Random Number Generator (RNG) that allows stream numbers to be set...
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
SourceApplication(bool allowPacketSocket=true)
Constructor.
EventId m_txEvent
Event id of pending TX event.
Ptr< Packet > m_unsentPacket
Unsent packet cached for future attempt.
void TxDone(Ptr< Socket > socket, uint32_t size)
Handle a Data Sent event.
void SendPacket()
Transmit the next VDI packet.
std::vector< Ptr< NormalRandomVariable > > m_pktSizeDistributions
Single or multi modal normal random variables to generate packet sizes in bytes.
ModelPresets
Model presets enumeration.
void DoStartApplication() override
Application specific startup code for child subclasses.
Ptr< ExponentialRandomVariable > m_interArrivalExponential
Exponential random variable to generate packet arrival times in nanoseconds.
uint32_t GetPacketSize() const
Get the size in bytes of the next VDI packet to send.
void SetParametersPacketSize(const std::vector< std::pair< double, double > > &params)
Set the parameters of the normal random variable used to generate the VDI packet sizes.
ModelPresets m_modelPresets
Model presets to use to configure the VDI traffic model parameters.
Ptr< UniformRandomVariable > m_initialArrivalUniform
Uniform random variable to generate initial packet arrival in nanoseconds.
void ScheduleNext()
Schedule the next TX.
void TxAvailable(Ptr< Socket > socket, uint32_t available)
Handle a Send event.
void DoConnectionSucceeded(Ptr< Socket > socket) override
Application specific code for child subclasses upon a Connection Succeed event.
static TypeId GetTypeId()
Get the type ID.
void CancelEvents() override
Cancel all pending events.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this Application object.
Time GetInterArrival() const
Get the duration to use to schedule the TX of the next VDI packet.
Ptr< BernoulliRandomVariable > m_dlModeSelection
Uniform random variable to select mode for downlink bimodal distribution.
bool m_initialPacket
True if the next packet to send is the initial packet.
void DoInitialize() override
Initialize() implementation.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
The uniform distribution Random Number Generator (RNG).
Every class exported by the ns3 library is enclosed in the ns3 namespace.