A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
periodic-sender.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 University of Padova
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
#ifndef PERIODIC_SENDER_H
10
#define PERIODIC_SENDER_H
11
12
#include "
lorawan-mac.h
"
13
14
#include "ns3/application.h"
15
#include "ns3/attribute.h"
16
#include "ns3/nstime.h"
17
18
namespace
ns3
19
{
20
namespace
lorawan
21
{
22
23
/**
24
* \ingroup lorawan
25
*
26
* Implements a sender application generating packets following a periodic point process.
27
*/
28
class
PeriodicSender
:
public
Application
29
{
30
public
:
31
PeriodicSender
();
//!< Default constructor
32
~PeriodicSender
()
override
;
//!< Destructor
33
34
/**
35
* Register this type.
36
* \return The object TypeId.
37
*/
38
static
TypeId
GetTypeId
();
39
40
/**
41
* Set the sending interval.
42
*
43
* \param interval The interval between two packet send instances.
44
*/
45
void
SetInterval
(
Time
interval);
46
47
/**
48
* Get the sending interval.
49
*
50
* \return The interval between two packet sends.
51
*/
52
Time
GetInterval
()
const
;
53
54
/**
55
* Set the initial delay of this application.
56
*
57
* \param delay The initial delay value.
58
*/
59
void
SetInitialDelay
(
Time
delay);
60
61
/**
62
* Set packet size.
63
*
64
* \param size The base packet size value in bytes.
65
*/
66
void
SetPacketSize
(uint8_t size);
67
68
/**
69
* Set to add randomness to the base packet size.
70
*
71
* On each call to SendPacket(), an integer number is picked from a random variable. That
72
* integer number is then added to the base packet size to create the new packet.
73
*
74
* \param rv The random variable used to extract the additional number of packet bytes.
75
* Extracted values can be negative, but if they are lower than the base packet size they
76
* produce a runtime error. This check is left to the caller during definition of the random
77
* variable.
78
*/
79
void
SetPacketSizeRandomVariable
(
Ptr<RandomVariableStream>
rv);
80
81
/**
82
* Send a packet using the LoraNetDevice's Send method.
83
*/
84
void
SendPacket
();
85
86
/**
87
* Start the application by scheduling the first SendPacket event.
88
*/
89
void
StartApplication
()
override
;
90
91
/**
92
* Stop the application.
93
*/
94
void
StopApplication
()
override
;
95
96
private
:
97
Time
m_interval
;
//!< The interval between to consecutive send events.
98
Time
m_initialDelay
;
//!< The initial delay of this application.
99
EventId
m_sendEvent
;
//!< The sending event scheduled as next.
100
Ptr<LorawanMac>
m_mac
;
//!< The MAC layer of this node.
101
uint8_t
m_basePktSize
;
//!< The packet size.
102
Ptr<RandomVariableStream>
103
m_pktSizeRV
;
//!< The random variable that adds bytes to the packet size.
104
};
105
106
}
// namespace lorawan
107
108
}
// namespace ns3
109
#endif
/* SENDER_APPLICATION */
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::EventId
An identifier for simulation events.
Definition
event-id.h:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::lorawan::PeriodicSender
Implements a sender application generating packets following a periodic point process.
Definition
periodic-sender.h:29
ns3::lorawan::PeriodicSender::m_pktSizeRV
Ptr< RandomVariableStream > m_pktSizeRV
The random variable that adds bytes to the packet size.
Definition
periodic-sender.h:103
ns3::lorawan::PeriodicSender::m_interval
Time m_interval
The interval between to consecutive send events.
Definition
periodic-sender.h:97
ns3::lorawan::PeriodicSender::~PeriodicSender
~PeriodicSender() override
Destructor.
Definition
periodic-sender.cc:58
ns3::lorawan::PeriodicSender::GetInterval
Time GetInterval() const
Get the sending interval.
Definition
periodic-sender.cc:71
ns3::lorawan::PeriodicSender::m_mac
Ptr< LorawanMac > m_mac
The MAC layer of this node.
Definition
periodic-sender.h:100
ns3::lorawan::PeriodicSender::SetInterval
void SetInterval(Time interval)
Set the sending interval.
Definition
periodic-sender.cc:64
ns3::lorawan::PeriodicSender::SetPacketSize
void SetPacketSize(uint8_t size)
Set packet size.
Definition
periodic-sender.cc:91
ns3::lorawan::PeriodicSender::StartApplication
void StartApplication() override
Start the application by scheduling the first SendPacket event.
Definition
periodic-sender.cc:121
ns3::lorawan::PeriodicSender::SetInitialDelay
void SetInitialDelay(Time delay)
Set the initial delay of this application.
Definition
periodic-sender.cc:78
ns3::lorawan::PeriodicSender::SetPacketSizeRandomVariable
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set to add randomness to the base packet size.
Definition
periodic-sender.cc:85
ns3::lorawan::PeriodicSender::m_initialDelay
Time m_initialDelay
The initial delay of this application.
Definition
periodic-sender.h:98
ns3::lorawan::PeriodicSender::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
periodic-sender.cc:28
ns3::lorawan::PeriodicSender::SendPacket
void SendPacket()
Send a packet using the LoraNetDevice's Send method.
Definition
periodic-sender.cc:97
ns3::lorawan::PeriodicSender::m_sendEvent
EventId m_sendEvent
The sending event scheduled as next.
Definition
periodic-sender.h:99
ns3::lorawan::PeriodicSender::PeriodicSender
PeriodicSender()
Default constructor.
Definition
periodic-sender.cc:48
ns3::lorawan::PeriodicSender::StopApplication
void StopApplication() override
Stop the application.
Definition
periodic-sender.cc:144
ns3::lorawan::PeriodicSender::m_basePktSize
uint8_t m_basePktSize
The packet size.
Definition
periodic-sender.h:101
lorawan-mac.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
periodic-sender.h
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0