modelización , simulación y pruebas en simulink · 3 testing to date… create harness models...
TRANSCRIPT
![Page 1: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/1.jpg)
1© 2015 The MathWorks, Inc.
Modelización , simulación y
pruebas en Simulink
Luis López
![Page 2: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/2.jpg)
2
Why Test?
Does the subsystem/system meet the design requirements?
The model worked last week… does it still?
The model / algorithm has been modified… is it still working ok?
Do these legacy models / libraries work in this new application?
Does it work real-time, integrated with hardware?
Does running the generated embedded code match running the model?
![Page 3: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/3.jpg)
3
Testing to date…
Create harness models
– to exercise model references or subsystems
Write MATLAB code
– to run the tests
Write more MATLAB code
– to verify the test results
Write some more MATLAB code / using Report Generator
– to report on the test results
Creating custom GUIs to manage running of tests
![Page 4: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/4.jpg)
4
1. Test Harnesses 2. Test Sequence Block 3. Test Manager
• Synchronized, simulatable test
environment
• Inputs and assessments based on logical,
temporal conditions
• Author, execute, manage test cases
• Review, export, report
Simulink Test Overview
Main Model
Test Harness
Component
under test
![Page 5: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/5.jpg)
5
Creating Test Harnesses
![Page 6: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/6.jpg)
6
![Page 7: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/7.jpg)
7
But what if…
The component is in a library
The reset should be relative to the time constant of the filter
We want to verify a requirement that:
filter output shall equal resetValue when reset is true
![Page 8: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/8.jpg)
8
![Page 9: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/9.jpg)
9
Release Notes – Test Harnesses
Test Harnesses for Libraries R2016a
External Test Harnesses R2016a
External Test Harnesses with Requirements Linking R2016b
Move/Clone test harnesses R2017a
![Page 10: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/10.jpg)
10
Test Sequence / Test Assessment
block
![Page 11: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/11.jpg)
11
Release Notes – Test Sequence
description field R2016a
tab complete & syntax highlighting R2016a
port reordering R2016a
support messages R2016a
“verify” statements R2016a
proof objective support for verify statements R2017a
![Page 12: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/12.jpg)
12
Test Manager
![Page 13: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/13.jpg)
13
Simulation Testing
Requirement Based (Simulation) Testing– Does my design comply with my requirements?
Equivalence Testing– Do these models match? Does generated code match this model?
Regression (Baseline) Testing– Have I broken anything with the change I’ve just made?
![Page 14: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/14.jpg)
14
Create a baseline test
![Page 15: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/15.jpg)
15
![Page 16: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/16.jpg)
16
Create a test
for multiple parameter values
and verify response against a custom criteria
![Page 17: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/17.jpg)
17
![Page 18: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/18.jpg)
18
Test Iterations
Define by table or script
Combine with Parallel Computing Toolbox &/or fast restart as appropriate
Run via UI or programmatically
Easy to re-run selected iterations
![Page 19: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/19.jpg)
19
Reporting
![Page 20: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/20.jpg)
20
![Page 21: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/21.jpg)
21
Release Notes – Test Manager
Parallel Computing Toolbox integration R2016a
Simulink Real-Time integration R2016a
Custom test criteria R2016b
MATLAB Unit Test integration R2016b
Simulink Design Verifier integration R2017a
Time Tolerance R2017a
![Page 22: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/22.jpg)
22
Extend requirements-based tests
to achieve full coverage
(Simulink Test + Simulink Design Verifier)
![Page 23: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/23.jpg)
23
![Page 24: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/24.jpg)
24
A file is modified;
What test(s) do I need to run?
(Simulink Test + Simulink Projects)
![Page 25: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/25.jpg)
25
![Page 26: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/26.jpg)
26
Simulink Test... makes testing easier...
Flexible
– Ease authoring different types of test
– Desktop or real-time
Scalable
– Hierarchical
– Integration with Parallel Computing Toolbox
Simple & Efficient
– Less time writing infrastructure code
– Integration with other V & V tools
– Automated reporting
![Page 27: Modelización , simulación y pruebas en Simulink · 3 Testing to date… Create harness models –to exercise model references or subsystems Write MATLAB code –to run the tests](https://reader035.vdocument.in/reader035/viewer/2022071421/611a8ccbeddba6207867c3d1/html5/thumbnails/27.jpg)
27