TWiki > Smarthome > TheBrain TWiki webs:
Main | TWiki | Sandbox
Smarthome . { Changes | Index | Search | Go }

The Brain

At the center of the Smarthome2 system is the brain. This is a C++ CORBA server with an embedded SWI Prolog engine. The C++ code implements three CORBA interfaces: x10react, x10send, and agentreact, and when a notification call is made to any of these interfaces, the C++ code spawns a thread to handle the notification and then returns immediatly. The thread then requests a mutex and then calls the Prolog predicate that handles the notification and decides on any action to take.

Currently all calls to the Brain are notifications - the notifier does not expect or wait for any response while the Brain decides what if any action to take. Eventually I'm sure I'll add function that will allow components of the system to ask the Brain questions and expect an answer.

Before I implemented the Brain, all the smarthome servers in the system operated autonomously and their reaction logic was hard coded in the Visual Basic. There was no facility to coordinate the activies across servers. Now the behavior of the system is centrally controlled by the Brain and the smarthome servers are becomming "dummer" and simply provide MS Agent, Video Capture, X10 interface, or 1-wire device facilities to the system.

One of the really nice things about having an Embedded Prolog engine controlling the reaction logic of the system is that the rules are dynamic - not only do I no longer have to recompile anything when I add new rule functionality, I don't even have to restart the Brain itself! The rules can be reloaded on the fly simply by selecting a command from the MS Agent interface.

rule base

inputs

cpplib

Back to the Smarthome page


Topic TheBrain . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More }
Revision r1.1 - 02 Feb 2004 - 01:14 - TWikiGuest

Copyright © 1999-2008 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback