Towards Application Development for the Internet of Things* Pankesh Patel ABB Corporate Research, India * This research work is partially done at University of Paris VI and French National Institute for Research in Computer Science & Automation (INRIA), Paris, France
54
Embed
Towards application development for the internet of things
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Towards Application Development for
the Internet of Things*
Pankesh Patel
ABB Corporate Research, India
* This research work is partially done at University of Paris VI and French National Institute
for Research in Computer Science & Automation (INRIA), Paris, France
image credit to organizations, who own copyrights of used images
7
Heterogeneity
Large number
Application logic in terms of
a set of distributed tasks for
hundreds
to thousands of devices
To reason at such levels of number is
impractical in general
image credit to organizations, who own copyrights of used images
Challenges
8
Heterogeneity
Large number
Multiple expertise
Knowledge from multiple
concerns intersect
Application domain
Software design
Algorithm design,
programming languages
Platform-specific
knowledge
Clear conflict with skill possessed by
the individual developer
Deployment
area
image credit to organizations, who own copyrights of used images
Challenges
9
Heterogeneity
Large number
Multiple expertise
Different life-cycle phases
Software development life cycle phases -- requirement analysis, design, implementation, testing, evolution
and maintenance [Ian Sommerville, Software Engineering (9th edition) , 2010]
Design: Application logic has to be analyzed and then
separated into a set of distributed tasks.
Implementations: Application has to be implemented
for heterogeneous platforms
Deployment: Tasks of an application have to be
decomposed in a (large) number of heterogeneous
devices.
Challenges
Existing approaches
10
Node-centric programming
Think in terms of activities of individual
devices & explicitly encode their
interactions with other devices.
Write a program that reads sensing data
from sensing devices, aggregates data
pertaining to the some external events,
decides where to send it addressed by
ID & communicates with actuators if
needed
Olympus with Gaia [Ranganathan et al., Percom, 2005], Context Toolkit [Dey
et al., HCI, 2001], TinyOS [Levis et al., MDM, 2006], Physical virtual mashup
[Guinard et al., NSS, 2010]
image credit to organizations, who own copyrights of used images
Existing approaches
11
Node-centric programming
Database approach
Queries to SN
Collects, aggregates, &
sends data to base station
Not flexible to introduce a
customized application logic.
Stakeholder
Base station
queries
collects
result
TinyDB [Madden et al., TODS ,2005], Semantic streams [Whitehouse et al., ,
EWSN, 2006], TinyREST [Luckenbach et al., REALWSN, 2005], TinySOA
[Aviles-Lopez , SOCA, 2009]
Existing approaches
12
Node-centric programming
Database approach
Macro-programming
Abstractions for high-level
collaborative behaviors
Lack of software engineering
methodology to support life
cycle phases – results in difficult
to maintain, reuse, and
platform-dependent design
Regiment [Newton et al., IPSN, 2007], MacroLab [Hnat et al.
, SenSys, 2008]
image credit to organizations, who own copyrights of used images
Existing approaches
13
Node-centric programming
Database approach
Macro-programming
Model-driven development
Vertical SoC – reduce app.
development complexity
separating PIM and PSM
Horizontal SoC – separate
different aspects of a system
Transformation and
code generators
PIM
PSM
E.g., J2SE E.g., .Net
PSM…
C1 C2 Cn…
Horizontal
Separation of
Concerns (SoC)
Vertical
separation of
concerns
ATaG [Pathak et al., DCSN, 2011], RuleCaster [Bischoff et al.,
EuroSSC, 2006], DiaSuite [Cassou et al., TSE, 2012], PervML
[Serral et al., Journal of Pervasive and Mobile computing, 2010],
Pantagruel [Drey et al., Percom, 2010]
image credit to organizations, who own copyrights of used images
Early contributions…
14
A comprehensive approach that utilizes advantages of existing MDD and
WSN macro-programming approaches, while focusing on ease of IoT
application development.
*It includes support programs, code libraries, high-level languages or other software that help stakeholders
to develop and glue together different components of a software product [Ian Sommerville, Software
Engineering (9th edition) , 2010].
Objectives:
Separate development into different concerns (reusability)
Integrate high-level modelling languages (reduce complexity & effort)
Automate development wherever possible (reduce effort)
Development framework*
Commonality
at various levels
15
Functionality(e.g., home
fire detection
Domain
(e.g., building
HVAC)
Deployment
Room
temperature
(e.g. building
automation)
Building fire
state
“Reusability
across concerns”
ABB- BTP
officeABB-Peenya
officeimage credit to organizations, who own copyrights of used images
Domain
16
Domain
Room
temperature
(e.g. building
automation)
Actuator
Sensor Storage
Concepts that are responsible
for interacting with EoI of a
domain
- Sensor, actuator, storage
Building fire
state
image credit to organizations, who own copyrights of used images
Functionality
17
Domain
Room
temperature
(e.g. building
automation)
FunctionalityHome fire
detectionBuilding
HVAC
Computational
service
Actuator
StorageSensor
Computational
service
responserequestpublish/
subscribeConcepts that are responsible for
- processing data and taking decisions
Building fire
state
command
image credit to organizations, who own copyrights of used images
Deployment
18
Domain
Room
temperature
(e.g. building
automation)
Functionality
Deployment
Device
Device
Device
Device Device
Building fire
state
Concepts to describe various
properties of devices
Actuator
Sensor Storage
Computational
service
Computational
service
responserequestpublish/
subscribe
Home fire
detectionBuilding
HVAC
command
ABB- BTP
officeABB-Peenya
officeimage credit to organizations, who own copyrights of used images
Modeling
languages
19
Domain
(e.g. building
automation)
Functionality
ABB- BTP
officeABB-Peenya
office
Deployment
Device
Device
Device
Device
Actuator
Sensor Storage
Computational
service
Computational
service
Home fire
detectionBuilding
HVAC
Vocabulary
Language (VL)
Architecture
Language
(AL)
Deployment
Language
(DL)
image credit to organizations, who own copyrights of used images
20
Hello world app in building automation: Personalized HVAC system
Badge
Reader
badgeDetected
badgeDisappeared
ProfileDB
profile
Proximity
Heater
off()
setTemp()
Temperature
Controller
Device
Device
Device
Device
Device
image credit to organizations, who own copyrights of used images
structs:
BadgeStruct
badgeID: String;
badgeEvent:String;
TempStruct
tempValue: double;
unitOfMeasurement: String;
resources:
sensors:
BadgeReader
generate badgeDetected: BadgeStruct;
generate badgeDisappeared: BadgeStruct;
actuators:
Heater
action Off();
action SetTemp(setTemp: TempStruct);
storages:
ProfileDB
generate profile: tempStruct accessed-by
badgeID: String;
21
Hello world app in building automation: Personalized HVAC system – vocabulary language
Badge
Reader
badgeDetected
badgeDisappeared
ProfileDB
profile
Proximity
Heater
off()
setTemp()
Temperature
Controller
Device
Device
Device
Device
Device
• Abstractions to specify heterogeneous
entities
• One entity description for many instances
computationalService:
Proximity
generate tempPref:TempStruct;
consume badgeDetected from region-hops:0:Room;
consume badgeDisappeared from region-hops:0:Room;
request profile;
partition-per:Room;
TemperatureController
consume tempPref from region-hops:0:Room;
command Off() to region-hops:0:Room;
command SetTemp(setTemp) to region-hops:0:Room;
partition-per:Room;
22
Hello world app in building automation: Personalized HVAC system – architecture language
Badge
Reader
ProfileDB
profile
Heater
off()
setTemp()
Device
Device
Device
Device
Device
Proximity
Temperature
Controller
Scope of
consuming dataScope of
Deployment
To reduce scale, devices can be grouped based on their
spatial relationship
- Cluster head is elected, responsible for processing
data of that cluster.
hops:0:Room
hops:0:Room
Room
Room
badgeDetected
badgeDisappeared
23
Hello world app in building automation: Personalized HVAC system – deployment language
Badge
Reader
ProfileDB
profile
Heater
off()
setTemp()
Device
Device
Device
Device
Device
Proximity
Temperature
Controller
badgeDetected
badgeDisappeared
Device1:
region:
Building:15 ;
Floor:11;
Room:1;
type:JavaSE;
resources: BadgeReader;
mobile: false;
Device2:
region:
Building:15 ;
Floor:11;
Room:1;
type: Android;
resources: Heater;
mobile: false;
Device3:
...
Type platform a
device runs on
Location of device
Property of a device
is specified individually – Not scalable.
Domain
concern
24
Domain
expert
Vocabulary
spec.
Compilation
of vocabulary
Domain expert (e.g. biologist, medical
system designer) understands domain
concepts.
Domain concepts
using vocabulary language
Badge
Reader
badgeDetected
badgeDisappeared
ProfileDB
profile
Proximity
Heater
off()
setTemp()
Temperature
Controller
image credit to organizations, who own copyrights of used images
Functional
concern
25
Domain
expert
Vocabulary
spec.
Compilation
of vocabulary
Architecture
spec.
Software designer
Software designer – understands
software architecture concepts,
Specifies computational components
using Architecture language
Badge
Reader
ProfileDB
profile
Heater
off()
setTemp()
Proximity
Temperature
Controller
badgeDetected
badgeDisappeared
image credit to organizations, who own copyrights of used images
Functional
concern
26
Domain
expert
Vocabulary
spec.
Compilation
of vocabulary
Architecture
spec. Compilation
of architectureApplication
developer
Architecture
frameworkSoftware designer
Application
logic
Architecture framework (in object-oriented GPL)
- Contains abstract classes
- Concrete methods
- Abstract methods
image credit to organizations, who own copyrights of used images
Implementing
application logic
27
Proximity
consume badgeDetected from region-hops:0:Room;
partition-per:Room;Compiler
generates
public void subscribeBadgeDetected() {
PubSubMiddleware.subscribe(this, “badgeDetected",
subscriptionCondition);
}
public void notifiedReceived (String event Name, Object arg,
Device deviceInfo) {
if (eventName.equals(“badgeDetected”) {
onBadgeDetectedEvent((BadgeStruct) arg) ;
}
}
public abstract void onBadgeDetectedEvent(BadgeStruct arg);
Concrete
method for
Subscription
request
Concrete
method for
Receiving
notifications
Application
developer
Structured code: Application Developer has to
locate methods to write application logic.
image credit to organizations, who own copyrights of used images
Deployment
concern
28
Vocabulary
spec.
Compilation
of vocabulary
Deployment
spec.
MapperNetwork
manager
Mapper – decides device where each computational
service will be executing
Mapping
files
Compilation
of architectureApplication
developer
Application
logic
Architecture
frameworkSoftware designer
Domain
expert
Architecture
spec.
ParserMapping Algorithm
Code Generator
Deployment Spec.
Architecture Spec.
Mapping files
Mapper
Data structures
Mappingdecisions
image credit to organizations, who
own copyrights of used images
Deployment
concern
29
computationalService:
Proximity
…
TemperatureController
…
Architecture
specification
devices:
Device1:
…
Device2:
…
DeviceN:
…
Deployment
Specification
Mapper
Device1:
Proximity
Device2:
TemperatureController
Mapping decision
(output in GPL)
Mapping decision
(output in GPL)
Platform
concern
30
Vocabulary
spec.
Compilation
of vocabulary
Device
developerDevice driver
Deployment
spec.
MapperNetwork
manager
Mapping
files
Compilation
of architectureApplication
developer
Application
logic
Architecture
frameworkSoftware designer
• Device developer – understands
inputs/outputs, protocols of
device platform
Vocabulary Framework
• Abstract classes with concrete
methods, interfaces
Device Driver
Sensing/actuating
framework
Vocabulary
frameworkDomain
expert
Architecture
spec.
image credit to organizations, who
own copyrights of used images
Implementing
device driver
31
public interface IBadgeReader {
public BadgeStruct getBadgeDetectedEvent();
public void getBadgeDetectedEvent(ListenerBadgeDetected handler);
}
Compiler
generates
BadgeReader
generate badgeDetected: BadgeStruct;
public class JavaSEBadgeReader implements IBadgeReader {
@Override
public BadgeStruct getBadgeDetectedEvent() {
// TODO: Write Device Driver
}
@Override
public void getBadgeDetectedEvent(ListenerBadgeDetected handler) {
// TODO: Write Device Driver
}
}
Device
developer
implements
interfaces
image credit to organizations, who
own copyrights of used images
Linking
32
Domain
expert
Vocabulary
spec.
Compilation
of vocabulary
Architecture
spec. Compilation
of architecture
Deployment
spec.
Mapper
Application
developer
Application
logic
Architecture
frameworkSoftware designer
Network
manager
Linker
Android
devices
PC
PC
Mapping
files
Combines and packs the code generated by
various stages into packages that can be
deployed on devices.
Generated code
For Device X
Middleware
Device
developerDevice driver
Vocabulary
framework
Device Driver
Sensing/actuating
framework
Middleware
Wrapper
image credit to organizations, who
own copyrights of used images
Evaluation
33
Development effort: the effort required to create a new application.
Reusability: the extend to which software artifacts can be reused during application development.
Expressiveness: the characteristics of IoT applications that can be modeled using our approach.
Technological change support: it indicates the support provided by the approach to change the implementation platform or programming language.
While the lines of code metric is useful, a number of limitations have been noted. It depends heavily on programming
languages, styles, and stakeholder’s skills. In view of this, we have combined one of well-known metrics – Code coverage (it
defines code which is actually executed, thus it show usefulness of the generated code), with LoC.
Example: Home automation
34
Motion sensor to detect the presence of a
moving object
Stove to sense if it is turned on/off
Badge
reader
Smoke
Detector
Fire
alarmHeater
Data
storage
Temperature
sensor
Room 2(bedroom)
Room 1 (Kitchen) Room 3
(MeetingRoom)
Application1: Personalized HVAC in Bedroom
35
Badge
Reader
badgeDetected
badgeDisappeared
ProfileDB
profile
Proximity
Heater
off()
setTemp()
Temperature
Controller
Device1 Device2
Device3
Device4
Device5
• 5 entities communicating
over MQTT* protocol
*MQTT (Message Queue Telemetry Transport) is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport.
• 5 devices simulated on
a single PC.
Aim: To demonstrate automation provided by
our approach.
Entities Name Platform
Sensor Badge
Reader
Android
(Simulated)
Storage ProfileDB MySQL
Server
Computation Proximity -
Temperature
Controller
-
Actuator Heater JavaSE
(Simulated)
Results…
Lines of code using Metrics 1.3.6 Eclipse plug-in.
Code Coverage using EclEmma Eclipse plug-in
• While considering code coverage, we wanted to measure code coverage of the generated code ,
not application logic, written by Application developer, and device driver, written by Device developer.
• Lines of Device driver code vary
from one platform to other
platform.
• Lines of application logic code
depend on functionalities.
• The other portion of code is unused features (e.g., getters, setters, exception handling, etc.),
which was not executed during experiments.
LoC Wriiten
by
Stakeholder
16%
Application
specific
generated LoC
63%
Provided
Wrapper with
Runtime
System LoC
21%
Code Coverage: 84%
37
Motion sensor to detect the presence of a
moving object
Stove to sense if it is turned on/off
Badge
reader
Smoke
Detector
Fire
alarmHeater
Data
storage
Temperature
sensor
Room 2(bedroom)
Room 1 (Kitchen) Room 3
(MeetingRoom)
Implement “Fire Mgmt.”
application
Application2: Fire Mgmt.
Application2:
Fire Mgmt.
38
Smoke
Detector
smoke
Presence
Temperature
Sensor
temperature
Measurement
Calculate
AvgTemp
FireState
Measurement
Fire
Controller
Alarm
activate()
deactivate()
Device2Device1
Device3
Device4
Device5
Device6
6 entities communicating
over MQTT protocol.
6 devices simulated on a
single PC.
Entities Name Platform
Sensor Smoke
Detector
JavaSE
(Simulated)
Temperature
Sensor
JavaSE
(Simulated)
Computation CalculateAvgTemp -
FireState
Measurement
-
FireController
Actuator Alarm JavaSE
(Simulated)
Results…
39
• Device driver code varies from one platform to other platform.
• Lines of application logic code depend on functionalities.