model driven developmentkramp.ch/wsn/4-2.bpmn.pdf · (c) 2010 ibm corp. 2 model-driven development...

Post on 16-Mar-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Model Driven Development

Programming and Debugging Business Processes for WSN

(C) 2010 IBM Corp. 2

Model-Driven Development

Model

Generate Code

CompileSimulate &

Debug

Inspect/Modify Generated Code

Instantiate &Deploy

Monitor &Analyze

(C) 2010 IBM Corp.

Graphical Modeling & Programming Languages

• Open-Industry Standards• Universal Modeling Language (UML) 2.0 • Specification and Description Language (SDL)

• Proprietary Standards• LEGO MINDSTORMS• NI LabVIEW• MathWorks Simulink (MATLAB extension)• Scratch

(C) 2010 IBM Corp.

Modeling for Wireless Sensor Networks

• Custom graphical notation• Viptos

• Flow

• Srijan

• Based on• UML 2.0 Activity Charts

• Simulink, Embedded Coder

• LabVIEW

• Generate C code from models

• Problems• Languages address technical audience

• Often lack of debugging facilities at the same level of abstraction

• Often simulate abstract model rather than actual application

• May require larger hardware platforms (e.g. 32-bit ARM)

(C) 2010 IBM Corp. 5

Business Processes

• Capture the interactions between• Humans• IT systems• Environment

• Capture business requirements

• Enable today's enterprises' to• manufacture products• deliver services

• Means of communication and discussion

• Serve as basis for business re-engineering

• Example: car rental

(C) 2010 IBM Corp. 6

Business Process Modeling Notation (BPMN)

• Widely used in the business community

• Intuitive notation, addresses a business audience

• Open-Standard Graphical Notation• Different Perspectives

• Hierarchical encapsulation

• Models− Control Flow− Data Flow− Communication Flow

• Graphical Symbols• Tasks & Events

• Messages & Flows

• Pools

• Annotations

• etc.

(C) 2010 IBM Corp.

Modeling for Business Processes

• Industry solutions• IBM WebSphere Business Modeler• SAP NetWeaver BPM Process Composer• BizAgi Modeler • Signavio

• Usually generate Business Process Execution Language (BPEL )• to be executed by an engine

• BPMN vs BPEL• BPEL is an XML notation without a standard graphical notation

(C) 2010 IBM Corp.

BPMN Perspectives

• Conversation• High-level interactions among participants

− Architecture

• Choreography• Message exchanges between participants

− Order of interactions

• Collaboration• Inner working of participants

− What and how

(C) 2010 IBM Corp.

BPMN Conversation

(C) 2010 IBM Corp.

BPMN Choreography

(C) 2010 IBM Corp.

BPMN Collaboration

(C) 2010 IBM Corp.

BPMN Pools & Swimlanes

(C) 2010 IBM Corp.

BPMN Activities

(C) 2010 IBM Corp.

BPMN Gateways

(C) 2010 IBM Corp.

BPMN Events

(C) 2010 IBM Corp.

BPMN Data

(C) 2010 IBM Corp.

Modeling Split Phase Operations

(C) 2010 IBM Corp.

Mapping WSN to BPMN

• BPMN • Parallelism, thread-based

• WSN• Single process, Event-based, queue

• Simplified mapping• Sensor node (entity) = Pool

• Callbacks = Event Task

• Variables = Data Objects/Messages

• Persistent data = Data Stores

• Data consistency, race conditions• Only allow one event task to be active at a given time

• Explicitly model using an event-based gateway

• Addressing• Implicit through message flow, explicit through message properties

(C) 2010 IBM Corp. 19

BPMNHeadquarters Example

(C) 2010 IBM Corp. 20

BPMNParcel Example

(C) 2010 IBM Corp. 21

BPMNmonitor Example

(C) 2010 IBM Corp.

ExampleGenerated Source Code (C#)

namespace Parcel { ... static class Monitor { static byte[] messageToTruck; static Timer timer; static uint threshold; .... static void onAlarm(byte param, long time) { timer.setAlarm(onAlarm, time + 2000000); uint value = SampleTemperature.start();

if (value > threshold){ Damaged(value);

return; }

HeartBeat.start(); } ....

(C) 2010 IBM Corp.

Compiler

Model

BPMNGraphical Editor

Compiler

WSNRun-time Platform

ModelGraph

ModelGraph

ModelGraph

ModelObject

ModelObject

ModelObject

Source Code

SymbolTable

Executable

.bxo

.json

.java

.bxd

.sba

.cs

1. Consistency checks

2. Translation

3. Generation

23

(C) 2010 IBM Corp.

Compiler: Consistency Checks

• Each throw event must be matched by a catch event

• Split-phase (asynchronous) tasks should not be blocking

• All data objects required by a task are present and have the right type• Infer data types of objects (if not present)

• Very task signatures (input/output data) against the API for target platform

• Communicate errors to IDE

(C) 2010 IBM Corp.

Compiler: Translation

• Previous stage ensures we operate on a consistent model• Further “compilation” errors are due to bugs in the tools

• Pattern-based compiler

• Transform to intermediate language (C#)

• Keep map to unique ID of graphical element

• Recursively map• Each process to a class with a given entry point• All event tasks in process to functions• All data objects are mapped to instance variables

(C) 2010 IBM Corp.

Compiler: Generation

• Link all intermediate representations into an application• Ensure all required intermediate representations are available

• Generate C# and Java code according to the API of the target platform • Construct the debug map

• Run platform compiler

(C) 2010 IBM Corp.

Simulation & Debugging

• Validate that the process behaves as intended and according to the requirements

• Simulate the execution of a business process

• Debug business process at the same level of abstraction• Break-points at the level of graphical symbols• Map from generated source code back to graphical elements and

vice-versa

• From the model infer the network topology and the cardinality of the sensor types

• Inspect values of data and messages

(C) 2010 IBM Corp.

WSN Platform Requirements

• Target platform API requirements• Events - queue

• Timers

• Communication

• Simulation environment with a debugging interface

• Reduced hardware resources→ small size factor & low cost

• e.g., 8-bit MCU− Larger platforms inherently consume more energy and are more expensive

• Dynamic management• Re-deploy a business process to adapt to changing business requirements

• Energy management• Efficient management of energy resource to ensure long-lifetime requirements

(C) 2010 IBM Corp.

Prototype Evaluation

Application Total Energy Max Stack Max Heap Executable Size Lines of CodeName Type (bytes) (bytes) (bytes) (C#)Blink generated 415 20 236 230 44

hand-coded 408 22 236 197 34overhead 1.70% 0.00% 0.00% 16.75% 29.00%

Parcel generated 2682 24 480 573 142hand-coded 2669 20 452 422 100

overhead 0.49% 20.00% 6.19% 35.00% 42.00%Truck generated 403917 14 440 478 120

hand-coded 403917 14 420 369 87overhead 0.00% 0.00% 4.76% 29.50% 37.90%

Average overhead 0.73% 5.16% 27.08% 36.30%Resource Battery RAM Flash ---

(uAs)

(C) 2010 IBM Corp. 30

Integrated Modeling & Development

DEMO

(C) 2010 IBM Corp. 31

Questions?

top related