Sinalgo - Simulator for Network Algorithms

Framework and Project Configuration

For each simulation, the framework needs to be set up correctly to implement the desired behavior. This section describes the tools that Sinalgo provides to configure the framework and your projects.

In a nutshell, the entire configuration is done through the config.xml file, that is located in the root folder of each project. This file contains information on how the framework should run, as well as project specific settings. The file has the following structure:

<Document>
<Framework>
......
</Framework>
<Custom>
......
</Custom>
</Document>

The <Framework> tag encloses the framework specific settings, whereas the <Custom> tag contains project specific settings. You may edit the config.xml directly in your favorite text or XML editor. Alternatively, you can start Sinalgo without specifying the project with the -project flag. In the latter case, Sinalgo opens a project selection window, which shows the available projects. After selecting a project from the list, the Configuration tab on the right shows the content of the corresponding configuration file and lets you edit the entries.

Framework Configuration

Through the configuration of the framework you can specify the size of the deployment area, the dimension of the deployment area (2D or 3D), whether the simulation is synchronous or asynchronous, and many other settings. These settings are available through public member variables of the class sinalgo.configuration.Configuration.

When Sinalgo loads a project, it parses the configuration file of the project to determine the settings that should be used. Enclosed in the <Framework> tag, it expects to find entries of the form

<memberName value="....">

where memberName is the name of a member variable of sinalgo.configuration.Configuration, and the attribute value the value (as a string) that should be assigned to the member variable.

Note: When modifying the configuration file through the project selector, you can get a description of the entries by pointing the mouse on the corresponding field.

Tooltip
A sample tooltip help when pointing with the mouse on the entry mobility.

Implementation Note: The member variables of sinalgo.configuration.Configuration are overwritten by the entries contained in the configuration file. Therefore, you may not modify these member variables in the source code to modify the settings of Sinalgo. Instead, change the values in the project specific configuration file.

Project Configuration

In contrast to the predefined framework configuration, the project specific configuration is enclosed in the <Custom> tag and may contain arbitrary (but still valid XML) content. Upon loading the project, Sinalgo also parses the project specific settings and stores the information in a lookup table.

All settings are assumed to be specified through tag attributes in the following way:

<Custom>
<Node size="80" visible="true" speed="0.8" value="1"/>

<Node2 value="0"/>

<MobileNode speed="23.22">
<Name value="speedy"/>
<Type kind="fast" color="red"/>
</MobilityModel>

<A value="aval">
<B value="bval">
<C a="1" b="2" c="3">
<D e="abc"/>
<C/>
<B/>
<A/>
</Custom>

For each attribute, the key for the lookup table is composed by concatenating the names of all parental tag-names and the name of the attribute, separated by slashes. Exception: If the name of the attribute is value, the key only consists of the concatenated parental tag-names. The example above would result in a lookup table with the following content:

Key Value
"Node" "1"
"Node/size" "80"
"Node/visible" "true"
"Node/speed" "0.8"
"Node2" "0"
"MobileNode/speed" "23.22"
"MobileNode/Name" "speedy"
"MobileNode/Type/kind" "fast"
"MobileNode/Type/color" "red"
"A" "aval"
"A/B" "bval"
"A/B/C/a" "1"
"A/B/C/b" "2"
"A/B/C/c" "3"
"A/B/C/D/e" "abc"

Accessing the Project Configuration

The lookup table containing the project specific configuration is stored in sinalgo.configuration.Configuration. This class provides the following set of static methods to retrieve these config entries. Note that all of these methods are case insensitive.

boolean hasStringParameter(String key) Tests whether the table contains the given key.
String getStringParameter(String key) Returns the value associated with the key.
double getDoubleParameter(String key) Transforms the value associated with the key to a double and returns it.
int getIntegerParameter(String key) Transforms the value associated with the key to a integer and returns it.
boolean getBooleanParameter(String key) Transforms the value associated with the key to a boolean and returns it.
Methods to obtain the project configuration. Refer to the source code for a more detailed description.

Required Project Configuration Entries

The following configuration entries are needed in the <Custom> section, unless you completely redefine the behavior of the framework. (Of course, you may change the values assigned to the properties.)

<Node defaultSize="10"/>
<GeometricNodeCollection rMax="150"/>

The Node/defaultSize entry specifies how large network nodes should be painted on the GUI. The GeometricNodeCollection/rMax declares the maximum transmission range of any node in the simulation. Refer to the Sinalgo Architecture section for more details about the geometric node collection.

Depending on the models you use (e.g. from the defaultProject), further entries are needed to configure the models. Refer to the documentation of the models for detailed information; the Model Implementation section of this tutorial also gives some information for most models provided in the defaultProject.

Overwriting or Adding Config Entries on the Command Line

As described in the Execution section of this tutorial, the -overwrite command line argument can be used to overwrite settings from the configuration file. This may be handy to write a script to run several simulations with a set of slightly different settings without chaning the configuration file manually.

The syntax is -overwrite key=value (key=value)*.

The key is either the name of a framework configuration setting (which is case sensitive), or the key of a project setting (which is case insensitive). If the command line parser finds a framework setting associated with the key, it assigns the specified value. Otherwise, the project setting with the corresponding key is updated to have the new value. If the key neither points to a framework setting, nor to a project setting, a new key/value pair is added to the lookup table of the project configuration.

Example: The following command line argument sets several framework settings (mobility, interference, dimX, dimY, and dimZ), as well as two project specific settings (GeometricNodeCollection/rMax, Node/defaultSize).

-overwrite mobility=false interference=true dimX=1000 dimY=250 dimZ=800 GeometricNodeCollection/rMax=80 Node/defaultSize=10


© Distributed Computing Group
GitHub.com Mark GitHub.com Logo SourceForge.net Logo Valid CSS! Valid HTML 4.01 Transitional