00001 #include "PERModel.h" 00002 00003 void PERModel::filterSignal(Signal& s) { 00004 simtime_t start = s.getSignalStart(); 00005 simtime_t end = start + s.getSignalLength(); 00006 00007 double attenuationFactor = 1; // no attenuation 00008 if(packetErrorRate > 0 && uniform(0, 1) < packetErrorRate) { 00009 attenuationFactor = 0; // absorb all energy so that the receveir cannot receive anything 00010 } 00011 00012 TimeMapping<Linear>* attMapping = new TimeMapping<Linear> (); 00013 Argument arg; 00014 attMapping->setValue(arg, attenuationFactor); 00015 s.addAttenuation(attMapping); 00016 } 00017 00018 00019