Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate...

34
1 © 2015 The MathWorks, Inc. Simplifying Requirements Based Verification with Model-Based Design Dr. Tjorben Groß, Senior Application Engineer

Transcript of Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate...

Page 1: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

1© 2015 The MathWorks, Inc.

Simplifying Requirements Based

Verification with Model-Based

Design

Dr. Tjorben Groß, Senior Application Engineer

Page 2: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

2

Key takeaways

▪ Verify and validate requirements earlier

▪ Identify inconsistencies in requirements by using unambiguous

assessments

▪ Traceability from requirements to design and test

“By enabling us to analyze requirements quickly, reuse designs from previous products,

and eliminate manual coding errors, Model-Based Design has reduced development

times and enabled us to shorten schedules to meet the needs of our customers.”

- MyoungSuk Ko, LS Automotive

Page 3: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

3

Requirements

Challenge: Errors introduced early but found late

Specification C/C++

Hand code

Most errors

introduced

Unit test finds some

errors

Errors found during

integration or in field

Page 4: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

4

Requirements

Cost of finding errors increases over time

Specification C/C++

Hand code

Time

TestingCost

Page 5: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

5

Requirements

Challenges with requirements-based verification

Specification C/C++

Hand code

Is requirement

interpreted

correctly?

Is the implementation

functioning correctly?

Are all

requirements

implemented?

How to avoid

modifying the

design for test?

Page 6: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

6

Simulink models for specification

Requirements C/C++Design

Model

Hand code

Model-Based Design enables:

▪ Early testing to increase confidence in your design

▪ Delivery of higher quality software throughout the workflow

Page 7: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

7

Multiple languages to describe complex systems

Requirements C/C++Design

Model

Hand code

Page 8: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

8

Ad-Hoc Testing: Explore behavior and design alternatives

Requirements C/C++Design

Model

Hand code

Page 9: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

9

Validate behavior earlier with simulation

Page 10: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

10

Validate Behavior Earlier with Simulation

Page 11: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

11

Complete Model Based Design

Code

Generation

RequirementsDesign

Model

Model used for

production code

generation

Simulink Models

C/C++

Generated code

Page 12: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

12

Systematically verify requirements

RequirementsDesign

Model

Model used for

production code

generation

Simulink Models

C/C++

Generated code

Are all requirements implemented?

Is the implementation functioning correctly?

Are designs and requirements consistent?Requirements

Based Testing

Page 13: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

13

Integrate with requirements tools and author requirements

Simulink Requirements

Authored Requirements

External Requirements

External

Requirements

Requirements

Managements

Tools

• Import from:

• Word / Excel

• IBM® Rational®

DOORS®

• ReqIF™ standard

• Update synchronizes

changes from source

• Edit and add further

details to import

• Author requirements

• Export ReqIF

• Enables roundtrip with

external tools

Import

Update

Export

Page 14: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

14

Roundtrip workflow with external tools thru ReqIF

Simulink Requirements

Authored Requirements

External Requirements

External

Requirements

Requirements

Managements

Tools

• Import from:

• Word / Excel

• IBM® Rational®

DOORS®

• ReqIF™ standard

• Update synchronizes

changes from source

• Edit and add further

details to import

• Author requirements

• Export ReqIF

• Enables roundtrip with

external tools

Page 15: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

15

Test Case

Requirements Verification with Simulink

Implemented

By

Test Harness

Inputs

Test Sequence

Signal Editor

Assessments

Test

Assessments

MATLAB Unit Test

Verified

By

Simulink / Stateflow

Simulink Test

MAT / Excel

file (input)

MAT / Excel

File (baseline)

Requirements

Page 16: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

16

Test Case

Requirements Verification with Simulink

Implemented

By

Test Harness

Inputs

Test Sequence

Signal Editor

Assessments

Test

Assessments

MATLAB Unit Test

Verified

By

Simulink / Stateflow

Simulink Test

MAT / Excel

file (input)

MAT / Excel

File (baseline)

Requirements

Page 17: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

17

Example: Verifying Heat Pump Controller Requirements

Requirements in DOORS

Page 18: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

18

Example: Heat Pump Controller Implementation

Page 19: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

19

Link requirements to implementation in model

Page 20: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

20

Work with Model and Requirements with Requirements

Perspective

Requirement

Annotations

Badges

Implementation and

Verification Status

Browser

Property

Inspector

Page 21: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

21

Isolate Component Under Test with Test Harness

Page 22: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

22

Test Sequence Block: Step-based and temporal test sequences

Page 23: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

23

Test Assessments: Formalize and execute requirements

Activate Heat Pump

If the temperature difference

exceeds 2 degrees for more

than 2 seconds, then the

pump shall activate for at

least 2 seconds

Page 24: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

24

Author temporal assessments using form based editor

Page 25: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

25

Execute assessments to verify requirements

Page 26: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

26

Locate implementation of requirement using link

Page 27: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

27

Translate textual requirements into unambiguous Temporal

Assessments

• Compose assessments

using form based editor

• View assessments as

English-like sentence

• Review and debug

temporal assessment

results

• Link to requirements

Temporal Assessment Editor

View and Debug Assessment Results

Page 28: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

28

Track Implementation and Verification

Implemented

Justified

Implementation Status

Missing

Passed

Failed

Unexecuted

Missing

Verification Status

Page 29: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

29

Observers: Separate test/verification logic from design

• Access nested signals

without signal lines or

changing dynamic response

• Avoid modifying interface

for testing

• Simplify design and test by

avoiding additional signal

lines

Design Model

Page 30: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

30

Observers: Separate test/verification logic from design

• Access nested signals

without signal lines or

changing dynamic

response

• Avoid modifying interface

for testing

• Simplify design and test by

avoiding additional signal

lines

Observer Model

Design Model

Page 31: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

31

Re-use tests developed for model to test code

Processor in the Loop

(PIL)– Numerical equivalence,

model to target code

– Execute on target board

Software in the Loop

(SIL)– Show functional equivalence,

model to code

– Execute on desktop

Hardware in the Loop

(HIL)– Check real-time behavior of

the design and code.

– Execute on Speedgoat target

computer using Simulink

Real-Time

C/C++

Page 32: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

32

IDNEO Accelerates Development of AUTOSAR Software

Components and Complex Device Drivers with Model-Based Design

Challenge

Reduce development time for embedded software for

automotive applications

Solution

Use MATLAB and Simulink to model AUTOSAR

software components and complex device drivers, run

simulation-based tests, and generate embedded C code

Results

▪ Development time cut by at least 50%

▪ 80% of errors detected before hardware testing

▪ Test harnesses and MISRA-compliant C code

generated from models

“By using Model-Based Design for all AUTOSAR projects, we

have cut development time by at least 50 percent while

increasing the number of defects identified early in the design

phase and reducing the number of defects found in hardware

tests and beyond.”

- Joan Albesa, IDNEO

Link to article

AUTOSAR software architecture.

Page 33: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

33

Summary

▪ Verify and validate requirements earlier

▪ Identify inconsistencies in requirements

by using unambiguous assessments

▪ Traceability from requirements to design

and test

Page 34: Simplifying Requirements Based Verification with Model ... · 2 Key takeaways Verify and validate requirements earlier Identify inconsistencies in requirements by using unambiguous

34

Learn More

Key products covered in this presentation:

▪ Simulink Requirements

▪ Simulink Test

▪ Embedded Coder

▪ Simulink Real-Time

Learn more at Verification, Validation and Test Solution Page:

mathworks.com/solutions/verification-validation.html

MathWorks Training Services:

mathworks.com/training-schedule/simulation-based-testing-with-Simulink

Visit our Demo Booth