Documente Academic
Documente Profesional
Documente Cultură
Toolboxes: 1) Symbolic Math Toolbox 2) Control System Toolbox and Curve Fitting Toolbox
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
4
Technische Universitt Mnchen
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
Control systems Signal Processing systems Communications systems Embedded systems Physical systems other Dynamic systems
Implementation
Automatic code generation Rapid prototyping for HIL, SIL Verification and validation
Starting Simulink
10
11
12
13
14
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
15
Remeber MuPad:
+ b + = 0, x 0 = 0, 0 = 1, = 10, = 1, = 10
16
Alternative, but bad solution: reduce diagnostics settings and leave solving up to Simulink engine (not recommended!!)
17
Solver?
Determines solution at current time step Determines the next simulation time step
Solver options:
18
19
20
mx _ step _ size
Max step size is the largest time step that the solver can take (auto means 50 steps)
21
22
23
24
25
26
27
28
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
29
Exercise: Create a Stop Watch Combine counters to a stop watch Show tenth seconds, seconds, minutes and hours Reduce simulation speed to soft realtime
TUM Graduate School Training on MATLAB and Simulink
30
Different sample times need to be an integer multiple of the highest (global) sampling rate
Sample Time Colors -> fastest discrete sampling time is displayed in red
TUM Graduate School Training on MATLAB and Simulink
31
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
32
33
34
35
36
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
Simulink Libraries and Model Reference User Libraries Collection of reusable blocks Prototype block vs Reference block Propagation of changes to Library
Discard Push
37
Library Links
Disable link
Restore link Break link
Other features
Display in Simulink Library Browser Add documentation
TUM Graduate School Training on MATLAB and Simulink
Simulink Libraries and Model Reference Model Referencing One model in another- parent and referenced model Advantages:
Componentization/Modularization IP protection Multiple referencing Acceleration
38
39
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
40
41
42
43
44
45
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
46
47
Terminating Junction
Junction
Stateflow Hints
First Condition, then Action!
48
49
50
The execution has only one entry point! The execution has only one termination point! The execution can always reach the termination point! The flow never backtracks!
51
52
53
true
executes
false
54
55
56
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
57
58
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
59
60
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
61
62
63
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
64
S-Functions can be created by Block Context Menu, by Legacy Code Tool, by S-Function Builder or they can be written by hand (template available) S-Functions always consist of two elements: A .mexw32 file containing the compiled model A S-Function Block calling the .mexw32 file In most cases S-Function blocks are masked to increase usability
Integrating C Code using the Legacy Code Tool Demo: Legacy Code Tool
LCT only creates a wrapper, which will be removed at code generation Simple way to integrate C code in Simulink In MATLAB use ceval to integrate code
65
Help => Integrating Existing C Functions into Simulink Models with the Legacy Code Tool
TUM Graduate School Training on MATLAB and Simulink
66
Advanced: 1) Libraries and Model Reference 2) Style Guidelines 3) Model Advisor 4) Report Generator and Model Comparison 5) Integrating C Code using the Legacy Code Tool 6) MATLAB Coder, Simulink Coder, Embedded Coder
67
MATLAB Coder, Simulink Coder, Embedded Coder Simulink Coder and Embedded Coder
68
69
Summary
Simulink is a graphical modeling environment based on MATLAB Simulink is fully integrated in MATLAB environment Simulink can be used to model continuous, discrete and hybrid sytsems In addition, Simulink is a graphical programming language for embedded systems Simulink interacts with real hardware for Hardware In The Loop or Procesoor in the Loop setups, as well as for test beds and laboratory setups
70
Contact