-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsam.cc
530 lines (407 loc) · 18.2 KB
/
sam.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
#include <string>
#include <fstream>
#include <cstdlib>
#include <map>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/gnuplot.h"
#include <iostream>
#include "ns3/point-to-point-layout-module.h"
#include "ns3/packet-sink.h"
#include "ns3/config.h"
#include "ns3/gtk-config-store.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/callback.h"
#include "ns3/error-model.h"
#include "ns3/tcp-header.h"
#include "ns3/enum.h"
#include "ns3/event-id.h"
#include "ns3/flow-monitor-helper.h"
#include "ns3/network-module.h"
#include "ns3/traffic-control-module.h"
//
typedef uint32_t uint;
using namespace ns3;
#define ERROR 0.000001
std::string dir = "TcpLedbat_results/";
// queue part
void
CheckQueueDelay (Ptr<QueueDisc> queue)
{
double qSize = queue->GetCurrentSize ().GetValue ();
qSize=(qSize*1.2*1024*1000*8)/(1000000); //(qsize*packet_size)/(bandwidth)
// check queue size every 1/100 of a second
Simulator::Schedule (Seconds (0.001), &CheckQueueDelay, queue);
std::ofstream fPlotQueue (std::stringstream (dir+"queue-delay.plotme").str ().c_str (), std::ios::out | std::ios::app);
fPlotQueue << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
fPlotQueue.close ();
}
void
SojournTimeTrace (Time sojournTime)
{
std::ofstream fPlot(std::stringstream (dir+"sojournTime.plotme").str ().c_str (), std::ios::out | std::ios::app);
fPlot << Simulator::Now ().GetSeconds () << " " << sojournTime.ToDouble (Time::MS) << std::endl;
fPlot.close ();
}
/*
in traffic-control/model/queue-disc.h, there is m_sojourn. You can write a function to get that value.
Or you can calculate queuing delay from queue length (CheckQueueSize() function in the file I had sent).
Queue delay = Queue Length / Bottleneck Bandwidth
*/
// static void
// DropAtQueue (Ptr<OutputStreamWrapper> stream, Ptr<const QueueDiscItem> item)
// {
// *stream->GetStream () << Simulator::Now ().GetSeconds () << " 1" << std::endl;
// }
// static void
// MarkAtQueue (Ptr<OutputStreamWrapper> stream, Ptr<const QueueDiscItem> item, const char* reason)
// {
// *stream->GetStream () << Simulator::Now ().GetSeconds () << " 1" << std::endl;
// }
// void
// TraceProb (uint32_t node, uint32_t probability,
// Callback <void, double, double> ProbTrace)
// {
// Config::ConnectWithoutContext ("$ns3::NodeListPriv/NodeList/" + std::to_string (node) + "/$ns3::TrafficControlLayer/RootQueueDiscList/" + std::to_string (probability) + "/$ns3::PieQueueDisc/Probability", ProbTrace);
// }
//
// app
NS_LOG_COMPONENT_DEFINE ("App6");
class APP: public Application {
private:
virtual void StartApplication(void);
virtual void StopApplication(void);
void ScheduleTx(void);
void SendPacket(void);
Ptr<Socket> mSocket;
Address mPeer;
uint32_t mPacketSize;
uint32_t mNPackets;
DataRate mDataRate;
EventId mSendEvent;
bool mRunning;
uint32_t mPacketsSent;
public:
APP();
virtual ~APP();
void Setup(Ptr<Socket> socket, Address address, uint packetSize, uint nPackets, DataRate dataRate);
void ChangeRate(DataRate newRate);
void recv(int numBytesRcvd);
};
APP::APP(): mSocket(0),
mPeer(),
mPacketSize(0),
mNPackets(0),
mDataRate(0),
mSendEvent(),
mRunning(false),
mPacketsSent(0) {
}
APP::~APP() {
mSocket = 0;
}
void APP::Setup(Ptr<Socket> socket, Address address, uint packetSize, uint nPackets, DataRate dataRate) {
mSocket = socket;
mPeer = address;
mPacketSize = packetSize;
mNPackets = nPackets;
mDataRate = dataRate;
}
void APP::StartApplication() {
mRunning = true;
mPacketsSent = 0;
mSocket->Bind();
mSocket->Connect(mPeer);
SendPacket();
}
void APP::StopApplication() {
mRunning = false;
if(mSendEvent.IsRunning()) {
Simulator::Cancel(mSendEvent);
}
if(mSocket) {
mSocket->Close();
}
}
void APP::SendPacket() {
Ptr<Packet> packet = Create<Packet>(mPacketSize);
mSocket->Send(packet);
if(++mPacketsSent < mNPackets) {
ScheduleTx();
}
}
void APP::ScheduleTx() {
if (mRunning) {
Time tNext(Seconds(mPacketSize*8/static_cast<double>(mDataRate.GetBitRate())));
mSendEvent = Simulator::Schedule(tNext, &APP::SendPacket, this);
}
}
void APP::ChangeRate(DataRate newrate) {
mDataRate = newrate;
return;
}
static void CwndChange(Ptr<OutputStreamWrapper> stream, double startTime, uint oldCwnd, uint newCwnd) {
*stream->GetStream() << Simulator::Now ().GetSeconds () - startTime << "\t" << newCwnd << std::endl;
}
std::map<uint, uint> mapDrop;
static void packetDrop(Ptr<OutputStreamWrapper> stream, double startTime, uint myId) {
*stream->GetStream() << Simulator::Now ().GetSeconds () - startTime << "\t" << std::endl;
if(mapDrop.find(myId) == mapDrop.end()) {
mapDrop[myId] = 0;
}
mapDrop[myId]++;
}
void IncRate(Ptr<APP> app, DataRate rate) {
app->ChangeRate(rate);
return;
}
std::map<Address, double> mapBytesReceived;
std::map<std::string, double> mapBytesReceivedIPV4, mapMaxThroughput;
static double lastTimePrint = 0, lastTimePrintIPV4 = 0;
double printGap = 0;
void ReceivedPacket(Ptr<OutputStreamWrapper> stream, double startTime, std::string context, Ptr<const Packet> p, const Address& addr){
double timeNow = Simulator::Now().GetSeconds();
if(mapBytesReceived.find(addr) == mapBytesReceived.end())
mapBytesReceived[addr] = 0;
mapBytesReceived[addr] += p->GetSize();
double kbps_ = (((mapBytesReceived[addr] * 8.0) / 1024)/(timeNow-startTime));
if(timeNow - lastTimePrint >= printGap) {
lastTimePrint = timeNow;
*stream->GetStream() << timeNow-startTime << "\t" << kbps_ << std::endl;
}
}
void ReceivedPacketIPV4(Ptr<OutputStreamWrapper> stream, double startTime, std::string context, Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint interface) {
double timeNow = Simulator::Now().GetSeconds();
if(mapBytesReceivedIPV4.find(context) == mapBytesReceivedIPV4.end())
mapBytesReceivedIPV4[context] = 0;
if(mapMaxThroughput.find(context) == mapMaxThroughput.end())
mapMaxThroughput[context] = 0;
mapBytesReceivedIPV4[context] += p->GetSize();
double kbps_ = (((mapBytesReceivedIPV4[context] * 8.0) / 1024)/(timeNow-startTime));
if(timeNow - lastTimePrintIPV4 >= printGap) {
lastTimePrintIPV4 = timeNow;
*stream->GetStream() << timeNow-startTime << "\t" << kbps_ << std::endl;
if(mapMaxThroughput[context] < kbps_)
mapMaxThroughput[context] = kbps_;
}
}
//socket program
Ptr<Socket> uniFlow(Address sinkAddress,
uint sinkPort,
std::string tcpVariant,
Ptr<Node> hostNode,
Ptr<Node> sinkNode,
double startTime,
double stopTime,
uint packetSize,
uint numPackets,
std::string dataRate,
double appStartTime,
double appStopTime) {
std:: cout<<"\ntcpVariant="<< tcpVariant <<"\ndataRate: " <<dataRate<< "\nsinkaddress:" <<sinkAddress<<"\nhostNode:"<<hostNode <<"\nsinkNode"<<sinkNode;
TypeId tid;
if((tcpVariant.compare("TcpNewReno")) == 0) {
tid = TypeId::LookupByName ("ns3::TcpNewReno");
} else if((tcpVariant.compare("TcpLedbat")) == 0) {
tid = TypeId::LookupByName ("ns3::TcpLedbat");
} else {
std:: cout<<"line 256\n";
fprintf(stderr, "Invalid TCP version\n");
exit(EXIT_FAILURE);
}
//
// setting tcp tcpVariant
std::stringstream nodeId;
nodeId << hostNode->GetId ();
std::string specificNode = "/NodeList/" + nodeId.str () + "/$ns3::TcpL4Protocol/SocketType";
Config::Set (specificNode, TypeIdValue (tid));
//sink app
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), sinkPort));
ApplicationContainer sinkApps = packetSinkHelper.Install(sinkNode);
sinkApps.Start(Seconds(startTime));
sinkApps.Stop(Seconds(stopTime));
Ptr<Socket> ns3TcpSocket = Socket::CreateSocket(hostNode, TcpSocketFactory::GetTypeId());
//sender app
Ptr<APP> app = CreateObject<APP>();
app->Setup(ns3TcpSocket, sinkAddress, packetSize, numPackets, DataRate(dataRate));
hostNode->AddApplication(app);
app->SetStartTime(Seconds(appStartTime));
app->SetStopTime(Seconds(appStopTime));
return ns3TcpSocket;
}
int main(int argc, char **argv)
{
std::cout << "Part B started..." << std::endl;
std::string rateHR = "5Mbps";
std::string latencyHR = "0.00005ms";
std::string rateRR = "1Mbps";
std::string latencyRR = "0.00025ms";
std::string animFile = "d-animation.xml" ;
std::string queue_disc_type = "FifoQueueDisc";
queue_disc_type = std::string ("ns3::") + queue_disc_type;
double simulation_time=100;
double oneFlowStart = 0;
double otherFlowStart =20;
double FlowEndtime=100;
std::string tcpVariant1 = "TcpLedbat";
std::string tcpVariant2 = "TcpNewReno";
uint port = 9000;
uint32_t numPackets = 1000000*100;
std::string transferSpeed = "2Mbps";
std:: cout<<queue_disc_type;
TypeId qdTid;
NS_ABORT_MSG_UNLESS (TypeId::LookupByNameFailSafe (queue_disc_type, &qdTid), "TypeId " << queue_disc_type << " not found");
uint packetSize = 1.2*1024;
uint numSender = 3;
double errorP = ERROR;
//Creating channel without IP address
std::cout << "Creating channel without IP address" << std::endl;
PointToPointHelper p2pHR, p2pRR;
p2pHR.SetDeviceAttribute("DataRate", StringValue(rateHR));
p2pHR.SetChannelAttribute("Delay", StringValue(latencyHR));
p2pHR.SetQueue("ns3::DropTailQueue", "MaxSize", StringValue("38p"));
p2pRR.SetDeviceAttribute("DataRate", StringValue(rateRR));
p2pRR.SetChannelAttribute("Delay", StringValue(latencyRR));
p2pRR.SetQueue("ns3::DropTailQueue", "MaxSize", StringValue("38p"));
//Adding some errorrate
std::cout << "Adding some errorrate" << std::endl;
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> ("ErrorRate", DoubleValue (errorP));
NodeContainer routers, senders, receivers;
routers.Create(2);
senders.Create(numSender);
receivers.Create(numSender);
//installing router on channel
NetDeviceContainer routerDevices = p2pRR.Install(routers);
NetDeviceContainer leftRouterDevices, rightRouterDevices, senderDevices, receiverDevices;
//Adding links
std::cout << "Adding links" << std::endl;
for(uint i = 0; i < numSender; ++i) {
NetDeviceContainer cleft = p2pHR.Install(routers.Get(0), senders.Get(i));
leftRouterDevices.Add(cleft.Get(0));
senderDevices.Add(cleft.Get(1));
cleft.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue(em));
NetDeviceContainer cright = p2pHR.Install(routers.Get(1), receivers.Get(i));
rightRouterDevices.Add(cright.Get(0));
receiverDevices.Add(cright.Get(1));
cright.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue(em));
}
//Install Internet Stack
std::cout << "Install Internet Stack" << std::endl;
InternetStackHelper stack;
stack.Install(routers);
stack.Install(senders);
stack.Install(receivers);
//Adding IP addresses
std::cout << "Adding IP addresses" << std::endl;
Ipv4AddressHelper routerIP = Ipv4AddressHelper("10.3.0.0", "255.255.255.0");
Ipv4AddressHelper senderIP = Ipv4AddressHelper("10.1.0.0", "255.255.255.0");
Ipv4AddressHelper receiverIP = Ipv4AddressHelper("10.2.0.0", "255.255.255.0");
Ipv4InterfaceContainer routerIFC, senderIFCs, receiverIFCs, leftRouterIFCs, rightRouterIFCs;
routerIFC = routerIP.Assign(routerDevices);
for(uint i = 0; i < numSender; ++i) {
NetDeviceContainer senderDevice;
senderDevice.Add(senderDevices.Get(i));
senderDevice.Add(leftRouterDevices.Get(i));
Ipv4InterfaceContainer senderIFC = senderIP.Assign(senderDevice);
senderIFCs.Add(senderIFC.Get(0));
leftRouterIFCs.Add(senderIFC.Get(1));
senderIP.NewNetwork();
NetDeviceContainer receiverDevice;
receiverDevice.Add(receiverDevices.Get(i));
receiverDevice.Add(rightRouterDevices.Get(i));
Ipv4InterfaceContainer receiverIFC = receiverIP.Assign(receiverDevice);
receiverIFCs.Add(receiverIFC.Get(0));
rightRouterIFCs.Add(receiverIFC.Get(1));
receiverIP.NewNetwork();
}
//different
Config::SetDefault (queue_disc_type + "::MaxSize", QueueSizeValue (QueueSize ("38p")));
AsciiTraceHelper asciiTraceHelper;
Ptr<OutputStreamWrapper> streamWrapper;
TrafficControlHelper tch;
tch.SetRootQueueDisc (queue_disc_type);
QueueDiscContainer qd;
tch.Uninstall (routers.Get (0)->GetDevice (0));
qd.Add (tch.Install (routers.Get (0)->GetDevice (0)).Get (0));
Simulator::ScheduleNow (&CheckQueueDelay, qd.Get (0));
// // streamWrapper = asciiTraceHelper.CreateFileStream (dir + "/queueTraces/drop-0.plotme");
// qd.Get (0)->TraceConnectWithoutContext ("Drop", MakeBoundCallback (&DropAtQueue, streamWrapper));
// // streamWrapper = asciiTraceHelper.CreateFileStream (dir + "/queueTraces/mark-0.plotme");
// qd.Get (0)->TraceConnectWithoutContext ("Mark", MakeBoundCallback (&MarkAtQueue, streamWrapper));
//from H1 to H4
// AsciiTraceHelper asciiTraceHelper;
Ptr<OutputStreamWrapper> stream1CWND = asciiTraceHelper.CreateFileStream(dir+"tcp_h1_h4_b.cwnd");
Ptr<OutputStreamWrapper> stream1PD = asciiTraceHelper.CreateFileStream(dir+"tcp_h1_h4_b.congestion_loss");
Ptr<OutputStreamWrapper> stream1TP = asciiTraceHelper.CreateFileStream(dir+"tcp_h1_h4_b.tp");
Ptr<OutputStreamWrapper> stream1GP = asciiTraceHelper.CreateFileStream(dir+"tcp_h1_h4_b.gp");
Ptr<Socket> ns3TcpSocket1 = uniFlow(InetSocketAddress(receiverIFCs.GetAddress(0), port), port,tcpVariant1, senders.Get(0), receivers.Get(0), oneFlowStart,FlowEndtime, packetSize, numPackets*1000, transferSpeed, oneFlowStart,FlowEndtime);
ns3TcpSocket1->TraceConnectWithoutContext("CongestionWindow", MakeBoundCallback (&CwndChange, stream1CWND, 0));
ns3TcpSocket1->TraceConnectWithoutContext("Drop", MakeBoundCallback (&packetDrop, stream1PD, 0, 1));
std::string sink = "/NodeList/5/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink, MakeBoundCallback(&ReceivedPacket, stream1GP, 0));
std::string sink_ = "/NodeList/5/$ns3::Ipv4L3Protocol/Rx";
Config::Connect(sink_, MakeBoundCallback(&ReceivedPacketIPV4, stream1TP, 0));
// from H2 to H5
// std::cout << "TCP Westwood from H2 to H5" << std::endl;
Ptr<OutputStreamWrapper> stream2CWND = asciiTraceHelper.CreateFileStream(dir+"tcp_h2_h5_b.cwnd");
Ptr<OutputStreamWrapper> stream2PD = asciiTraceHelper.CreateFileStream(dir+"tcp_h2_h5_b.congestion_loss");
Ptr<OutputStreamWrapper> stream2TP = asciiTraceHelper.CreateFileStream(dir+"tcp_h2_h5_b.tp");
Ptr<OutputStreamWrapper> stream2GP = asciiTraceHelper.CreateFileStream(dir+"tcp_h2_h5_b.gp");
Ptr<Socket> ns3TcpSocket2 = uniFlow(InetSocketAddress(receiverIFCs.GetAddress(1), port), port,tcpVariant2, senders.Get(1), receivers.Get(1),otherFlowStart,FlowEndtime, packetSize, numPackets*1000, transferSpeed,otherFlowStart,FlowEndtime);
ns3TcpSocket2->TraceConnectWithoutContext("CongestionWindow", MakeBoundCallback (&CwndChange, stream2CWND, 0));
ns3TcpSocket2->TraceConnectWithoutContext("Drop", MakeBoundCallback (&packetDrop, stream2PD, 0, 2));
sink = "/NodeList/6/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink, MakeBoundCallback(&ReceivedPacket, stream2GP, 0));
sink_ = "/NodeList/6/$ns3::Ipv4L3Protocol/Rx";
Config::Connect(sink_, MakeBoundCallback(&ReceivedPacketIPV4, stream2TP, 0));
Config::ConnectWithoutContext ("/NodeList/0/$ns3::TrafficControlLayer/RootQueueDiscList/0/SojournTime",MakeCallback (&SojournTimeTrace));
//temporary disable
//p2pHR.EnablePcapAll("tcp_HR_b");
//p2pRR.EnablePcapAll("tcp_RR_b");
//Turning on Static Global Routing
std::cout << "Turning on Static Global Routing" << std::endl;
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
std::cout << "Monitoring flows..." << std::endl;
Ptr<FlowMonitor> flowmon;
FlowMonitorHelper flowmonHelper;
flowmon = flowmonHelper.InstallAll();
Simulator::Stop(Seconds(simulation_time));
Simulator::Run();
flowmon->CheckForLostPackets();
Ptr<OutputStreamWrapper> streamTP = asciiTraceHelper.CreateFileStream(dir+"tcp_b.tp");
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmonHelper.GetClassifier());
std::map<FlowId, FlowMonitor::FlowStats> stats = flowmon->GetFlowStats();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin(); i != stats.end(); ++i) {
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
*streamTP->GetStream() << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*streamTP->GetStream() << " Tx Bytes: " << i->second.txBytes << "\n";
*streamTP->GetStream() << " Rx Bytes: " << i->second.rxBytes << "\n";
*streamTP->GetStream() << " Time " << i->second.timeLastRxPacket.GetSeconds() - i->second.timeFirstTxPacket.GetSeconds() << "\n";
*streamTP->GetStream() << " Throughput: " << i->second.rxBytes * 8.0 / (i->second.timeLastRxPacket.GetSeconds() - i->second.timeFirstTxPacket.GetSeconds())/1024/1024 << " Mbps\n";
if(t.sourceAddress == "10.1.0.1") {
if(mapDrop.find(1)==mapDrop.end())
mapDrop[1] = 0;
*stream1PD->GetStream() << "Tcpledbat Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*stream1PD->GetStream() << "Net Packet Lost: " << i->second.lostPackets << "\n";
*stream1PD->GetStream() << "Packet Lost due to buffer overflow: " << mapDrop[1] << "\n";
*stream1PD->GetStream() << "Packet Lost due to Congestion: " << i->second.lostPackets - mapDrop[1] << "\n";
*stream1PD->GetStream() << "Max throughput: " << mapMaxThroughput["/NodeList/5/$ns3::Ipv4L3Protocol/Rx"] << std::endl;
} else if(t.sourceAddress == "10.1.1.1") {
if(mapDrop.find(2)==mapDrop.end())
mapDrop[2] = 0;
*stream2PD->GetStream() << "TcpWestwood Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*stream2PD->GetStream() << "Net Packet Lost: " << i->second.lostPackets << "\n";
*stream2PD->GetStream() << "Packet Lost due to buffer overflow: " << mapDrop[2] << "\n";
*stream2PD->GetStream() << "Packet Lost due to Congestion: " << i->second.lostPackets - mapDrop[2] << "\n";
*stream2PD->GetStream() << "Max throughput: " << mapMaxThroughput["/NodeList/6/$ns3::Ipv4L3Protocol/Rx"] << std::endl;
}
}
flowmon->SerializeToXmlFile(dir+"tcp_b.flowmon", true, true);
std::cout << "Simulation finished" << std::endl;
Simulator::Destroy();
}