Answer to Question #271126 in C++ for ruhi

Question #271126

Write run a program in C/C++ to simulate the behavior of Aloha random access protocol and

show the output.

You are required to the following tasks:

• Generate packets randomly

• Simulate transfer of packets at a random time

• Simulate the occurrence of collision of packets

• Calculate throughput of Aloha

• Plot throughput Vs Load graph 


1
Expert's answer
2021-11-25T00:53:05-0500


SOLUTION




#include <iostream>
#include <string>
using namespace std;


int main()
{
  cout<<"Enter the system bps: ";
  double bps;
  cin>>bps;
  cout<<"Enter the system packet length in bits: ";
  double packet_length;
  cin>>packet_length;
  
  //Now lets calculate the packet rate
  
  double packet_rate = bps/packet_length;
  
  //Now lets calculate the maximum throughput for the ALOHA
  
  double max_ALOHA_throughput = packet_rate * 0.184;
  
  //Now lets calculate the maximum throughput for the slotted ALOHA
  
  double max_slotted_ALOHA_throughput = packet_rate * 0.368;
   
   cout<<"The system is operating at "<<bps<<"bps"<<endl;
   cout<<"The packets are "<<packet_length<<" bits long"<<endl;
   cout<<"The packet rate is : "<<packet_rate<<endl;
   cout<<"The  maximum throughput for the ALOHA is : "<<max_ALOHA_throughput<<" packets/second"<<endl;
   cout<<"The maximum throughput for the slotted  ALOHA is : "<<max_slotted_ALOHA_throughput<<" packets/second"<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS