Logical Approach To Home Automation

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

A LOGICAL APPROACH TO HOME AUTOMATION

A. Alvi and D. J. Greaves


University of Cambridge, UK

ABSTRACT computation uses URIs for remote tuple names and


defines its own federation protocol over UDP. Each
This paper describes an automated home environment pebble describes itself using a command reflection API
comprising a varying population of different hardware and a novel code reflection API and registers with
and software modules, called pebbles, being controlled dynamic directory services of the form required for ad
by a varying number of rules. The aim is to execute a hoc computing, say UPnP. We use the term code
number of concurrent applications and to be sure in reflection for the concept of application software being
advance of their potential interactions in order to avoid examinable in some form or another. Push Logic is our
any feature interaction. For this, all devices and present API for code reflection. A Push Logic program
applications must advertise their behaviour beforehand consists of a bundle of rules that must be checked
by code reflection. Our API for code reflection is a before execution. Devices and rules enter on a first-
formally verifiable logic language, called Pushlogic, come basis and hence take priority over subsequent
into which all the control software is eventually disagreeing arrivals. Using the Push Logic approach,
translated. We use a home control scenario to highlight all application scripts within an environment of
different aspects of our logic-based control of these participating devices must either be implemented in
Pebbles. This work is carried out under the CMI Push Logic, or else be summarised in it. A high-level
Goals/Pebbles project (1)~\cite{goalspaper}. language, such as Push Logic source, is compiled to
generate Push Logic object code. In future, there can
be various routes to this object code e.g. from Push
INTRODUCTION[ADD SOMETHING ABOUT Logic source code compiler and from tangible, speech
DOMAIN MANAGER somewhere] and gesture interfaces source compilers (Figure 1 Push
Logic Tool Chain Flow). The object code is then
[INSERT GRAND CHALLENGE PAPER REF] canned in ROM for direct interpretation in the
Ours is a joint project with MIT under the CMI 1 embedded target or further compiled to native code for
initiative and is in the realm of Pervasive or Ubiquitous a micro-controller. The latter approach uses far less
Computing. At Cambridge, we are investigating ways RAM. In all routes, a Push Logic form of each
to enable heterogeneous devices in a constrained application is made available for checking in advance
environment like a home, car, or a spacecraft to better of the application being allowed to join the
serve the needs of the occupants in an efficient, environment of participation. Rehydration, or binding,
unobtrusive, natural and conflict-free manner. Current of canned code is the process of mapping textual
technologies like UPnP, WSDL or XML-RPC are identifiers found in the source code to actual objects
mature enough to register these devices and specify found in the execution environment and taking default
and export their command APIs in such environments, actions if there is no mapping to hand. We have built
but so far little consideration has been given to the some simple embedded pebbles ~\cite{mollies} based
automated description of the proactive behaviour of on CPU cards that operate under Push Logic scripts.
these interacting devices, and to the resolution of
conflicts arising out of this interaction e.g. when [Write something about the sections to come]
different devices try to play different channels on the
same TV simultaneously. Automated Home
The home is an eternal, heterogeneous, distributed
We are exploring solutions under the umbrella name computing environment which must be secure and
AutoHAN (automated home area network) reliable. Computers and embedded processors in the
~\cite{autohanweb}. In our approach, each device must home are all different shapes, sizes and ages. Hence the
be architecturally componentised into some number of home is representative of an automated constrained
passive pebbles governed by a set of rules in environment that poses some of the toughest
Pushlogic. A pebble could be a hardware component, challenges for co-operative programming. The number
such as a fire alarm sounder, or it could be an entirely of microprocessors in the western home of today can
virtual networked device, such as a speech recogniser. easily exceed one hundred. In the past, each processor
Pushlogic is our own scripting language that is ran some ROM code that encapsulated a fixed
amenable to automated reasoning. It operates on data application that was never upgraded. An application
held in tuples that may contain other tuples in a tree was typically a simple event control loop which, for
structure. The runtime system for tuple space instance, ejected the CD player drawer when the eject
1
button was pressed, and implemented a rule of not
Cambridge-MIT Institute
much greater complexity for each of the other buttons house for user interaction. All of these devices have
on the device or on the device's dedicated IR controller. been mocked up in our lab as physical prototypes or
However, as devices become networked the interaction virtual devices using a process with a GUI on a
of these `canned' applications becomes important. workstation.

Therefore we argue that all embedded applications \subsubsection {Multimedia}


should export the details of their operation—their Push Logic is currently interpreted and the interpreter
‘semantics’—over the network. This is a natural does not have sufficient throughput to directly
extension to what is offered, for example, in UPnP for manipulate multimedia streams. Instead, multimedia
exporting device description and providing device streams are started, stopped and routed using Push
control. UPnP enables a device to describe itself and Logic as a control plane. Even when compiled, it is
offer an API to allow remote applications to invoke its preferred not to directly manipulate the media. The
internal functions. However, UPnP does not export the Push Logic sets fields2 held on media pebbles, such as
canned application inside a device and so there is no cameras, speakers, fileservers and so on, to circuit
knowledge of what a device will actually do when identifier values. The Pebbles then send the media
introduced to the environment. Only if a device exports streams amongst themselves until again commanded by
information about the control code that it introduces the Push Logic.
into the home can the home remain stable.
\subsubsection Asynchronous Eventing
We envisage serious uses of the equipment in the Push Logic may be thought of as an algebra over
home, such as the fire alarm presented in example asynchronous events. Our fields implement a
below, alongside trivial applications, such as a program publish/subscribe mechanism. The existence of fields
found on a freebie smartcard in a cornflakes box that is published in the reflection information of a device
turns the house lighting into a disco sound-to-light and they are bound at rule rehydration time. When a
system. Therefore it is essential that priorities between field changes, our wire protocol sends asynchronous
competing applications can be determined and notifications to the subscribers.
potential conflicts determined before they arise. In
addition, we will wish to impose a large set of [ASK ABOUT NOTE BY DAVID (FIG X, FIG Y)
rules/[constraints] on the system regarding the ON P.4 OF DRAFT]
allowable reachable states and perhaps the rate of
expenditure of children’s electronic pocket money. \subsubsection{Timer}
Apart from not disabling the burglar alarm, a base rule Frequently, rules must fire at a particular time of day,
set may restrict the user from locking himself out of the or describe constraints that apply only for specific
house or spending more than 100 pounds per day on periods of time. Examples are, respectively, “Turn the
video network services. All this requires a language—a light on at 6:30 pm” and “All lights must be off
code reflection API—that is amenable to automated between 01:00 and 06:30”. As a basis for execution of
reasoning and to which all device applications can be temporal rules, a clock device is provided as a local
directly or indirectly converted. We are developing resource at each Push Logic interpreter. At the object
Push Logic to fulfil this role. level, it is accessed in the same way as any other
pebble, but hooks for handling time are built into a
\section{An Illustrative Automated Home Scenario} library implemented in the Push Logic source
\subsection{General Description} language.

We shall now describe the operation of a few devices \subsubsection{Some Push Logic Semantics}
in the automated home to outline the types of rules in Push Logic interacts with pebbles by monitoring and
operation. To facilitate understanding, we shall use changing fields held inside a pebble. Pebbles also
standard logic symbols. Details of the semantics and monitor and change these fields. When a pebble
syntax of Push Logic for doing the same can be found changes a field, we call this a ‘unilateral’ change. For
in ~\cite{Semantics paper DJG}. example, a keypad pebble will make a unilateral
change to one of its fields when a user presses a button.
Figure 2 [\emph{the big diagram}] is a schematic Equally, a local timer pebble will make a unilateral
embodying common home devices such as alarm change to a field as it expires. Push Logic object rules
clock, heating control, TV, etc. It shows a mobile [define source and object] are predicates over subsets
phone commanding heating control and the front door of the fields in a domain of participation and have three
lock through an SMS pebble. An alarm clock is forms: executable, liveness and safety.
controlling a DVD player, heating control, and a
curtain opening mechanism. The fire alarm controller Safety:
is responsible for generating a fire alarm through
klaxons in case smoke is detected by a smoke sensor 2
A field is a scalar variable name in a global namespace. Our Push
pebble. It also takes inputs from a timer and general- Logic implementation is part of a distributed tuple space platform
purpose keypads installed at various locations in the and hence variables are called fields.
klaxon pebbles that ensures that a klaxon will sound if
S ( q )  true any klaxon in its local domain is sounding:
[GIVE EXAMPLE]
$# sounding : $domain# klaxons# sounding
where S is the safety predicate.
The domain was set up by the rehydration stage when
Executable:} [not clear] the klaxon first switched on.

Control for fire alarm: We would like the klaxons to


⊢ i p (i ) sound if a fire alarm detects fire:

Liveness: [not clear] $domain# klaxons # sounding :


[GIVE EXAMPLE] $domain# firealarm # de
S stable  {s |  p ( q )} But if the fire alarm is turned off by the user, which
sets its muted variable to 0, we would like the klaxons
where p is the r.h.s. of an executable rule. to be muted too:

Liveness and safety rules are assertions to be checked if ($domain# firealarm # muted )
by a model checker invoked by the loader (the model $ domain# klaxons# sounding
checker can be run as a network service or as a process
on the target execution platform). The combination of Imagine that the user forgets to reset the fire alarm and
the current bundle and all other rules in the domain of there is another fire—there will be no alarm now as the
participation is model checked. If all assertions still klaxons are still muted. To avoid this hazard, we can
hold, then the new bundle is acceptable to the domain use a timer to clear the mute after, say, twenty minutes
and becomes part of it. Execution of its executable if a fire is detected.
rules is then allowed. Normally, one bundle is loaded
onto one bytecode interpreter (execution platform) for if ( dom ain #
tim e # fi r
fir
ealar
execution, but it could potentially be split over several if (tim e # fireal ar
if required rule associations that use local field names $ domai n # fire

are not violated.


The ‘  ’ in front of an expression means its time
The conjunction of all executable and safety rules derivative. So that Push Logic programs do not
holds at all times, whereas liveness rules assert that the generate unstable behaviour, all integrators must be
predicate will hold infinitely often in the future (not inside differentiators. This means that [CHECK]
deadlocked). The executable rules have one output if ( x )(v : v  1)
field (more for pushbacks, which are not discussed in is not allowed because an infinite number of
this paper) that is to be changed when any input field increments will occur. Whereas,
changes such that the predicate does not hold if ( x )(v : v  1)
temporarily.
is allowed (provided both x and x̂ are both held on
\subsection{Logic Control} the same execution platform), which expands to
We now present various example rules that govern the if ( x  xˆ )(v : v  1)
behaviour of these home devices. It will be obvious xˆ : x
from the rules whether these are canned in the devices where x̂ is hidden in # local by the compiler.
themselves or are part of the bundles stored in the
central controller(s). We use the dot operator in the Dedicated Mute Button: We have a dedicated mute
usual sense of accessing an attribute in the object-
button represented by $domain# q , where
oriented part of the compiler and use # in the same
sense elsewhere, optionally through a series of # ($domain# devicetype ' Keypad ' )  ( q :' Mutebutton'
operators that travel down a hierarchy of domains and
devices, e.g. x# y means the y attribute of variable [CHECK]This is a universal quantification over all
x , and x # y # z means the z attribute of variable devices rehydrated to a number of simple rules. The
y that, in turn, is contained in x . We use $ for user presses this button, provided on different keypads,
local variable, : for assignment, and for to mute the fire alarm:
equality.
if ($# keys # mutebutton)
$ domain# firealarm # muted

Klaxon Canned Rule: Taking klaxon to be a standard


sounding device in home, we can store a rule in all the As an example, consider the following possible safety
rule:
A sounding fire alarm is never muted, except by thehttp://www.cag.lcs.mit.edu/~umar/publications/ubisys.
dedicated mute buttons. pdf
This can be expressed as the following two-equation[2] The AutoHAN project.
set: www.cl.cam.ac.uk/Research/SRG/netos/han/AutoHAN
[3] Molly CPU Cards for AutoHAN/Pebbles.

  detect (i ) 
  
  sounding( j ) 

http://www.cl.cam.ac.uk/Research/SRG/HAN/molly/m
 sensors   klaxons  olly.html
  [4] Semantics paper
  mutebutton(i )    $domain# firealarm # muted
 keypads 

Again, the quantification is done at hydration time.

Canned rule for a new smoke sensor: [not clear to me]


$ dom ain# devicetype : ' Sm okeSens or '
if ( $# s ensor s # de tect  1)
$ dom ain # firealar m # d etect  1

SMS Pebble:[CHECK]
If we receive an SMS message on our mobile phone
that a fire alarm is sounding but [WHAT
SCENARIO?]…
if ( self .msg :' MuteFireAlarm' )
$domain# firealarm # muted  1
\section {Conclusions}
[to be written]+[enhance references]

\begin{thebibliography}{99}
\bibitem{goalspaper}`A Case for Goal-oriented
Programming Semantics' in System Support for
Ubiquitous Computing Workshop at the Fifth Annual
Conference on Ubiquitous Computing (UbiComp '03).
Umar Saif, Hubert Pham, Justin Mazzola Paluska,
Jason Waterman, Chris Terman, Steve Ward.
http://www.cag.lcs.mit.edu/~umar/publications/ubisys.
pdf
http://o2s.csail.mit.edu/goals.html

\bibitem{autohanweb}The AutoHAN project.\\


www.cl.cam.ac.uk/Research/SRG/netos/han/AutoHAN

\bibitem{mollies}Molly CPU Cards for


AutoHAN/Pebbles.\\
http://www.cl.cam.ac.uk/Research/SRG/HAN/molly/m
olly.html

\bibitem{Semantics paper DJG}Semantics paper

\end{thebibliography}

[1] ‘A Case for Goal-oriented Programming


Semantics’ in System Support for Ubiquitous
Computing Workshop at the Fifth Annual Conference
on Ubiquitous Computing (UbiComp ’03). Umar Saif,
Hubert Pham, Justin Mazzola Paluska, Jason
Waterman, Chris Terman, Steve Ward.
http://o2s.csail.mit.edu/goals.html

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy