ZALF-Home page samt-Schriftzug Home
NEWS
SAMT
SAMT- download
Developer
Institute of Landscape Systems Analysis

Software, Compilation, Hints and Future Work

  1. Software
  2. Some hints for use
  3. Software structure
  4. Software compilation
  5. The dynamic simulation system DESIRE
  6. Installation
  7. TO DO

Overview of SAMT

picture samt

Software

SAMT is an open source project and stands under the GPL. It uses the following software components:

  1. DESIRE a powerful simulation system developed by G.A.Korn
  2. SAMT as the spatial simulation part is based on a grid library to perform the main grid operations
  3. Fuzzy developing toolbox
  4. Neural network developing toolbox
  5. additional software:
    • MySQl: http://www.mysql.com
    • QT: http://www.trolltech.no
    • QWT: http://qwt.sourceforge.net/
    • VTK: http://public.kitware.com/VTK/
    • HDF: http://hdf.ncsa.uiuc.edu/ (version: hdf5-1.4.5-post2)
    • GSL: http://sources.redhat.com/gsl/
  6. Linux and many components of this system (should be installed if you use Linux)

Software interfaces

SAMT is divided into a core part and an model part for the models. The core part consists of the control center that performs all basic operation over grids, the io-operations, simple analysis functions etc. The model part provides a unified interface to the data and models. SAMT load the grids, point themes and the fuzzy models etc. in the memory. This is a very fast method, but you will need a lot of memory. (Memory can be replaced by nothing than memory ;-) A serious work can be done on a computer with 512 MB.
SAMT contains some models like fuzzy model, cluster and kohon models and neural networks. This models are characterized by a direct access to the grid data. The calculation is very fast, but an error in this model can damage the whole system. This part will be expanded by models like cellular automata, individual based algorithms etc.. To put a new model into this part, you should know the system very well.
For tasks that do not need such a high interaction, it should be used a second interface, the template interface. The template interface organizes the export of grid data (via temporary hdf files), called the model and read the results into SAMT as temporary hdf file. The models run as different process, so that an error in this part have no influence on the whole system.
A third interface is the socket interface. The data transport is organized by Internet sockets. This interface should be used if the model can run on a different computer (computer cluster for example). To avoid bottleneck the data transfer over a network should be restricted. In one application we realized a separate model to solve a differential equation. This model needs only a few data from SAMT and send a few data back to SAMT. That means that the network traffic was high, but the calculation was done on a powerful computer.
Last but not the least there is a connection to the database MySQL. Some programs write data in the database, SAMT can read it and show it. This interface is used by some economic models.

Some hints for use

SAMT was constructed to store all maps in the main memory. That means it is very fast, but it needs a lot of memory. But with 512 MByte it is quite usable.
The HDF-Filesystem is used to store basic maps as a project. This maps are very fast to read from the hard disk. This technique was also used to store temporary information between SAMT and the additional modules like 3D. But it is not possible to change files in an HDF-System. So you must read the files and store it in a new one. In practice this is not a big problem. If you want to exchange data with a GIS, please use the ASCII-File format.
A important feature of SAMT is the project system. A project means a aggregation of grids and models to an unit. The project can be expanded and stored but not shrinked. (to shrink a project the file structure has to be edited by hand). That means that a project should include all basic data and models that are essential for an simulation but not the results. The results should be stored as ASCII grids or hdf files. A project can be loaded very fast and it provides a state of a simulation. Of course the models can be changed (expanded, adapted etc.). If they are stored with the same name as in project the actual changed models are used.
The menu structure of SAMT is flat. (I hate to search in difficult menu structures) To input parameters to a program, please use the three input windows, called P1, P2, P3. All programs can have up to three parameters. But the programs react in a different way depending on the number and type of parameters. It is a bit like the bash (I like it ;-) For example: you can construct a new grid, called xxx, with random values when you input in P1 the number of rows and in P2 the number of columns. Sometimes it is better to overwrite an existing map with random values. For this case only the map must be highlighted.
An other example of the use of different parameters is the histogram. The histogram uses 250 bins as default. If a number between 3 and 250 are in P1, the number of bins will be changed. This behavior seems useful for me.
An other point is that we need sometimes more than three inputs. In this case the operation is splitted into an init phase and an execution phase. If you want to use a kohonen net for example you have to specify the number of input maps, the rows and cols of the semantic map in the init phase and the maps for the execution phase. This sounds a bit confusing, but it is very easy. After specification, the "kohonen" model will be visible as "kohon" in the model folder. In the second step you have to select the maps (by double clicking the map it will be visible in the window P1, P2 P3 ) and highlight the "kohon" to execute the model.
At last, there are commands that destroy the selected maps (overwrite them). You should make a copy before using such a command. Sometimes a command creates a new map (xxx, yyy etc.) Please read the hint in the status line.

Software structure

SAMT is structured in the main gui-based program called "samt" and additional programs for 3D-view and of course the models as user programs. SAMT is based on a grid-library which preforms all the grid operations. This library will be expanded. SAMT itself uses the qt-library for the window system and to draw the maps. The source of SAMT is located in the directory src. The directory 3d contains all routines for the 3d-visualization. The 3d-visualizations routines run as separate programs. So we can change the visualization easily. A new visualization module is under development and will expand the poor 3d-possibilities soon. The fuzzy toolbox "SAMT-Fuzzy" can be used in SAMT and the results are available in SAMT. In addition a fuzzy analysis is include in SAMT. This analysis can be used to get information about the model from the real spatial data. From this analysis it is easy to correct your fuzzy model. In summary this should be a good integration of fuzzy in a spatial modeling system.
The models are located in the directory modell. Every model runs as a separate program. An error in a model can not damage the whole system. In the model "template" two maps are added. (This simple model are used as a template for much more complicated models) the models can use the grid library so it is easy to read grids, write grids and do some calculations on grids (norm, cut, copy,...). The input of maps in a model uses the hdf-files xxx.h5 the output the yyy.h5. This exchange is not very elegant but fast enough and very secure. Please look at the samples to see how it works. The models are included into samt by writing the information into two files. The information about the inputs has to be written into a file called .name.scr (name stands for the program name of the model) This file has a defined structure:

inputs number_of_inputs // up to three inputs are possible
name_of_input1 type // type 0 indicates a number type 1 a map
name_of_input2 type // type 0 indicates a number type 1 a map
name_of_input3 type // type 0 indicates a number type 1 a map

This file will be read by the samt and it will be included in the model-part of samt. This technique allows the inclusion of different models depending on different tasks for the users.
In the directory model are also located the fuzzy-models. These type of models is interpreted directly by samt. The models are included by the menu Model_Open. The parameters of the inputs of the models are listed in the status line if the model is highlighted.
In addition to the models there are directories for the data. The test directory contains all ASCII-grids, the hdf directory all HDF files. The tables directory the tables (for joining like the database) and the tmp directory contains all temporarily used data.

Software compilation

Before you can start you should install the basic software components like:

  • MySQl: http://www.mysql.com version better than MySQL 4.0
  • QT: http://www.trolltech.no
  • QWT: http://qwt.sourceforge.net/
  • VTK: http://public.kitware.com/VTK/
  • HDF: http://hdf.ncsa.uiuc.edu/ (version: hdf5-1.4.5-post2)
  • GSL: http://sources.redhat.com/gsl/

This software to compile and install should be easy. Please read the INSTALL documents from the web locations. For the hdf you can download it from my web-page because the newer versions are a bit different from the hdf5-1.4.5-post2 that I used.

The compilation of SAMT needs the following steps:

  • unpack the software
  • add some lines in your .bashrc
  • compile the software step by step
  • install the example data and models and test samt

Unpack the software

unpack the software with: tar -zxvf samt.tgz. A new directory samt will be created. In this directory has the following structure:

new_samt // main directory of SAMT

  • src // contains the source code for qt
    • grid // grid library
    • gui // gui design for qt4.1 designer
  • qt4samtdesire // SAMTDESIRE
    • bin
    • doc
    • src
    • scripts // a lot of samples for DESIRE
  • SAMT_FUZZY // the fuzzy developing toolbox
  • NNQT // the neural newtork toolbox
    • data // location for data input for nn
    • models // location for models produced by nnqt
    • doc
    • icons
  • point // location for point theme
  • test // location for ASCII grids
  • hdf // hdf files
  • tmp // directory for temporary results (kohonen, rbf etc.)
  • tables // location for tables in csv format
  • texture // produced texture as png files
  • project // project file structure
  • scripts // descript of models
  • modell // directory for the models
    • fuzzy // localtion for all fuzzy models
    • different models
    • R // export directory for the statistic package R
  • tools // additonal software for SAMT
  • dynamic // directory for export from SAMTDESIRE to SAMT
  • doc
  • pixmaps

Compilation

Please start the compilation with the the libraries and software from the network. This libraries are needed for the compilation of SAMT. A good way to start is:

  • compile or install MySQL
  • compile the gsl
  • compile the vtk
  • compile or install qt4.1 or better
  • compile the qwt library

Please read carefully the install hints of the software. The compilation and installation is easy but read the hints! If this work is done (on my old 750 MHz AMD with 384 MB it needs about 8 hours) the installation of SAMT can be done. All software based on the grid library. Please compile this library first. The compilation is easy. Go to the samt/src/grid and type make. After a few minutes all should be fine. Please ignore some warnings.

Compilation step by step

To compile the qt based software (SAMT, SAMTDESIRE, NNQT, FUZZY-SAMT) qt4.x must be installed properly. Please insert into your .bashrc lines like the following:

export QTDIR=/usr/local/Trolltech/Qt-4.1.0
export PATH=$QTDIR/bin:$PATH:/./
export QMAKESPEC=/usr/local/Trolltech/Qt-4.1.0/mkspecs/linux-g++

If qt4.1 and qwt works the next steps are simple. Please go into samt/src and type qmake. After that type make. The compilation of SAMT needs about 10 minutes on my computer. If this worked please got to NNQT and do the same steps (qmake, make). The samt thinks must be done with SAMT_FUZZY and qt4desire.

Sometimes errors appear. This can be because of some files are not found. Please look to the installation directory of the components (hdf, gsl, vtk, mysql) and change the locations in the files with the extension pro (for example the new_samt.pro). Please be careful with it.
If all was fine the personal installation is ready. The only task to do is the adaption of the .bashrc in your home directory.

export SAMTHOME=/home/ralf/samt
export DESIREHOME=/home/ralf/samt/qt4samtdesire
export DESIRESCRIPTS=/home/ralf/samt/qt4desire/desire_examples
export DESIRE_SRC=/home/ralf/samt/qt4samtdesire
export SAMTINSTALL=/home/ralf/samt
export SAMTSRC=/home/ralf/samt
export GRIDDIR=/home/ralf/samt/src/grid
export FUZZYHOME=/home/ralf/samt/SAMT_FUZZY
export NN_HOME=/home/ralf/samt/NNQT
export NN_SRC=/home/ralf/samt/NNQT

To compile the 3d library please go to 3d/src.org and type make and make install. If the vtk software was properly installed the compilation should be smooth. If not please look in the Makefile and adapt it accordingly your file structure.
The directories like "splatter.src", "elevation.src" etc. came from the vrs version of 3d modeling and are obsolete.

Installation

The SAMT installation directories have changed a bit due to more server application in a network. SAMT is used from many users of a central computer via remote login. This is leading to a spitted directory structure. One part of SAMT in installed in /usr/local and the part with maps and application is installed in the home directory. To install SAMT on your computer the following structure should be a good starting point:

/usr/local/bin: samt nnqt fuzzy
/usr/local/bin/3d: elevation splatte/r /usr/local/samt_src/doc
/usr/local/samt_src/src
/usr/local/samt_src/src/grid
/usr/local/samt_src/tools
/usr/local/samt_src/SAMT-Fuzzy
/usr/local/samt_src/NNQT

in your home directory put:

~/new_samt/test
~/new_samt/hdf
~/new_samt/project
~/new_samt/tmp
~/new_samt/scripts
~/new_samt/texture
~/new_samt/modell
~/new_samt/NNQT
~/new_samt/tables
~/new_samt/dynamic/data
~/new_samt/NNQT/data
~/new_samt/NNQT/models

In the samt_src are located all sources and docs. All directories in the home directory must be writable for the owner. This spitted structure must be usable with a set of shell variables. Assuming you are using the bash please put in your .bashrc:

export SAMTHOME=/home/ralf/new_samt
export SAMTINSTALL=/usr/local/bin
export SAMTSRC=/usr/local/samt_src
export FUZZYHOME=/home/ralf/new_samt/SAMT-Fuzzy
export NN_HOME=/home/ralf/new_samt/NNQT
export NN_SRC=/usr/local/samt_src/NNQT
export DESIREHOME=/home/ralf/new_samt/samtdesire
export DESIRESCRIPTS=/home/ralf/new_samt/desire_examples
export DESIRE_SRC=/usr/local/samt_src/samtdesire

TODO

There are lot of bugs in the source ;-). I have put into SAMT a sample of functions that seems to be useful for me. I want to use SAMT to create dynamic simulations like cellular automata or individual based algorithms. The next steps for SAMT are:

  • individual based algorithms
  • faster an better quality of 3D-visualization using qt4.x
  • more sophisticated interface between SAMT and DESIRE
  • interface between SAMT and the statistic package R
  • reading of shape files and transform into grids (?)