Changeset e44e1f1 for src/python/bin
- Timestamp:
- Aug 22, 2017, 6:02:32 PM (9 years ago)
- Branches:
- 0.5, debian/bullseye, debian/jessie, master
- Children:
- fb91143
- Parents:
- 60de003a
- Location:
- src/python/bin
- Files:
-
- 1 added
- 1 edited
-
gnuboat (modified) (3 diffs)
-
gnuboat-data-generator (added)
Legend:
- Unmodified
- Added
- Removed
-
src/python/bin/gnuboat
r60de003a re44e1f1 48 48 nmeafile = None 49 49 nmeaFileDate = None 50 51 52 def rraRows(duration, resolution, step):53 return int(round(float(duration) / rraSteps(resolution, float(step)) / float(step)))54 55 56 def rraSteps(resolution, step):57 return int(round(float(resolution) / float(step)))58 59 60 def createDatabase(databaseFile):61 rrdDataSources = ['DS:latitude:GAUGE:15:-90:90',62 'DS:longitude:GAUGE:15:-180:180',63 'DS:speedthroughwater:GAUGE:15:U:U',64 'DS:speedoverground:GAUGE:15:U:U',65 'DS:courseoverground:GAUGE:15:U:U',66 'DS:waterdepth:GAUGE:15:0:10000',67 'DS:watertemperature:GAUGE:15:-10:50',68 'DS:gpsfix:GAUGE:15:-999:3']69 70 step = logperiod71 # durations: each archive should contain values for in seconds72 archives = [73 {"duration": 240, "resolution": 2},74 {"duration": 3600, "resolution": 10},75 {"duration": 86400, "resolution": 60},76 ]77 rrdArchives = []78 for i in range(0, len(archives)):79 rrdArchives += ['RRA:AVERAGE:0.5:%d:%d' % (rraSteps(archives[i]["resolution"], step), rraRows(80 archives[i]["duration"], archives[i]["resolution"], step))]81 82 if not os.path.isfile(databaseFile):83 rrdtool.create(databaseFile,84 "--start",85 "N",86 "--step",87 str(step),88 rrdDataSources,89 rrdArchives)90 50 91 51 … … 205 165 sys.exit(2) 206 166 207 createDatabase(rrdfile)167 daemon.rrd_create_database(rrdfile, logperiod) 208 168 209 169 if os.path.isfile(shutdownfile): … … 231 191 232 192 # update rrd database for the webservice 233 rrdtool.update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s:%s" % (193 daemon.rrd_update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s:%s" % ( 234 194 latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix)) 235 195
Note:
See TracChangeset
for help on using the changeset viewer.
