LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 { | 135 { |
136 FadingTraceSample rbTimeFadingTrace; | 136 FadingTraceSample rbTimeFadingTrace; |
137 for (uint32_t j = 0; j < m_samplesNum; j++) | 137 for (uint32_t j = 0; j < m_samplesNum; j++) |
138 { | 138 { |
139 double sample; | 139 double sample; |
140 ifTraceFile >> sample; | 140 ifTraceFile >> sample; |
141 rbTimeFadingTrace.push_back (sample); | 141 rbTimeFadingTrace.push_back (sample); |
142 } | 142 } |
143 m_fadingTrace.push_back (rbTimeFadingTrace); | 143 m_fadingTrace.push_back (rbTimeFadingTrace); |
144 } | 144 } |
145 m_timeGranularity = m_traceLength.GetMilliSeconds () / m_samplesNum; | 145 m_timeGranularity = static_cast<uint8_t> (m_traceLength.GetMilliSeconds () / m
_samplesNum); |
146 m_lastWindowUpdate = Simulator::Now (); | 146 m_lastWindowUpdate = Simulator::Now (); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 Ptr<SpectrumValue> | 150 Ptr<SpectrumValue> |
151 TraceFadingLossModel::DoCalcRxPowerSpectralDensity ( | 151 TraceFadingLossModel::DoCalcRxPowerSpectralDensity ( |
152 Ptr<const SpectrumValue> txPsd, | 152 Ptr<const SpectrumValue> txPsd, |
153 Ptr<const MobilityModel> a, | 153 Ptr<const MobilityModel> a, |
154 Ptr<const MobilityModel> b) const | 154 Ptr<const MobilityModel> b) const |
155 { | 155 { |
156 NS_LOG_FUNCTION (this << *txPsd << a << b); | 156 NS_LOG_FUNCTION (this << *txPsd << a << b); |
157 ·· | 157 ·· |
158 std::map <ChannelRealizationId_t, int >::iterator itOff; | 158 std::map <ChannelRealizationId_t, int >::iterator itOff; |
159 ChannelRealizationId_t mobilityPair = std::make_pair (a,b); | 159 ChannelRealizationId_t mobilityPair = std::make_pair (a,b); |
160 itOff = m_windowOffsetsMap.find (mobilityPair); | 160 itOff = m_windowOffsetsMap.find (mobilityPair); |
161 if (itOff!=m_windowOffsetsMap.end ()) | 161 if (itOff!=m_windowOffsetsMap.end ()) |
162 { | 162 { |
163 if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () +
m_windowSize.GetSeconds ()) | 163 if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () +
m_windowSize.GetSeconds ()) |
164 { | 164 { |
165 // update all the offsets | 165 // update all the offsets |
166 NS_LOG_INFO ("Fading Windows Updated"); | 166 NS_LOG_INFO ("Fading Windows Updated"); |
167 std::map <ChannelRealizationId_t, int >::iterator itOff2; | 167 std::map <ChannelRealizationId_t, int >::iterator itOff2; |
168 for (itOff2 = m_windowOffsetsMap.begin (); itOff2 != m_windowOffsetsMa
p.end (); itOff2++) | 168 for (itOff2 = m_windowOffsetsMap.begin (); itOff2 != m_windowOffsetsMa
p.end (); itOff2++) |
169 { | 169 { |
170 std::map <ChannelRealizationId_t, Ptr<UniformRandomVariable> >::it
erator itVar; | 170 std::map <ChannelRealizationId_t, Ptr<UniformRandomVariable> >::it
erator itVar; |
171 itVar = m_startVariableMap.find ((*itOff2).first); | 171 itVar = m_startVariableMap.find ((*itOff2).first); |
172 (*itOff2).second = (*itVar).second->GetValue (); | 172 (*itOff2).second = static_cast<int> ((*itVar).second->GetValue ())
; |
173 } | 173 } |
174 m_lastWindowUpdate = Simulator::Now (); | 174 m_lastWindowUpdate = Simulator::Now (); |
175 } | 175 } |
176 } | 176 } |
177 else | 177 else |
178 { | 178 { |
179 NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.s
ize () = " << m_windowOffsetsMap.size ()); | 179 NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.s
ize () = " << m_windowOffsetsMap.size ()); |
180 Ptr<UniformRandomVariable> startV = CreateObject<UniformRandomVariable> ()
; | 180 Ptr<UniformRandomVariable> startV = CreateObject<UniformRandomVariable> ()
; |
181 startV->SetAttribute ("Min", DoubleValue (1.0)); | 181 startV->SetAttribute ("Min", DoubleValue (1.0)); |
182 startV->SetAttribute ("Max", DoubleValue ((m_traceLength.GetSeconds () - m
_windowSize.GetSeconds ()) * 1000.0)); | 182 startV->SetAttribute ("Max", DoubleValue ((m_traceLength.GetSeconds () - m
_windowSize.GetSeconds ()) * 1000.0)); |
183 if (m_streamsAssigned) | 183 if (m_streamsAssigned) |
184 { | 184 { |
185 NS_ASSERT_MSG (m_currentStream <= m_lastStream, "not enough streams, c
onsider increasing the StreamSetSize attribute"); | 185 NS_ASSERT_MSG (m_currentStream <= m_lastStream, "not enough streams, c
onsider increasing the StreamSetSize attribute"); |
186 startV->SetStream (m_currentStream); | 186 startV->SetStream (m_currentStream); |
187 m_currentStream += 1; | 187 m_currentStream += 1; |
188 } | 188 } |
189 ChannelRealizationId_t mobilityPair = std::make_pair (a,b); | 189 mobilityPair = std::make_pair (a,b); |
190 m_startVariableMap.insert (std::pair<ChannelRealizationId_t,Ptr<UniformRan
domVariable> > (mobilityPair, startV)); | 190 m_startVariableMap.insert (std::pair<ChannelRealizationId_t,Ptr<UniformRan
domVariable> > (mobilityPair, startV)); |
191 itOff = m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (
mobilityPair, startV->GetValue ())).first; | 191 itOff = m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (
mobilityPair, static_cast<int> (startV->GetValue ()))).first; |
192 } | 192 } |
193 | 193 |
194 ·· | 194 ·· |
195 Ptr<SpectrumValue> rxPsd = Copy<SpectrumValue> (txPsd); | 195 Ptr<SpectrumValue> rxPsd = Copy<SpectrumValue> (txPsd); |
196 Values::iterator vit = rxPsd->ValuesBegin (); | 196 Values::iterator vit = rxPsd->ValuesBegin (); |
197 ·· | 197 ·· |
198 //Vector aSpeedVector = a->GetVelocity (); | 198 //Vector aSpeedVector = a->GetVelocity (); |
199 //Vector bSpeedVector = b->GetVelocity (); | 199 //Vector bSpeedVector = b->GetVelocity (); |
200 ·· | 200 ·· |
201 //double speed = std::sqrt (std::pow (aSpeedVector.x-bSpeedVector.x,2) + std::
pow (aSpeedVector.y-bSpeedVector.y,2)); | 201 //double speed = std::sqrt (std::pow (aSpeedVector.x-bSpeedVector.x,2) + std::
pow (aSpeedVector.y-bSpeedVector.y,2)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 NS_ASSERT_MSG (m_currentStream <= m_lastStream, "not enough streams, consi
der increasing the StreamSetSize attribute"); | 250 NS_ASSERT_MSG (m_currentStream <= m_lastStream, "not enough streams, consi
der increasing the StreamSetSize attribute"); |
251 (*itVar).second->SetStream (m_currentStream); | 251 (*itVar).second->SetStream (m_currentStream); |
252 m_currentStream += 1; | 252 m_currentStream += 1; |
253 } | 253 } |
254 return m_streamSetSize; | 254 return m_streamSetSize; |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 | 258 |
259 } // namespace ns3 | 259 } // namespace ns3 |
LEFT | RIGHT |