
Purpose:
	
	Study the optimal amount of connections, ttl for a target network size.  
	Study the frequency of traffic and collisions versus different node settings.
	Study ultrapeer behavior, upgrade/downgrade algorithms for optimal network density and efficiency.

_______________________________________________
Network Simulation:

	The simulation is hooked into the idle event of the application.  Each event fires another step (or second) of the simulation.  During this time the node table is looped through and nodes are given the chance to try a connection and generate some traffic.  Different settings determine what else happens, if a node flux is set there is a chance for nodes to leave or join the network.  If avoid triangles is set, nodes will actively try to avoid collisions within two hops.
	
	The simulation runs faster with avoid triagles off.  You may see a decrease in network reach though.
	
_______________________________________________	
WebCache Simulation:

	If a node has no nodes in its cache it does a web cache request.  Each hour if a node is in ultrapeer mode and not firewalled it does a web cache update.  Starting a simulation with multiple web caches and a lot of nodes all at once can cause network fragmentation, but usually goes away after an hour as nodes start updating with web caches.
	
_______________________________________________
Traffic Simulation:

	Currently only broadcast traffic is created, it is anticipated routed traffic will soon be taken off the network and sent directly to the requester.  Only ultrapeers generate traffic, ultrapeer <-> child traffic is not taken into account.  The simulation runs faster with the Traffic Sim off, only turn it on if you need it.
	
	Each second the NetSim runs allocating a set amount of bandwidth to each node. Also each node has a chance to generate a query. The packet is added to the packet queue. Any node that has traffic pending is added to a packet pending list.  After the NetSim is finished the TrafficSim loops until the traffic pending list is empty, meaning either all the packets are sent, or no node has enough bandwidth left to send another packet.  Each node also keeps a Guid table for packets its seen, if a packet is received with the same Guid it is counted as a collision, if a packet cannot be sent because of bandwidth it is dropped.  It is important to note the traffic sim does not work by following packets around the network, but by looping through the pending list over and over again, giving each node in it a 'pump'.  Eventually nodes either send all their packets or have no bandwidth left and the traffic pending list size drops to zero.
	
_______________________________________________
Ultrapeer Simulation:

	Each node starts off in ultrapeer mode, as nodes connect together they evaluate their settings and capacities and decide to connect, downgrade or upgrade.  It is modeled currently off GnucDNAs upgrade/downgrade algortihms and part of this project is to evaluate those algorithms and improve them.
	
	Since leaves are very simple the simulator runs faster when more nodes are in leaf mode.