Java based RPR simulator
This page presents a Java based RPR simulator developed at Simula Research Laboratory.
The simulator kernel was originally written by Olav Lysne. Stein Gjessing has used this kernel to develop his simulation model of the RPR ring. The current version is based on version 2.3 of the P802.17 draft.
The simulator model is focused on the fairness mechanism operating on the ring. Other parts, like topology discovery, is only partially implemented because protection events are not tested on this simulator.
The simulator is available at the download page. When downloaded, the simulator comes with 7 different scenarios. There should be quite simple to make your own scenarios after some familiarization with the model and its different classes.
The given scenarios are all a form of "the parkinglot scenario". An example of "the parkinglot scenario" is presented in the figure below where station 0 through six send to station 7.

The simulator is a collection of different classes. Some of the classes represent a logical part of the RPR standard (fairness/macclient/frame etc.). Some other classes is used by the simulator itself to run the simulations. The Start class is responsible for starting the simulation. This class makes all the stations with the different layers, connects the stations with links and starts the simulation.
Depending on what kind of scenario you want to run with the simulator, you will have to change some of the classes. Many start-parameters are set in Datapath, Fairness, Const, the Applications and some of the other classes. Depending on what kind of output you want the simulator to produce the Reporter class and when this is called will have to be changed.
To run a simulation, the following must be done:
- Configure all classes with the wanted parameters by editing the Java files. See the Examples section for further explanation.
- Set up the Reporter to produce the wanted statistics from the simulation. See the Examples section for further explanation.
- Compile the Java files.
- Run simulation by executing Start.
- See the Scenario section for information about compiling and running the different scenarios.
The figure below sketches an RPR station. Some of the classes in the simulator is written in parenthesis to indicate what they are used to and how they interconnect with the other classes.

Brief explanation of the classes where most configuring is
done:
- Start: The linklength and Kernel parameters.
- Datapath: Shaper and buffer sizes.
- Fairness: Fairness thresholds, aggressive/conservative and coefficients.
- Const: Alot of constants to the simulation and the simulationmodel. It also contains the maxId variable which sets the number of stations on the ring (if this is 15 there are 16 stations).
- ApplicationXXX: They define three different packet generators, one for each traffic class. Packet size and rate for each stations is set here.
The scenario
organization:
To avoid having a copy of each of the java files for each scenario, the
files that differ from the original version is located in a
subdirectory of the main directory (The "orignal version" refers to the
files in the main directory).
maindir | |--scenarioSubdir | | | |--Const.java | |--Start.java | |--Fairness.java | |--Reporter.java | |--Const.java |--Start.java |--Fairness.java |--Datapath.java |--Kernel.java |--MacClient.java |-- . |-- . |-- .
In this example, the four classes Const, Start, Fairness and Reporter is edited to create a new scenario differing from the original version reciding in maindir.
To compile and run the simulator with respect to a specific scenario, a "hack" has to be done to your CLASSPATH environment variable. This implies prepending "./:../:" to the existing classpath. The effect of this is that both the Java compiler and the Java runtime system will initially search for classes in the current directory, then in the parent directory, and then in whatever directories the CLASSPATH contains. Thus, when giving the following commands, the files in the scenarioSubdir will override the files in maindir:
cd scenarioSubdir
javac Start.java
java Start
If a file (.class or .java) is not found in current directory, the parent directory is searched. On Unix/Linux, the CLASSPATH variable can be set like this:
setenv CLASSPATH ./:../:$CLASSPATH
export CLASSPATH
On windows, if running Java from a command line, the CLASSPATH can be set like this:
set CLASSPATH=./:../:%CLASSPATH%
It is also possible to set environment variables permanently through
the control panel:
Control panel -> System -> Advanced -> Environment variables.
(might require a reboot)
Memory Usage
The memory usage of the simulations depends strongly on the number of
stations and the amount of packets traveling on the ring. For instance,
in scenario 1-3 the simulations uses approximately 70 Mbytes. These
scenarios consist of a 16-stations-ring, with senders sending from 1-6
to station 7. Scenario 4 concists of a 40-stations-ring, with 20
senders, and uses approximately 130 Mbytes. If memory limitations
become a problem, one solution is telling the Java runtime system to
set a higher maximum memory allocation limit. The default value is
64Mbytes. To do this, start the simulation like this: (jre1.3 and
jre1.4)
java -Xms128m -Xmx256m Start
This makes the Java runtime system allocate 128 Mbytes initially,
and sets the maximum memory allocation limit to 256Mbytes. The numbers
can be changed to fit your needs.
We have experienced memory problems when running simulations with
earlier versions (jre1.1.8), so it's recommended to do an upgrade.

