62 // |
62 // |
63 // Make the random number generators generate reproducible results. |
63 // Make the random number generators generate reproducible results. |
64 // |
64 // |
65 RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); |
65 RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); |
66 |
66 |
67 // Set a few parameters |
67 // Set a few attributes |
68 Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01)); |
68 Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01)); |
69 Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT")); |
69 Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT")); |
70 |
70 |
71 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210)); |
71 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210)); |
72 Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s"))); |
72 Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s"))); |
90 internet.Install (c); |
90 internet.Install (c); |
91 |
91 |
92 // We create the channels first without any IP addressing information |
92 // We create the channels first without any IP addressing information |
93 NS_LOG_INFO ("Create channels."); |
93 NS_LOG_INFO ("Create channels."); |
94 PointToPointHelper p2p; |
94 PointToPointHelper p2p; |
95 p2p.SetDeviceParameter ("DataRate", DataRateValue (DataRate (5000000))); |
95 p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (5000000))); |
96 p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2))); |
96 p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); |
97 NetDeviceContainer d0d2 = p2p.Install (n0n2); |
97 NetDeviceContainer d0d2 = p2p.Install (n0n2); |
98 |
98 |
99 NetDeviceContainer d1d2 = p2p.Install (n1n2); |
99 NetDeviceContainer d1d2 = p2p.Install (n1n2); |
100 |
100 |
101 p2p.SetDeviceParameter ("DataRate", DataRateValue (DataRate (1500000))); |
101 p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1500000))); |
102 p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (10))); |
102 p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10))); |
103 NetDeviceContainer d3d2 = p2p.Install (n3n2); |
103 NetDeviceContainer d3d2 = p2p.Install (n3n2); |
104 |
104 |
105 // Later, we add IP addresses. |
105 // Later, we add IP addresses. |
106 NS_LOG_INFO ("Assign IP Addresses."); |
106 NS_LOG_INFO ("Assign IP Addresses."); |
107 Ipv4AddressHelper ipv4; |
107 Ipv4AddressHelper ipv4; |