28
March 2012 - Business Confidential - Bitreactive AS Frank Alexander Kraemer, Ph.D. Bitreactive AS, Trondheim @fralkr Developing Robust IoT Gateway Applications from Building Blocks HIPEAC CSW & BR Oslo, May 4-8, 2015 Internet of Things (IoT): Technology and Applications for a Good Society

Developing Robust IoT Gateway Applications from Building Blocks

Embed Size (px)

Citation preview

Page 1: Developing Robust IoT Gateway Applications from Building Blocks

March 2012 - Business Confidential - Bitreactive AS

Frank Alexander Kraemer, Ph.D.

Bitreactive AS, Trondheim

@fralkr

Developing Robust IoT Gateway Applications from Building Blocks

HIPEAC CSW & BR Oslo, May 4-8, 2015

Internet of Things (IoT): Technology and Applications for a Good Society

Page 2: Developing Robust IoT Gateway Applications from Building Blocks

March 2012 - Business Confidential - Bitreactive AS

Summary

Gateways are essential components in IoT systems. Apart from providing network access to the leaf nodes, they can also run applications. This is important to reduce response time, network traffic, keep sensitive data within local boundaries and keep the system up even if the network is down. Home gateways, industrial field agents, on board units and roadside stations are examples for gateways. 

Application development for such gateways is hard. Since gateways tie together hardware and network resources, developers need a broad set of skills to begin with. Development is further complicated since applications must work autonomously, managed remotely and handle the incoming streams of events. To solve these challenges, we have developed Reactive Blocks, a tool to create applications from building blocks. Blocks can encapsulate protocols, hardware access and application patterns. This leads to increased reuse, enables automatic code generation and automated checking of designs.

Page 3: Developing Robust IoT Gateway Applications from Building Blocks

March 2012 - Business Confidential - Bitreactive AS

Frank Alexander Frank Alexander Kraemer studied Electrical Engineering and Information Technology at the University of Stuttgart, Germany, and received his Ph.D. from the Norwegian University of Science and Technology (NTNU) in 2008. Frank has experience with the development of software tools, initiated by an internship at IBM, Germany, where he helped integrating tools into the Eclipse platform. During the research for his Ph.D. thesis, he developed an engineering method for the design of reactive systems at the Department for Telematics, NTNU. The results of this research are usable with the Reactive Blocks tool, which is currently applied to a number of industrial projects. Frank is co-founder of Bitreactive AS, which helps other companies to deliver new applications built with Reactive Blocks.

Page 4: Developing Robust IoT Gateway Applications from Building Blocks

Title - edit manually in the normal master 4

A selection of gateways. All of them can run Linux and a

Java VM.

Page 5: Developing Robust IoT Gateway Applications from Building Blocks

Title - edit manually in the normal master 5

Examples for use cases of application

gateways.

Page 6: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

A smart parking house that shows you where the last free spots are.

Page 7: Developing Robust IoT Gateway Applications from Building Blocks

Gateway

Things

Cloud

BLE ZigBee Thread6LowPANMQTTCoAP

IPv6

MQTT HTTP CoAP AMQP …

A current basis architecture for IoT

systems, consisting of cloud, gateways and

the connected things.

Page 8: Developing Robust IoT Gateway Applications from Building Blocks

IoT Application Gateways- roadside stations - onboard units - residential gateways - field agents

Page 9: Developing Robust IoT Gateway Applications from Building Blocks

Gateway

Things

Cloud

Hardware

Operating System

JVM

A 1 A 2 A 3

Applications

Gateways can execute IoT applications. This can reduce latency,

reduce bandwidth, and keep data secure.

Page 10: Developing Robust IoT Gateway Applications from Building Blocks

Gateway

Things

Cloud

Hardware

Operating System

JVM

A 2 A 3

Applications

A 1

life cycle

services

config changes

messages

network

hardware signalshardware changes

The challenge is that each application needs

to handle lots of events. And

concurrent, event-drivem programming

is difficult.

Page 11: Developing Robust IoT Gateway Applications from Building Blocks

Title - edit manually in the normal master 11

That’s how a program looks like when we just

start coding, and concurrency is not handled correctly.

Page 12: Developing Robust IoT Gateway Applications from Building Blocks

Title - edit manually in the normal master

two types of spaghetti

■ Spaghetti code ■ GOTO is not the problem, but unstructured programming is

■ lots of blocking code, because of communnication to network and interaction with HW, also events and interrupts. —> start with concurrent programming

■ Spaghetti threads ■ in concurrent programming, threads can build spaghetti as well ■ you really give up to understand it

12

You may think “Ahh, spaghetti code!”. But

it’s even worse. There’s two types of spaghetti. You also deal with spaghetti

threads.

Page 13: Developing Robust IoT Gateway Applications from Building Blocks

So this is how it usually turn out with naïve

programming. Easy in the beginning, hard in

the end.

Page 14: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

Let’s instead solve this problem by cleaning up

the mess, and put everything into boxes, a.k.a. building blocks.

Page 15: Developing Robust IoT Gateway Applications from Building Blocks

CoAP Resource

ok

getResponse

init

failed

get

post

Config Listener

initConfig

start

updatedConfig

Kura CloudClient

readypublish

start

stop

waiting

stopped

failed

msgArrived

MQTT Core

initOksubscribe

init

initFailed

publishOk

message

error

stopped

disconnected

unsubscribe

publish

stopRPi GPIO Digital In

valuestop

init

initError

initOk

isLow

isHigh

stopped

read

initPS

Config Listener

initConfig

start

updatedConfig

playing

Modbus

initOkexecutedReadIn

init

initFailed

readDone

writeDone

readFailed

stopped

writeFailed

deviceId

executedWrite

stop

executeReadHold

registerId

1 2 3Config Listener

initConfig

start

updatedConfig

Reactive Blocks

Page 16: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

public void ledOn() {logInfo("Switching on LED");leds[0].setState(true);

}

public void ledOff() {logInfo("Switching off LED");leds[0].setState(false);

}

In Reactive Blocks, Java methods are the

smallest units of behavior. Here two

simple ones that turn an LED on and off.

Page 17: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

To let the LED blink, we just add a timer in between.

When an operation is called is determined graphically.

Its contents is still programmed.

Page 18: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

We can wrap that blink into a building block. (This is a very

simple block, there can be much more complex ones!)

Page 19: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

Page 20: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

We can add some logic to let the LED blink periodically.

Page 21: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

And also wrap that periodic timer as a new building

block.

Page 22: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

And the combination of these two blocks can in turn be a

building block.

Page 23: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

OSGi

Applications consist of a nice hierarchy of blocks, many of

them reused.

There are many libraries with blocks for typical IoT

functions.

Page 24: Developing Robust IoT Gateway Applications from Building Blocks

Interfaces✔ Names✔ Types✘ Sequences✘ Timing Traditional interfaces cover

method names and types, but do not help us with

timing and sequences of methods.

Page 25: Developing Robust IoT Gateway Applications from Building Blocks

INHOLD Corporate Identity Manual 7

X

X X

X/2

X/2

LOGO SCALE GUIDELINES

The logo must be surrounded with adequate clear space to ensuremaximum prominence and visual impact.

All scaling of the logo is to be proportional.

In case the logo needs to appear on a limited background, the minimum size allowed is not less than 15 mm.

min 15 mm

LOGO

Therefore, a reactive block has a contract, that

describes in which sequence we can use its pins. Here a

very simple example.

Page 26: Developing Robust IoT Gateway Applications from Building Blocks

Model CheckingAutomatic

This enables a mathematical analysis called “model

checking”. And in Reactive Blocks, it works

automatically, without any extra effort.

Page 27: Developing Robust IoT Gateway Applications from Building Blocks

Here the analysis finds if we abort a termination

sequence and hence do not reach the final state. Very

useful.

Page 28: Developing Robust IoT Gateway Applications from Building Blocks

Reactive Blocks

bitreactive.com