11#include "ns3/simulator.h"
33std::vector<Ptr<LogicalLoraChannel>>
46 if (sb->Contains(frequencyHz))
51 NS_LOG_ERROR(
"[ERROR] Requested frequency " << frequencyHz <<
" Hz outside known sub-bands.");
84 Time waitTime = subBand->GetNextTransmissionTime() -
Now();
85 waitTime =
Max(waitTime,
Time(0));
94 AddEvent(duration, channel->GetFrequency());
104 Time nextTxTime =
Now() + duration / subBand->GetDutyCycle();
105 subBand->SetNextTransmissionTime(nextTxTime);
122 return subBand->GetMaxTxPowerDbm();
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
~LogicalLoraChannelHelper()
Destructor.
void SetChannel(uint8_t chIndex, Ptr< LogicalLoraChannel > channel)
Set a new channel at a fixed index.
double GetTxPowerForChannel(Ptr< LogicalLoraChannel > channel) const
Returns the maximum transmission power [dBm] that is allowed on a channel.
bool IsFrequencyValid(uint32_t frequencyHz) const
Check if a frequency is valid, that is, if it belongs to any of the sub-bands registered in this clas...
std::vector< Ptr< LogicalLoraChannel > > m_channelVec
A vector of the LogicalLoraChannels that are currently registered within this helper.
LogicalLoraChannelHelper(uint8_t size)
Construct a LogicalLoraChannelHelper of a certain size.
std::vector< Ptr< SubBand > > m_subBandList
A vector of the SubBands that are currently registered within this helper.
std::vector< Ptr< LogicalLoraChannel > > GetRawChannelArray() const
Get the frequency channel storage array of this device.
Ptr< SubBand > GetSubBandFromFrequency(uint32_t frequencyHz) const
Get the SubBand a frequency belongs to, also used to test validity of a frequency.
void AddEvent(Time duration, Ptr< LogicalLoraChannel > channel)
Register the transmission of a packet.
void AddSubBand(Ptr< SubBand > subBand)
Add a new SubBand.
Time GetWaitTime(Ptr< LogicalLoraChannel > channel) const
Get the time it is necessary to wait for before transmitting on a given channel.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time Now()
create an ns3::Time instance which contains the current simulation time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.