A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sub-band.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Davide Magrin <magrinda@dei.unipd.it>
18 */
19
20#ifndef SUB_BAND_H
21#define SUB_BAND_H
22
24
25#include "ns3/nstime.h"
26#include "ns3/object.h"
27
28namespace ns3
29{
30namespace lorawan
31{
32
33class LogicalLoraChannel;
34
35/**
36 * \ingroup lorawan
37 *
38 * Class representing a SubBand, i.e., a frequency band subject to some
39 * regulations on duty cycle and transmission power.
40 */
41class SubBand : public Object
42{
43 public:
44 /**
45 * Register this type.
46 * \return The object TypeId.
47 */
48 static TypeId GetTypeId();
49
50 SubBand(); //!< Default constructor
51 ~SubBand() override; //!< Destructor
52
53 /**
54 * Create a new SubBand by specifying all of its properties.
55 *
56 * \param firstFrequency The SubBand's lowest frequency [MHz].
57 * \param lastFrequency The SubBand's highest frequency [MHz].
58 * \param dutyCycle The duty cycle (as a fraction) allowed on this SubBand.
59 * \param maxTxPowerDbm The maximum transmission power [dBm] allowed on this SubBand.
60 */
61 SubBand(double firstFrequency, double lastFrequency, double dutyCycle, double maxTxPowerDbm);
62
63 /**
64 * Get the lowest frequency of the SubBand.
65 *
66 * \return The lowest frequency [MHz] of the SubBand.
67 */
68 double GetFirstFrequency() const;
69
70 ///**
71 // * Get the last frequency of the subband.
72 // *
73 // * \return The lowest frequency [MHz] of the SubBand.
74 // */
75 // double GetLastFrequency ();
76
77 /**
78 * Get the duty cycle of the subband.
79 *
80 * \return The duty cycle (as a fraction) that needs to be enforced on this
81 * SubBand.
82 */
83 double GetDutyCycle() const;
84
85 /**
86 * Update the next transmission time.
87 *
88 * This function is used by LogicalLoraChannelHelper, which computes the time
89 * based on the SubBand's duty cycle and on the transmission duration.
90 *
91 * \param nextTime The future time from which transmission should be allowed
92 * again.
93 */
94 void SetNextTransmissionTime(Time nextTime);
95
96 /**
97 * Returns the next time from which transmission on this subband will be
98 * possible.
99 *
100 * \return The next time at which transmission in this SubBand will be
101 * allowed.
102 */
104
105 /**
106 * Return whether or not a frequency belongs to this SubBand.
107 *
108 * \param frequency The frequency [MHz] we want to test against the current subband.
109 * \return True if the frequency is between firstFrequency and lastFrequency,
110 * false otherwise.
111 */
112 bool BelongsToSubBand(double frequency) const;
113
114 /**
115 * Return whether or not a channel belongs to this SubBand.
116 *
117 * \param channel The channel we want to test against the current subband.
118 * \return True if the channel's center frequency is between firstFrequency
119 * and lastFrequency, false otherwise.
120 */
121 bool BelongsToSubBand(Ptr<LogicalLoraChannel> channel) const;
122
123 /**
124 * Set the maximum transmission power that is allowed on this SubBand.
125 *
126 * \param maxTxPowerDbm The maximum transmission power [dBm] to set.
127 */
128 void SetMaxTxPowerDbm(double maxTxPowerDbm);
129
130 /**
131 * Return the maximum transmission power that is allowed on this SubBand.
132 *
133 * \return The maximum transmission power, in dBm.
134 */
135 double GetMaxTxPowerDbm() const;
136
137 private:
138 double m_firstFrequency; //!< Starting frequency of the subband, in MHz
139 double m_lastFrequency; //!< Ending frequency of the subband, in MHz
140 double m_dutyCycle; //!< The duty cycle that needs to be enforced on this subband
141 Time m_nextTransmissionTime; //!< The next time a transmission will be allowed in this subband
142 double m_maxTxPowerDbm; //!< The maximum transmission power that is admitted on this subband
143};
144} // namespace lorawan
145} // namespace ns3
146#endif /* SUB_BAND_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Class representing a SubBand, i.e., a frequency band subject to some regulations on duty cycle and tr...
Definition: sub-band.h:42
double GetDutyCycle() const
‍**
Definition: sub-band.cc:70
Time GetNextTransmissionTime()
Returns the next time from which transmission on this subband will be possible.
Definition: sub-band.cc:95
Time m_nextTransmissionTime
The next time a transmission will be allowed in this subband.
Definition: sub-band.h:141
double m_dutyCycle
The duty cycle that needs to be enforced on this subband.
Definition: sub-band.h:140
double m_firstFrequency
Starting frequency of the subband, in MHz.
Definition: sub-band.h:138
bool BelongsToSubBand(double frequency) const
Return whether or not a frequency belongs to this SubBand.
Definition: sub-band.cc:76
static TypeId GetTypeId()
Register this type.
Definition: sub-band.cc:34
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
Definition: sub-band.cc:89
double GetFirstFrequency() const
Get the lowest frequency of the SubBand.
Definition: sub-band.cc:64
~SubBand() override
Destructor.
Definition: sub-band.cc:58
double GetMaxTxPowerDbm() const
Return the maximum transmission power that is allowed on this SubBand.
Definition: sub-band.cc:107
double m_lastFrequency
Ending frequency of the subband, in MHz.
Definition: sub-band.h:139
SubBand()
Default constructor.
Definition: sub-band.cc:40
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this SubBand.
Definition: sub-band.cc:101
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this subband.
Definition: sub-band.h:142
Every class exported by the ns3 library is enclosed in the ns3 namespace.