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.
help for simulation code
Started by DeSiGneR, Oct 25 2008 06:37 AM
11 replies to this topic
#1
Posted 25 October 2008 - 06:37 AM
|
|
|
#2
Posted 25 October 2008 - 01:48 PM
It sounds like you'll need a random number generator.
#3
Posted 25 October 2008 - 06:46 PM
Not exact..
I have one... but I don't know how can I use it?!!
I have one... but I don't know how can I use it?!!
#4
Posted 25 October 2008 - 07:40 PM
Then you need to RTFM.
#5
Posted 25 October 2008 - 08:38 PM
Are you asking how to use a random number generator, or how to use it to solve your problem?
#6
Posted 25 October 2008 - 08:44 PM
I am asking how to use it to solve your problem?!!
#7
Posted 25 October 2008 - 09:10 PM
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.
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.
#8
Posted 25 October 2008 - 09:10 PM
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.
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.
#9
Posted 25 October 2008 - 09:21 PM
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
what about the others nodes? Are they still inactive ?!!
I want simulate a number of transmitter and receivers at the same time
#10
Posted 26 October 2008 - 02:23 PM
How many are going to be starting at any given second? You will need to model which ones are busy, of course.
#11
Posted 27 October 2008 - 05:38 AM
at any given second, there is a random number of nodes will transmit or receive. maybe there are 3, 4 or maybe just 1
this is my problem, how can i do this?
think for your helping
this is my problem, how can i do this?
think for your helping
#12
Posted 27 October 2008 - 07:50 AM
I think you need a clearer specification of the desired behavior then. It was not clear to me that multiple nodes could start sending at the same time.
For any second, there are several possibilities that I can imagine:
1) a node is busy (sending or receiving data)
2) a node is doing nothing
3) a node wants to initiate a new send activity
4) a node wants to send but is waiting for the desired recipient to be free
In case 2, we can simply have each node randomly switch state to 3.
After processing those that switched to state 3, for each node we can randomly select a desired target node and set remaining wait time to 0
After processing those in state 3, we can look at all those waiting with wait time 0 and attempt to initiate a send. On failure, set the wait time to some positive value.
The key to getting ANY program to work is moving from a general description of behavior, "I want a simulator where nodes can try to contact other nodes to send data," to more precise descriptions of behavior, "I want a simulator with n nodes, where each non-busy node has an n% chance if initiating a transmission and will wait a-b seconds if the initiationg fails before re-initiating the transmission".
Usually, a precise description will resolve many of your questions about how to implement the program, because the description reduces the number of options down to something very simple.
For any second, there are several possibilities that I can imagine:
1) a node is busy (sending or receiving data)
2) a node is doing nothing
3) a node wants to initiate a new send activity
4) a node wants to send but is waiting for the desired recipient to be free
In case 2, we can simply have each node randomly switch state to 3.
After processing those that switched to state 3, for each node we can randomly select a desired target node and set remaining wait time to 0
After processing those in state 3, we can look at all those waiting with wait time 0 and attempt to initiate a send. On failure, set the wait time to some positive value.
The key to getting ANY program to work is moving from a general description of behavior, "I want a simulator where nodes can try to contact other nodes to send data," to more precise descriptions of behavior, "I want a simulator with n nodes, where each non-busy node has an n% chance if initiating a transmission and will wait a-b seconds if the initiationg fails before re-initiating the transmission".
Usually, a precise description will resolve many of your questions about how to implement the program, because the description reduces the number of options down to something very simple.


Sign In
Create Account

Back to top









