This repository was archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathLcgScheduler.h
More file actions
135 lines (109 loc) · 3.18 KB
/
Copy pathLcgScheduler.h
File metadata and controls
135 lines (109 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//
// SimuLTE
//
// This file is part of a software released under the license included in file
// "license.pdf". This license can be also found at http://www.ltesimulator.com/
// The above file and the present reference are part of the software itself,
// and cannot be removed from it.
//
#ifndef _LTE_LCGSCHEDULER_H_
#define _LTE_LCGSCHEDULER_H_
#include "common/LteCommon.h"
#include "stack/mac/layer/LteMacUe.h"
/// forward declarations
class LteSchedulerUeUl;
class LteMacPdu;
/**
* @class LcgScheduler
*/
typedef std::map<MacCid, unsigned int> ScheduleList;
class SIMULTE_API LcgScheduler
{
protected:
/**
* Score-based schedulers descriptor.
*/
template<typename T, typename S>
struct SortedDesc
{
/// Connection identifier.
T x_;
/// Score value.
S score_;
/// Comparison operator to enable sorting.
bool operator<(const SortedDesc& y) const
{
return score_ < y.score_;
}
public:
SortedDesc(const T x, const S score)
{
x_ = x;
score_ = score;
}
};
struct StatusElem
{
unsigned int occupancy_;
unsigned int bucket_;
unsigned int sentData_;
unsigned int sentSdus_;
};
// last execution time
omnetpp::simtime_t lastExecutionTime_;
/// MAC module, used to get parameters from NED
LteMacUe *mac_;
/// Associated LteSchedulerUeUl (it is the one who creates the LteScheduler)
LteSchedulerUeUl* ueScheduler_;
// schedule List - returned by reference on scheduler invocation
ScheduleList scheduleList_;
// scheduled bytes list
ScheduleList scheduledBytesList_;
MacCid firstSduCid;
/// Cid List
typedef std::list<MacCid> CidList;
// scheduling status map
std::map<MacCid, StatusElem> statusMap_;
public:
/**
* Default constructor.
*/
LcgScheduler(LteMacUe * mac);
/**
* Destructor.
*/
virtual ~LcgScheduler();
/**
* Initializes the LteScheduler.
* @param ueScheduler UE scheduler
*/
inline virtual void setUeUlScheduler(LteSchedulerUeUl* ueScheduler)
{
ueScheduler_ = ueScheduler;
}
/* Executes the LCG scheduling algorithm
* @param availableBytes
* @return # of scheduled sdus per cid
*/
virtual ScheduleList& schedule(unsigned int availableBytes, Direction grantDir = UL);
/* After the scheduling, returns the amount of bytes
* scheduled for each connection
*/
virtual ScheduleList& getScheduledBytesList();
inline virtual bool isFirstSdu(const MacCid& cid){
return firstSduCid == cid;
}
// *****************************************************************************************
// /// performs request of grant to the eNbScheduler
// virtual unsigned int grant(MacCid cid,unsigned int bytes, bool& terminate,bool& active,bool& eligible);
//
// /// calls eNbScheduler rtxschedule()
// virtual bool rtxschedule();
//
// virtual void notify( MacCid activeCid ) {;}
//
// virtual void remove( MacCid cid ) {;}
//
// virtual void update() {;}
};
#endif