RINASim  October 2016
Documentation of framework for OMNeT++
QoSMinComparer.cc
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #include <QoSMinComparer.h>
24 
26 
28  mHops = par("maxHops").longValue();
29  mlBandw = par("mulBandw").longValue();
30 }
31 
32 
33 bool QoSMinComparer::isValid(const QoSCube &upperQoS, const QoSCube &lowerQoS) {
34  if(upperQoS.getAvgBand()*mlBandw > lowerQoS.getAvgBand()) return false;
35  if(upperQoS.getAvgSduBand()*mlBandw > lowerQoS.getAvgSduBand()) return false;
36  if(upperQoS.getPeakBandDuration()*mlBandw > lowerQoS.getPeakBandDuration()) return false;
37  if(upperQoS.getPeakSduBandDuration()*mlBandw > lowerQoS.getPeakSduBandDuration()) return false;
38  if(upperQoS.getBurstPeriod()*mlBandw > lowerQoS.getBurstPeriod()) return false;
39  if(upperQoS.getBurstDuration()*mlBandw > lowerQoS.getBurstDuration()) return false;
40  if(1-pow(1-upperQoS.getUndetectedBitErr(), mHops) > lowerQoS.getUndetectedBitErr()) return false;
41  if(1-pow(1-upperQoS.getPduDropProbability(), mHops) > lowerQoS.getPduDropProbability()) return false;
42  if(upperQoS.getMaxSduSize() > lowerQoS.getMaxSduSize()) return false;
43  if(!upperQoS.isPartialDelivery() && lowerQoS.isPartialDelivery()) return false;
44  if(!upperQoS.isIncompleteDelivery() && lowerQoS.isIncompleteDelivery()) return false;
45  if(upperQoS.isForceOrder() && lowerQoS.isForceOrder()) return false;
46  if(upperQoS.getMaxAllowGap() < lowerQoS.getMaxAllowGap()) return false;
47  if(upperQoS.getDelay() < lowerQoS.getDelay()*mHops) return false;
48  if(upperQoS.getJitter() < lowerQoS.getJitter()) return false;
49  if(upperQoS.getCostTime() < lowerQoS.getCostTime()*mHops) return false;
50  if(upperQoS.getCostBits() < lowerQoS.getCostBits()*mHops) return false;
51 
52  return true;
53 }
54 
55 void QoSMinComparer::setRequirements(Flow * lowerflow, const QoSCube &upperQoS) {
56  QoSReq qosParams(upperQoS.getAvgBand()*mlBandw, upperQoS.getAvgSduBand()*mlBandw,
58  upperQoS.getBurstPeriod()*mlBandw, upperQoS.getBurstDuration()*mlBandw,
59  1-pow(1-upperQoS.getUndetectedBitErr(), mHops),1-pow(1-upperQoS.getPduDropProbability(), mHops),
60  upperQoS.getMaxSduSize(), upperQoS.isPartialDelivery(), upperQoS.isIncompleteDelivery(), upperQoS.isForceOrder(),
61  upperQoS.getMaxAllowGap(), upperQoS.getDelay()/mHops, upperQoS.getJitter(),
62  upperQoS.getCostTime()/mHops, upperQoS.getCostBits()/mHops);
63  lowerflow->setQosRequirements(qosParams);
64 }
Class representing flow object with attributes from specs.
Definition: Flow.h:45
void setQosRequirements(const QoSReq &qosReqs)
Sets QoS parameters wanted by flow initiator.
Definition: Flow.cc:323
int getBurstPeriod() const
Gets Burst Period parameter.
Definition: QoSCube.cc:276
int getBurstDuration() const
Gets Burst Duration parameter.
Definition: QoSCube.cc:268
int getAvgBand() const
Gets Average Bandwidth parameter.
Definition: QoSCube.cc:252
double getPduDropProbability() const
Gets PDU Dropping Probability parameter.
Definition: QoSCube.cc:400
int getPeakBandDuration() const
Gets Peak Band Duration parameter.
Definition: QoSCube.cc:340
int getJitter() const
Gets Jitter parameter.
Definition: QoSCube.cc:308
double getCostBits() const
Gets Cost-bits parameter.
Definition: QoSCube.cc:368
void setRequirements(Flow *lowerflow, const QoSCube &upperQoS)
int getMaxSduSize() const
Gets Maximum SDU Size parameter.
Definition: QoSCube.cc:324
double getUndetectedBitErr() const
Gets Undetected Bit Error Rate parameter.
Definition: QoSCube.cc:356
bool isIncompleteDelivery() const
Gets incomplete delivery flag.
Definition: QoSCube.cc:300
bool isValid(const QoSCube &upperQoS, const QoSCube &lowerQoS)
Define_Module(QoSMinComparer)
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
Definition: QoSCube.h:57
double getCostTime() const
Gets Cost-time parameter.
Definition: QoSCube.cc:376
bool isPartialDelivery() const
Gets partial delivery flag.
Definition: QoSCube.cc:332
bool isForceOrder() const
Gets in-order delivery flag.
Definition: QoSCube.cc:292
Class representing QoSReq with all its properties that is primarily used by FA, RMT and RA Specificat...
Definition: QoSReq.h:44
int getDelay() const
Gets Delay parameter.
Definition: QoSCube.cc:284
int getPeakSduBandDuration() const
Gets Peak SDU Duration parameter.
Definition: QoSCube.cc:348
int getAvgSduBand() const
Gets Average SDU Bandwidth parameter.
Definition: QoSCube.cc:260
int getMaxAllowGap() const
Gets Maximum Allowable Gap in SDUs parameter.
Definition: QoSCube.cc:316