Top Banner
1 © 2015 The MathWorks, Inc. Simulink 기반 Legacy C/C++ Code 통합, 결과 시각화 및 검증 방안 유성재
32

기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

Jun 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

1© 2015 The MathWorks, Inc.

Simulink 기반 Legacy C/C++

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

유성재

Page 2: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 3: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

3

Legacy Code? Hand-written code?

Vendor Libraries

Hand Code

Internal Libraries

Device DriversVerified Components

Components

Under

Development

Page 4: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 5: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

5

Challenge?

Page 6: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

6

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

Page 7: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

7

How to Import Legacy Code

▪ Legacy Code Tool

▪ Legacy code integration in Stateflow

▪ C Caller Block

Page 8: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 9: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

9

How to use Legacy Code Tool?

▪ General procedure for using Legacy Code Tool

S-function block

Modeling with S-Function

Page 10: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

10

Maintenance Problem…

Legacy codeWrapper code

Modeling

Script file

If any changes in code

Page 11: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

11

Introducing C Caller Block

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

→ It works for simulation and Code Generation

Page 12: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 13: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

13

Demo: Simple C Caller

Page 14: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

14

Demo: Integrate C code with Simulink Model

Page 15: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

15

C Caller workflow

①②

③④

Page 16: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

16

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

Page 17: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

17

Visualize Simulation Data

Page 18: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

18

Visualize Simulation Data

Page 19: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

19

Visualize Simulation Data

Page 20: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

20

Tune and Visualize Your Model with Dashboard Blocks

Flight Instrument Gauges

- Aerospace Blockset -

Custom Gage

Page 21: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

21

Tune and Visualize Your Model with Dashboard Blocks

Page 22: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

22

DEMO : Test harness creation with Dashboard

Page 23: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

23

DEMO : Visualize Input and Output data

Page 24: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

24

Visualization Summary

Page 25: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

25

Agenda

▪ Legacy code integration using Simulink

▪ Visualization using Simulink

▪ Verification with legacy code

Page 26: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

26

Test Case generation

Test case

generation

Page 27: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 28: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

28

DEMO : Code Coverage with C caller

Page 29: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

29

DEMO : Coverage Report

Page 30: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

30

DEMO : Test Case Generation

Page 31: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

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

Page 32: 기반 Legacy C/C++ Code 통합 결과시각화및검증€¦ · C/C++ code Code Generation Model used for production code generation Requirements Authoring Software architecture

32© 2015 The MathWorks, Inc.

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

감사합니다