Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
architecture [2011/11/15 18:40]
jap [Software architecture]
architecture [2011/11/15 22:07]
jap
Line 33: Line 33:
 Example:\\ Example:\\
 Sensor //Outdoor Air Temperature//​ of ventilation unit may simultaneously belong to both ventilation measurements group and outdoor weather measurements group. Sensor //Outdoor Air Temperature//​ of ventilation unit may simultaneously belong to both ventilation measurements group and outdoor weather measurements group.
 +
 +=== Initialization ===
 +
 +''​RamDB''​ is located in RAM file system, thus all date is lost each time system boots. Due to that database needs to be re-generated during each boot. There are bunch of scripts that create the database.
 +
 +''/​etc/​rc3.d/​S80ha''​ -> ''/​etc/​init.d/​ha.sh''​
 +<​file>​
 +#!/bin/sh
 +
 +PATH=/​usr/​local/​bin
 +
 +. /​lib/​lsb/​init-functions
 +
 +
 +case "​$1"​ in
 +    start)
 + createdb.sh
 + ;;
 +    *)
 + ;;
 +esac
 +</​file>​
 + 
 +''/​usr/​local/​bin/​createdb.sh''​
 +<​file>​
 +#!/bin/bash
 +
 +PATH=/​bin:/​sbin:/​usr/​bin:/​usr/​sbin
 +
 +DB=/​lib/​init/​rw/​haram.db
 +SQL=/​usr/​local/​share/​ha/​ramdb.sql
 +
 +if [ -e ${DB} ]; then
 +    rm ${DB}
 +fi
 +
 +echo "​.exit"​ | sqlite3 -init ${SQL} ${DB}
 +</​file>​
 +
 +''/​usr/​local/​share/​ha/​ramdb.sql''​
 +<​file>​
 +CREATE TABLE Variable (
 +       VarID INTEGER PRIMARY KEY AUTOINCREMENT,​
 +       Name TEXT NOT NULL,
 +       ​Device TEXT,
 +       Bus TEXT,
 +       Type TEXT NOT NULL,
 +       ​Quantity NOT NULL,
 +       Unit NOT NULL 
 +);
 +
 +CREATE TABLE Value (
 +       VarID INTEGER NOT NULL,
 +       Value REAL NOT NULL,
 +       ​Timestamp TIMESTAMP DEFAULT (datetime('​now','​localtime'​)),​
 +       ​FOREIGNKEY VarID REFERENCES Variable(VarID)
 +);
 +</​file>​
  
architecture.txt ยท Last modified: 2011/12/05 00:21 by jap
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki