기반 legacy c/c++ code 통합 결과시각화및검증€¦ · c/c++ code code generation model...

Post on 20-Jun-2020

11 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1© 2015 The MathWorks, Inc.

Simulink 기반 Legacy C/C++

Code 통합, 결과시각화및검증방안

유성재

2

Model-Based DesignSystematic use of models throughout the development process

system

REQUIREMENTSsystem

DESIGNcomponent

VERIFICATIONcomponent

REQUIREMENTS

SUBSYSTEM/COMPONENT

SYSTEM LEVEL

INTEGRATION

system

BEHAVIOR

system

ANALYSIS

component

ARCHITECTURE

3

Legacy Code? Hand-written code?

Vendor Libraries

Hand Code

Internal Libraries

Device DriversVerified Components

Components

Under

Development

4

MBD with Legacy Code!

Textual

Requirements

Executable

Specification

Modelling

Object

code

Compilation

and Linking

Generated

C/C++ code

Code

Generation

Model used for

production code

generation

Requirements

Authoring

Software architecture

and unit design

S-functions from

Handed C/C++ code

Coverage analysis

Unit(/Integration) testing

Code review and

Static analysis

/ Test case generation

For Model-Based Design

For legacy code development

5

Challenge?

6

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

7

How to Import Legacy Code

▪ Legacy Code Tool

▪ Legacy code integration in Stateflow

▪ C Caller Block

8

What legacy C code integration in Simulink means?

▪ Legacy Code Tool enables existing C code to be used in Simulink models

External C

Functions

Generating

S-function

9

How to use Legacy Code Tool?

▪ General procedure for using Legacy Code Tool

S-function block

Modeling with S-Function

10

Maintenance Problem…

Legacy codeWrapper code

Modeling

Script file

If any changes in code

11

Introducing C Caller Block

C Caller Block makes it easier to call C Functions in Simulink

→ It works for simulation and Code Generation

12

▪ Automate the process

▪ Synchronize with custom code changes

Key Features

C/C++ Code

functions*

types *

globals

Define Block

Interface

Build Simulation

MEX

Write Codegen

TLC

Automate

• Tedious

• Error prone

• Hard to maintain

13

Demo: Simple C Caller

14

Demo: Integrate C code with Simulink Model

15

C Caller workflow

①②

③④

16

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

17

Visualize Simulation Data

18

Visualize Simulation Data

19

Visualize Simulation Data

20

Tune and Visualize Your Model with Dashboard Blocks

Flight Instrument Gauges

- Aerospace Blockset -

Custom Gage

21

Tune and Visualize Your Model with Dashboard Blocks

22

DEMO : Test harness creation with Dashboard

23

DEMO : Visualize Input and Output data

24

Visualization Summary

25

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

26

Test Case generation

Test case

generation

27

Test Case

Main Model

Systematic Functional Testing with Simulink Test

AssessmentsInputs

Test Sequence

Signal Builder

MAT file (input) MAT file (baseline)

Test Assessment

MATLAB Unit Test

and more! and more!

Test Harness

28

DEMO : Code Coverage with C caller

29

DEMO : Coverage Report

30

DEMO : Test Case Generation

31

Key takeaways

Bring C/C++ code into Simulink

▪ With full integration into Model-Based Design workflows

▪ To visualize simulation result

▪ Enable unified verification environment

32© 2015 The MathWorks, Inc.

데모부스와상담부스로질문하시기바랍니다.

감사합니다

top related