21 #ifndef SAT_FRAME_ALLOCATOR_H
22 #define SAT_FRAME_ALLOCATOR_H
27 #include <ns3/address.h>
28 #include <ns3/simple-ref-count.h>
29 #include <ns3/traced-callback.h>
164 bool operator()(
const Ptr<SatFrameAllocator>& a,
const Ptr<SatFrameAllocator>& b)
const;
183 Ptr<SatFrameAllocator> parent);
254 bool GetBestWaveform(
double cno, uint32_t& waveFormId,
double& cnoThreshold)
const;
271 bool Allocate(
CcLevel_t ccLevel, SatFrameAllocReq* allocReq, uint32_t waveformId);
291 uint32_t maxSizeInBytes,
293 bool rcBasedAllocationEnabled,
294 TracedCallback<uint32_t> waveformTrace,
295 TracedCallback<uint32_t, uint32_t> utLoadTrace,
296 TracedCallback<uint32_t, double> loadTrace);
375 Ptr<SatWaveform> trcWaveForm,
376 bool ctrlSlotPresent,
377 double ctrlSlotLength);
544 uint32_t& waveformId);
559 int64_t& utSymbolsToUse,
560 int64_t& carrierSymbolsToUse,
561 int64_t& utSymbolsLeft,
562 int64_t& rcSymbolsLeft,
564 bool rcBasedAllocationEnabled);
578 int64_t& utSymbolsToUse,
579 int64_t& carrierSymbolsToUse,
580 int64_t& utSymbolsLeft,
581 int64_t& rcSymbolsLeft,
582 bool rcBasedAllocationEnabled);
604 std::vector<Address>
SortUts();
619 std::vector<uint32_t>
SortUtRcs(Address ut);
629 SatFrameAllocator::UtAllocInfoContainer_t::iterator
GetUtAllocItem(
CcReqCompare class for CC type comparisons.
CcReqType_t
Definition for different comparison types.
@ CC_TYPE_MIN_RBDC
CC_TYPE_MIN_RBDC.
@ CC_TYPE_VBDC
CC_TYPE_VBDC.
@ CC_TYPE_RBDC
CC_TYPE_RBDC.
CcReqCompare(const UtAllocContainer_t &utAllocContainer, CcReqCompare::CcReqType_t ccReqType)
Construct CcReqCompare.
bool operator()(RcAllocItem_t rcAlloc1, RcAllocItem_t rcAlloc2)
Comparison operator to compare two RC allocations.
CcReqType_t m_ccReqType
Type used for comparisons.
const UtAllocContainer_t & m_utAllocContainer
Reference to UT allocation container.
SatFrameAllocInfo is used to hold a frame's allocation info in symbols.
SatFrameAllocInfoItemContainer_t m_allocInfoPerRc
Information for the RCs.
SatFrameAllocInfo()
Construct empty SatFrameAllocInfo.
double GetTotalSymbols()
Get total symbols of the item.
SatFrameAllocInfoItem UpdateTotalCounts()
Update total count of SatFrameAllocInfo from RCs.
Allocation information item for requests and allocations [symbols] used internally by SatFrameAllocat...
SatFrameAllocInfoItem()
Construct SatFrameAllocInfoItem.
double GetTotalSymbols()
Get symbols allocated/requested by this item.
SatFrameAllocReq is used to define frame allocation parameters when requesting allocation from SatFra...
SatFrameAllocReq(SatFrameAllocReqItemContainer_t req)
Construct SatFrameAllocReq.
SatFrameAllocReqItemContainer_t m_reqPerRc
Allocation information item for the UT/RC requests [bytes].
helper class for Satellite Superframe Allocator.
std::list< RcAllocItem_t > RcAllocContainer_t
Container for RC allocation items.
void ShareSymbols(bool fcaEnabled)
Share symbols between all UTs and RCs allocated to the frame.
double m_maxSymbolsPerCarrier
std::vector< uint16_t > SortCarriers()
Sort carriers belonging to this frame.
RcAllocContainer_t m_rcAllocs
Ptr< SatWaveform > m_mostRobustWaveform
Ptr< SatFrameAllocator > GetParent() const
double m_preAllocatedCraSymbols
double GetCcLoad(CcLevel_t ccLevel)
Get frame load by requested CC.
std::vector< SatFrameAllocReq * > SatFrameAllocContainer_t
Container to store SatFrameAllocReq item pointers.
uint16_t m_carriersOffset
Ptr< SatFrameConf > m_frameConf
SatSuperframeConf::ConfigType_t m_configType
void SelectCarriers(uint16_t &amount, uint16_t offset)
Set the amount of carriers used in this frame.
double m_preAllocatedRdbcSymbols
std::map< Address, UtAllocItem_t > UtAllocContainer_t
Map container for UT allocation items.
SatFrameAllocator::UtAllocInfoContainer_t::iterator GetUtAllocItem(UtAllocInfoContainer_t &allocContainer, Address ut)
Get UT allocation item from given container.
bool Allocate(CcLevel_t ccLevel, SatFrameAllocReq *allocReq, uint32_t waveformId)
Allocate symbols to this frame, if criteria are fulfilled.
bool GetBestWaveform(double cno, uint32_t &waveFormId, double &cnoThreshold) const
Get the best waveform supported by this allocator based on given C/N0.
Ptr< SatWaveform > GetMostRobustWaveform() const
Get the most robust waveform used by this frame allocator.
SatWaveformConf::BurstLengthContainer_t m_burstLenghts
Ptr< SatWaveformConf > m_waveformConf
void Reset()
Reset frame allocator.
SatFrameAllocator()
Default constructor (not in used)
std::vector< Address > SortUts()
Sort UTs allocated to this frame.
std::pair< std::vector< uint32_t >, bool > UtAllocInfoItem_t
Pair used to store UT allocation information.
double m_totalSymbolsInFrame
Ptr< SatTimeSlotConf > CreateTimeSlot(uint16_t carrierId, int64_t &utSymbolsToUse, int64_t &carrierSymbolsToUse, int64_t &utSymbolsLeft, int64_t &rcSymbolsLeft, double cno, bool rcBasedAllocationEnabled)
Create time slot according to configuration type.
void UpdateAndStoreAllocReq(Address address, double cno, SatFrameAllocInfo &req)
Update RC/CC requested according to carrier limit.
void AcceptRequests(CcLevel_t ccLevel)
Accept UT/RC requests of the frame according to given CC level.
double m_preAllocatedMinRdbcSymbols
uint16_t m_maxCarrierCount
std::vector< SatFrameAllocInfoItem > SatFrameAllocInfoItemContainer_t
Container to store SatFrameAllocInfoItem items.
std::vector< Ptr< SatTbtpMessage > > TbtpMsgContainer_t
Container to store generated TBTP messages.
uint32_t GetOptimalBurtsLengthInSymbols(int64_t symbolsToUse, int64_t symbolsLeft, double cno, uint32_t &waveformId)
Get optimal burst length in symbols.
uint32_t GetCarrierMinPayloadInBytes() const
Get minimum payload of a carrier in bytes.
Ptr< SatFrameAllocator > m_parent
UtAllocContainer_t m_utAllocs
Ptr< SatTimeSlotConf > CreateCtrlTimeSlot(uint16_t carrierId, int64_t &utSymbolsToUse, int64_t &carrierSymbolsToUse, int64_t &utSymbolsLeft, int64_t &rcSymbolsLeft, bool rcBasedAllocationEnabled)
Create control time slot.
double m_availableSymbolsInFrame
double m_preAllocatedVdbcSymbols
Ptr< SatTbtpMessage > CreateNewTbtp(TbtpMsgContainer_t &tbtpContainer)
Creates new TBTP to given container with information of the last TBTP in container.
double GetVolumeBytes() const
void GenerateTimeSlots(SatFrameAllocator::TbtpMsgContainer_t &tbtpContainer, uint32_t maxSizeInBytes, UtAllocInfoContainer_t &utAllocContainer, bool rcBasedAllocationEnabled, TracedCallback< uint32_t > waveformTrace, TracedCallback< uint32_t, uint32_t > utLoadTrace, TracedCallback< uint32_t, double > loadTrace)
Generate time slots for UT/RCs i.e.
CcLevel_t
Enum for CC levels.
@ CC_LEVEL_CRA_RBDC
CC level CRA + RBDC.
@ CC_LEVEL_CRA
CC level CRA.
@ CC_LEVEL_CRA_RBDC_VBDC
CC level CRA + RBDC + VBDC.
@ CC_LEVEL_CRA_MIN_RBDC
CC level CRA + Minimum RBDC.
std::map< Address, UtAllocInfoItem_t > UtAllocInfoContainer_t
Map container to store UT allocation information.
std::pair< Address, uint8_t > RcAllocItem_t
Pair used as RC allocation item.
uint16_t GetCarrierCount() const
Get the amount of carriers used in this frame.
uint8_t m_guardTimeSymbols
void PreAllocateSymbols(double targetLoad, bool fcaEnabled)
Preallocate symbols for all UTs with RCs allocated to the frame.
double GetCarrierBandwidthHz(bool checkParent=false) const
std::vector< SatFrameAllocReqItem > SatFrameAllocReqItemContainer_t
Container to store SatFrameAllocReqItem items.
std::vector< uint32_t > SortUtRcs(Address ut)
Sort RCs in given UT.
ConfigType_t
Enum for configuration types.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
BandwidthComparator is a custom functor meant as comparison function for std::map.
bool operator()(const Ptr< SatFrameAllocator > &a, const Ptr< SatFrameAllocator > &b) const
Allocation information for a UT.
SatFrameAllocInfo m_request
SatFrameAllocInfo m_allocation