DB Postgres scheme

The figure below show the ER scheme of iEnergy database.

Here are the details of involved tables:

da_drain_descriptor

This table contains the description/definition of drains described in the system. The table have this information:

  • id: drain's univocal identification
  • drain: drain's name (uppercase)
  • description: drain's description
  • unit: drain's unit of measure
  • historyfunction: aggregation fuction to be used for data storage process (from detail to history). Supported function: AVG, SUM, FIRST, LAST
  • aggregationfunction: aggregation fuction to be used during querying phase if temporal aggregation different from minute (optional parameter, default is AVG). Possible values: AVG, SUM, MAX, MIN
  • real: specifies if a measure is real or virtuale, that is it is obtained by the sum or the subtraction of powers.

da_drain_formula

This table contains the decription of formulas in case of virtual drains. Supported operation is just sum./p>

  • drain_id: drain's identification corresponding to the result of a formula.
  • drain_argument_id: drain's identification of formula's argument
  • sign: sign to be applied to the formula (1 for sum, -1 for subtraction)

da_measure_XX

This table contains measures related to sensors, defined during the installation phase. It contains time and value of the measure. Tables are two: da_measure_history and da_measure_detail, that contain respectively historical measures (hourly) and detailed measures, depending on spchain configuration.

da_measure_rt

This table contains instant measures of meters. Updating time depends onthe technology uses (e.g. es modbus polling every 10 seconds).

da_confort_indicator

This table contains the definition of confort indicators.

  • id: indicator's identification
  • name: indicator's name
  • description: indicator's description
  • function: aggregation function to be used for votes
  • type: indicator's type

Back to top

Here are listed the required components for a system based on iEnergy

Bundle iEnergy

For the correct working of iEnergy, it is necessary the domotic gateway Dog, that allowes the comunication with different technologies installed on fiels (http://dog-gateway.github.io/)

It is necessary to add the bundle it.proximacentauri.ienergy.osgi, that is responsable for storage og instant/detailes measure in the database making them available for the user.

iEnergyDa

This module is in charge of historical storage of data from Dod to Postgres database. Moreover,it supplie some API API REST/JSON available for different type of clients (as web or mobile).

The measures management module allows to handle with detailed (every 10 minutes), historical (hourly cadency) and real-time measures. Management module allows to use some aggregation function (as sum, average, etc..) in different levels of temporal aggregation (minutes, hours, days ...). Here it is also available a configuration interface that allows to define the modality of measures (e.g.: type of storage).

The module is in charge of confort indicators management.

ETL

Module for the trasformation of data from detailed to historical according to the sensors description in the database, chosen during the configuration phase.

IEnergyUtil

This module allows to access as administrator to drains and confort indicators management.

Back to top

Requirements

The requirements for iEnergy installation are:

  • Server Linux debian-like
  • Java 1.7+
  • Tomcat 7+
  • Dog 2.5+
  • Postgres 9+

Dog

For the field part it is necessary to follow the guide for Dog installation, available on the project website http://dog-gateway.github.io/, to which add the bundle it.proximacentauri.ienergy.osgi.

Necessary modules in Dog are:

  • spchain - stream processor
  • xively/cosmoutlet
  • Network Driver

The configuration requiresthe configuration file it.proximacentauri.ienergy.osgi.config, that includes:

# mapping between dog devices and measure
source.mapping=sourceDeviceMapping.xml
#source drain remove pattern (reg expression)
source.removePattern=-raw
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/ienergy
db.username=xxx
db.password=xxx
db.maxActive=10

Where there are

  • source.mapping - indicates the mapping file for the association of Dog event and drain's name.
  • source.removePattern - indicates the pattern to remove from drain's name (regular expression). This is necessary because the eventes enetering in spchain are defined with the name raw and at the outp they don't have this name since they are processed measures.The pattern is aimed the link processed measure and real time measure.
  • db.X - indicate access credetianl for the database

The second step of configuration regards xively COSMOutlet.config/it.polito.elite.dog.addons.xively.client.cfg

# ----------- COSMOutlet configuration ------------------- # the API key, only needed for the real COSM web site
# cosm.Key =
# the media type to be delivered, either application/xml or application/json
cosm.mediaType = application/json
# The COSM base datastream uri for measures (must end with a trailing /)
cosm.events.feedURL = http://localhost:8080/JeerpDa/processing/
# The default feed id for measures (no trailing /)
cosm.events.default = 106199
# The COSM base datastream uri for alerts (must end with a trailing /)
cosm.alerts.feedURL = http://localhost:8080/IEnergyDa/alerts/
# The default feed id for alerts (no trailing /)
cosm.alerts.default = 106199
# The COSM waiting list size (number of alerts/events sent in the same request, up to 500)
cosm.waitingList.size = 1
# The delivery queue maximum size
# if set to 0 the queue has no limit (be aware of possible out-of-memory errors)
cosm.deliveryQueue.size = 100
# The waiting list self-tune flag,
# if true the delivery queue automatically changes the size of the delivered JSON array
# to avoid (or at least limit) event dropping
cosm.deliveryQueue.selfTune = true

The last step is to create the database according to the schema in showed the first section.

IEnergyDa

The installation of analysis module is a .war that can be installed in tomcat 7+. The configuration is very easy and affects the file jeerpda.properties

db.url=jdbc:postgresql://10.10.10.196:5432/ienergy db.username=xxx db.password=xxx

All it is needed ar access credetial for the Postgres database.

If you have to configure administration functions that are protected by spring security, it is necessary to configure the file spring-security.xml

IEnergyUtil

It is sufficient the deploy for this application

ETL

For ETL, it is necessary to proceed with the configuration of database parameters

Back to top