Hi there...
I try to write a program to simulate a wireless network WLAN
Let us suppose that the network consists of 5 nodes (A to E) and the simulation time is 300 seconds.
Also, let us assume the algorithm used as follow: when a node intents to send, it checks the receiver status. If it is a free which means it does not receive or send data from another node, the node starts transmission. If not it delay for a while then try a gain.
let's take the simple scenario:
at T=2 (second no. 2) node A starts sending to B.
at T=3, node C want to send to B. It will check the receiver status and then find the node B is busy. So, it will defer the transmission for a period of time then start a gain.
My question is: I want a way to pick up a transmitter and receiver randomly during simulation time.
for example, at t=4 A sends to C
at t=4.5 D sends to B and so on.
Thank you very much in advance.
It sounds like you'll need a random number generator.
Not exact..
I have one... but I don't know how can I use it?!!
Then you need to RTFM.
Are you asking how to use a random number generator, or how to use it to solve your problem?
I am asking how to use it to solve your problem?!!
You will need a list of inactive nodes. Count those nodes and generate a random number between 1 and n (the number of inactive nodes). That node becomes the new transmitter.
Next you will need a list of all the nodes except the transmitter. Generate another random number between 1 and m (the number of other nodes). That node becomes the new desired receiver.
You will need a list of inactive nodes. Count those nodes and generate a random number between 1 and n (the number of inactive nodes). That node becomes the new transmitter.
Next you will need a list of all the nodes except the transmitter. Generate another random number between 1 and m (the number of other nodes). That node becomes the new desired receiver.
Ok ... but that means I simulate one transmission (between one transmitter and one receiver) .
what about the others nodes? Are they still inactive ?!!
I want simulate a number of transmitter and receivers at the same time
How many are going to be starting at any given second? You will need to model which ones are busy, of course.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks