23 #ifndef SAT_BEAM_SCHEDULER_H
24 #define SAT_BEAM_SCHEDULER_H
30 #include <ns3/callback.h>
31 #include <ns3/nstime.h>
32 #include <ns3/object.h>
34 #include <ns3/simple-ref-count.h>
35 #include <ns3/traced-callback.h>
46 class SatControlMessage;
50 class SatSuperframeSeq;
51 class SatSuperframeAllocator;
52 class SatLowerLayerServiceConf;
135 Ptr<SatSuperframeSeq> seq,
136 uint32_t maxFrameSizeInBytes,
146 uint32_t
AddUt(Address utId, Ptr<SatLowerLayerServiceConf> llsConf);
154 bool HasUt(Address utId);
178 void UtCrReceived(Address utId, Ptr<SatCrMessage> crMsg);
186 bool Send(Ptr<SatControlMessage> message);
195 bool SendTo(Ptr<SatControlMessage> message, Address utId);
204 bool SendToSatellite(Ptr<SatControlMessage> msg, Address satelliteMac);
301 Ptr<SatCnoEstimator> cnoEstimator,
302 Time controlSlotOffset,
303 bool controlSlotsEnabled);
337 void AddCrMsg(Ptr<SatCrMessage> crMsg);
431 double result =
false;
433 double cnoFirst =
m_utInfoMap.at(utReqInfo1.first)->GetCnoEstimation();
434 double cnoSecond =
m_utInfoMap.at(utReqInfo2.first)->GetCnoEstimation();
436 if (!std::isnan(cnoFirst))
438 if (std::isnan(cnoSecond))
444 result = (cnoFirst < cnoSecond);
614 void AddRaChannels(std::vector<Ptr<SatTbtpMessage>>& tbtpContainer);
616 void AddUtInfo(Address utId, Ptr<SatUtInfo> utInfo);
CnoCompare class to sort UT request according to C/N0 information.
bool operator()(UtReqInfoItem_t utReqInfo1, UtReqInfoItem_t utReqInfo2)
Compare operator to compare request information of the two UTs.
CnoCompare(const UtInfoMap_t &utInfoMap)
Construct CnoCompare object.
const UtInfoMap_t & m_utInfoMap
Reference to map container for the UT information.
UT information helper class for SatBeamScheduler.
void ClearCrMsgs()
Remove all CR messages from UT info to reset capacity requests in case of handover.
void UpdateDamaEntryFromCrs()
Update DamaEntry with information of the received CR messages.
void AddCrMsg(Ptr< SatCrMessage > crMsg)
Add CR message to UT info to be used when capacity request is calculated next time (method UpdateDama...
double GetCnoEstimation()
Get estimated C/N0 value based on added samples.
Ptr< SatDamaEntry > GetDamaEntry()
Get damaEntry of the UT info.
bool IsControlSlotGenerationTime() const
Check if time is expired to send control slot.
Ptr< SatDamaEntry > m_damaEntry
DamaEntry of this UT info.
SatUtInfo(Ptr< SatDamaEntry > damaEntry, Ptr< SatCnoEstimator > cnoEstimator, Time controlSlotOffset, bool controlSlotsEnabled)
Construct SatUtInfo.
Ptr< SatCnoEstimator > m_cnoEstimator
Estimator for the C/N0.
void SetControlSlotGenerationTime(Time offset)
Set time for next time slot generation for this UT.
CrMsgContainer_t m_crContainer
Received CRs since last update round (call of the method UpdateDamaEntryFromCrs).
Time m_controlSlotGenerationTime
Time to send next control time slot.
bool m_controlSlotsEnabled
Flag to indicated if control time slots generation is enabled.
std::vector< Ptr< SatCrMessage > > CrMsgContainer_t
Container to store received CR messages.
void AddCnoSample(double sample)
Add C/N0 sample to UT info's estimator.
class for module Beam Scheduler.
bool SendToSatellite(Ptr< SatControlMessage > msg, Address satelliteMac)
Send control message to the satellite.
HandoverInformationForward_t m_handoverStrategy
void UtCrReceived(Address utId, Ptr< SatCrMessage > crMsg)
Receive capacity requests from UTs.
uint32_t UpdateDamaEntriesWithAllocs(SatFrameAllocator::UtAllocInfoContainer_t &utAllocContainer)
Update dama entries with given allocations at end of the scheduling.
uint32_t m_maxBbFrameSize
Maximum size of the BB frame.
Callback< void, uint32_t, Ptr< SatTbtpMessage > > TbtpAddCallback
Ptr< SatCnoEstimator > m_satelliteCnoEstimator
Estimator for the C/N0 from satellite.
Time m_cnoEstimationWindow
Time window for C/N0 estimation.
bool m_receivedSatelliteCnoSample
Indicates if Cno sample have been received since last C/N0 control message sent.
Callback< bool, Ptr< SatControlMessage >, const Address & > SendCtrlMsgCallback
SatBeamScheduler::SendTbtpCallback m_txTbtpCallback
The TBTP send callback to inform GW Mac.
void AddRaChannels(std::vector< Ptr< SatTbtpMessage >> &tbtpContainer)
Add RA channel information to TBTP(s).
void DoPreResourceAllocation()
Do pre-allocation of the symbols per UT/RC, before time slot generation.
Time m_maxTwoWayPropagationDelay
Maximum two-way propagation delay estimate between GW-SAT-UT-SAT-GW.
void RemoveUtInfo(UtInfoMap_t::iterator iterator)
TracedCallback< uint32_t > m_exceedingCapacityTrace
Trace exceeding capacity.
Callback< void, Ptr< SatTbtpMessage > > SendTbtpCallback
void(* UnmetCapacityTraceCallback)(uint32_t unmetCapacity)
Callback signature for the UnmetCapacityTrace trace source.
void AddUtInfo(Address utId, Ptr< SatUtInfo > utInfo)
TracedCallback< uint32_t > m_usableCapacityTrace
Trace usable capacity.
TracedCallback< uint32_t, double > m_frameLoadTrace
Trace frame load ratio.
void DoDispose(void)
Dispose actions for SatBeamScheduler.
Address GetGwAddress(void) const
Return the address of the gateway responsible of this beam.
SatBeamScheduler::SendCtrlMsgCallback m_txCallback
The control message send callback.
uint32_t m_logonChannelIndex
Logon channel ID to exclude it from the RA channel selection.
SatEnums::SuperframeAllocatorType_t m_superframeAllocatorType
Type of SatSuperframeAllocator class to use.
HandoverInformationForward_t
Strategies to exchange informations between beams.
void SetSendTbtpCallback(SendTbtpCallback cb)
Set the callback to inform NCC a TBTP has been sent.
Time m_controlSlotInterval
Interval to generate control time slots.
bool Send(Ptr< SatControlMessage > message)
Send control messages to the beam.
bool SendTo(Ptr< SatControlMessage > message, Address utId)
Send control message to an UT into the beam.
std::map< Address, Ptr< SatUtInfo > > UtInfoMap_t
Map container to store UT information.
Ptr< SatSuperframeSeq > m_superframeSeq
Pointer to super frame sequence.
Ptr< SatCnoEstimator > CreateCnoEstimator()
Create estimator for the UT according to set attributes.
Ptr< SatSuperframeAllocator > m_superframeAllocator
Superframe allocator to maintain load information of the frames and their configurations.
TracedCallback< std::string > m_backlogRequestsTrace
Trace for backlog requests done to beam scheduler.
TracedCallback< uint32_t, uint32_t > m_frameUtLoadTrace
Trace count of UTs scheduled per Frame.
TracedCallback< uint32_t > m_waveformTrace
Trace first wave form scheduled for the UT.
Ptr< RandomVariableStream > m_raChRandomIndex
Random variable stream to select RA channel for a UT.
void(* ExceedingCapacityTraceCallback)(uint32_t exceedingCapacity)
Callback signature for the ExceedingCapacityTrace trace source.
void(* BacklogRequestsTraceCallback)(std::string trace)
Callback signature for BacklogRequestsTrace trace source.
static TypeId GetTypeId(void)
Get the type ID.
Time m_maxTbtpTxAndProcessingDelay
Maximum TBTP tx and processing delay estimate at the GW (scheduler).
void SendCnoToSatellite()
Send an estimation of cno to satellite, if samples have been received.
void TransferUtToBeam(Address utId, Ptr< SatBeamScheduler > destination)
Transfer ownership of a terminal to the given SatBeamScheduler.
void ReserveLogonChannel(uint32_t logonChannelId)
std::list< UtReqInfoItem_t > UtReqInfoContainer_t
Container to store capacity request information for the UTs.
~SatBeamScheduler()
Destroy a SatBeamScheduler.
bool HasUt(Address utId)
Check whether an UT is handled by this scheduler.
uint32_t m_superFrameCounter
Counter for super frame sequence.
Ptr< SatTimuMessage > CreateTimu() const
Create a TIM unicast message containing enough data for a terminal to connect to the beam handled by ...
void RemoveUt(Address utId)
Remove a UT from its SatBeamScheduler.
void Initialize(uint32_t beamId, SatBeamScheduler::SendCtrlMsgCallback cb, Ptr< SatSuperframeSeq > seq, uint32_t maxFrameSizeInBytes, Address gwAddress)
UtReqInfoContainer_t m_utRequestInfos
Container including every UT's allocation requests.
Address m_satelliteMac
MAC address of the satellite (used when regenerative)
SatCnoEstimator::EstimationMode_t m_cnoEstimatorMode
Mode used for C/N0 estimator.
std::pair< Address, SatFrameAllocator::SatFrameAllocReq > UtReqInfoItem_t
Pair to store capacity request information for the UT.
void Schedule()
Schedule UTs added (registered) to scheduler.
bool m_controlSlotsEnabled
Flag to indicated if control time slots generation is enabled.
void(* UsableCapacityTraceCallback)(uint32_t usableCapacity)
Callback signature for the UsableCapacityTrace trace source.
uint32_t m_beamId
ID of the beam.
uint32_t UpdateDamaEntriesWithReqs()
Update dama entries with received requests at beginning of the scheduling.
void UpdateUtCno(Address utId, double cno)
Update UT C/N0 info with the latest value.
void(* WaveformTraceCallback)(uint32_t waveformId)
Callback signature for WaveformTrace trace source.
SatBeamScheduler()
Construct a SatBeamScheduler.
uint32_t AddUt(Address utId, Ptr< SatLowerLayerServiceConf > llsConf)
Add UT to scheduler.
UtInfoMap_t m_utInfos
Map to store UT information in beam for updating purposes.
void UpdateSatelliteCno(Address satelliteMac, double cno)
Update satellite C/N0 info with the latest value.
TracedCallback< uint32_t > m_unmetCapacityTrace
Trace unmet capacity.
EstimationMode_t
Definition of modes for estimator.
SuperframeAllocatorType_t
std::map< Address, UtAllocInfoItem_t > UtAllocInfoContainer_t
Map container to store UT allocation information.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.