Design – Database Schema

It’s worth stepping back at this point to take a look at the database schema, and highlight some of the key tables.

Zone – a zone is a physical sub-space within the area being monitored. Typically a room: Kitchen, Bathroom, etc. but can represent larger spaces such as Outside or Locality. Zones have x, y, z co-ordinates which enable the website to display values overlayed on a floor-plan. Sensors, Actuators and Impulses are all associated with a Zone.

Measurand – a measurand is a physical quantity to be measured e.g. Temperature, Relative Humidity, etc. Sensors are associated with a Measurand.

Sensor holds the key data for each sensor. There is no Sensor Type, but the SensorFunction column effectively has a pointer to the code which handles the reading.

The Actuator table keeps track of the hub outputs such as fan relays, indicators, etc.

Sample is where current values are logged, which becomes the source for graphs on the website.

The EventQueue is important, because it queues events such as a threshold being reached or an impulse from the occupant, until they can be processed by the Rules Engine.

In the next post we will test that our controller can access the database.