Difference between revisions of "Adding an example"

From SUMOwiki
Jump to navigationJump to search
 
Line 1: Line 1:
This page explains how to add your own data/simulation code/... to the toolbox to model it.
+
This page explains how to add your own data/simulation code/... to the toolbox in order to model it.
  
 
== Project directories ==
 
== Project directories ==
  
The SUMO Toolbox comes with a large number of example problems and datasets which you can use for testing, benchmarking, or simply to get a feel of what is possible.  These problems cover a very large range of domains, from Biology to Geography and Electronics.
+
The SUMO Toolbox comes with a large number of example problems and datasets which you can use for testing, benchmarking, or simply to get a feel of what is possible.  These problems cover a very large range of domains, from Biology to Geography and Electronics. If you simply want to play around and try different examples please refer to [[Running#Running_different_examples]].
  
Since version 6.0 every example (and all related files) is self contained in a project directory.  See <code>examples/</code> for a list of examples and associated project directories.
+
All the files related to one problem are placed together in a directory.  We call this the project directory for that problemMany examples of project directories can be found in the <code>examples/</code> subdirectory of your SUMO-Toolbox installation. If you open one of those directories you will see they contain the following things:
If you open one of those directories you will see they contain the following things:
 
  
# A simulator xml file with the same name as the project directory (mandatory)
+
# A simulator xml file with the same name as the project directory.  This file is mandatory (though there are some small exceptions)
 
# One or more executables: matlab script, C++ file, binary, ... (optional)
 
# One or more executables: matlab script, C++ file, binary, ... (optional)
 
# One or more data files (optional)
 
# One or more data files (optional)
Line 14: Line 13:
 
# Other files, e.g., a documenting pdf (optional)  
 
# Other files, e.g., a documenting pdf (optional)  
  
You can structure the directory as you please but make sure it contains at least the simulator xml and a dataset or executable.
+
Open up a couple of the example project directories and have a look inside so you are sure whats going on.
  
== Simulator file ==
+
== Modeling your own problem ==
  
If you want to create a surrogate model (metamodel) for your own problem you will first have to write a simple [[simulator]] [[FAQ#What is XML|XML]] file. You can use one of the existing simulator XML files (from one of the examples) as a guideThe simulator xml file should have the same name and capitalization as the project directory (except for the .xml extension).
+
If you want to model your own problem, this means you have to create a new project directory and give it a name. For ease of use we suggest to create it in the examples/ subdirectory.  For example, if your problem is called ''Foobar'' create the directory ''examples/Foobar''Inside this directory you must place: a file called ''Foobar.xml'', this is the [[simulator configuration]] file.  See the [[simulator configuration]] page for information how to write such a file.
You can then edit this file to suit your particular problem (see also [[Simulator configuration]]).
 
  
Then just place any datasets, Matlab scripts, ... into that directory.  For requirements on the structure of the dataset or signature of the executable/script please see [[Interfacing with the toolbox]].
+
Once you have this file you simply place place any datasets, Matlab scripts, ... into your project directory.  If you specified the correct path in your simulator configuration file then SUMO will find them.  Paths can be absolute or relative to the project directory.  If no file extension is present, '.txt' is assumed.
  
 
Having written your simulator XML file and provided the datasets/executables you now just need to change <code>default.xml</code> so it uses your problem (<Simulator> tag).  For information on this see [[Running#Running different examples]].
 
Having written your simulator XML file and provided the datasets/executables you now just need to change <code>default.xml</code> so it uses your problem (<Simulator> tag).  For information on this see [[Running#Running different examples]].

Latest revision as of 23:04, 2 September 2009

This page explains how to add your own data/simulation code/... to the toolbox in order to model it.

Project directories

The SUMO Toolbox comes with a large number of example problems and datasets which you can use for testing, benchmarking, or simply to get a feel of what is possible. These problems cover a very large range of domains, from Biology to Geography and Electronics. If you simply want to play around and try different examples please refer to Running#Running_different_examples.

All the files related to one problem are placed together in a directory. We call this the project directory for that problem. Many examples of project directories can be found in the examples/ subdirectory of your SUMO-Toolbox installation. If you open one of those directories you will see they contain the following things:

  1. A simulator xml file with the same name as the project directory. This file is mandatory (though there are some small exceptions)
  2. One or more executables: matlab script, C++ file, binary, ... (optional)
  3. One or more data files (optional)
  4. Alternative simulator xml files (optional)
  5. Other files, e.g., a documenting pdf (optional)

Open up a couple of the example project directories and have a look inside so you are sure whats going on.

Modeling your own problem

If you want to model your own problem, this means you have to create a new project directory and give it a name. For ease of use we suggest to create it in the examples/ subdirectory. For example, if your problem is called Foobar create the directory examples/Foobar. Inside this directory you must place: a file called Foobar.xml, this is the simulator configuration file. See the simulator configuration page for information how to write such a file.

Once you have this file you simply place place any datasets, Matlab scripts, ... into your project directory. If you specified the correct path in your simulator configuration file then SUMO will find them. Paths can be absolute or relative to the project directory. If no file extension is present, '.txt' is assumed.

Having written your simulator XML file and provided the datasets/executables you now just need to change default.xml so it uses your problem (<Simulator> tag). For information on this see Running#Running different examples.