28 #include <ns3/mac48-address.h>
29 #include <ns3/nstime.h>
30 #include <ns3/simulator.h>
31 #include <ns3/uinteger.h>
36 NS_LOG_COMPONENT_DEFINE(
"SatTbtpContainer");
41 NS_OBJECT_ENSURE_REGISTERED(SatTbtpContainer);
46 static TypeId tid = TypeId(
"ns3::SatTbtpContainer")
48 .AddConstructor<SatTbtpContainer>()
49 .AddAttribute(
"MaxStoredTbtps",
50 "Maximum amount of stored TBTPs",
53 MakeUintegerChecker<uint32_t>());
59 m_maxStoredTbtps(100),
61 m_superFrameDuration(0)
63 NS_FATAL_ERROR(
"SatTbtpContainer::SatTbtpContainer - Constructor not in use");
69 m_maxStoredTbtps(100),
90 NS_LOG_FUNCTION(
this);
97 NS_LOG_FUNCTION(
this << startTime.GetSeconds());
101 m_tbtps.insert(std::make_pair(startTime, tbtp));
113 NS_LOG_FUNCTION(
this);
121 NS_LOG_FUNCTION(
this);
123 for (TbtpMap_t::iterator it =
m_tbtps.begin(); it !=
m_tbtps.end();)
139 NS_LOG_FUNCTION(
this);
141 bool hasScheduledTimeSlots =
false;
148 for (TbtpMap_t::const_reverse_iterator it =
m_tbtps.rbegin(); it !=
m_tbtps.rend(); ++it)
150 info = it->second->GetDaTimeslots(
m_address);
153 if (!info.second.empty())
155 Time superframeStartTime = it->first;
158 if (superframeStartTime >= Simulator::Now())
160 NS_LOG_INFO(
"Superframe counter: " << it->second->GetSuperframeCounter()
162 << superframeStartTime.GetSeconds());
164 hasScheduledTimeSlots =
true;
174 std::sort(info.second.begin(), info.second.end(),
SortTimeSlots());
177 Time startTimeOffsetForLastSlot = (*(info.second.rbegin()))->GetStartTime();
183 Ptr<SatSuperframeConf> superframeConf =
185 uint8_t frameId = info.first;
186 Ptr<SatFrameConf> frameConf = superframeConf->GetFrameConf(frameId);
187 uint32_t wfId = (*(info.second.rbegin()))->GetWaveFormId();
188 Ptr<SatWaveform> wf =
m_superframeSeq->GetWaveformConf()->GetWaveform(wfId);
189 Time lastSlotDuration =
190 wf->GetBurstDuration(frameConf->GetBtuConf()->GetSymbolRateInBauds());
193 "Superframe counter: "
194 << it->second->GetSuperframeCounter() <<
", start time: "
195 << superframeStartTime.GetSeconds() <<
", last allocated slot start time: "
196 << (superframeStartTime + startTimeOffsetForLastSlot).GetSeconds()
197 <<
", last allocated slot end time: "
198 << (superframeStartTime + startTimeOffsetForLastSlot + lastSlotDuration)
207 if ((superframeStartTime + startTimeOffsetForLastSlot + lastSlotDuration) >
210 hasScheduledTimeSlots =
true;
218 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.