没有合适的资源?快使用搜索试试~ 我知道了~
首页FMI Toolbox for Matlab/Simulink的安装和使用说明
资源详情
资源评论
资源推荐

FMI Toolbox User's Guide 2.7

FMI Toolbox User's Guide 2.7
Publication date 2019-06-02
Copyright © 2019 Modelon AB
Ideon Science Park
SE-22370 LUND
<info@modelon.com>
Self publishing
ALL RIGHTS RESERVED. This document contains material protected under International Copyright Laws and Treaties. Any unauthorized
reprint or use of this material is prohibited. No part of this document may be reproduced or transmitted in any form or by any means, electronic
or mechanical, including photocopying, or by any information storage and retrieval system without express written permission from the author /
publisher.

iii
Table of Contents
1. Introduction .............................................................................................................................. 1
1.1. The FMI Toolbox for MATLAB/Simulink ........................................................................... 1
1.2. The Functional Mock-up Interface ...................................................................................... 1
2. Installation ................................................................................................................................ 3
2.1. Supported platforms ......................................................................................................... 3
2.2. Prerequisites ................................................................................................................... 3
2.2.1. MATLAB/Simulink ............................................................................................... 3
2.2.1.1. FMU import .............................................................................................. 3
2.2.1.2. Simulink Coder/Real-Time Workshop ............................................................ 4
2.3. Installation procedure ....................................................................................................... 6
2.3.1. For Windows ....................................................................................................... 6
2.3.2. For Linux ............................................................................................................ 7
2.3.3. Set MATLAB path ................................................................................................ 7
2.3.4. Unattended installation ........................................................................................... 7
2.3.4.1. Windows ................................................................................................... 7
2.3.4.2. Linux ....................................................................................................... 8
2.4. External installation ......................................................................................................... 9
2.4.1. MinGW-w64 GCC compiler ................................................................................... 9
2.4.1.1. Installation ................................................................................................. 9
2.5. License information ........................................................................................................ 10
2.5.1. Demo mode ........................................................................................................ 10
2.6. Uninstallation procedure .................................................................................................. 10
2.6.1. For Windows ...................................................................................................... 10
2.6.2. For Linux ........................................................................................................... 11
2.6.3. Unattended uninstallation ...................................................................................... 11
2.6.3.1. Windows ................................................................................................. 11
2.6.3.2. Linux ...................................................................................................... 12
2.7. Support ........................................................................................................................ 12
3. Simulation with Simulink .......................................................................................................... 13
3.1. Introduction .................................................................................................................. 13
3.2. Getting started ............................................................................................................... 13
3.3. FMU block properties ..................................................................................................... 19
3.3.1. Set parameters and variables start values .................................................................. 19
3.3.2. Input ports ......................................................................................................... 22
3.3.3. Output ports ....................................................................................................... 22
3.3.3.1. Direct Feedthrough .................................................................................... 25
3.3.4. FMU model information ....................................................................................... 27
3.3.5. Log ................................................................................................................... 29
3.3.5.1. Create result file ....................................................................................... 30
3.3.5.2. Logger .................................................................................................... 31

FMI Toolbox User's Guide 2.7
iv
3.3.6. Advanced ........................................................................................................... 31
3.3.6.1. Block icon and mask ................................................................................. 32
3.3.6.2. Tolerances (Not for FMU CS 1.0) ................................................................ 33
3.3.6.3. Sample times (FMU CS block only) ............................................................. 33
3.3.6.4. Reload FMU ............................................................................................ 33
3.3.6.5. Find FMU file on Model load ..................................................................... 33
3.3.7. Coder ................................................................................................................ 34
3.3.8. Scripting FMU block ........................................................................................... 35
3.3.9. Load FMU model ................................................................................................ 36
3.3.10. Reset an FMU model ......................................................................................... 37
3.3.11. Reload FMU model ............................................................................................ 37
3.3.12. Add Structured Ports to the FMU Block ................................................................ 37
3.3.13. Using the filter functions ..................................................................................... 37
3.4. FMU block and Simulink Coder ....................................................................................... 38
3.5. Examples ...................................................................................................................... 39
3.5.1. Changing start values and using the filter functions .................................................... 39
3.5.2. Configure outputs ................................................................................................ 41
3.5.3. Configure ports using structural naming ................................................................... 46
3.5.4. Build target containing an FMU block ..................................................................... 51
3.5.5. Build rti1006.tlc target containing an FMU block ...................................................... 55
3.5.5.1. Set start values and parameters .................................................................... 58
4. Simulation in MATLAB ............................................................................................................ 59
4.1. Introduction .................................................................................................................. 59
4.2. A first example ............................................................................................................. 59
4.3. Using the FMU model classes .......................................................................................... 61
4.3.1. Handle class ....................................................................................................... 61
4.3.2. Calling functions ................................................................................................. 61
4.3.3. Help .................................................................................................................. 62
4.4. Examples ...................................................................................................................... 63
4.4.1. Set start values and parameters .............................................................................. 63
4.4.2. Simulation with inputs .......................................................................................... 65
4.4.3. Simulation with configured output .......................................................................... 67
4.4.3.1. Using custom solver (Model Exchange only) .................................................. 69
4.5. Upgrading to FMI 2.0 ..................................................................................................... 69
4.5.1. Converting from FMI 1.0 to FMI 2.0 ...................................................................... 69
4.5.2. Using both FMI 1.0 and FMI 2.0 in scripts .............................................................. 71
5. FMU export from Simulink ........................................................................................................ 72
5.1. Introduction .................................................................................................................. 72
5.2. Getting started ............................................................................................................... 72
5.3. Simulink Coder targets for FMU export ............................................................................. 78
5.4. Selecting MEX C compiler .............................................................................................. 80
5.5. Co-Simulation export ...................................................................................................... 80

FMI Toolbox User's Guide 2.7
v
5.5.1. Synchronization of time ........................................................................................ 80
5.5.2. Capability flags ................................................................................................... 81
5.5.3. Configuration Parameters ...................................................................................... 82
5.5.3.1. Solver ..................................................................................................... 82
5.5.3.2. Optimization ............................................................................................ 82
5.5.3.3. Real-Time Workshop/Code Generation ......................................................... 82
5.5.4. Support for user defined S-Function blocks .............................................................. 85
5.6. Model Exchange export .................................................................................................. 87
5.6.1. Configuration Parameters ...................................................................................... 87
5.6.1.1. Solver ..................................................................................................... 87
5.6.1.2. Optimization ............................................................................................ 88
5.6.1.3. Real-Time Workshop/Code Generation ......................................................... 88
5.6.2. Support for user defined S-Function blocks .............................................................. 91
5.7. Parameters .................................................................................................................... 92
5.8. Internal signals .............................................................................................................. 92
5.8.1. Test points ......................................................................................................... 94
5.9. Supported data types ...................................................................................................... 95
5.10. Supported blocks .......................................................................................................... 96
5.11. Examples .................................................................................................................. 107
5.11.1. Using a Simulink model to control a Vehicle model ............................................... 107
5.11.1.1. Export Simulink model as FMU ............................................................... 107
5.11.1.2. Import FMU in vehicle model and simulate it in Dymola ............................... 109
6. Design of Experiments ............................................................................................................ 113
6.1. Introduction ................................................................................................................. 113
6.1.1. Concepts .......................................................................................................... 113
6.1.2. Workflow ......................................................................................................... 114
6.2. Getting started ............................................................................................................. 114
6.3. Function reference ........................................................................................................ 117
6.3.1. FMUModelME1 ................................................................................................ 118
6.3.1.1. trim ....................................................................................................... 118
6.3.1.2. linearize ................................................................................................. 119
6.3.2. FMUDoESetup .................................................................................................. 120
6.3.2.1. Constructor ............................................................................................ 120
6.3.2.2. DoE methods .......................................................................................... 123
6.3.3. FMUDoEResult ................................................................................................. 126
6.3.3.1. properties ............................................................................................... 126
6.3.3.2. main_effects ........................................................................................... 127
6.3.3.3. bode ...................................................................................................... 129
6.3.3.4. step ....................................................................................................... 130
6.4. Examples .................................................................................................................... 130
6.4.1. Mass-Spring system ........................................................................................... 130
6.4.1.1. Define the Experiment Setup ..................................................................... 130
剩余189页未读,继续阅读









安全验证
文档复制为VIP权益,开通VIP直接复制

评论0