Index: src/python/bin/gnuboat
===================================================================
--- src/python/bin/gnuboat	(revision 4eee08036d5ed78ea2214ab7e5bd1e5fe803778c)
+++ src/python/bin/gnuboat	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -48,44 +48,4 @@
 nmeafile = None
 nmeaFileDate = None
-
-
-def rraRows(duration, resolution, step):
-    return int(round(float(duration) / rraSteps(resolution, float(step)) / float(step)))
-
-
-def rraSteps(resolution, step):
-    return int(round(float(resolution) / float(step)))
-
-
-def createDatabase(databaseFile):
-    rrdDataSources = ['DS:latitude:GAUGE:15:-90:90',
-                      'DS:longitude:GAUGE:15:-180:180',
-                      'DS:speedthroughwater:GAUGE:15:U:U',
-                      'DS:speedoverground:GAUGE:15:U:U',
-                      'DS:courseoverground:GAUGE:15:U:U',
-                      'DS:waterdepth:GAUGE:15:0:10000',
-                      'DS:watertemperature:GAUGE:15:-10:50',
-                      'DS:gpsfix:GAUGE:15:-999:3']
-
-    step = logperiod
-    # durations: each archive should contain values for in seconds
-    archives = [
-        {"duration": 240, "resolution": 2},
-        {"duration": 3600, "resolution": 10},
-        {"duration": 86400, "resolution": 60},
-    ]
-    rrdArchives = []
-    for i in range(0, len(archives)):
-        rrdArchives += ['RRA:AVERAGE:0.5:%d:%d' % (rraSteps(archives[i]["resolution"], step), rraRows(
-            archives[i]["duration"], archives[i]["resolution"], step))]
-
-    if not os.path.isfile(databaseFile):
-        rrdtool.create(databaseFile,
-                       "--start",
-                       "N",
-                       "--step",
-                       str(step),
-                       rrdDataSources,
-                       rrdArchives)
 
 
@@ -205,5 +165,5 @@
         sys.exit(2)
 
-    createDatabase(rrdfile)
+    daemon.rrd_create_database(rrdfile, logperiod)
 
     if os.path.isfile(shutdownfile):
@@ -231,5 +191,5 @@
 
             # update rrd database for the webservice
-            rrdtool.update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s:%s" % (
+            daemon.rrd_update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s:%s" % (
                 latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
 
Index: src/python/bin/gnuboat-data-generator
===================================================================
--- src/python/bin/gnuboat-data-generator	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
+++ src/python/bin/gnuboat-data-generator	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -0,0 +1,110 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+'''
+    Copyright (C) 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import rrdtool
+import argparse
+import random
+import time
+import sys
+import os
+
+from gnuboat import daemon
+
+# default values for command line arguments
+rrdfile = "/var/lib/gnuboat/gnuboat.rrd"
+# in seconds
+logperiod = 2
+duration = 24 * 60 * 60
+latitude_min = -90
+latitude_max = 90
+longitude_min = -180
+longitude_max = 180
+
+def main(argv):
+    global rrdfile
+    global duration
+    global latitude_min
+    global latitude_max
+    global longitude_min
+    global longitude_max
+    global logperiod
+
+    parser = argparse.ArgumentParser(description="Generates test data for gnuboat webservice and fills the rrd database")
+    parser.add_argument('-f', '--file', dest='rrd_database', metavar='rrd_database', type=str,
+                        help='File path of the rrd database to fill', default="/var/lib/gnuboat/gnuboat.rrd")
+    parser.add_argument('-lat-min', '--latitude-min', dest='lat_min', metavar='lat_min', type=float,
+                        help='Minimum latitude generated', default=latitude_min)
+    parser.add_argument('-lat-max', '--latitude-max', dest='lat_max', metavar='lat_max', type=float,
+                        help='Maximum latitude generated', default=latitude_max)
+    parser.add_argument('-lon-min', '--longitude-min', dest='lon_min', metavar='lon_min', type=float,
+                        help='Minimum longitude generated', default=longitude_min)
+    parser.add_argument('-lon-max', '--longitude-max', dest='lon_max', metavar='lon_max', type=float,
+                        help='Maximum longitude generated', default=longitude_max)
+    parser.add_argument('-l', '--logperiod', dest='logperiod', metavar='logperiod', type=int,
+                        help='Period of data generation (seconds between two values)', default=logperiod)
+    arguments = parser.parse_args(argv)
+   
+    if arguments.rrd_database is not None:
+        rrdfile = arguments.rrd_database
+
+    if arguments.lat_min is not None:
+        latitude_min = arguments.lat_min
+    if arguments.lat_max is not None:
+        latitude_max = arguments.lat_max
+
+    if arguments.lon_min is not None:
+        longitude_min = arguments.lon_min
+    if arguments.lon_max is not None:
+        longitude_max = arguments.lon_max
+
+    if arguments.logperiod is not None:
+        logperiod = arguments.logperiod
+
+    if not os.path.exists(os.path.dirname(rrdfile)):
+        print "rrd database directory not found %s" % os.path.dirname(rrdfile)
+        print ""
+        parser.print_help()
+        sys.exit(2)
+
+    timestamp = int(time.time())
+    start_time = timestamp - duration - logperiod
+        
+    if os.path.isfile(rrdfile):
+        print "Removing old database %s" % rrdfile
+        os.remove(rrdfile)
+
+    print "Creating %s" % rrdfile
+    daemon.rrd_create_database(rrdfile, logperiod, str(start_time))
+    
+    print "Filling database inside [%s, %s] --> [%s,%s]..." % (latitude_min, longitude_min, latitude_max, longitude_max)
+    for current_time in xrange(timestamp - duration, timestamp, logperiod):
+        latitude = random.uniform(latitude_min, latitude_max)
+        longitude = random.uniform(longitude_min, longitude_max)
+        speedThroughWater = random.randint(0, 10)
+        speedOverGround = random.randint(-2, 15)
+        courseOverGround = random.randint(0, 360)
+        waterDepth = random.randint(0, 20)
+        waterTemperature = random.randint(2, 25)
+        gpsFix = 3
+        # update rrd database for the webservice
+        daemon.rrd_update(rrdfile, "%s:%s:%s:%s:%s:%s:%s:%s:%s" % (
+                       current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
+
+if __name__ == "__main__":
+    main(sys.argv[1:])
Index: src/python/gnuboat/__init__.py
===================================================================
--- src/python/gnuboat/__init__.py	(revision 4eee08036d5ed78ea2214ab7e5bd1e5fe803778c)
+++ src/python/gnuboat/__init__.py	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -19,2 +19,4 @@
 from daemon.gpsdpoller import GpsdPoller
 from daemon.n2kdpoller import N2kdPoller
+from daemon.rrdhandler import rrd_create_database
+from daemon.rrdhandler import rrd_update
Index: src/python/gnuboat/daemon/__init__.py
===================================================================
--- src/python/gnuboat/daemon/__init__.py	(revision 4eee08036d5ed78ea2214ab7e5bd1e5fe803778c)
+++ src/python/gnuboat/daemon/__init__.py	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -20,4 +20,6 @@
 from .gpsdpoller import GpsdPoller
 from .n2kdpoller import N2kdPoller
+from .rrdhandler import rrd_create_database
+from .rrdhandler import rrd_update
 
-__all__ = ["displayhandler", "gpsdpoller", "n2kdpoller"]
+__all__ = ["displayhandler", "gpsdpoller", "n2kdpoller", "rrd_create_database", "rrd_update"]
Index: src/python/gnuboat/daemon/displayhandler.py
===================================================================
--- src/python/gnuboat/daemon/displayhandler.py	(revision 4eee08036d5ed78ea2214ab7e5bd1e5fe803778c)
+++ src/python/gnuboat/daemon/displayhandler.py	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -92,5 +92,5 @@
             pass
 
-    def displayValues(epd, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix):
+    def displayValues(self, epd, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix):
         if not epdEnabled:
             return
Index: src/python/gnuboat/daemon/rrdhandler.py
===================================================================
--- src/python/gnuboat/daemon/rrdhandler.py	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
+++ src/python/gnuboat/daemon/rrdhandler.py	(revision aef04dea944e3a42c66a534c881ad4364479a11e)
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+'''
+    Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import rrdtool
+import os
+
+def rrd_create_database(database_file, logperiod, start_time = 'N'):
+    rrd_data_sources = ['DS:latitude:GAUGE:15:-90:90',
+                        'DS:longitude:GAUGE:15:-180:180',
+                        'DS:speedthroughwater:GAUGE:15:U:U',
+                        'DS:speedoverground:GAUGE:15:U:U',
+                        'DS:courseoverground:GAUGE:15:U:U',
+                        'DS:waterdepth:GAUGE:15:0:10000',
+                        'DS:watertemperature:GAUGE:15:-10:50',
+                        'DS:gpsfix:GAUGE:15:-999:3']
+
+    step = logperiod
+    # durations: each archive should contain values for in seconds
+    archives = [
+        {"duration": 240, "resolution": 2},
+        {"duration": 3600, "resolution": 10},
+        {"duration": 86400, "resolution": 60},
+    ]
+    rrd_archives = []
+    for i in range(0, len(archives)):
+        rrd_archives += ['RRA:AVERAGE:0.5:%d:%d' % (_steps(archives[i]["resolution"], step), _rows(
+        archives[i]["duration"], archives[i]["resolution"], step))]
+
+    if not os.path.isfile(database_file):
+        rrdtool.create(database_file,
+                       "--start",
+                       start_time,
+                       "--step",
+                       str(step),
+                       rrd_data_sources,
+                       rrd_archives)
+
+def rrd_update(rrdfile, value_string):
+    rrdtool.update(rrdfile, value_string)
+
+def _rows(duration, resolution, step):
+    return int(round(float(duration) / _steps(resolution, float(step)) / float(step)))
+
+def _steps(resolution, step):
+    return int(round(float(resolution) / float(step)))
