# HG changeset patch # User cdfreire # Date 1310564355 -7200 # Node ID c25325ce6381936d52a537d3a631ecf7b975322b # Parent d210b6af8fd0e86145c9e30a9c064173cc66d65e Avoid creating RandomVariables every time the phy receives a packet, now that it's not as efficient. diff -r d210b6af8fd0 -r c25325ce6381 src/wimax/model/simple-ofdm-wimax-phy.cc --- a/src/wimax/model/simple-ofdm-wimax-phy.cc Wed Jul 13 14:45:19 2011 +0200 +++ b/src/wimax/model/simple-ofdm-wimax-phy.cc Wed Jul 13 15:39:15 2011 +0200 @@ -342,7 +342,6 @@ Ptr burst) { - UniformVariable URNG; uint8_t drop = 0; double Nwb = -114 + m_noiseFigure + 10 * log (GetBandwidth () / 1000000000.0) / 2.303; double SNR = rxPower - Nwb; @@ -351,9 +350,9 @@ double I1 = record->GetI1 (); double I2 = record->GetI2 (); - double blockErrorRate = URNG.GetValue (I1, I2); + double blockErrorRate = m_rng.GetValue (I1, I2); - double rand = URNG.GetValue (0.0, 1.0); + double rand = m_rng.GetValue (0.0, 1.0); if (rand < blockErrorRate) { diff -r d210b6af8fd0 -r c25325ce6381 src/wimax/model/simple-ofdm-wimax-phy.h --- a/src/wimax/model/simple-ofdm-wimax-phy.h Wed Jul 13 14:45:19 2011 +0200 +++ b/src/wimax/model/simple-ofdm-wimax-phy.h Wed Jul 13 15:39:15 2011 +0200 @@ -27,6 +27,7 @@ #include "ns3/callback.h" #include "ns3/nstime.h" #include "ns3/event-id.h" +#include "ns3/random-variable.h" #include "wimax-phy.h" #include "bvec.h" #include "ns3/snr-to-block-error-rate-manager.h" @@ -256,6 +257,7 @@ double m_noiseFigure; double m_txGain; double m_rxGain; + UniformVariable m_rng; /** * The trace source fired when a packet begins the transmission process on * the medium.