OpenSCADAWiki: Home Page En/Using/ Smart House
 


Apartment house automation - "Smart House" (HouseSpirit)

Name: "Smart House" (HouseSpirit)
Start: 28 03(March) 2011
Finish: 12 06(June) 2011
Location: Khanty-Mansiysk city, Russia
Performers: Oleg Sidashov, Roman Savochenko
Description: Implementation of the apartment house automation project - "Smart House" (HouseSpirit).


Contents

Introduction

The object of automation is the house with equipment - the subject to automation. The system is designed to automate the actions performed by the user or service personnel to provide security, comfort, convenience at the automation object - the living room (apartment, private house), as well as at the surrounding area (land, yard, garden) .

The system is designed for the solution of following tasks:

Objectives of the creation of the system are:

1. Automation object

The area of the automation object - 300 m2. The air temperature in rooms intended for the server, sensors and actuators placement from 10 to 25 degrees Celsius. The air temperature outside the premises where the sensors and actuators are placed: from - 30 to 30 ° C.

The levels of pollution, humidity, light, noise and ionizing radiation correspond to sanitary and epidemiological requirements for residential buildings and premises (ÑÀÍÏÈÍ 2.1.2.1002-00).

At the object there is electromagnetic radiation induced by the appliances, as well as by means of different equipment (Bluetooth, Wi-Fi, GSM).

The "Smart house. Control Server" system is a hardware-software module, which is the main control center of the automation object. The server receives and processes signals from various sensors, generates and transmits signals to control actuators, communicating with the user via GSM. Management of the system is made via the web interface.

The "Smart house. Control Server" system includes the following subsystems:
  1. Access control subsystem.
  2. Lighting control subsystem.
  3. Climate control subsystem.
  4. Water network control subsystem.
  5. Household and multimedia devices control subsystem.
  6. Subsystem of the processing the information from the sensors.
  7. Subsystem for the providing the interaction with the user through the Web-interface and via GSM.
  8. Authorization subsystem.
  9. The reporting subsystem.
  10. Configuration subsystem provides mechanisms to add, remove or edit information in the used database for the 1-8 subsystems.

The block diagram of the house automation system is shown in Figure 1.

Overall structure – png (194 Kb)
Fig. 1. The block diagram of the house automation system


To control the various hardware of the house it was designed the hub and built the wireless network ZigBee of the devices for the equipment control. Overall equipment control, as well as providing the Web-based user interface and other methods of notification are made by the dedicated server of house automation. The hub if the ZigBee network is connected to the server through the RS-232 and ModBus/RTU protocol. Alarms in the automatics' control area will be sent to the user via SMS-notifications through the connected GSM-modem.

Wireless controller has the following specifications:

GSM-module has the following specifications (Siemens TC65):

The hardware of the server:

As a software environment, to serve the house automation functions — "Smart House" an open SCADA system OpenSCADA is used, in the environment of which it is designed the Web-based user interface "Smart House", and implemented the interrogation and control of devices via ZigBee concentrator.

2. Automation system

OpenSCADA system has several ways of forming visualization user interfaces, stating from integrated development tools of standard interfaces of controls the various areas of automation and ending by the low-level mechanisms of libraries and interfaces of graphic concepts.

The integrated interfaces of OpenSCADA are:

The low-level mechanisms of constructing the user interfaces include any other graphics libraries, which have a rapid development tools of the user interface. The co-operation with OpenSCADA is produced as with data source and with the interface of the unified control of the equipment under different protocols.

In order to provide the ability of user's Web-interfaces formation directly in the OpenSCADA, the module "UI.WebUser" module is provided. Overall, the OpenSCADA contains all the basic functions of a typical Web-server, as follows:

Consequently, for the construction of any user control interface it is enough to have installed OpenSCADA system with the following modules: Transport.Sockets, Transport.SSL, Protocol.HTTP and UI.WebUser.

2.1. The structure and location of files

In order to reduce the load on the fully dynamic formation of the user interface, as well as to facilitate the future expansion and modification of style the Web-interface was divided into static and dynamic parts.

The static part consists of a set of template HTML-files with labels of the dynamics placement and resource files: CSS, JavaScript and images. In general, the static part is represented by files, which are described in the table below:

File Description
HTML-templates (HouseSpirit/Web/*)
main.html The main user interface template. Contains a general user interface with location tag of the pages' content "#####CONTEXT#####".
auth.html Template of the authorization interface with the tag of content's location "#####CONTEXT#####". It is created for using by the HTTP protocol module (/sub_Protocol/mod_HTTP).
access.html Access control template.
temperature.html Climate control template.
light.html Lighting control template.
water.html Water supply subsystem control template.
tech.html Electronic and household appliances control template.
friend.html User devices control template.
user.html Users manager template.
devices.html Device manager template.
loginError.html Page of authentication error messages, or lack of it.
mess.html Active alarm messages template.
report.html Template for alarms', actions and system messages reports formation.
welcome.html The welcome page displayed by default in the content field.
Resources (HouseSpirit/Web/res/*)
stylesheet.css Cascading Style Sheets of the user interface.
main.js JavaScript code of the main template for the time counter and session.
devMon.js JavaScript code that implements a dynamic AJAX interface for the monitoring of subsystems' device.
access.png, accesson.png Images of the access control subsystem.
temperature.png, temperatureon.png Images of the climate control subsystem.
light.png, lighton.png Images of the lightning control subsystem.
water.png, wateron.png Images of the water supply control subsystem.
tech.png, techon.png Images of the electronic appliances control subsystem.
friend.png, friendon.png Images of the user's devices control subsystem.
user.png, useron.png Images of the users' Manager.
devices.png, deviceson.png Images of the devices' manager.
report.png, reporton.png Images of the alarms, actions and system messages reports formation.
help.png, helpon.png Images of the help page.
HouseSpirit.ico Icon of the Web-based interface.
hd_l.png, hd_r.png The left and right parts of the header.
select_l.png, select_r.png Background images of the selected menu item on the left and right
space_l.png, space_r.png Images of the free menu item on the left and right.
status_l.png, status_r.png status_edge.png Images of the status bar.
Report files (HouseSpirit/Web/reports/*)
rep_{user}.html The latest report of the "user" user.

The dynamic part is implemented by the scripts in the internal language of OpenSCADA - JavaLikeCalc, which are described in the table below:
Script address Description
The script of the Web-site (/sub_UI/mod_WebUser/)
up_hs Main Web-site script, which performs direct reception, initial processing and forming the definitive reply, namely:
  • Processing the requests to the template-pages:
    • read the file of the selected template-page, if the selection had taken place;
    • reading and parsing of the file of the main interface template (main.html);
    • placing the current server time in the "value" attribute of the element of the main template tree with the "time_vl" ID;
    • placement of the initial counter value of an active session in the "value" attribute of the element of the main template tree with the "ses_vl" ID;
    • checking the public access of the authenticated user to some parts of the interface and to hiding items that do not have access to be viewed;
    • processing the selected menu item of the page:
      • backlight of the menu item of the active page;
      • search and call of the (/sub_DAQ/mod_JavaLikeCalc/lib_web/*) dynamics script from the "script URL" argument of the selected page.
    • reading of the welcome page file (welcome.html), in the case of absence the selected page from the menu;
    • setting the values of the current page and the user in the status bar;
    • placing of the page context to the main template of the interface.
  • Processing the requests to the resource files and reports:
    • Processing the resource files extension and the formation of the attribute of (Content-Type) type for the transmitted content.
  • Generation the replies with an error if there is no template-pages, or resource files.
Script library of the template-pages, and system processes (/sub_DAQ/mod_JavaLikeCalc/lib_web/*)
user Script of the template-page "Users Manager" implements the function of the formation of form for the users' management, depending on the rights of the logged in user.
devices Script of the template-page "Devices Manager" implements the function of forming the devices' control and the alarms generation form for two types of devices: decimal and dynamic.
devMon The script of the formation of the monitoring interface and form of the devices' management, configured in the "Devices Manager". This script is used by all subsystems of the devices monitoring.
alarms Script of the periodical task that checks the value of variables of devices for the configured alarms. In addition to the direct formation of alarms the script provides the SMS-notification messages to users' phones, set for notification via SMS.
mess Script of the template-page "Alarms" implements the function of forming the active list of alarms.
report Script of the template-page "Reports" implements the function of forming the table-report with the events in the system and in the various subsystems for a specified period of time. Report is generated simultaneously on the screen and in the file that can be downloaded separately by the link.

In general, the algorithm processing the requests to the pages is(on the example of http://localhost:10002/WebUser/temperature?script=devMon):

2.2. Devices Manager

The Devices Manager is available only for root and builds the form (Fig. 2) for edit, and and remove devices of two types: binary and decimal.


Fig. 2. Devices Manager.


The created device are placed in the attributes list of the parameter of the specifically taken subsystem of "ZigBee" controller of the data source module "ModBus" (/sub_DAQ/mod_ModBus/cntr_ZegBee/). Recording format of an attribute is as follows:

In addition to direct sensors the configuration and formation of alarms is made in the form of text procedure. The program of formation is placed in the "var" attribute of the alarms controller parameter /sub_DAQ/mod_JavaLikeCalc/cntr_alarms/prm_rules. The "var" attribute contains the following XML tree:
<ALARMS>
  <it id = "temperature.cond1">
    if(x&lt;10) err = &quot;Low temperature: &quot;+x+&quot; &lt; 10&quot;;
  </it>
</ALARMS>


According to the XML-tree the formation of alarms and sending SMS-notifications to the subscribed users is made in the controller's task /sub_DAQ/mod_JavaLikeCalc/cntr_alarms, which is executed with a period of 1 minute.

SMS-notifications are sent via the serial transport /sub_Transport/mod_Serial/out_GSM and through the user's SMS-protocol (/sub_Protocol/mod_UserProtocol/up_SMS).

You can also select the delayed giving of the control action. To do this, the user sets the right time, in the form of: {Min}:{Sec}. Processing of the delayed control is made in the controller /sub_DAQ/mod_JavaLikeCalc/cntr_timers by setting the "var" attribute of the "rules" parameter with the help of requests in the XML tree:
<TIMERS>
  <timer id="temperature.tGhost1" tm="60" user="root">20</timer>
  <timer id="temperature.cond1" tm="10" user="root">0</timer>
</TIMERS>

2.3. Subsystems

All visualization subsystems are served by the /sub_DAQ/mod_JavaLikeCalc/lib_web/devMon script. This script process the requests from the script of the dynamic visualization of Web-browser and receive the data on the subsystem's devices, required for visualization (Fig. 3). Data about the devices are transferred in accordance with the privileges of the logged user.


Fig. 3. Subsystem's management.


The configuration of sensors is read from the parameter corresponding to the "ZigBee" controller's subsystem (/sub_DAQ/mod_ModBus/cntr_ZegBee). The values are read and written to the attributes of the sensors of these parameters or through the controller or delayed management.

The task of the "ZigBee" controller is executed with the period of 1 second, in the process of which the request of the the current values of all configured sensors is made. Record of the the values is made on the fact of modification, regardless of the periodic polling task or through the delayed management controller in the case of installation of nonzero timer.

Connection to the "ZigBee" controller is made via serial outgoing transport /sub_Transport/mod_Serial/out_ZegBee.

2.4. Users manager

Users manager (Fig. 4) is intended to create, delete and edit accounts of ordinary users.


Fig. 4. Users manager.


Users are divided into administrators and ordinary users. Identification of the user as an administrator in the OpenSCADA system is made by turning it into the "WebRoot" group (/sub_Security/grp_WebRoot). An ordinary user is included into the "Web" group (/sub_Security/grp_Web).

In OpenSCADA system, each user (/sub_Security/usr_test1/) has a text description field, which in this case serves to store its special settings in the following way:
TEL: +380679859815
SMS: true
Report: false
sub_access: --
sub_friend: --
sub_light: --
sub_tech: --
sub_temperature: rw
sub_water: --


In the case of an administrator's account the records of an access rights to the subsystems are not available, but there are system-wide settings such as the lifetime of the session (/sub_Protocol/mod_HTTP).

2.5. Messages

The message list is formed based on the active list of alarms in their categories "ALARM:House:*" in tabular form, with the time, category, level and the alarm message (Fig. 5).


Fig. 5. Messages.

2.6. Reports

During the report's generating the time range is indicated and messages' types are select. The generation of message for the following types is provided:

The protocol is formed as a table (Fig. 6) with the time, category, level and message of the alarm, which is also recorded in the separate report file, later available on the link to the separate opening.


Fig. 6. Reports.

Links

Referring pages: HomePageEn/Using/SmartHouse