A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
periodic-sender-helper.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_HELPER_H
10#define PERIODIC_SENDER_HELPER_H
11
12#include "ns3/application-container.h"
13#include "ns3/node-container.h"
14#include "ns3/object-factory.h"
15
16namespace ns3
17{
18namespace lorawan
19{
20
21/**
22 * @ingroup lorawan
23 *
24 * This class can be used to install PeriodicSender applications on a wide
25 * range of nodes.
26 */
28{
29 public:
30 PeriodicSenderHelper(); //!< Default constructor
31 ~PeriodicSenderHelper(); //!< Destructor
32
33 /**
34 * Helper function used to set the underlying application attributes.
35 *
36 * @param name The name of the application attribute to set.
37 * @param value The value of the application attribute to set.
38 */
39 void SetAttribute(std::string name, const AttributeValue& value);
40
41 /**
42 * Install a PeriodicSender application on each node of the input container
43 * configured with all the attributes set with SetAttribute or other functions of this class.
44 *
45 * @param c NodeContainer of the set of nodes on which an PeriodicSender
46 * will be installed.
47 * @return Container of Ptr to the applications installed.
48 */
50
51 /**
52 * Install a PeriodicSender application on the input Node configured with all the attributes set
53 * with SetAttribute or other functions of this class.
54 *
55 * @param node The node on which a PeriodicSender will be installed.
56 * @return Container of the Ptr to the application installed.
57 */
59
60 /**
61 * Set the period to be used by the applications created by this helper.
62 *
63 * A value of Seconds (0) results in randomly generated periods according to
64 * the model contained in the TR 45.820 document.
65 *
66 * @param period The period to set.
67 */
68 void SetPeriod(Time period);
69
70 /**
71 * Set a random variable to enable a random size to be added to the base packet size for
72 * each new transmission of PacketSender applications.
73 *
74 * @param rv The random variable.
75 */
77
78 /**
79 * Set the base value for applications packet size in bytes.
80 *
81 * @param size The packet size in bytes.
82 */
83 void SetPacketSize(uint8_t size);
84
85 private:
86 /**
87 * Install a PeriodicSender application on the input Node configured with all the attributes set
88 * with SetAttribute or other functions of this class.
89 *
90 * @param node The node on which a PeriodicSender will be installed.
91 * @return A pointer to the application installed.
92 */
94
95 ObjectFactory m_factory; //!< The factory to create PeriodicSender applications
96 Ptr<UniformRandomVariable> m_initialDelay; //!< The random variable used to extract a start
97 //!< off delay for each PeriodicSender application
99 m_intervalProb; //!< The random variable used to pick inter-transmission intervals of
100 //!< different applications from a discrete probability distribution
101 Time m_period; //!< The base period with which the application will be set to send messages
103 m_pktSizeRV; //!< Whether or not a random component is added to the packet size.
104 uint8_t m_pktSize; //!< The base packet size.
105};
106
107} // namespace lorawan
108} // namespace ns3
109
110#endif /* PERIODIC_SENDER_HELPER_H */
holds a vector of ns3::Application pointers.
Hold a value for an Attribute.
Definition attribute.h:59
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
Ptr< RandomVariableStream > m_pktSizeRV
Whether or not a random component is added to the packet size.
uint8_t m_pktSize
The base packet size.
void SetPeriod(Time period)
Set the period to be used by the applications created by this helper.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SetPacketSize(uint8_t size)
Set the base value for applications packet size in bytes.
Ptr< Application > InstallPriv(Ptr< Node > node) const
Install a PeriodicSender application on the input Node configured with all the attributes set with Se...
Ptr< UniformRandomVariable > m_intervalProb
The random variable used to pick inter-transmission intervals of different applications from a discre...
void SetPacketSizeRandomVariable(Ptr< RandomVariableStream > rv)
Set a random variable to enable a random size to be added to the base packet size for each new transm...
Time m_period
The base period with which the application will be set to send messages.
ObjectFactory m_factory
The factory to create PeriodicSender applications.
Ptr< UniformRandomVariable > m_initialDelay
The random variable used to extract a start off delay for each PeriodicSender application.
ApplicationContainer Install(NodeContainer c) const
Install a PeriodicSender application on each node of the input container configured with all the attr...
Every class exported by the ns3 library is enclosed in the ns3 namespace.