To allow for an efficient viewing, analyzing and management of large amounts of simulation output, the openWNS supports a database frontend based on the open-source PostgreSQL database. In the following, this database will be configured to work together with the openWNS.
Important
The following steps are only required if you want to store simulation results into a PostgreSQL database. To run a single simulation this is not required.
- PostgreSQL A powerful, open source object-relational database system.
- python-psycopg2 (>= 2.0) A PostgreSQL database adapter for the Python programming language.
The following section is only valid for a virgin installation of the PostgreSQL without any existing users. If you would like to use an already existing PostgreSQL, some of the following steps are not neccessary. Please contact your database administrator and the PostgreSQL manual for further information.
After a virgin installation, the database-admin user postgres does not have any password. To change it to foobar, type
$ su postgres
$ psql
Welcome to psql 8.3.6, the PostgreSQL interactive terminal.
postgres=# ALTER ROLE postgres PASSWORD 'foobar';
ALTER ROLE
postgres=# \q
$ exit
Furthermore, the database can be accessed from everywhere, not only locally. To change this, edit the file /etc/postgresql/8.3/main/pg_hba.conf:
Then, restart PostgreSQL with
$ /etc/init.d/postgresql-8.3 restart
Now, you can create the database required for the simulation. The default name in all scripts is simdb, so it is recommended to use this name:
$ su postgres
$ psql
Password: foobar
Welcome to psql 8.3.6, the PostgreSQL interactive terminal.
postgres=# CREATE DATABASE simdb;
postgres=# \q
$ exit
Then, the neccessary tables to store simulation campaign parameters and results have to be created. For this purpose, a script can be used which is part of the wrowser. It can be found in the directory wrowser/simdb/sql:
$ cd wrowser/simdb/sql
$ psql -U postgres -d simdb -f setupSimDB.sql
Finally, a database user account for your user account must be created. Again, a script is prepared for this, now in the directory wrowser/simdb/scripts:
$ cd wrowser/simdb/scripts
$ ./createUser.py
Note
Before running the ./createUser, check that in this script the two variables hostname and dbName are set to the correct values, i.e., localhost and simdb if this installation guide is followed.
Important
The script assigns a default password to the created user account, which is foobar. You can change this password by editing the variable password in the script before running. Do not use your default user password - the database user account password is not stored secure!
Now, a account is created on the database which can be used to store the simulation results.
The Wrowser needs to know where to find the campaign database. This can be configured by starting the Wrowser and then selecting Extra, Preferences in the menu. In the following dialog, see Setting the database., please fill in the following values:
- Hostname: localhost
- Databasename: simdb
- Username: Your user account name
- Password: foobar if not changed in the createUser.py script.
Setting the database.
Then, select the tab Sandbox and fill in the complete path to the sandbox of your openWNS installation, e.g., /home/userName/myOpenWNS/sandbox.