software engineering for real-time systems (© j.e.cooling 2003) software design - core concepts -...

23
SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section 4 Software design - core concepts

Post on 20-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1

Software engineering for real-time systems

Section 4

Software design - core concepts

Page 2: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 2

Objectives

To:

Outline fundamental software design strategies.

Describe how and why modular design is essential for the production of good software.

Introduction

Page 3: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 3

Part 1

Design fundamentals

Design fundamentals

Page 4: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 4

S pecif ica tion

D esign

D eve lopm entand test

The p roduct

P ro to typem anu factu re

Overview of the design and development process

Page 5: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 5

S pec ifica tion fo r : P ow er tra in sys temFue l : D iese lF ina l d rive : Tw o road w hee lsH igh leve l

descrip tion

P ow er un it(P U )

P ow ertransm ission

R oad w hee ld rive un it

(D U )

Fue l (F )A ir (A )

Force

P uF

A

M echan ica lpow er

transm issionD u

Force

M echan ica l so lu tion

E xpanded D escrip tion

P UF

A

E lectrica lgenera to r

D UForceE lectrica l

pow ertransm ission

E lectro -m echan ica l so lu tion

Specification translation - high-level description

Page 6: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 6

H igh leve ldescrip tion

M echan ica l so lu tion(expandeddescrip tion )

E lectro -m echan ica lso lu tion (expanded

descrip tion )

Fron t w hee ld rive

R ear w hee ld rive

P U a tfron t

P U a tfron t

P U a trea r

P U C lu tch G earbox D iffren tia l

F A

P rope lle rsha ft

W hee l

H a lfsha fts

P UF

AG earbox

E lectron iccon tro l un it

Le ft w hee lm oto r

R igh t w hee lm oto r

W hee l un its

W hee l

Generaldesign level

Translation to the general design level

Page 7: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 7

W heelM otor

T

V

i

I = (V - E b)/R

T = kIa

T = J(d²/dt²) + K(d/dt) + Fc

Detailed design level

Page 8: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 8

An outline design example

The task in question is the design of a vehicle anti- skid braking system.

Its purpose is to eliminate vehicle skidding by preventing lock-up of the wheels.

The control system:

Measures the speed of each wheel, calculates acceleration/deceleration values. Using this data, detects the onset of wheel lock-up. Generates command signals to back-off the braking effect should lock-up occur.

A design problem

Page 9: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 9

W heelsensors

M easurew hee l speed

C a lcu la te w hee lacce le ra tions/decla ra tions

O utpu tcom m ands tob rake servo

un its

B rakeservoun its

S to rem easured

data

Control system software design - a functional approach

Page 10: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 10

A nti-sk idcom puter

W hee l1

W hee l4

W hee l2

W hee l3

S end speed s igna l (S S )

S end actua to r com m and(A C )

(S S )

(S S )

(S S )

(A C )(A C )

(A C )

Control system software design - an object-based approach

Page 11: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 11

W hee lspeed

S ensors

B rakeservova lves

A nti-sk idcom pute r

system B rakingsigna ls

S peedsigna ls

G etw hee lspeedsigna ls

C om puteb rakingsigna ls

C ontro lse rvova lves B raking

signa lsS peedsigna ls

W hee lspeeds

S ervodem ands

(a) S ystem -o rien ted v iew

(b) H igher-leve l so ftw are structu re

Control system software design - a data-flow approach

Page 12: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 12

Part 2

Modular design

Modular design

Page 13: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 13

S peedsensor 1

S peedsensor 2

Tyre p ressuresensor 1

Tyre P ressuresensor 2

V eh ic le dashd isp lay

V a lve 1

V a lve 2

C ontro lcom puter

Introducing modularization

Modularization - the process of forming a complete software system from a set of individual units or modules.

Module? A standardized part or independent unit in the construction of software.

But how should a system be modularized?

Example system: How should this be modularized?

Page 14: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 14

S peedsensor 1

S peedsensor 2

Tyre p ressuresensor 1

Tyre P ressuresensor 2

S peed inpu tm odu le

Tyre p ressureinpu t m odu le

C ond itioned s igna ls

R equest fo r s igna ls

C om putingm odu le

D isp lay d rive rm odu le

S ervo va lvem odu le 1

S ervo va lvem odu le 2

Tyre p ressureva lue

V a lvecon tro ls igna ls

V eh ic le dashd isp lay

V a lve 1

V a lve 2

Modularization – design solution 1

Page 15: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 15

Modularization – design solution 2

Speed sensor 1

Tyre pressure sensor 1

Speed sensor 2

Tyre pressure sensor 2

Dataacquisition

module

Computingmodule

Datarequest

Datareply

Outputcontrolmodule

Displaydriver

module

Valve 1

Valve 2

Vehicledash

display

Page 16: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 16

D esign ing m odu les -The design decis ions

P artition ingo f the system

S ize o fm odu le

E xte rna lin te rfaces o f the

m odu le

C om plexityw ith in the

m odu le

R e la tionsh ip andcom m un ica tion

be tw eenm odu les

S cope o fm odu le

con tro l andin fluence

Modules - design decisions

Page 17: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 17

(a) High Coupling (b) Low Coupling

• Methods to evaluate modularization (1) - coupling.

- The amount of interaction between modules.

• Check points:

- number of module interconnections.

- complexity of module interconnections.

• Desirable features - few interconnections having low complexity.

Evaluating modularization 1: coupling - the outside view

Page 18: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 18

Types of module coupling

Content coupling.

Common coupling.

Stamp coupling.

Data coupling by reference.

Data coupling by value.

Coupling methods - overview

Page 19: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 19

M odu le A M odu le B

C ode

D ata

C ode

D ata

C oncep tua l structu re

C ode

D ata

A ctua l structu re

A

C ode

D ata

B

C ode

D ata

S hareddata a rea(g loba l)

S haredcode

Content coupling

Common coupling

(common resource

sharing)

Coupling methods 1

Page 20: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 20

A

C ode

D ata

B

C ode

D ata

D atastructu re

P o in te r

P o in te r transfe r

Stamp coupling

(data structure coupling)

A

C ode

D ata

B

C ode

D ata

D atava lues

Data coupling by value

A

C ode

D ata

B

C ode

D ata

D a taaddress

Data coupling by reference

Coupling methods 2

Page 21: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 21

G etAnalogueData

ReadADC(Speed)

F ilter(Speed)

L inearize(Speed)

ReadAD C

Filter

L inearize

Software m achine"G etAnalogueData"

• Methods to evaluate modularization (2) - cohesion.

• Look into the modules.

• How well do the component parts (the internal software machines) relate to each other?

• Strong relationships indicate a good cohesion or “glue” factor.

• This example has high cohesion - remove any part and the machine won’t work.

• High cohesion = “Good”

Cohesion - ‘the inside view’

Evaluating modularization 2: cohesion - the inside view

Page 22: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 22

P rob lemdriven

Functiona l

C om m un ica tiona l

S equen tia l

P rocedura l

Tem pora l

Log ica l

C o inciden ta l

P rogram(code)d riven

B est

W orst

The seven level cohesion model

Page 23: SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 1 Software engineering for real-time systems Section

SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J.E.Cooling 2003) Software design - core concepts - slide 23

Review of section

You should now:

Understand that system design is basically a top-down process.

Appreciate the various levels of design and how they relate to each other.

See how designs may be formed as functional, object or data-flow structures.

Recognize that modularity is a key factor in any design approach.

See how coupling and cohesion can be used as indicators of the quality of asoftware design.

END OF SECTION ‘Software design - core concepts’

Review of ‘Software design - core concepts’