I built the model of packets transmission through two networks in multipath scenario. Each packet is presented as an agent. The Logic is the following: firstly, packets are transmited into the Network1 (if it has enough resources), if resources are not enough in Network1 the packets are transmitted into Network2. If there are not enough resources in both Networks the packets are waiting in the Queue. The packets also have the lifetime. If the lifetime is up the packet leave the Queue.
How to count the average size of the queue? I mean the packets which are waiting in the queue, but don't pass it immediatelly. If there is enough resourses in any Network to send the data we shouldn't count this packet because it will immediately leave the queue. However the Queue count each packet on Enter. From the other side, the packets may wait for resources. How to count the average number of waiting packets in a queue through the simulation?
Also the Queue shows that larger numbers of input data (more packets than were generated).
I will appreciate any help. Thank you.
Create a cyclic event that regularly computes queue.size()
. You decide on the interval.
The event then adds this value to a new Statistics
object and you can retrieve the mean and other stats from that (use myStatisticsObject.add(queue.size())
in the event)