51 void MM_DQ_Out::initialize() {
52 defaultPriority = par(
"defPriority").longValue();
53 if(defaultPriority < 0) { error(
"Error at eDL_Out. defPriority must be >=0!"); }
55 int rateUnit = par(
"rateUnit").longValue();
56 if(defaultPriority < 0) { error(
"Error at eDL_Out. defPriority must be >=0!"); }
58 maxPriority = defaultPriority;
60 cXMLElement* Xml = NULL;
61 if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
62 Xml = par(
"data").xmlValue();
65 cXMLElementList queues = Xml->getChildrenByTagName(
"queue");
66 for(
auto queue : queues){
67 if (!queue->getAttribute(
"id")) { error(
"Error parsing DQ_Out Queue. Its ID is missing!"); }
68 std::string
id = queue->getAttribute(
"id");
69 if (
id==
"") { error(
"Error parsing DQ_Out Queue. Queue ID cannot be empty!"); }
71 if (!queue->getAttribute(
"defPriority")) { error(
"Error parsing DQ_Out Queue. Its default Priority is missing!"); }
72 int defPriority = atoi(queue->getAttribute(
"defPriority"));
73 if (defPriority<0) { error(
"Error parsing DQ_Out Queue. Queue default Priority must be >=0!"); }
74 if(maxPriority<defPriority) { maxPriority = defPriority ; }
78 if(queue->getAttribute(
"rate")) {
79 double rate = atof(queue->getAttribute(
"rate"));
80 if(rate <= 0) { error(
"Error parsing DQ_Out Queue. Queue Rate cannot be <= 0"); }
85 cXMLElementList degradLists = queue->getChildrenByTagName(
"degradList");
86 for(
auto degrad : degradLists){
87 if (!degrad->getAttribute(
"t")) { error(
"Error parsing degradList. Its t is missing!"); }
88 double t = atof(degrad->getAttribute(
"t"));
89 if (t<0) { error(
"Error parsing degradList. t cannot be <0!"); }
95 cXMLElementList PPs = degrad->getChildrenByTagName(
"PP");
97 if(PPs.size() <= 0) { error(
"Error parsing degradList. At least one PP must be defined!"); }
99 if(!PP->getAttribute(
"priority")) { error(
"Error parsing PP. priority must be defined!"); }
100 int priority = atoi(PP->getAttribute(
"priority"));
101 if(priority<0) { error(
"Error parsing PP. priority must be >=0!"); }
102 if(maxPriority<priority) { maxPriority = priority ; }
104 if(!PP->getAttribute(
"probability")) { error(
"Error parsing PP. probability must be defined!"); }
105 double probability = atof(PP->getAttribute(
"probability"));
106 if(probability<=0 || probability>1) { error(
"Error parsing PP. probability must be in (0,1]!"); }
108 sumProb += probability;
113 if(sumProb > 1) { error(
"Error parsing degradList. probability of PPs cannot surpass 1!"); }
123 MM_DQ_Out::~MM_DQ_Out(){}
125 void MM_DQ_Out::finish() {
146 simtime_t now = simTime();
155 }
else if (qc->
rate <= 0.0) {
166 simtime_t st = lt-now;
172 if(dl == NULL) { dl = &pdl; }
173 else if( dl->
t < pdl.
t) { dl = &pdl; }
182 double r = uniform(0,1);
185 if(ul.
limit < r) { cPrio = ul.
urg; }
210 }
else { error(
"PDU dropped from empty queue!??"); }
216 }
else { error(
"Multiple PDUs dropped at same time!??"); }
222 if(queuesConf.find(q->getName()) != queuesConf.end()) {
223 queueConf[q] = &queuesConf[q->getName()];
229 portQueues[p].insert(q);
240 if(qd->
count <= 0) {
continue; }
242 int qP = maxPriority;
244 if(qpc.second > 0 && qpc.first < qP) { qP = qpc.first; }
246 if(mpriority < 0 || mpriority > qP) {
250 }
else if(mpriority == qP && minT > qd->
inTimes.front()) {
256 if(ret==NULL) {
return NULL; }
267 simtime_t MM_DQ_Out::getnextTime(
RMTPort * p) {
vector< UrgLimit > urgList
vector< DegradList > degradLists
const cPacket * getLastPDU() const
list< simtime_t > inTimes
map< int, int > countUrgstats
list< simtime_t > outTimes