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