40
Model-based Design 182.721 VO Embedded Systems Engineering Armin Wasicek 6.12.2011

Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model-based Design

182.721 VO Embedded Systems EngineeringArmin Wasicek6.12.2011

Page 2: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Overview

� Introduction� System Theory� Model Driven Architecture (MDA)� MBD Development Environments� Summary

210.12.2010 Model‐based Design

Page 3: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

History

� General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques by the 1970s

� Computer-Aided Software Engineering (CASE) tools developed in the 1980s

� Creating the Unified Modeling Language (UML) in the 1990s

� Model Driven Architecture (MDA) launched in 2001

310.12.2010 Model‐based Design

Page 4: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Challenges

� Exploding code sizes and complexity of software

� Increase the productivity of the individual engineer

� Agility of applications, technologies, platforms

� Coordinate the resources of people with expertise in a wide range of disciplines

410.12.2010 Model‐based Design

Page 5: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

When software engineers buildsystems…

Software-centric design methodologies:� Treat software as

main entity� Overlook domain

knowledge� Dominate the

functional design

10.12.2010 Model‐based Design 5

UML is not the answerto system design

Page 6: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Overview

� Introduction� System Theory� Model Driven Architecture (MDA)� Models of Computation� Summary

610.12.2010 Model‐based Design

Page 7: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Introduction to System Theory

� Systems theory first originated in biology in the 1920s out of the need to explain the interrelatedness of organisms in ecosystems

� Systems as interacting components: Purpose, Environment, Interrelations, Boundary/Interfaces, Input/Output

� Emergence is the way complex systems and patterns arise out of a multiplicity of relatively simple interactions.

710.12.2010 Model‐based Design

System theory is an approach to a complex structure that abstracts away from theparticular physical, chemical, or biological nature of its components and simplyconsiders the structure they together implement, in terms of the functional role ofindividual parts and their contribution to the functioning of the whole.

Page 8: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Which models are there?

� Scale models� Partial models� Process models� State models� Etc.

Substitute for direct measurement and experimentation

energize

activeassemble

disassemble

deplete

short-circuit

passive

810.12.2010 Model‐based Design

Page 9: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model Definition

Representation�A model represents some thing.�Model and thing are connected by a morphism.

Abstraction�The model suppresses irrelevant detail and

focuses on important aspects.Pragmatics

�The model is created for a purpose.[Herbert Stachowiak, Allgemeine Modelltheorie]

910.12.2010 Model‐based Design

Page 10: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Relations between Models and Code

Code

Model onlyCode visualization

Code only RuntimeEnvironment

Model‐centric

generatesynchronizevisualize

Model Model Model Model

Code Code Code„What‘s a model?“

„The code isthe model“

„Manage code andmodel“

„The model is the code“

„Let‘s talk models!“

Tim Trew, Creating Embedded Platforms with MDA, ECMDA, 2009

1010.12.2010 Model‐based Design

Page 11: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model representations

Textual Hierachical Graphical

10.12.2010 Model‐based Design 11

Graphical modeling tools reduce the complexity of model designs by breaking them into hierarchies of individual design blocks.

mtype = {REQ,ACK};typedef Msg {byte a[2];mtype tp;} ;chan toR = [1] of {Msg};bool flag;proctype Sender() {Msg m;...m.a[0]=2; m.a[1]=7; m.tp = REQ;toR ! m;}proctype Receiver(byte n) {Msg m;...toR ? m;}init {run Sender();run Receiver(2);}

Page 12: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model Driven X

� Model Driven Architecture (MDA)� Model Driven Development (MDD) (e.g. UML)� Model Driven Engineering (MDE) � Model Based Engineering (MBE)

26.11.2009 Model‐based Design 12

Page 13: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Overview

� Introduction� System Theory� Model Driven Architecture (MDA)� MBD Development Environments� Summary

1310.12.2010 Model‐based Design

Page 14: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Traditional approach for a controller

Development strategy for a digital control system:� Design controller on paper with block diagrams� Implement the design in a programming language� Integrate controller with the plant model� Adjust parameters of the controller through simulation� Trash or take: reinterate the design until satisfactory

10.12.2010 Model‐based Design 14

Rapid prototyping is the application of productivity tools to developworking prototypes of control systems in the minimum amount of time.

Page 15: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model-Based Design

• From Paper-based approach to Executable Model• Model captures all information about concept,

design, implementation• Model is used in all development stages

(Research, Design, Implementation andVerification&Validation)

• Model is continously updated and elaborated

10.12.2010 Model‐based Design 15

Page 16: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Applications of System Models

Models reflecting all different aspects of the required system are developed and used throughout all stages of the system development process

� Simulation, Visualization� Static System Analysis, (e.g., predict energy consumption)� Formal Verification� Virtual Fault Injection� Synthesis of Implementations & Test Suites� Documentation, Presentation

10.12.2010 Model‐based Design 16

Page 17: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Key steps in the MBD approach

(1) System identification (modeling the plant) is an iterative process. By acquiring and processing raw data from a real-world system and choosing a mathematical model to represent the plant behavior

(2) Controller analysis and synthesis. Identify dynamic characteristics of the plant model and synthesize an appropriate controller.

(3) Offline simulation. Simulation allows specification, requirements, and modeling errors to be found early

(4) Deployment

10.12.2010 Model‐based Design 17

Page 18: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

MBD: System Simulation

• Simulation Goals• Verification and Validation• Collect Data to Improve Models

• Software in the Loop• Non real-time simulation, e.g. using SimuLink• Using plant model and implementation of controller model

• Hardware in the Loop • Real-time simulation of plant model• Using plant model and controller implemented on target

10.12.2010 Model‐based Design 18

Page 19: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Software-in-the-Loop (SiL) Simulation

� Goal: verify that code generated from a model will function identically to the model

� Generate code from models (e.g., c-code)� Run code together with model of plant on the

development platform� Benefits:

Low cost Target platform must not

be specified

26.11.2009 Model‐based Design 19

Page 20: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Hardware-in-the-Loop (HIL)-Simulation

� Form of real-time simulation

� Purpose of a HiL is to provide all of the electrical stimuli to fully exercise the ECU

� Connect actual ECU to simulator

� Plant is simulated, ECU is real

26.11.2009 Model‐based Design 20

1. Model of the plant2. Sensor models 3. Real‐time target 4. Real or simulated loads5. Fault insertion relay matrix6. Host PC to

• Control simulation• Collect diagnostics

Page 21: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Key benefits of the MBD approach

� MBD provides a common design environment, which facilitates general communication, data analysis, and system verification between development groups.

� Engineers can locate and correct errors early in system design, when the time and financial impact of system modification are minimized.

� Design reuse, for upgrades and for derivative systems with expanded capabilities, is facilitated.

10.12.2010 Model‐based Design 21

Page 22: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Shift from ‚V‘ to ‚Y‘ Model

� Domain Engineering: identify potentially reusablecomponents

� Frameworking:generic components and theirrelationships

� Assembly:specialization of reusablecomponents

� Archiving:make a reusable component available26.11.2009 Model‐based Design 22

Capretz, L.F., „Y: A New Component‐Based Software Life Cycle Model” , Journal of Computer Science 1 (1): 76‐82, 2005

Page 23: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Model Driven Architecture (MDA)

� OMG Standard: Model Driven Architecture (MDA).� Application of models and generators to improve

the software development process

� The objective is NO total automation, but a reasonable proportion

� Goals� Speed up the development process:

„automation through formalization“� Tackle the complexity challenge through abstraction

2310.12.2010 Model‐based Design

Page 24: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

MDA Process

a. Computation Independent Model (CIM): informal specification

b. Platform Independent Model (PIM): model which is independent from a specific computational platform (for business processes)

c. Platform Specific Model (PSM): model which is dependent on a particular architecture, service definitions

d. Code model and target platform

� MDA defines conceptual separation between models and thetransformation between models: Model-to-model transformation (MOF QVT) Model-to-code transformation

2410.12.2010 Model‐based Design

Page 25: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Architecture Analysis and Design Language (AADL)� Textual and graphic language (SAE standard)� Design and analyze the software and hardware

architectures of embedded and real-time systems� End-to-end latency � Schedulability� Reliability, …

� Describe the structure as an assembly of software components

� Mapping to an execution platform26.11.2009 Model‐based Design 25

Page 26: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

AADL - Context Diagram for a Set of Vehicle Control Systems

26.11.2009 Model‐based Design 26

John Hudak, Peter Feiler, „Developing AADL Models for Control Systems: A Practitioner’s Guide“, Technical Report CMU/SEI‐2007‐TR‐014, 2007

Page 27: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

AADL - Context Diagram of the Cruise Control

26.11.2009 Model‐based Design 27

John Hudak, Peter Feiler, „Developing AADL Models for Control Systems: A Practitioner’s Guide“, Technical Report CMU/SEI‐2007‐TR‐014, 2007

Page 28: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

AADL - Software Component View of the Cruise Control

26.11.2009 Model‐based Design 28

John Hudak, Peter Feiler, „Developing AADL Models for Control Systems: A Practitioner’s Guide“, Technical Report CMU/SEI‐2007‐TR‐014, 2007

Page 29: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

AADL - System Hierarchy for the Cruise Control

26.11.2009 Model‐based Design 29

John Hudak, Peter Feiler, „Developing AADL Models for Control Systems: A Practitioner’s Guide“, Technical Report CMU/SEI‐2007‐TR‐014, 2007

Page 30: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Basic Comparison of UML and AADL

� System designers can use UML to diagram functionalstructures, and AADL to define runtime behavior

� SysML and the MARTE profile extend UML for embedded andreal-time systems

26.11.2009 Model‐based Design 30

Dionisio de Niz, „Diagrams and Languages forModel‐Based Software Engineering of Embedded Systems: UML and AADL“, Whitepaper, SEI, 2007 

Page 31: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

UML & AADL Focus Areas

26.11.2009 Model‐based Design 31

Dionisio de Niz, „Diagrams and Languages forModel‐Based Software Engineering of Embedded Systems: UML and AADL“, Whitepaper, SEI, 2007 

Page 32: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Overview

� Introduction� System Theory� Model Driven Architecture (MDA)� MBD Development Environments� Summary

3210.12.2010 Model‐based Design

Page 33: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

MatLab/SimuLink

� Development Environment for multi-domain simulation andmodel-based design of dynamic systems

� Basic notation are blocks and data flows between them� Provides domain-specific toolboxes (e.g., automotive)� Provides code generation facilities

26.11.2009 Model‐based Design 33

Page 34: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

dSPACE

� Leading developer of MBD toolsfor automotive applications

� dSPACE products help to reducecomplexity of today’s embedded software engineering

� Integrated Development Environment features:• system design, rapid control prototyping, automatic production

code generation, and HIL testing

26.11.2009 Model‐based Design 34

Page 35: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Esterel SCADE

� SCADE addresses mission and safety-critical embedded applications.

� SCADE is certified/qualified � Features

� Graphical and text editor� Simulation� Formal verification� Code generation � Model Test Coverage� Gateways: Simulink, DOORS, Altia, UML/SysML, etc.

26.11.2009 Model‐based Design 35

Page 36: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Eclipse Modeling Framework

� Eclipse-based modeling framework and code generation facility for building tools and other applications based on a structured data model

� Ecore is a language to define meta-models

� “Your models instantiate the meta-model, and your meta model instantiates Ecore”

� Xtext can be used to create a domain-specific language

� People use Xtext-based languages to drivecode generators that target Java, C, C++, C#, Objective C, Python, or Ruby code

26.11.2009 Model‐based Design 36

http://www.eclipse.org/Xtext/documentation/2_0_0/210‐emf‐integration.php

Page 37: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Overview

� Introduction� System Theory� Model Driven Architecture (MDA)� MBD Development Environments� Summary

3710.12.2010 Model‐based Design

Page 38: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

MBD Increase of productivity

� The MBD approach can dramatically increase a system designer’s productivity

11.10.2011 Embedded Systems Engineering 38

SCADE Reductions of efforts in percent

Software development cost 70‐90% 

Software certification cost 50%

Software update cycle time 65‐75%

MatLab Reductions of efforts

Development time 50% 

Design reuse Up to 80%

Debugging process ~20%

Code efficiency

Minimized documentation

Collaboration simplified

Page 39: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

Summary

� Models and their application� MBD offers a systematic engineering approach for

embedded systems design� Industry-grade software development is not

imaginable without model-based testing� Key benefits of MBD:

� Design reuse� Faster development cycle� Early detection of faults

11.10.2011 Embedded Systems Engineering 39

Page 40: Model-based Design - Institute of Computer Engineering (E191) · History ˜ General Systems Theory (GST) was the fundamental underpinning of most commercial software design techniques

ENDE

Danke für die Aufmerksamkeit!