Decoding the binary status of the drivers smart home – source code
Smart Home , intelligent Building eHouse – Decoding the status of microprocessor controllers
Home Automation , Building Automation received by the control panels working on the LAN or WiFi , the UDP ( User Datagram Protocol) .
The standard frame reception status in binary form , with microprocessor controllers
Decoding the frame requires analyzing each bit of data from separate . In addition, each driver type :
It has a difference in the amount of digital inputs , measurement , digital outputs , dimmers , monitoring features and algorithms which cause , that the mutate in a standard frame according to the type of driver .
This necessitates the decoding bit by bit for each type of controller independently . In the case of the implementation of all types of microprocessor controllers to create and test an algorithm decoding the frame can take up to 1 month .
To minimize the time to a minimum, to facilitate ready to present an algorithm borrowed from an application ehouse.exe , enabling automatic decoding of all information from the driver and load data into the template registers the touch panel ( for PADs ) Windows XP , Vista , 7 , 8. After automatically loading the data into the eHouse software libraries , with the help of a few lines of code you can create your own control algorithms running eHouse.
The standard template software panels should make the library “binary” , which is a full frame decoding of a binary status .
Decoding the entire frame ( for microprocessor controllers eHouse1 RM , EM , HM ) is realized by the function procedure set_rm(p:array of char ;TCP_INDEX_INC:integer);
function parameters are buffer status and shift (offset ) . The buffer contains all the data received from the status.
The offset depends on the type of transmission (extended address , normal , and other future applications dependent on algorithms and communication).
It automatically populates the array status for each driver individually and can then directly manipulate the data or automatically update the data on the screen, touch panels.
This function is activated in the procedure of receiving data from the component UDP ( TNMUDP – called binary) in the event onDataReceived .
The reception is as follows:
procedure TForm1 . binaryDataReceived (Sender: TComponent ;
NumberBytes : Integer ;
FromIP : String ;
Port : Integer );
var C : array [0..1024 ] of char ;
Mystree : TMemoryStream ;
if filesystem_status then exit ; // if not by the file system filesystem_status
Mystree : = TMemoryStream.create ; // creates a data stream
binary.ReadStream(Mystree); // reads the data stream
Mystree.Read (C,NumberBytes); // loads into buffer C
set_rm(C,1); // Processes binary data and loads the registers rm [index ] for drivers eHouse 1
Test_save ; // Test record the output to a text file for ease of operation
update_panel ; // Loading data for the control panel
Allows for automatic and non-invasive receiving data via LAN or WiFi using UDP broadcasts packets ( User Datagram Protocol).
What more does not require connecting to the server and only listens on port broadcast ‘6789’ default or other .
errors link , network , routers will not result in a suspension of software or indeterminate error (as in the case of communication with TCP servers ) , but disappears only update the data without affecting the sending server or client application data UDP.
NOTE !! . When you create the control software on a Windows server system eHouse , it is necessary to implement all the algorithms in one application , which analyzes the data and performs all the algorithms, and it visualizes .
Significant variables in the library binary :
boiler_alarm : boolean = false ; // boiler alarm alarm programmed temperature above
// exceeded the alarm temperature boiler
bonfire_stat : integer ; // bonfire heating level 0 – 7 for binary mode – operating status of the fireplace
// 0 – fire off – does not heat
// 1 – Fire on / extinguishing = > Green Level < temp jacket (green LED blinking ) – expires flashes green
// 2 – fire on = > Green Level > = temp jacket > yellow level – histeressis (green LED ) – green
// 3 – fire on = > yellow level – histeressis > Temp jacket > yellow level + histeressis ) (green + yellow leds ) – green – yellow
// 4 – fire on = > yellow level + histeressis > Temp jacket > red level – histeressis ( yellow) – yellow
// 5 – unconditional = > red level – histeressis < Temp jacket < Red Level + histeressis ( red + yellow leds ) yellow – red
// 6 – unconditional = > Temp jacket > Red Level + histeressis ( red LED constant ) – red
// 7 – unconditional = > Temp jacket > bonfire alarm ( red LED blinking ) ALARM – red flashing
bonfire_sensor_error : boolean = false ; // bonfire sensors error too much different temperature water jacket between two sensors
// Error fireplace mantle temperature sensors too big difference
recuperator_status : string ; // Status of recuperation , ventilation , air heating – status of the recuperator and ventilation
recu_winter : boolean = false ; // recuperator winter / summer heat exchanger mode enabled / disabled – recuperator winter / summer
recu_manual_amalva : boolean = true ; // recuperator auto / manual mode for We reserve recuperator (auto We reserve managed by internal controler , manual to eHouse HeatManager ) // We reserve recuperator manual / auto
went_cooler : boolean = true ; // water cooler on / off for ventilation or cooler recuperation recuperation system or GHE ON / OFF
went_gwc : boolean = false ; // gwc ( ground heat exchanger ) servo motor on / off – ground heat exchanger actuator on / off
went_aux_gwc_fan : boolean = false ; // auxiliary gwc ventilator / fan on / off for ground heat exchanger – fan assisted GWC
bonfire_dgp : boolean = false ; // bonfire hot air distribution system enabled / disabled – Fan distribution of hot air from the fireplace DGP
ventilation_on : boolean = false ; // ventilation is currently working on / off – inclusion of ventilation and heat recovery
heater_pump : boolean = true ; // pump for heater for ventilation on / off – heater pump circuit ventilation or heaters
three_ways_cutoff : integer = 0 ; // three ways cutoff direction 0 off , 1 Increasing level , – 1 Decreasing level) direction of rotation of the electro -way valve
solar_pump : boolean = false ; // solar pump on / off – solar collector pump
boiler_on : boolean = false ; // boiler enabled / disabled – boiler on / off
boiler_pump : boolean = false ; // boiler pump on / off status – boiler pump on / off
boiler_fuel_out : boolean = false ; // boiler out of fuel aproximate (count hours of heating ) – estimated lack of fuel for solid fuel boiler (calculated on the basis of hours of operation of the boiler )
boiler_power_on : boolean = false ; // supplay boiler power on / off ; – Power Boiler on / off
boiler_fuel_supply_override : boolean = false ; // boiler fuel supplyier override ( control by ehouse / internal boiler controller ) – overriding control of fuel delivery system eHouse on / off
bonfire_pump : boolean = false ; // bonfire pump on / off status – the fire pump on / off
recu_speed : integer = 0 ; // recuperator speeed 0 . . 3 – speed recuperator
recu_temperature : integer ; // temperature level of recu 0 . . 30C temperature recuperator for amalva
_recu_mode : string = ” ; // recuperation mode in text as he HeatManager control panel ( ehouse.exe ) – recuperator mode as the control panel in the application HeatManager eHouse.exe
Fan : string ; // ventilation status as text on HeatManager Control panel ( ehouse . exe ) – ventilation status identical to the panel HeatManager ehouse.exe
cat , sola : string ; // boiler , Solar text status as he HeatManager Control panel ( ehouse . exe ) – status of the boiler and solar collector panel to control HeatManager eHouse.exe
Komi : string ; // bonfire text status as he HeatManager Control panel ( ehouse . exe ) – status of the fireplace as in the control panel in the application HeatManager eHouse.exe