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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#ifndef SUB_BAND_H
10#define SUB_BAND_H
11
12#include "ns3/nstime.h"
13#include "ns3/ptr.h"
14#include "ns3/simple-ref-count.h"
15
16namespace ns3
17{
18namespace lorawan
19{
20
22
23/**
24 * @ingroup lorawan
25 *
26 * Class representing a SubBand, i.e., a frequency band subject to some
27 * regulations on duty cycle and transmission power.
28 */
29class SubBand : public SimpleRefCount<SubBand>
30{
31 public:
32 /**
33 * Create a new SubBand by specifying all of its properties.
34 *
35 * @param firstFrequencyHz The SubBand's lowest frequency [Hz].
36 * @param lastFrequencyHz The SubBand's highest frequency [Hz].
37 * @param dutyCycle The duty cycle (as a fraction) allowed on this SubBand.
38 * @param maxTxPowerDbm The maximum transmission power [dBm] allowed on this SubBand.
39 */
40 SubBand(uint32_t firstFrequencyHz,
41 uint32_t lastFrequencyHz,
42 double dutyCycle,
43 double maxTxPowerDbm);
44
45 /**
46 * Get the lowest frequency of the SubBand.
47 *
48 * @return The lowest frequency [Hz] of the SubBand.
49 */
51
52 /**
53 * Get the highest frequency of the SubBand.
54 *
55 * @return The highest frequency [Hz] of the SubBand.
56 */
58
59 /**
60 * Get the duty cycle of the subband.
61 *
62 * @return The duty cycle (as a fraction) that needs to be enforced on this
63 * SubBand.
64 */
65 double GetDutyCycle() const;
66
67 /**
68 * Update the next transmission time.
69 *
70 * This function is used by LogicalLoraChannelHelper, which computes the time
71 * based on the SubBand's duty cycle and on the transmission duration.
72 *
73 * @param nextTime The future time from which transmission should be allowed
74 * again.
75 */
76 void SetNextTransmissionTime(Time nextTime);
77
78 /**
79 * Returns the next time from which transmission on this subband will be
80 * possible.
81 *
82 * @return The next time at which transmission in this SubBand will be
83 * allowed.
84 */
86
87 /**
88 * Return whether or not a frequency belongs to this SubBand.
89 *
90 * @param frequencyHz The frequency [Hz] we want to test against the current subband.
91 * @return True if the frequency is between firstFrequencyHz and lastFrequencyHz,
92 * false otherwise.
93 */
94 bool Contains(uint32_t frequencyHz) const;
95
96 /**
97 * Return whether or not a channel belongs to this SubBand.
98 *
99 * @param channel The channel we want to test against the current subband.
100 * @return Whether the channel's center frequency is between the first and last frequency of the
101 * sub-band, margins excluded.
102 */
103 bool Contains(Ptr<const LogicalLoraChannel> channel) const;
104
105 /**
106 * Set the maximum transmission power that is allowed on this SubBand.
107 *
108 * @param maxTxPowerDbm The maximum transmission power [dBm] to set.
109 */
110 void SetMaxTxPowerDbm(double maxTxPowerDbm);
111
112 /**
113 * Return the maximum transmission power that is allowed on this SubBand.
114 *
115 * @return The maximum transmission power, in dBm.
116 */
117 double GetMaxTxPowerDbm() const;
118
119 private:
120 uint32_t m_firstFrequencyHz; //!< Starting frequency of the subband, in Hz
121 uint32_t m_lastFrequencyHz; //!< Ending frequency of the subband, in Hz
122 double m_dutyCycle; //!< The duty cycle that needs to be enforced on this subband
123 Time m_nextTransmissionTime; //!< The next time a transmission will be allowed in this subband
124 double m_maxTxPowerDbm; //!< The maximum transmission power that is admitted on this subband
125};
126
127} // namespace lorawan
128} // namespace ns3
129
130#endif /* SUB_BAND_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
This class represents a logical LoRaWAN channel.
double GetDutyCycle() const
Get the duty cycle of the subband.
Definition sub-band.cc:46
bool Contains(uint32_t frequencyHz) const
Return whether or not a frequency belongs to this SubBand.
Definition sub-band.cc:52
Time GetNextTransmissionTime()
Returns the next time from which transmission on this subband will be possible.
Definition sub-band.cc:70
Time m_nextTransmissionTime
The next time a transmission will be allowed in this subband.
Definition sub-band.h:123
double m_dutyCycle
The duty cycle that needs to be enforced on this subband.
Definition sub-band.h:122
void SetNextTransmissionTime(Time nextTime)
Update the next transmission time.
Definition sub-band.cc:64
uint32_t GetFirstFrequency() const
Get the lowest frequency of the SubBand.
Definition sub-band.cc:34
uint32_t m_firstFrequencyHz
Starting frequency of the subband, in Hz.
Definition sub-band.h:120
double GetMaxTxPowerDbm() const
Return the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:82
uint32_t m_lastFrequencyHz
Ending frequency of the subband, in Hz.
Definition sub-band.h:121
SubBand(uint32_t firstFrequencyHz, uint32_t lastFrequencyHz, double dutyCycle, double maxTxPowerDbm)
Create a new SubBand by specifying all of its properties.
Definition sub-band.cc:20
uint32_t GetLastFrequency() const
Get the highest frequency of the SubBand.
Definition sub-band.cc:40
void SetMaxTxPowerDbm(double maxTxPowerDbm)
Set the maximum transmission power that is allowed on this SubBand.
Definition sub-band.cc:76
double m_maxTxPowerDbm
The maximum transmission power that is admitted on this subband.
Definition sub-band.h:124
Every class exported by the ns3 library is enclosed in the ns3 namespace.