Installation

This page describes an installation of the package dm and how to integrate it into the project.

Getting the source code

Contact project manager (project no. TH02010845: IotCloud - Intelligence for IoT systems) to obtain source code.

Requirements

Ubuntu packages

Use the command below to install the required Ubuntu packages.

apt install python3-tk python3-venv

A Python virtual environment (optional)

It is suitable to create a Python virtual environment.

python3 -m venv env

After successful creation, it is necessary to activate the environment.

source env/bin/activate # for activate env

Python dependencies

List of used packages

matplotlib==3.0.2
mysql-connector-python==8.0.15
numpy==1.16.1
pandas==0.24.2
pickle-mixin==1.0.2
pytz==2018.9
requests==2.21.0
scipy==1.2.1
sklearn==0.0
sphinx==2.2.0
sphinx_rtd_theme==0.4.3
sympy==1.3

Install Python dependencies using the command below. The installation should be done in the virtual environment.

pip install -r requirements.txt

Documentation dependencies (optional)

apt-get install latexmk texlive-latex-recommended \
                texlive-latex-extra texlive-fonts-recommended

To generate the documentation, it is required to go to the docs folder. The documentation can be generated either in HTML form or in PDF form. If the documentation is generated in PDF form, it is open in the Opera browser after a successful generation.

cd docs
make latex && \
cd build/latex/ && \
make && \
opera modulesforhealthyenvironment.pdf && \
cd - make html \
&& opera build/html/index.html

Configuration file

The configuration file config.ini has to be placed in the /etc/dp/ folder. The example of a configuration file follows.

[ant-work]
api.key.dm =

[rehivetech]
api.key.dm =
api.key.acontroller =

[db]
host =localhost
user =
passwd =
database =statistiky

[rapidminer]
launcher = ./rapidminer-studio/RapidMiner-Studio.sh
repository.processes.path =

[OpenWeatherOrg]
api.key =

[WundergroundCom]
api.key =

[package]
abs.path = /home/travis/build/iotcloud

abs.graph.path = ${abs.path}/src/graph

; shift last value in PreProcessing, this value is last measured from server
shift.last_value = 300

co2.event_file.name = ${abs.path}/examples/events_peto.json
t_h.event_file.name = ${abs.path}/examples/events_klarka.json
shower.event_file.name = ${abs.path}/examples/events_klarka_shower.json

; time shift that is subtracted or added to start or end of an interval respectively
interval_extension = 300

[open-detector]
generic.directory = ${package:abs.path}/examples2/0300_open_detector/generic_data
generic.devices.path = ${package:abs.path}/examples2/0001_create_update_db/devices.json

generic.co2.data_file.name = ${generic.directory}/training_co2.csv
generic.t_h.data_file.name = ${generic.directory}/training_t_h.csv

generic.co2.model.name = ${generic.directory}/model_co2.bin
generic.t_h.model.name = ${generic.directory}/model_t_h.bin

adapted.directory = ${package:abs.path}/examples2/0300_open_detector/adapted_data
adapted.combined_with_generic_data = No

; time shift to select an event when window was closed
attrs.no_event.time_shift = -1800

; time shift that is subtracted or added to start or end of an interval respectively
attrs.interval_extension = 300

selector.cache.before = 1800
selector.cache.after = 600

co2.detection.delay = 180
t_h.detection.delay = 180

[estimate]
; window size for linear regression
co2.windows.size = 1200
t_h.windows.size = 2700

; time shift that is subtracted or added to start or end of an interval respectively
attrs.interval_extension = 300

estimate.time = 3600

[predictor]
; time shift that is subtracted or added to start or end of an interval respectively
attrs.interval_extension = 300

selector.cache.before = 3600
selector.cache.after = 7200

generic.directory = ${package:abs.path}/examples2/0302_ventilation_predictor/generic_data
adapted.directory = ${package:abs.path}/examples2/0302_ventilation_predictor/adapted_data

generic.co2.data_file.name = ${generic.directory}/training_co2.csv
generic.t_h.data_file.name = ${generic.directory}/training_t_h.csv

generic.co2.model.name = ${generic.directory}/model_co2.bin
generic.t_h.model.name = ${generic.directory}/model_t_h.bin

generic.t_h.raw_csv.training_data = ${generic.directory}/raw_training.csv

; time shift to select an event when window was closed
attrs.no_event.time_shift = -1800

Other tools

The following command can be used for API key generation on the server. It is only required to enter an arbitrary email in the right form.

echo `pwgen 80 1` "= namea@example.org" >> /etc/beeeon/server/apikeys.properties