CS 351 Network Simulation

Barney Maccabe Last modified: Wed Dec 8 15:39:02 MST 1999


In this exercise, you will write an event-driven simulation to explore issues related to congestion control in communication networks. In addition to writing a program that implements the event driven simulation, you are to write a ten to fifteen page (double spaced with 1'' margins, including illustrations) report that summarizes your experiments using the simulator. Your program documentation should include a class diagram for the classes used in your program. The program and report will be graded separately.

This exercise is intended to provide a platform for exploring several topics, including:

Due Date: Thursday December 9, 1999 at the start of class

In addition to submitting your program to the TAs, you should turn in a class diagram and your written report.


A communication network consists of three types of objects: nodes, switches, and links. Nodes generate and consume messages; switches route messages in the network; and links transmit messages between nodes and switches.

Data transmission in communication networks is difficult for a number of reasons, including: transmission errors, flow control, and network congestion. In this exercise, you are to build an event-driven simulation to explore congestion and congestion control in a communication network. We will ignore issues related to flow control and transmission errors. Congestion in a communication network becomes a problem when the combined rates of the nodes transmitting data exceed the capacity of switches in the network. Because switches have a limited capacity to buffer messages for outgoing links, they must discard messages when their storage capacity is exceeded.

Because messages can be discarded by intermediate switches, nodes must implement "end-to-end" protocols to ensure reliable delivery their messages. In this simulation, we will use a simple acknowledge/retransmit protocol. In this protocol, whenever a node initiates the transmission of a message, it starts a "watchdog" timer. When message arrives at a destination node, the destination sends a special "acknowledge" message back to the sender. If the acknowledgement does not arrives before timer expires, the original node presumes that the message (or the acknowledgement) must have been dropped, and retransmits the message.

Basic Objects

As a minimum, your simulation must include three types of nodes, two types of switches, and links that transmit message packets between nodes and switches.

Nodes can be sinks or sources. Sinks consume messages (and generate acknowledgements). Sources produce messages. Source nodes can be further categorized based on the way in which they respond to dropped messages. A "greedy" source will simply transmit messages as fast as it can. Other types of sources will reduce their transmission rates when they detect dropped messages and increase their transmission rates when no messages are dropped.

Switches can be distinguished by the procedure they use to determine which message(s) should be dropped when they reach their storage capacity. A "simple" switch discards the incoming message, independent of the source. A "fair" switch selects messages from the source node that is consuming the highest percentage of its memory.


The input to your simulation is divided in five parts. The first part describes the nodes used in the simulation. The second part describes the switches. The third describes the connections between the nodes and switches. The fourth part will describe the routes between nodes. Finally, the fifth part will describe the collection of statistics.

Each section starts with a negative number. Other than indicating the start of a section, the negative number and any other characters on the line should be ignored.


As a minimum, the description of a node includes the type of node. For sink nodes, this is sufficient to fully describe the node. Source nodes require additional information. Sources require the destination node for their messages, the length of each message, and the timeout interval for their "watchdog" timers. Nodes that vary their transmission rates will also need parameters to control the reduction and increase in transmission rate.

Each node will be specified by a single line of input. Using square brackets to indicate optional items, a node specification has the following form:

node_type [ destination length timeout [ reduction increase ] ]

As an example, the input line

2 23 15000 1200000 .75 .005
Specifies a variable rate source node that sends messages consisting of 15,000 bits to node 23. The timeout interval for each message is 1,200,000 microseconds. Whenever a message is dropped, the transmission rate for the node is decreased to 75% of it's current value. Whenever a message is successfully acknowledged, the transmission rate will be increased by 0.005 bits/microsecond. (The initial rate should be set to the rate for the outgoing link.)


Switch specifications include a type and the amount of memory available for storing messages. The type is an integer value. The value 0 is used to indicate a "simple" switch. The value 1 indicates a "fair" switch. The available memory is specified using an integer value which indicates the size of the memory (in bits).


Each link is specified by a source, a destination, and a bit rate. The source and destination are specified using integer values. If n is the number of nodes and m is the number of switches in the simulation, the source and destination will be a number in the range 0 to n+m-1. A value between 0 and n-1 indicates a node (recall, node identifiers are assigned in the order they are defined). A value between n and n+m-1 indicates a switch. Like nodes, switch identifiers are assigned based on the order in which the switches are defined (switch identifiers start with the value n).

The bit rate for a link is a double precision value that specifies the capacity on the link (in bits per microsecond). Typical link speeds are 56Kb/s (.056 b/usec), 10 Mb/s (10 b/usec), and 100Mb/s (100 b/usec).


Each line in the routes section consists of three integer values. The first integer identifies the switch (a value between n and n+m-1), the second identifies the destination node (a value between 0 and n-1), the third identifies the port within the switch to use. Port identifiers are local to each switch and are in the range 0 to p-1, where p is the number of output links for the switch. That is, each link that specifies a switch as its source, creates a new (output) port in the switch. Port identifiers are assigned in the order that the links are defined.


The last section consists of two integer values. The first indicates the interval (measured in microseconds) between collection of statistics. The second indicates the number of times the statistics should be printed before the simulation terminates. As a minimum, each source node should print out the bandwidth that it has attained.

Sample Input File

The following input file corresponds to a network with three nodes and one switch. Two of the nodes are sources (one is a greedy source, the other is a variable rate source), the other is a sink. Both sources send their messages to the sink. The switch is a simple switch and can buffer up to 20,000,000 bits of messages. There are six links (each node has two links -- one leading to the switch and another coming from the switch) and each link has a capacity of 56Kb/s.

    -1 The node section -- two sources and one sink
    1 2 15000 1200000
    2 2 15000 1200000 .75 .005

    -1 The switch section -- only one (simple) switch
    0 20000000

    -1 The link section -- three links
    0 3 .056
    3 0 .056
    1 3 .056
    3 1 .056
    2 3 .056
    3 2 .056

    -1 The routing section -- only one switch, so this is pretty easy
    3 0 0
    3 1 1
    3 2 2

    -1 200 Statistics should be collected every 10000 microseconds

Additional Information

Things that didn't fit neatly in the other sections.