supervisory logic & fault management in matlab/simulink

21
1 © 2016 The MathWorks, Inc. Supervisory Logic & Fault Management in MATLAB/Simulink Nordic MATLAB EXPO 2016 Hossein Mousavi Application Engineering Manager MathWorks Nordic

Upload: others

Post on 01-Oct-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Supervisory Logic & Fault Management in MATLAB/Simulink

1© 2016 The MathWorks, Inc.

Supervisory Logic & Fault Management

in MATLAB/Simulink

Nordic MATLAB EXPO 2016

Hossein Mousavi

Application Engineering Manager

MathWorks Nordic

Page 2: Supervisory Logic & Fault Management in MATLAB/Simulink

2

Challenges of Product Development

Early

testing

Multi-

domain

Design

Data source:

System Design: New Product Development for Mechatronics

January 2008, Aberdeen Group, Survey size: 160 enterprises

Page 3: Supervisory Logic & Fault Management in MATLAB/Simulink

3

PlantController

s1 s2

s3

System

Ac

tua

tors

Se

ns

ors

ControllerPlant

Controller Plant

Motivation

Page 4: Supervisory Logic & Fault Management in MATLAB/Simulink

4

Mathematical algorithms

Logic (modes, supervisory, fault)

Physical components (plant)

Data driven (system identification)

Code (legacy, MATLAB )

Multi-Domain Engineering in ONE environment

Plant

+u y

Controller

s1 s2

s3

System

Ac

tua

tors

Se

ns

ors

Page 5: Supervisory Logic & Fault Management in MATLAB/Simulink

5

Multi-Domain Engineering in ONE environment

Plant

+u y

Controller

s1 s2

s3

System

Ac

tua

tors

Se

ns

ors

Control Algorithms

Control Logic

Hydaulics

Mechanics

Power Electronics

Other domains …

DESIGN

Environmental Models

Control Algorithms

Mechanical Electrical

Supervisory Logic

Page 6: Supervisory Logic & Fault Management in MATLAB/Simulink

6

Example: Control Logic for a Fan Cooling System

Device generates heat

when it is switched on

Page 7: Supervisory Logic & Fault Management in MATLAB/Simulink

7

Example: Control Logic for a Fan Cooling System

Device generates heat

when it is switched ON

Temperature of device

rises when it is ON

Cooling fan switches

ON when temperature

exceeds threshold

Cooling fan has modes

Off, Low and High to

regulate temperature

Page 8: Supervisory Logic & Fault Management in MATLAB/Simulink

8

Example: Control Logic for a Fan Cooling System

Device generates heat

when it is switched ON

Temperature of device

rises when it is ON

Cooling fan switches

ON when temperature

exceeds threshold

Cooling fan has modes

Off, Low and High to

regulate temperature

2 fans for redundancy

Page 9: Supervisory Logic & Fault Management in MATLAB/Simulink

9

DEMO: Supervisory Logic – High level

Page 10: Supervisory Logic & Fault Management in MATLAB/Simulink

10

Challenges to Designing Control Logic

Modes of operation are difficult to represent with traditional approaches

Conditional logic can be very complex

Interaction between components is hard to visualize and debug

Page 11: Supervisory Logic & Fault Management in MATLAB/Simulink

11

Solution: State machines and Flow Charts in Stateflow

State machines are regularly used

to represent mode logic

Flow charts are used to model

processes that contain conditions

In Stateflow you can visualize the

behavior of logic by animating it

during simulation

Page 12: Supervisory Logic & Fault Management in MATLAB/Simulink

12

Other Approaches for Modeling Control Logic

~50 lines

Code

Simulink

Page 13: Supervisory Logic & Fault Management in MATLAB/Simulink

13

Page 14: Supervisory Logic & Fault Management in MATLAB/Simulink

14

Other Approaches for Modeling Control Logic

>1000 lines

CodeStateflow

Page 15: Supervisory Logic & Fault Management in MATLAB/Simulink

15

DEMO: Simple State Machine (subpart)

How do we actually create the state chart?

Page 16: Supervisory Logic & Fault Management in MATLAB/Simulink

16

Questions:

We want to start test and verify our design. What is the most

common way to do this?

Answer: Use the play-button for simulation!

Test Automation through MATLAB scripting

Page 17: Supervisory Logic & Fault Management in MATLAB/Simulink

17

Testing Using Simulation

Input Test Vector

Analyze results!

Model Used for

Production

Code Generation

C Source

Code

Executable

Object Code

Textual

Requirements

Executable

Specification

Design Verification

Code Verification

Model

Testing

Page 18: Supervisory Logic & Fault Management in MATLAB/Simulink

18

Questions:

How do we know if enough testing performed on our

Control Logic?

All parts tested?

Answer: Coverage analysis !

Page 19: Supervisory Logic & Fault Management in MATLAB/Simulink

19

Model Coverage Report

Coverage metrics identifies untested

portions of your model

• Decision

• Condition

• MC/DC

• Lookup table

• Signal range

Page 20: Supervisory Logic & Fault Management in MATLAB/Simulink

20

Questions:

What if not high enough coverage with current test cases?

What if not reaching specific scenario (hard-to-reach)?

Answer:

Additional testing requirements -> Additional test cases

Automatic test case generation!

Page 21: Supervisory Logic & Fault Management in MATLAB/Simulink

21

Automatic Test Generation

To reach full coverage or user-defined objectives (specific

scenarios)

Test vectors generated (structural) can be used for

equivalence test

– Software-in-the-Loop (SIL)

– Processor-in-the-Loop (PIL)