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) 2009 University of Washington | 3 * Copyright (c) 2009 University of Washington |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Get maximum arrival offset | 144 // Get maximum arrival offset |
145 double maxAmp = -1; | 145 double maxAmp = -1; |
146 double maxTapDelay = 0.0; | 146 double maxTapDelay = 0.0; |
147 UanPdp::Iterator pit = pdp.GetBegin (); | 147 UanPdp::Iterator pit = pdp.GetBegin (); |
148 for (; pit != pdp.GetEnd (); pit++) | 148 for (; pit != pdp.GetEnd (); pit++) |
149 { | 149 { |
150 if (std::abs (pit->GetAmp ()) > maxAmp) | 150 if (std::abs (pit->GetAmp ()) > maxAmp) |
151 { | 151 { |
152 maxAmp = std::abs (pit->GetAmp ()); | 152 maxAmp = std::abs (pit->GetAmp ()); |
153 maxTapDelay = pit->GetDelay ().GetSeconds (); | 153 // Modified in order to subtract delay of first tap (maxTapDelay appea
rs to be used later in code· |
| 154 // as delay from first reception, not from TX time) |
| 155 maxTapDelay = pit->GetDelay ().GetSeconds () - pdp.GetTap(0).GetDelay(
).GetSeconds(); |
154 } | 156 } |
155 } | 157 } |
156 | 158 |
157 | 159 |
158 double effRxPowerDb = rxPowerDb + KpToDb (csp); | 160 double effRxPowerDb = rxPowerDb + KpToDb (csp); |
159 | 161 //It appears to be just the first elements of the sum in Parrish paper,· |
160 double isiUpa = rxPowerDb * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime),
Seconds (ts)); | 162 // "System Design Considerations for Undersea Networks: Link and Multiple Acce
ss Protocols", eq. 14 |
| 163 double isiUpa = DbToKp(rxPowerDb) * pdp.SumTapsFromMaxNc (Seconds (ts + cleari
ngTime), Seconds (ts)); // added DpToKp() |
161 UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); | 164 UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
162 double intKp = -DbToKp (effRxPowerDb); | 165 double intKp = -DbToKp (effRxPowerDb); |
163 for (; it != arrivalList.end (); it++) | 166 for (; it != arrivalList.end (); it++) |
164 { | 167 { |
165 UanPdp intPdp = it->GetPdp (); | 168 UanPdp intPdp = it->GetPdp (); |
166 double tDelta = std::abs (arrTime.GetSeconds () + maxTapDelay - it->GetArr
ivalTime ().GetSeconds ()); | 169 double tDelta = std::abs (arrTime.GetSeconds () + maxTapDelay - it->GetArr
ivalTime ().GetSeconds ()); |
167 // We want tDelta in terms of a single symbol (i.e. if tDelta = 7.3 symbol
+clearing | 170 // We want tDelta in terms of a single symbol (i.e. if tDelta = 7.3 symbol
+clearing |
168 // times, the offset in terms of the arriving symbol power is | 171 // times, the offset in terms of the arriving symbol power is |
169 // 0.3 symbol+clearing times. | 172 // 0.3 symbol+clearing times. |
170 | 173 |
171 int32_t syms = (uint32_t)( (double) tDelta / (ts + clearingTime)); | 174 int32_t syms = (uint32_t)( (double) tDelta / (ts + clearingTime)); |
172 tDelta = tDelta - syms * (ts + clearingTime); | 175 tDelta = tDelta - syms * (ts + clearingTime); |
173 | 176 |
174 // Align to pktRx | 177 // Align to pktRx |
175 if (arrTime + Seconds (maxTapDelay) > it->GetArrivalTime ()) | 178 if (arrTime + Seconds (maxTapDelay) > it->GetArrivalTime ()) |
176 { | 179 { |
177 tDelta = ts + clearingTime - tDelta; | 180 tDelta = ts + clearingTime - tDelta; |
178 } | 181 } |
179 | 182 |
180 double intPower = 0.0; | 183 double intPower = 0.0; |
181 if (tDelta < ts) | 184 if (tDelta < ts) // Case where there is overlap of a symbol due to interfe
rer arriving just after desired signal |
182 { | 185 { |
| 186 //Appears to be just the first two elements of the sum in Parrish pape
r, eq. 14 |
183 intPower += intPdp.SumTapsNc (Seconds (0), Seconds (ts - tDelta)); | 187 intPower += intPdp.SumTapsNc (Seconds (0), Seconds (ts - tDelta)); |
184 intPower += intPdp.SumTapsNc (Seconds (ts - tDelta + clearingTime), | 188 intPower += intPdp.SumTapsNc (Seconds (ts - tDelta + clearingTime), |
185 Seconds (2 * ts - tDelta + clearingTime)
); | 189 Seconds (2 * ts - tDelta + clearingTime)
); |
186 } | 190 } |
187 else | 191 else // Account for case where there's overlap of a symbol due to interfer
er arriving with a tDelta of a symbol + clearing time later |
188 { | 192 { |
| 193 // Appears to be just the first two elements of the sum in Parrish pap
er, eq. 14 |
189 Time start = Seconds (ts + clearingTime - tDelta); | 194 Time start = Seconds (ts + clearingTime - tDelta); |
190 Time end = start + Seconds (ts); | 195 Time end = /*start +*/ Seconds (ts); // Should only sum over portion o
f ts that overlaps, not entire ts |
191 intPower += intPdp.SumTapsNc (start, end); | 196 intPower += intPdp.SumTapsNc (start, end); |
192 | 197 |
193 start = start + Seconds (ts + clearingTime); | 198 start = start + Seconds (ts + clearingTime); |
194 end = start + Seconds (ts); | 199 //Should only sum over portion of ts that overlaps, not entire ts |
| 200 end = end + Seconds (ts + clearingTime); //start + Seconds (ts); |
195 intPower += intPdp.SumTapsNc (start, end); | 201 intPower += intPdp.SumTapsNc (start, end); |
196 } | 202 } |
197 intKp += DbToKp (it->GetRxPowerDb ()) * intPower; | 203 intKp += DbToKp (it->GetRxPowerDb ()) * intPower; |
198 } | 204 } |
199 | 205 |
200 double totalIntDb = KpToDb (isiUpa + intKp + DbToKp (ambNoiseDb)); | 206 double totalIntDb = KpToDb (isiUpa + intKp + DbToKp (ambNoiseDb)); |
201 | 207 |
202 NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Effective
Rx power " << effRxPowerDb << " dB. Number of interferers = " << arrivalList.s
ize () << " Interference + noise power = " << totalIntDb << " dB. SINR = " <<
effRxPowerDb - totalIntDb << " dB."); | 208 NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Effective
Rx power " << effRxPowerDb << " dB. Number of interferers = " << arrivalList.s
ize () << " Interference + noise power = " << totalIntDb << " dB. SINR = " <<
effRxPowerDb - totalIntDb << " dB."); |
203 return effRxPowerDb - totalIntDb; | 209 return effRxPowerDb - totalIntDb; |
204 } | 210 } |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 } | 1042 } |
1037 | 1043 |
1038 Ptr<Packet> | 1044 Ptr<Packet> |
1039 UanPhyGen::GetPacketRx (void) const | 1045 UanPhyGen::GetPacketRx (void) const |
1040 { | 1046 { |
1041 return m_pktRx; | 1047 return m_pktRx; |
1042 } | 1048 } |
1043 | 1049 |
1044 | 1050 |
1045 } // namespace ns3 | 1051 } // namespace ns3 |
LEFT | RIGHT |