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/address.h"
13#include "ns3/application-container.h"
14#include "ns3/attribute.h"
15#include "ns3/net-device.h"
16#include "ns3/node-container.h"
17#include "ns3/object-factory.h"
18#include "ns3/periodic-sender.h"
19
20#include <stdint.h>
21#include <string>
22
23namespace ns3
24{
25namespace lorawan
26{
27
28/**
29 * \ingroup lorawan
30 *
31 * This class can be used to install PeriodicSender applications on a wide
32 * range of nodes.
33 */
35{
36 public:
37 PeriodicSenderHelper(); //!< Default constructor
38 ~PeriodicSenderHelper(); //!< Destructor
39
40 /**
41 * Helper function used to set the underlying application attributes.
42 *
43 * \param name The name of the application attribute to set.
44 * \param value The value of the application attribute to set.
45 */
46 void SetAttribute(std::string name, const AttributeValue& value);
47
48 /**
49 * Install a PeriodicSender application on each node of the input container
50 * configured with all the attributes set with SetAttribute or other functions of this class.
51 *
52 * \param c NodeContainer of the set of nodes on which an PeriodicSender
53 * will be installed.
54 * \return Container of Ptr to the applications installed.
55 */
57
58 /**
59 * Install a PeriodicSender application on the input Node configured with all the attributes set
60 * with SetAttribute or other functions of this class.
61 *
62 * \param node The node on which a PeriodicSender will be installed.
63 * \return Container of the Ptr to the application installed.
64 */
66
67 /**
68 * Set the period to be used by the applications created by this helper.
69 *
70 * A value of Seconds (0) results in randomly generated periods according to
71 * the model contained in the TR 45.820 document.
72 *
73 * \param period The period to set.
74 */
75 void SetPeriod(Time period);
76
77 /**
78 * Set a random variable to enable a random size to be added to the base packet size for
79 * each new transmission of PacketSender applications.
80 *
81 * \param rv The random variable.
82 */
84
85 /**
86 * Set the base value for applications packet size in bytes.
87 *
88 * \param size The packet size in bytes.
89 */
90 void SetPacketSize(uint8_t size);
91
92 private:
93 /**
94 * Install a PeriodicSender application on the input Node configured with all the attributes set
95 * with SetAttribute or other functions of this class.
96 *
97 * \param node The node on which a PeriodicSender will be installed.
98 * \return A pointer to the application installed.
99 */
101
102 ObjectFactory m_factory; //!< The factory to create PeriodicSender applications
103 Ptr<UniformRandomVariable> m_initialDelay; //!< The random variable used to extract a start
104 //!< off delay for each PeriodicSender application
106 m_intervalProb; //!< The random variable used to pick inter-transmission intervals of
107 //!< different applications from a discrete probability distribution
108 Time m_period; //!< The base period with which the application will be set to send messages
110 m_pktSizeRV; //!< Whether or not a random component is added to the packet size.
111 uint8_t m_pktSize; //!< The base packet size.
112};
113
114} // namespace lorawan
115
116} // namespace ns3
117#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.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
This class can be used to install PeriodicSender applications on a wide range of nodes.
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.