OLD | NEW |
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) 2010 CTTC | 3 * Copyright (c) 2010 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 PacketSocketHelper packetSocket; | 185 PacketSocketHelper packetSocket; |
186 packetSocket.Install (ofdmNodes); | 186 packetSocket.Install (ofdmNodes); |
187 | 187 |
188 PacketSocketAddress socket; | 188 PacketSocketAddress socket; |
189 socket.SetSingleDevice (ofdmDevices.Get (0)->GetIfIndex ()); | 189 socket.SetSingleDevice (ofdmDevices.Get (0)->GetIfIndex ()); |
190 socket.SetPhysicalAddress (ofdmDevices.Get (1)->GetAddress ()); | 190 socket.SetPhysicalAddress (ofdmDevices.Get (1)->GetAddress ()); |
191 socket.SetProtocol (1); | 191 socket.SetProtocol (1); |
192 | 192 |
193 OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket)); | 193 OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket)); |
194 onoff.SetAttribute ("OnTime", RandomVariableValue (ExponentialVariable (0.4)))
; | 194 onoff.SetAttribute ("OnTime", StringValue ("ns3::ExponentialRandomVariable[Mea
n=0.4]")); |
195 onoff.SetAttribute ("OffTime", RandomVariableValue (ExponentialVariable (0.1))
); | 195 onoff.SetAttribute ("OffTime", StringValue ("ns3::ExponentialRandomVariable[Me
an=0.1]")); |
196 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("0.4Mbps"))); | 196 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("0.4Mbps"))); |
197 onoff.SetAttribute ("PacketSize", UintegerValue (1500)); | 197 onoff.SetAttribute ("PacketSize", UintegerValue (1500)); |
198 | 198 |
199 ApplicationContainer apps = onoff.Install (ofdmNodes.Get (0)); | 199 ApplicationContainer apps = onoff.Install (ofdmNodes.Get (0)); |
200 apps.Start (Seconds (0.0)); | 200 apps.Start (Seconds (0.0)); |
201 apps.Stop (Seconds (2)); | 201 apps.Stop (Seconds (2)); |
202 | 202 |
203 Ptr<Socket> recvSink = SetupPacketReceive (ofdmNodes.Get (1)); | 203 Ptr<Socket> recvSink = SetupPacketReceive (ofdmNodes.Get (1)); |
204 | 204 |
205 | 205 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 Simulator::Stop (Seconds (0.3)); | 256 Simulator::Stop (Seconds (0.3)); |
257 | 257 |
258 Simulator::Run (); | 258 Simulator::Run (); |
259 | 259 |
260 Simulator::Destroy (); | 260 Simulator::Destroy (); |
261 | 261 |
262 } | 262 } |
263 | 263 |
264 | 264 |
OLD | NEW |