Dog2.3 Architecture

91
Dog2.3 Domotic OSGi Gateway Architecture Insights and development guidelines

description

An introduction to the Dog2.3 inner architecture. Stating from an high-level description of Intelligent Domotic Environment, this presentation provides deeper insights on the Dog architecture together with development guidelines for open source contributors.

Transcript of Dog2.3 Architecture

Page 1: Dog2.3 Architecture

Dog2.3 Domotic OSGi Gateway

Architecture Insights and development guidelines

Page 2: Dog2.3 Architecture

04/12/2023

Summary

Dario Bonino - Dog 2.32

Intelligent Domotic Environments System Architecture Dog 2.3

Overview Core Drivers Add-ons Run-time operation

Dog Development Guidelines

Page 3: Dog2.3 Architecture

General Picture

System Architecture

Page 4: Dog2.3 Architecture

04/12/2023

Intelligent Domotic Environments

Dario Bonino - Dog 2.34

A home setting in which a low cost

device (embedded PC) is added to new

or existing commercial domotic systems

allowing interoperation and supporting

more sophisticated automation

scenarios.

Page 5: Dog2.3 Architecture

04/12/2023

System Architecture

Dario Bonino - Dog 2.35

D D D D D D D D Domotic devices (switches, buttons, relays, sensors, meters, …)

Domotic bus (wired, wireless)

GWBus-to-IP gatewayBus-to-serial gatewayGW

Ethernet, Wi-Fi, USB

UserInterface

Mobile, Web, Home Display, Multi Touch, Accessibility, Natural language, …

Dog API

Data analysis

Dog API

ERP, Web services, Stream processors, Datawarehouse

Dog Bundles

Device abstraction, Event abstraction, State abstraction, Rules engine, …

UserInterfaceUser

Interface

SmartApplianc

e

Page 6: Dog2.3 Architecture

04/12/2023

In Ontology We Trust

Dario Bonino - Dog 2.36

Devices and networks exposed by means of a formal, unique, representation DogOnt (Ontology)

Applications only see DogOnt-based device descriptions Functionalities

Notifications Commands

States State values

Internal representations and drivers must be ontology-aware, at different degrees

Page 7: Dog2.3 Architecture

Dog 2.3

Architecture

Page 8: Dog2.3 Architecture

04/12/2023

High-Level Architecture

Dario Bonino - Dog 2.38

OSGi - based 2 main layers 3 main bundle

groups Core Drivers Add-ons

OSGiDrivers

Core Add-ons

Applications

XML-RPC / JSON

Page 9: Dog2.3 Architecture

04/12/2023

Core

Dario Bonino - Dog 2.39

Page 10: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.310

Page 11: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Dog REST EndPoint

Dario Bonino - Dog 2.311

Dog REST EndPoint Provides REST access to Dog Based on JSON or XML messages Under development

Page 12: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.312

Page 13: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Dog XML EndPoint

Dario Bonino - Dog 2.313

Dog XML EndPoint Provides XML-RPC access to Dog Based on XML messages Two Way Connection

Client to send notifications Server to listen application requests

Page 14: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.314

Page 15: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogStateMonitor

Dario Bonino - Dog 2.315

DogStateMonitor Keeps a snapshot of the state of all devices Allows for state change listener

registration Supports state querying

Typically asynchronous Synchronous through a different interface (API)

Page 16: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.316

Page 17: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogScheduler

Dario Bonino - Dog 2.317

DogScheduler Allows to schedule recurring tasks

involving Command execution (done through the

command handling bundles) State requests (done by reading the current

device state in dog – not on the network) Notification…?(for what?)

Page 18: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.318

Page 19: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogExecutor

Dario Bonino - Dog 2.319

DogExecutor Dispatches a command to relative

device object Performs command validation Supports message priority

No pre-defined priority levels Higher priority Higher Priority Value in the

corresponding DogMessage

Page 20: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.320

Page 21: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogDeviceManager

Dario Bonino - Dog 2.321

DogDeviceManager Implements the OSGi device manager

(device access specification) Manages device/driver attachment in

Dog When device/driver are

added/modified/removed

Page 22: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.322

Page 23: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogNotificationManager

Dario Bonino - Dog 2.323

DogNotificationManager Implements the Event Admin Service

Specification Version 1.2 It is based on a event publish and subscribe

model Filters inner state change notifications from

outer ones (visible to applications) Dispatches Notification and State Change

Notifications only

Page 24: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.324

Page 25: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogDeviceFactory

Dario Bonino - Dog 2.325

DogDeviceFactory Creates device istances according to the

runtime home configuration Either provided by the SimpleHouseModel or by

the Semantic House Model

Page 26: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.326

Page 27: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogOntLibrary

Dario Bonino - Dog 2.327

DogOntLibrary All possible

Devices (interfaces) Functionalities

classes

State classes State value classes

Programmatically generated from DogOnt

Page 28: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.328

Page 29: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogDeviceModel

Dario Bonino - Dog 2.329

DogDeviceModel All possible

Device implementations

Page 30: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.330

Page 31: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogSemanticHouseModel

Dario Bonino - Dog 2.331

DogSemanticHouseModel Manages the home description in form of DogOnt instances Supports configuration requests Supports model merging Implements classification and basic reasoning Supports interoperation rules extraction Potentially provides access to all properties/features defined in DogOnt Can generate XML home configuration to be used by the

SimpleHouseModel

Page 32: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.332

Page 33: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogSimpleHouseModel

Dario Bonino - Dog 2.333

DogSimpleHouseModel Manages the home description in XML Used for Dog instances running on devices with low

computational power No model-merge capabilities No reasoning support If a SemanticHouseModel is present, this bundle automatically

shuts down

Page 34: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.334

Page 35: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogConfigurator

Dario Bonino - Dog 2.335

DogConfigurator Manages bundle-specific configurations

Property files XML files Additional files (ontology, images, etc.)

Provides configurations to all bundles implementing the ManagedService interface

Page 36: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.336

Page 37: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogLogger

Dario Bonino - Dog 2.337

DogLogger Provides logging facilities to all Core bundles Can log on console or file Can apply different handlers (file, console) to

different logging levels

Page 38: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.338

Page 39: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Dog2Library

Dario Bonino - Dog 2.339

Dog2Library Defines all the Message Types used for inter-bundle

communication Defines all the bundle service interfaces Defines core-level notifications (not defined in

DogOnt) Provides utility classes to other bundles

Page 40: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.340

Page 41: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogJaxBLibrary

Dario Bonino - Dog 2.341

DogJaxBLibrary Provides XML serialization / de-serialiazion for

Inner messages Outer messages Configurations Etc.

Page 42: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.342

Page 43: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

DogSemanticLibrary

Dario Bonino - Dog 2.343

DogSemanticLibrary Encapsulates and makes available all

semantics-related libraries Jena Pellet SPARQL query facilitator

Page 44: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.344

Page 45: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

MeasureLibrary

Dario Bonino - Dog 2.345

MeasureLibrary Exports the JScience library to all Dog

bundles Will define un-supported JScience unit of

measures

Page 46: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Core

Dario Bonino - Dog 2.346

Page 47: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

Org.rxtx

Dario Bonino - Dog 2.347

Org.rxtx Exports the serial port API library (rxtx) to all

Dog bundles

Page 48: Dog2.3 Architecture

04/12/2023

Drivers

Dario Bonino - Dog 2.348

Page 49: Dog2.3 Architecture

Drivers

04/12/2023Dario Bonino - Dog 2.349

KNXNetIP

EIBLibIP

OpenWebNet

Modbus

Elite

Echelon

ZWave

TexasInstruments

Page 50: Dog2.3 Architecture

04/12/2023

Driver structure

Dario Bonino - Dog 2.350

Network Driver

Gateway Driver

DriverDriverDevice

Driver

Page 51: Dog2.3 Architecture

04/12/2023

Network Driver

Dario Bonino - Dog 2.351

Gateway Driver

DriverDriverDevice

Driver

Network Driver Handles network-level communication

Protocol Connection Polling (when needed)

Defines the network access APIs for all driver bundles, for the same technology

Page 52: Dog2.3 Architecture

04/12/2023

Driver structure

Dario Bonino - Dog 2.352

Network Driver

Gateway Driver

DriverDriverDevice

Driver

Page 53: Dog2.3 Architecture

04/12/2023

Gateway driver

Dario Bonino - Dog 2.353

Gateway Driver

DriverDriverDevice

Driver

Gateway Driver Supports multi-gateway operation for a

given network technology Handles the association between devices and

gateways Permits to install device driver bundles only if

the corresponding network gateway is present (in the configuration)

Page 54: Dog2.3 Architecture

04/12/2023

Driver structure

Dario Bonino - Dog 2.354

Network Driver

Gateway Driver

DriverDriverDevice

Driver

Page 55: Dog2.3 Architecture

04/12/2023

Device Driver

Dario Bonino - Dog 2.355

Gateway Driver

DriverDriverDevice

Driver

Device Driver Implements the DogOnt device features

for a given class of devices Translates ontology-defined commands,

functionalities and states into network level messages

One device driver per each DogOnt device class Sometimes the same driver can serve multiple

device classes but this should be avoided

Page 56: Dog2.3 Architecture

04/12/2023

Add-ons

Dario Bonino - Dog 2.356

Page 57: Dog2.3 Architecture

04/12/2023

Add-on

Dario Bonino - Dog 2.357

DogRulesBundle

DogPowerModelBundle

DogPowerBundle

Page 58: Dog2.3 Architecture

04/12/2023

DogRulesBundle

Dario Bonino - Dog 2.358

DogPowerModelBundle

DogPowerBundle

DogRulesBundle Provides a rule-engine runtime for

Defining automation scenarios Interoperation Complex device behaviors

Programmable through dedicated DogMessages XML-based rule definitions

Uses notifications as triggers, states as constraints and commands as rule consequent

Supports time-driven triggers

Page 59: Dog2.3 Architecture

04/12/2023

Add-on

Dario Bonino - Dog 2.359

DogRulesBundle

DogPowerModelBundle

DogPowerBundle

Page 60: Dog2.3 Architecture

04/12/2023

Add-on

Dario Bonino - Dog 2.360

DogRulesBundle

DogPowerModelBundle

DogPowerBundle

DogPowerModelBundle Handles the power extension of

DogOnt Plug in the main Semantic House Model

Provides power-specific query functionalities on the model

Page 61: Dog2.3 Architecture

04/12/2023

Add-on

Dario Bonino - Dog 2.361

DogRulesBundle

DogPowerModelBundle

DogPowerBundle

Page 62: Dog2.3 Architecture

04/12/2023

Add-on

Dario Bonino - Dog 2.362

DogRulesBundle

DogPowerModelBundle

DogPowerBundle

DogPowerBundle Exploits the DogPowerModelBundle Provides power consumption estimation based on

Actual measures Typical/Nominal values defined in the DogOnt power

extension Disaggregates actual measures when needed Keeps an updated snapshot of the current home

power consumption

Page 63: Dog2.3 Architecture

04/12/2023

Runtime Operation

Dario Bonino - Dog 2.363

Page 64: Dog2.3 Architecture

04/12/2023

Start-up

Dario Bonino - Dog 2.364

Development Configured in Eclipse (Helios) Bundles are automatically started No pre-defined start-up order

Production Bundles are started by the DogAutoStart bundle No pre-defined start-up order for most bundles If both Semantic and Simple House Model are

present, the Simple House Model is shut down

Page 65: Dog2.3 Architecture

04/12/2023

Start-up order?

Dario Bonino - Dog 2.365

No explicit order, except for the DogAutoStart bundle

Each bundle waits for the availability of required services before registering to the OSGi framework

When off-line and run-time dependencies are satisfied, bundles register their own services, possibly enabling the registration of other bundles

Library bundles start without waiting No dependencies

Page 66: Dog2.3 Architecture

04/12/2023

Start-up example

Dario Bonino - Dog 2.366

Bundles are installed Bundles start their lifecycle and become resolved Bundles with no dependencies start (active)

All library bundles The other bundles start as soon as their

dependencies are satisfied (service being available) When an House Model provider (either the Simple or

the Semantic House Model) becomes available The device factory creates all devices defined in the house

model The device manager takes care of device/driver

attachment All devices for which a driver cannot be found become idle

Page 67: Dog2.3 Architecture

04/12/2023

Start-up example

Dario Bonino - Dog 2.367

On the driver side Network drivers start as soon as the

DogConfigurator is started (if they need configuration)

Gateway drivers start when their associated network driver becomes active (exposing the network service)

Device drivers become active if both the network driver and the gateway driver for their associated technologies are active

When a device (gateway) driver becomes active All idle devices are matched against the driver

Matching devices attach the driver and become active Non-Matching devices remain idle

Page 68: Dog2.3 Architecture

04/12/2023

Device access (OSGi)

Dario Bonino - Dog 2.368

DogDeviceManager

DeviceDriver

DogDeviceModel

DogDeviceCategory

Page 69: Dog2.3 Architecture

04/12/2023

Command handling (1)

Dario Bonino - Dog 2.369

Application

Dog

Command

Page 70: Dog2.3 Architecture

04/12/2023

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2LibraryDogJaxBLibrary

DogSemanticLibrary MeasureLibrary org.rxtx

DogA

uto

Sta

rt

KNX Modbus Echelon OpenWebNet ZWave

Command handling (2)

Dario Bonino - Dog 2.370

Command

Network Message

Page 71: Dog2.3 Architecture

04/12/2023

Notification handling (1)

Dario Bonino - Dog 2.371

Application

Dog

Notification

Page 72: Dog2.3 Architecture

DogXMLEndPoint DogRESTEndPoint

DogStateMonitor

DogScheduler

DogExecutor

DogDeviceManager

DogNotificationManager

DogLoggerDogConfigurator

DogDeviceFactory

DogOntLibrary

DogDeviceModel

DogSemanticHouseModel

DogSimpleHouseModel

Dog2Library DogJaxBLibrary

DogSemanticLibrary

MeasureLibrary

org.rxtx

DogA

uto

Sta

rt

KNX Modbus Echelon OpenWebNet ZWave

Rules

PowerModel Bundle

PowerBundle

Notification handling

04/12/2023Dario Bonino - Dog 2.372

Page 73: Dog2.3 Architecture

Dog Development Guide

A quick reference to Dog development patterns

Page 74: Dog2.3 Architecture

04/12/2023

The Dog Mantra

Dario Bonino - Dog 2.374

3. Configuration first

1. In DogOnt we trust

2. Never stop auto-generation

Page 75: Dog2.3 Architecture

04/12/2023

In DogOnt we trust

Dario Bonino - Dog 2.375

Internal representations and drivers must be ontology-aware, at different degrees

Therefore: All device-related bundles / modules / libraries must

be compliant with the DogOnt model Functionalities States Behaviors

Whenever a new device must be represented First check the corresponding ontology

If missing, amend the ontology (by coordinating your action with the coordinator of the ontology development “group”)

If present, conform to the device model when developing the corresponding driver / module / library

Page 76: Dog2.3 Architecture

04/12/2023

In DogOnt we trust (2)

Dario Bonino - Dog 2.376

DogOnt is not only for description! At runtime it is used for

Answering model queries Configuration Interoperation rules

Provide model handling capabilities Model update Model merging Model querying (see above)

Offline it is used for Describing specific environments (related to runtime) Ensure DogDevice / DogOnt device coherency

By means of AutoGeneration

Page 77: Dog2.3 Architecture

04/12/2023

In DogOnt we trust (4)

Dario Bonino - Dog 2.377

Even when we do not use it! Installations with reduced computational power

Simple Home XML configuration

Auto-generation from the full ontology instantiation Using the same process adopted for runtime configuration

querying using the Semantic House Model I.e.,

it.polito.elite.domotics.ontologies.dogont.DogOnt2XMLDog

Page 78: Dog2.3 Architecture

04/12/2023

In DogOnt we trust (3)

Dario Bonino - Dog 2.378

ThingBuilding thing

Controllable

Appliances

WhiteGoo

ds

Brown

Goods

HousePlants

Electrical

System

HVAC

System

Security

UnControllablle

SemanticHouseModel

Device Representations

AutoGeneration

Configuration Lamp1

Lamp2

Button1

Controls

Controls

PowerModel

PowerConsumption

Eletric PowerConsumption

Imports

Configuration

Plug

Model

Applica

tions

DogOntInstances

Lamp1Pw = 18W

Page 79: Dog2.3 Architecture

04/12/2023

Never Stop Auto-generation (2)

Dario Bonino - Dog 2.379

Ensure DogDevice / DogOnt device coherency Autogenerate all possible components starting

from the ontology Device category Device model DogCommands DogStates DogStateValues

> 400 Java classes in one time (< 1 min) Advantages

Only two points of failure The autogeneration process The class templates used in the generation process

Page 80: Dog2.3 Architecture

04/12/2023

Never Stop Auto-generation (3)

Dario Bonino - Dog 2.380

Advantages Less burden on writing very similar classes Less errors as writing device-related classes is

error prone Quick generation time Robust enough to tackle typical ontology changes

Class creation / modification / deletion

Shortcomings Needs changes if the ontology structure changes

heavily Relation / Property changes

Especially if existing, core properties are modified However change effect is confined to the auto-

generation process

Page 81: Dog2.3 Architecture

04/12/2023

Never Stop Auto-generation (4)

Dario Bonino - Dog 2.381

Available through Dog Utilities

i.e., it.polito.elite.domotics.ontologies.dogont.DogOnt2Dog.

In conclusion… Never stop auto-generation, i.e., auto-generate all the Dog modules that can

be written by only exploiting DogOnt and Code templates

Page 82: Dog2.3 Architecture

04/12/2023

Configuration First

Dario Bonino - Dog 2.382

Bundle-specific information E.g., network addresses, ports, sampling times,

configuration files, etc. Must be exposed through the DogConfigurator

service i.e., must be accessed through the ManagedService

interface Avoid hard-coding

Never, never, never Hardcode information in bundle code Soft-hardcode information in the bundle archive

Avoid using configuration parameters for properties defined in DogOnt E.g., gateway IP address, gateway port, etc.

Page 83: Dog2.3 Architecture

04/12/2023

Beware of Dog!

Dario Bonino - Dog 2.383

1. Think first!2. Comment, comment and

comment!3. Check spelling4. Do not hardcode, use configuration5. Design & implement for the future6. Do housekeeping7. Document your choices

Page 84: Dog2.3 Architecture

04/12/2023

Beware of Dog!

Dario Bonino - Dog 2.384

/** * A class implementing the functionalities of a generic Modbus gateway, as modeled in DogOnt. It offers ways to trace the number of currently managed * gateways and to access the corresponding slaves and registers, this permits multiple-gateway operation in Dog. Currently no gateway-specific functions * are available, however in future releases functionalities offered by the real devices will be modeled and implemented here. * * @author xxxxxxx * */public class ModbusGatewayDriver implements Driver, ServiceTrackerCustomizer{

// The OSGi framework contextprotected BundleContext context;

// System loggerLogService logger;

// the log identifier, unique for the classpublic static String logId = "[ModbusGatewayDriver]: ";

// a reference to the network driver (currently not used by this driver// version, in the future it will be used to implement gateway-specific// functionalities).private ModbusNetwork network;

// the registration object needed to handle the life span of this bundle in// the OSGi framework (it is a ServiceRegistration object for use by the// bundle registering the service to update the service's properties or to// unregister the service).private ServiceRegistration regDriver;

// the set of currently connected gateways... indexed by their idsprivate Map<String, ModbusGatewayDriverInstance> connectedGateways;

Page 85: Dog2.3 Architecture

04/12/2023

Beware of Dog!

Dario Bonino - Dog 2.385

public void run(){

// get the service pidString serivicePid = (String) serviceRef.getProperty(Constants.SERVICE_PID);Object managedServiceObj = configurationAdmin.context.getService(serviceRef);if (managedServiceObj instanceof ManagedService){

ManagedService managedService = (ManagedService) managedServiceObj;if (serivicePid != null && managedService != null){

this.configAdminLogger.log(LogService.LOG_INFO,this.logId + String.format("%s search for configuration", serivicePid));if (configurationAdmin.configFileList.containsKey(servicePid)){

Properties propConfig = configurationAdmin.getConfigurationFromPid(servicePid);

try{

managedService.updated(propConfig);}catch (ConfigurationException e){

this.configAdminLogger.log(LogService.LOG_ERROR, this.logId + e);

}this.configAdminLogger.log(LogService.LOG_WARNING,

this.logId + String.format("%s configuration updated", serivicePid));

}}

}…

Spelling errors!No comments!

Questionable use of logging levels!

Page 86: Dog2.3 Architecture

04/12/2023

Dog Development Guidelines

Dario Bonino - Dog 2.386

1. Check DogOnt2. Respect OSGi specifications

1. Document yourself2. Ask more-experienced Dog developers3. Do not re-invent the wheel4. If something can be done using an OSGi

specification, then the specification is the only correct choice!

3. Respect the DogArchitecture1. Do not insert strict bundle dependencies, use

services!2. Do not duplicate functions in Dog3. Do not mix different architectural levels

Page 87: Dog2.3 Architecture

04/12/2023

Dog Development Guidelines

Dario Bonino - Dog 2.387

4. Develop a self-contained contribution1. Clearly identify the contribution boundaries2. Ask the development team for

changes/improvements involving other, possibly shared, Dog bundles

5. Work in team1. Never commit not-working solutions

1. Unless you are the only one working on it and itstill is a “work-in-progress”

2. The solution does not impact on the other’s work

2. Always do complete commits1. Check all dependencies, libraries, resources, etc.

Page 88: Dog2.3 Architecture

04/12/2023

Dog Development Guidelines

Dario Bonino - Dog 2.388

5. Work in team3. Always update before committing

1. To detect possible conflicts and get the latest updates

4. Respect the dead / wrong code policy1. Remove dead code or not working code2. Be aware that not working / un-complete components

are deleted after one month of grace time3. Today we’ll delete the Effect bundles since they are in

an Error State since 3 months and 1e-mail alert!

5. Each bundle should have its own trunk (branches and tags), on the SVN server

Page 89: Dog2.3 Architecture

04/12/2023

Dog Development Guidelines

Dario Bonino - Dog 2.389

6. Be collaborative1. Amend wrong / deprecated code in Dog as soon as

you find it2. Ask for opinions on your design choices3. Express your opinions on future works / versions

7. Develop for the future1. Sound code2. Polished code3. Commented code4. Document your code using Javadoc5. Write documentation manuals when Javadoc is not

sufficient

8. Think first!

Page 90: Dog2.3 Architecture

04/12/2023

Thanks!

Dario Bonino - Dog 2.390

Page 91: Dog2.3 Architecture

04/12/2023

License

This work is licensed under the Creative Commons “Attribution-NonCommercial-ShareAlike Unported (CC BY-NC-SA 3,0)” License.

You are free: to Share - to copy, distribute and transmit the work to Remix - to adapt the work

Under the following conditions: Attribution - You must attribute the work in the manner specified by the

author or licensor (but not in any way that suggests that they endorse you or your use of the work).

Noncommercial - You may not use this work for commercial purposes.

Share Alike - If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

91 Dario Bonino - Dog 2.3