136 .SetParent<PropagationLossModel> () |
136 .SetParent<PropagationLossModel> () |
137 .AddConstructor<JakesPropagationLossModel> () |
137 .AddConstructor<JakesPropagationLossModel> () |
138 .AddAttribute ("NumberOfRaysPerPath", |
138 .AddAttribute ("NumberOfRaysPerPath", |
139 "The number of rays to use by default for compute the fading coeficent for a given path (default is 1)", |
139 "The number of rays to use by default for compute the fading coeficent for a given path (default is 1)", |
140 UintegerValue (1), |
140 UintegerValue (1), |
141 MakeUintegerAccessor (&JakesPropagationLossModel::m_nRays), |
141 MakeUintegerAccessor (&JakesPropagationLossModel::SetNRays, |
|
142 &JakesPropagationLossModel::GetNRays), |
142 MakeUintegerChecker<uint8_t> ()) |
143 MakeUintegerChecker<uint8_t> ()) |
143 .AddAttribute ("NumberOfOscillatorsPerRay", |
144 .AddAttribute ("NumberOfOscillatorsPerRay", |
144 "The number of oscillators to use by default for compute the coeficent for a given ray of a given " |
145 "The number of oscillators to use by default for compute the coeficent for a given ray of a given " |
145 "path (default is 4)", |
146 "path (default is 4)", |
146 UintegerValue (4), |
147 UintegerValue (4), |
147 MakeUintegerAccessor (&JakesPropagationLossModel::m_nOscillators), |
148 MakeUintegerAccessor (&JakesPropagationLossModel::SetNOscillators, |
|
149 &JakesPropagationLossModel::GetNOscillators), |
148 MakeUintegerChecker<uint8_t> ()) |
150 MakeUintegerChecker<uint8_t> ()) |
149 .AddAttribute ("DopplerFreq", |
151 .AddAttribute ("DopplerFreq", |
150 "The doppler frequency in Hz (f_d = v / lambda = v * f / c), the default is 0)", |
152 "The doppler frequency in Hz (f_d = v / lambda = v * f / c), the default is 0)", |
151 DoubleValue (0.0), |
153 DoubleValue (0.0), |
152 MakeDoubleAccessor (&JakesPropagationLossModel::m_fd), |
154 MakeDoubleAccessor (&JakesPropagationLossModel::m_fd), |
179 delete ps; |
182 delete ps; |
180 } |
183 } |
181 } |
184 } |
182 |
185 |
183 void |
186 void |
184 JakesPropagationLossModel::DoConstruct () |
187 JakesPropagationLossModel::SetNRays (uint8_t nRays) |
185 { |
188 { |
|
189 m_nRays = nRays; |
|
190 } |
|
191 |
|
192 void |
|
193 JakesPropagationLossModel::SetNOscillators (uint8_t nOscillators) |
|
194 { |
|
195 m_nOscillators = nOscillators; |
|
196 delete [] m_amp; |
186 uint16_t N = 4 * m_nOscillators + 2; |
197 uint16_t N = 4 * m_nOscillators + 2; |
187 m_amp = new ComplexNumber[m_nOscillators + 1]; |
198 m_amp = new ComplexNumber[m_nOscillators + 1]; |
188 m_amp[0].real = 2.0 * sqrt(2.0 / N) * cos (PI / 4.0); |
199 m_amp[0].real = 2.0 * sqrt(2.0 / N) * cos (PI / 4.0); |
189 m_amp[0].imag = 2.0 * sqrt(2.0 / N) * sin (PI / 4.0); |
200 m_amp[0].imag = 2.0 * sqrt(2.0 / N) * sin (PI / 4.0); |
190 for (uint8_t i = 1; i <= m_nOscillators; i++) |
201 for (uint8_t i = 1; i <= m_nOscillators; i++) |
193 m_amp[i].real = 4.0 * cos (beta) / sqrt(N); |
204 m_amp[i].real = 4.0 * cos (beta) / sqrt(N); |
194 m_amp[i].imag = 4.0 * sin (beta) / sqrt(N); |
205 m_amp[i].imag = 4.0 * sin (beta) / sqrt(N); |
195 } |
206 } |
196 } |
207 } |
197 |
208 |
198 void |
209 uint8_t |
199 JakesPropagationLossModel::SetNRays (uint8_t nRays) |
210 JakesPropagationLossModel::GetNRays (void) const |
200 { |
211 { |
201 m_nRays = nRays; |
212 return m_nRays; |
202 } |
213 } |
203 |
214 uint8_t |
204 void |
215 JakesPropagationLossModel::GetNOscillators (void) const |
205 JakesPropagationLossModel::SetNOscillators (uint8_t nOscillators) |
216 { |
206 { |
217 return m_nOscillators; |
207 m_nOscillators = nOscillators; |
218 } |
208 } |
219 |
209 |
220 |
210 double |
221 double |
211 JakesPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
222 JakesPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
212 Ptr<MobilityModel> a, |
223 Ptr<MobilityModel> a, |
213 Ptr<MobilityModel> b) const |
224 Ptr<MobilityModel> b) const |