eHouse Smart Home – Programming Delphi

Home Automation example of creating your own control algorithms for system eHouse

Smart Home , intelligent Building eHouse allows you to create your own overlay ( application running on a PC on eHouse system server ), which makes it easy to create your own individual programming algorithms using our software template EhouseLogAnalizer in Delphi .

eHouse Home Automation .
Thanks to the stability of today’s PCs and Windows is unproblematic and continuous operation management eHouse smart house software additionally monitored by the application KillExec.exe .
In the case of hangs or errors the application is closed and started again without user intervention to the system.

When Window and eHouse system is properly configured, it is possible to maintain the continuity of the smart home software on the PC for many months.

Competent writing control software system smart home eHouse requires sequential checking of measurements changing ( and sending appropriate control events if necessary – once) .
When writing your own control algorithms with software, create a flag confirming the execution of the event to senselessly not repeatedly send the same event: for example, every 2 seconds to close the blinds that are already closed .

Applications can be assigned to several of Timers :
first – The main example at 10 seconds updating the data controllers .
Another – values ​​dependent on the volatility of the phenomenon :
eg . for control of blinds , awnings in relation to the outside temperature and light level may be a few minutes .

In the case of drive control blinds , gates , awnings , windows, etc. can be used reed relays connected to digital inputs eHouse smart home controllers , confirming the closure and make control operations on the state of the inputs RoomManager , which is much better and truer than flag Sofware, whose value may be set incorrectly as a result of software bugs, or because of errors the drive ( not the closure of the , mechanical , block , etc.. ) .

Examples of the use of data from controllers in the application eHouseLogAnalizer ( in a repetitive loop working in increments of a few seconds)

// Initialization data from the controller boiler HeatManager
TzewnetrznaPN : = HADC[HM_ZEWNPN] ; External temperature // North
TemperaturaGWC : = HADC[HM_GWC] ; // Temperature for GWC – Ground heat exchanger recuperator
TemperaturaKominekPlaszcz : = HADC[HM_KOM1] ; // Temperature Fireplace Mantle in aqueous 1 sensor
TemperaturaKominekKonvekcja : = HADC[HM_KOMKONV] ; // Temperature convection fireplace – sensor at the chimney of the actual work of the fireplace
TemperaturaKominekPlaszcz : = HADC[HM_KOM2] ; // Fireplace water jacket temperature sensor 2 – (backup )
TemperaturaWewnętrzna : = HADC[HM_TWEWN] ; Room temperature internal // – for CO
TemperaturaSolar : = HADC[HM_SOLAR] ; // Temperature solar collector on the tube top (hot )
TzewnetrznaPD : = HADC[HM_ZEWNPD] ; // outside temperature noon
Tkociol : = HADC[HM_KOC] ; // Temperature boiler tube top (hot )
TemperaturaBuforaCODol : = HADC[HM_BANDOL] ; // Temperature CO / hot water tank down
TemperaturaRecuIn : = HADC[HM_REQIN] ; // Temperature recuperator entry of clean air
TemperaturaRecuOut : = HADC[HM_REQOUT] ; // Temperature recuperator air out the house
TemperaturaZaworTrojDrozny : = HADC[HM_NAG] ; // Temperature controlled three-way valve such as heater or heaters
TemperaturaRecuWyciog : = HADC[HM_REQWYC] ; // Temperature recuperator extract from the house dirty air
TemperaturaBuforaCOGora : = HADC[HM_BANGORA] ; // Temperature / DHW tank top
TemperaturaBuforaCOSrodek : = HADC [ HM_BANSRO ] ; // Temperature heating / hot water tank measure
// Measurements from the sensors to RoomManager
TzewWschod : = RMGetTempNr(get_index_rm(’55-2′),8) ; // External temperature east of the sensor 8 for RM with the address 55 – 2
TzewZachod : = RMGetTempNr(get_index_rm(’55-3′),8) ; // West Outside temperature sensor 8 for RM with the address 55 – 3
TzewPolnoc : = RMGetTempNr(get_index_rm(’55-4′),8) ; North // Outside temperature sensor 8 for RM with the address 55 – 4
TzewPoludnie : = RMGetTempNr(get_index_rm(’55-5′),8) ; South // Outside temperature sensor 8 for RM with the address 55 – 5
LNaslonecznienieWschod : = RMGetInvPercentNr(get_index_rm(’55-2′),1) ; // Level outdoor lighting east of sensor No. 1 for RM with the address 55 – 2
LNaslonecznienieZachod : = RMGetInvPercentNr(get_index_rm(’55-3′),1) ; // Level outdoor lighting West of sensor No. 1 for RM with the address 55 – 3
LNaslonecznieniePolnoc : = RMGetInvPercentNr(get_index_rm(’55-4′),1) ; // Level of external illumination North of sensor No. 1 for RM with the address 55 – 4
LNaslonecznieniePoludnie : = RMGetInvPercentNr(get_index_rm(’55-5′),1) ; // Level of external illumination South of sensor No. 1 for RM with the address 55 – 5
SilaWiatru : = RMGetPercentNr(get_index_rm(’55-5′),7) ; // Level of external illumination South of sensor No. 1 for RM with the address 55 – 5
Control algorithms can be arbitrary and may include any parameters and measurements so far have used and installed sensors specified physical quantities .

// Algorithm contained in the slow timer reproducibility e.g. . 10min

// Example of energy-efficient control of roller shutters and awnings (resulting in significant savings due to the sun’s rays heating the house in winter) and the accumulation of free solar energy

// Free and ecological heating of the rooms on the east side of the building sunlight
if ( not RoletyWschod) then // if they are no longer open
if ( LNaslonecznienieWschod > 80) then // if the sun – check the value of empirically
if ( Month < 5 ) and month > 8 ) then // if the months from September to April
if ( TzewWschod > 0 ) then // temperature sensor in the sun warmed higher than 0C
if ( Time>8) and ( Time < 11 ) then // in the morning when the sun shines directly from the east
begin
RoletyWschod : = true ; // flag opening shutters eastern
OtworzRoletyWschod ; // function of sending an event to the system drivers eHouse
ZamknijMarkizyWschod ; // do not give anything because the sun is too low
end ;

// Free and ecological heating of the rooms on the south side of the building sunlight
if ( not RoletyPoludnie ) then // if they are no longer open
if ( LNaslonecznieniePolodnie >80) then // if the sun – check the value of empirically
if ( Month < 5 ) and month > 8 ) then // if the months from September to April
if ( TzewPoludnie > 0 ) then // temperature sensor in the sun warmed higher than 0C
if ( Time>10) and ( Time < 14 ) then // in the morning when the sun shines directly from the south
begin
RoletyPoludnie : = true ; // flag opening blinds polodniowych
OtworzRoletyPolodnie ; // function of sending an event to the system drivers eHouse
ZamknijMarkizyPolodnie ; // do not give anything because the sun is too low
end ;

// Free and ecological heating of the rooms on the west side of the building sunlight
if ( not RoletyZachod ) then // if they are no longer open
if ( LNaslonecznienieZachod > 80) then // if the sun – check the value of empirically
if ( Month < 5 ) and month > 8 ) then // if the months from September to April
if ( TzewZachod > 0 ) then // temperature sensor in the sun warmed higher than 0C
if ( Time> 14) and ( Time < 18 ) then // in the morning when the sun shines directly from the west
begin
RoletyZachod : = true ; // flag blinds open western
OtworzRoletyZachod ; // Function of sending an event to the system drivers eHouse
ZamknijMarkizyZachod ; // do not give anything because the sun is too low
end ;

Ecological and Economic // free Reducing the impact of heating premises as a result of sunlight in summer – control awnings

// Control awnings – opening awnings to reduce solar radiation and heating the house in the summer – east
if ( not MarkizaWschodA ) then // if they are no longer open
if ( SilaWiatru < 5 ) then // if no wind
if (( Month > 4) and ( Month < 9) ) then // summer months
if ( LNaslonecznienieWschod > 50 ) then // if the sun shines
if ( Time> 6 ) and ( Time < 12 ) then // if hours of the morning
if ( TwewnWschodA > 25 ) then // if the room is too warm
begin
MarkizaWschodA : = true ; // flag awning open room A
OtworzMarkizeWchodA ; // sending an event to the system drivers eHouse
end ;
// Similarly, you can replicate the code for independent control of awnings in other areas on the eastern facade of changing A to a different value

// Control awnings – opening awnings to reduce solar radiation and heating the house in the summer noon
if ( not MarkizaPoludnieA ) then // if they are no longer open
if ( SilaWiatru < 5 ) then // if no wind
if (( Month >4) and ( Month < 9) ) then // summer months
if ( LNaslonecznieniePoludnie > 50 ) then // if the sun shines
if ( Time> 8) and ( Time < 18 ) then // if the hours in which the sun hardest operates from the south
if ( TwewnPoludnieA > 25 ) then // if the room is too warm
begin
MarkizaPoludnieA : = true ; // flag awning open room A
OtworzMarkizePoludnieA ; // sending an event to the system drivers eHouse
end ;
// Similarly, you can replicate the code for independent control of awnings in other rooms on the South facade changing the A to a different value

// Control awnings – opening awnings to reduce solar radiation and heating the house in the summer west side
if ( not MarkizaZachodA ) then // if they are no longer open
if ( SilaWiatru < 5 ) then // if no wind
if (( Month > 4) and ( Month < 9) ) then // summer months
if ( LNaslonecznieniePoludnie > 50 ) then // if the sun shines
if ( Time > 8) and ( Time < 18 ) then // if the hours in which the sun hardest operates from the south
if ( TwewnZachodA > 25 ) then // if the room is too warm
begin
MarkizaZachodA : = true ; // flag awning open room A
OtworzMarkizeZachodA ; // sending an event to the system drivers eHouse
end ;
// Similarly, you can replicate the code for independent control of awnings in other areas on the western facade of changing A to a different value
// Closing Marquis is too much wind
if ( LNaslonecznieniePoludnie < 20 ) then // if the sun does not shine ( chosen empirically taking into account cloud and rainfall)
if ( MarkizaPoludnieA ) then // if you open the awning
begin
MarkizaPoludnieA : = false ; // changes flag
ZamknijMarkizePoludnieA ; // send events to the microprocessor controllers eHouse
end ;
if ( LNaslonecznienieZachod < 20 ) then // if the sun does not shine ( chosen empirically )
if ( MarkizaZachodA ) then // if you open the awning
begin
MarkizaZachodA : = false ; // changes flag
ZamknijMarkizeZachodA ; // send events to the microprocessor controllers eHouse
end ;
if ( LNaslonecznienieWschod < 20 ) then // if the sun does not shine ( chosen empirically )
if ( MarkizaWschodA ) then // if you open the awning
begin
MarkizaWschodA : = false ; // changes flag
ZamknijMarkizeWschodA ; // send events to the microprocessor controllers eHouse
end ;
if ( SilaWiatru > 5) then // Wind is closing the awning
if ( MarkizaZachodA or MarkizaWschodA or MarkizaPoludnieA ) then // if one is open
begin
ZamknijWszystkieMarkizy ; // sending the event to the system drivers eHouse
MarkizaZachodA : = false ;
MarkizaWschodA : = false ;
MarkizaPoludnieA : = false ;
end ;

// Automatic control of shutters closing at too low a temperature outside the limiting heat escape through the windows on the outside
// South- closing shutters at the cold and lack of sun for the southern elevation
if ( RoletyPoludnie ) then // if it is open
if ( TzewPoludnie < – 10 ) then // temperature sensor smaller than the southern – 10C indicating the large frost and lack of sun heating the sensor on the south side
begin
RoletyPoludnie : = false ; // flag opening blinds polodniowych
ZamknijRoletyPolodnie ; // function of sending an event to the system drivers eHouse
// ZamknijMarkizyPolodnie ; // do not give anything because the sun is too low
end ;

// East- closing shutters at the cold and lack of sun for the elevation of Eastern
if ( RoletyWschod ) then // if it is open
if ( TzewWschod < – 10 ) then // temperature sensor smaller than the Eastern – 10C indicating the large frost and lack of sun heating the sensor on the east side
begin
RoletyWschod : = false ; // flag opening shutters eastern
ZamknijRoletyWschod ; // function of sending an event to the system drivers eHouse
// ZamknijMarkizyWschod ; // do not give anything because the sun is too low
end ;

// West- closing shutters at the cold and lack of sun to the west elevation
if ( RoletyZachod ) then // if it is open
if ( TzewZachod < – 10 ) then // temperature sensor smaller than the western – 10C indicating the large frost and lack of sun heating the sensor on the west side
begin
RoletyZachod : = false ; // flag blinds open western
ZamknijRoletyZachod ; // function of sending an event to the system drivers eHouse
// ZamknijMarkizyZachod ; // do not give anything because the sun is too low
end ;