28 #include <ns3/mac48-address.h>
29 #include <ns3/nstime.h>
30 #include <ns3/simulator.h>
31 #include <ns3/uinteger.h>
37 NS_LOG_COMPONENT_DEFINE(
"SatTbtpContainer");
42 NS_OBJECT_ENSURE_REGISTERED(SatTbtpContainer);
47 static TypeId tid = TypeId(
"ns3::SatTbtpContainer")
49 .AddConstructor<SatTbtpContainer>()
50 .AddAttribute(
"MaxStoredTbtps",
51 "Maximum amount of stored TBTPs",
54 MakeUintegerChecker<uint32_t>());
60 m_maxStoredTbtps(100),
62 m_superFrameDuration(0)
64 NS_FATAL_ERROR(
"SatTbtpContainer::SatTbtpContainer - Constructor not in use");
70 m_maxStoredTbtps(100),
91 NS_LOG_FUNCTION(
this);
98 NS_LOG_FUNCTION(
this << startTime.GetSeconds());
102 m_tbtps.insert(std::make_pair(startTime, tbtp));
114 NS_LOG_FUNCTION(
this);
122 NS_LOG_FUNCTION(
this);
124 for (TbtpMap_t::iterator it =
m_tbtps.begin(); it !=
m_tbtps.end();)
140 NS_LOG_FUNCTION(
this);
142 bool hasScheduledTimeSlots =
false;
149 for (TbtpMap_t::const_reverse_iterator it =
m_tbtps.rbegin(); it !=
m_tbtps.rend(); ++it)
151 info = it->second->GetDaTimeslots(
m_address);
154 if (!info.second.empty())
156 Time superframeStartTime = it->first;
159 if (superframeStartTime >= Simulator::Now())
161 NS_LOG_INFO(
"Superframe counter: " << it->second->GetSuperframeCounter()
163 << superframeStartTime.GetSeconds());
165 hasScheduledTimeSlots =
true;
175 std::sort(info.second.begin(), info.second.end(),
SortTimeSlots());
178 Time startTimeOffsetForLastSlot = (*(info.second.rbegin()))->GetStartTime();
184 Ptr<SatSuperframeConf> superframeConf =
186 uint8_t frameId = info.first;
187 Ptr<SatFrameConf> frameConf = superframeConf->GetFrameConf(frameId);
188 uint32_t wfId = (*(info.second.rbegin()))->GetWaveFormId();
189 Ptr<SatWaveform> wf =
m_superframeSeq->GetWaveformConf()->GetWaveform(wfId);
190 Time lastSlotDuration =
191 wf->GetBurstDuration(frameConf->GetBtuConf()->GetSymbolRateInBauds());
194 "Superframe counter: "
195 << it->second->GetSuperframeCounter() <<
", start time: "
196 << superframeStartTime.GetSeconds() <<
", last allocated slot start time: "
197 << (superframeStartTime + startTimeOffsetForLastSlot).GetSeconds()
198 <<
", last allocated slot end time: "
199 << (superframeStartTime + startTimeOffsetForLastSlot + lastSlotDuration)
208 if ((superframeStartTime + startTimeOffsetForLastSlot + lastSlotDuration) >
211 hasScheduledTimeSlots =
true;
219 return hasScheduledTimeSlots;
Ptr< SatSuperframeSeq > m_superframeSeq
Superframe sequence.
Mac48Address m_address
Address of this UT.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_rcvdTbtps
Number of received TBTPs.
virtual void DoDispose()
Dispose of this class instance.
bool HasScheduledTimeSlots()
Method of checking whether the UT has been scheduled time slots into the future.
uint32_t m_maxStoredTbtps
Maximum stored TBTPs in the container.
void Add(Time startTime, Ptr< SatTbtpMessage > tbtp)
Add a TBTP message to the container.
~SatTbtpContainer()
Destructor for SatTbtpContainer.
void RemovePastTbtps()
Function for removing the TBTPs which are in the past.
void SetMacAddress(Mac48Address address)
Set the MAC address of this node.
Time m_superFrameDuration
Superframe duration.
SatTbtpContainer()
Default constructor.
std::pair< uint8_t, DaTimeSlotConfContainer_t > DaTimeSlotInfoItem_t
Item for DA time slot information.
This class sorts time slots within TBTP into increasing order based on start time.
constexpr uint8_t SUPERFRAME_SEQUENCE
Used superframe sequence in the RTN link.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.