文件名称:
Developing S-Functions.pdf
开发工具:
文件大小: 2mb
下载次数: 0
上传时间: 2019-07-28
详细说明:MATLAB的S-Function开发说明,是S函数开发的指导说明,很有价值Revision History
October 1998 First printing
Revised for version 3.0(Release R11)
November 2000 Second printing
Revised for Version 4.0(Release R12
July 2002
Third printing
Revised for version 5.0 Release R13)
April 2003
Online only
Revised for Version 5.1 (Release r13SP1)
April 2004
Online only
Revised for version 5.1.1(Release R13SP1+)
June 2004
Online only
Revised for Version 6.0(Release r14)
October 2004
Online only
Revised for Version 6.1(Release R14SP1)
March 2005
Online only
Revised for version 6.2(Release R14SP2)
September 2005 Online Only
Revised for Version 6.3(Release r14SP3)
March 2006
Online only
Revised for Version 6.4(Release 2006a)
September 2006 Online only
Revised for Version 6.5 (Release 2006b
March 2007
Online only
Revised for Version 6.6 (Release 2007a)
September 2007 Online only
Revised for Version 7.0(Release 2007b
March 2008
Online only
Revised for Version 7. 1(Release 2008a)
October 2008
Online only
Revised for version 7. 2(Release 2008b)
March 2009
Online only
Revised for Version 7. 3(Release 2009a)
September 2009 Online only
Revised for version 7. 4(Release 2009b)
March 2010
Online only
Revised for Version 7.5 (Release 2010a)
September 2010 Online only
Revised for Version 7.6 (Release 2010b)
april 2011
Online only
Revised for Version 7. 7(Release 2011a)
September 2011 Online only
Revised for Version 7. 8(Release 2011b)
March 2012
Online only
Revised for Version 7. 9(Release 2012a
September 2012 Online only
Revised for Version 8.0(Release 2012b)
March 2013
Online only
Revised for Version 8. 1(Release 2013a
September 2013 Online only
Revised for version 8.2(Release 2013b)
March 2014
Online only
Revised for Version 8. 3(Release 2014a)
October 2014 Online only
Revised for version 8.4(Release 2014b)
March 2015
Online only
Revised for Version 8.5(Release 2015a)
September 2015 Online only
Revised for Version 8.6(Release 2015b
October 2015
Online only
Rereleased for Simulink 8.5. 1(Release
2015aSP1)
March 2016
Online only
Revised for Version 8. 7(Release 2016a)
September 2016 Online only
Revised for Version 8.8(Release 2016b
March 2017
Online only
Revised for Version 8.9(Release 2017a)
September 2017 Online only
Revised for Version 9.0(Release 2017b
March 2018
Online only
Revised for Version 9.1(Release 2018a
Contents
Overview of s-functions
1
What is an s-function?
1-2
Use s-Functions in models
Overview
Passing Parameters to s-Functions
When to use an s-Function
1-7
How S-Functions work
1-8
Introduction
1-8
Mathematics of simulink blocks
1-8
Simulation stages
1-8
S-Function Callback methods
1-11
Implementing S-Functions
1-12
MATLAB S-Functions
1-12
MEX S-Functions
1-13
S-Function callback methods
1-14
Callback methods Overview
1-14
Callback methods for C meX s-Functions
1-15
Callback methods for level-2 MATLAB S-Functions
1-16
S-Function Compatibility
1-19
S-Function Concepts
1-20
Direct Feedthrough
1-20
Dynamically Sized Arrays.........
1-21
Setting Sample Times and offsets
1-22
S-Function Examples
1-26
Overview of Examples
1-26
Level-2 MATLAB S-Function Examples
1-29
Level-1 MATLAB S-Function Examples
1-29
C S-Function Examples
1-30
Fortran s-Function Examples
1-34
C++ S-Function Examples
1-35
Organizing s-Function in a Simulink Project
1-35
Selecting an s-Function Implementation
Available s-Function Implementations
2-2
S-Function Types
2-3
Implement s-Functions
2-4
S-Function Features
2-7
S-Function limitations
2-12
s-Functions Incorporate Legacy C Code
2-14
Overview
2-14
Using a Hand-Written S-Function to Incorporate Legacy
Code
2-15
Using the s-Function Builder to Incorporate Legacy Code.. 2-17
Using the Legacy Code Tool to Incorporate Legacy Code
2-20
Writing S-Functions in MATLAB
Custom Blocks using MATLaB s-Functions
3-2
Write level-2 matlab s-functions
3-3
About Level-2 MATLAB S-Functions
3-3
About Run-Time Objects
3-4
Level-2 MATLAB S-Function Template
3-4
Level-2 MATLAB S-Function Callback Methods
3-5
Using the setup Method
3-6
vi Contents
Example of Writing a Level-2 MATLAB S-Function......... 3-7
nstantiating a Level-2 MATLAB S-Function
3-10
Operations for Variable-Size Signals
3-11
Generating Code from a Level-2 MATLAB S-Function
3-11
MATLAB S-Function Examples
3-11
Maintain Level-1 MATLAB S-Functions
3-12
About the maintenance of level-1 MATLAB S-Functions
3-12
Level-1 MATLAB S-Function Arguments
3-13
Level-1 MATLAB S-Function Outputs
3-14
Convert Level-1 MATLAB S-Functions to Level2∴."…·..
Define s-Function block characteristics
3-15
Processing
S-Function parameters
3-16
3-16
Writing S-Functions in C
About c s-Functions
4-2
Creating c mex s-Functions
4-4
Build s-Functions automatically
4-5
About building S-Functions Automatically
45
Deploying the g
ed s-Function
49
How the s-Function builder builds an s-function
4-9
S-Function Builder Dialog box
4-11
About s-Function builder
4-11
Parameters/s-Function Name Pane
4-13
Port/Parameter Pane
4-14
Initialization pane
4-14
Data Properties Pane....
4-16
nput Ports Pane
4-16
Output Ports Pane
4-17
Parameters pane
4-19
Data Type Attributes Pane
4-19
Libraries pane
4-20
Start pane
4-21
Outputs Pane
4-22
Continuous derivatives pane
4-24
Discrete Update Pane
音看面
4-26
Terminate pane
4-27
Build info pane
4-27
Example: Modeling a Two-Input/Two-Output System
4-28
Basic c mex s-function
4-34
Introducing an Example of a basic c mex s-Function
4-34
Defines and includes
4-36
Callback method Implementations
4-37
Simulink/Simulink Coder Interfaces
4-39
Building the Timestwo Example
4-39
Templates for c s-Functions
4-40
About the Templates for C s-Functions
4-40
S-Function Source File Requirements
鲁鲁音
4-40
The sim Struct
4-42
Data Types in S-Functions
4-43
Compiling c s-Functions
4-43
Integrate C Functions Using Legacy Code Tool
4-44
Overvie
4-44
Integrate C Functions into Simulink Models with Legacy Code
Tool
4-47
Integrate C Function Whose Arguments are pointers to
Structures
4-50
Registering Legacy Code Tool Data Structures
4-56
Declaring Legacy Code Tool Function Specifications
458
Generating and Compiling the s-Functions
4-65
Generating a Masked s-Function Block for Calling a Generated
S-Function
4-66
Forcing simulink accelerator Mode to Use S-Function tLC
Inlining Code
4-66
Calling Legacy C++ Functions
4-67
Handling multiple Registration Files
4-67
Deploying Generated S-Functions
4-68
Legacy Code Tool Examples
4-68
Legacy Code Tool Limitations...........
4-68
Simulink Engine Interaction with C s-Functions
4-70
Introduction
4-70
ProcessⅤiew,,,,,,,,,,,,,,,,,
4-70
DataⅤiew
4-77
viii Contents
Write Callback methods
4-81
S-Functions in normal mode referenced models
4-82
Supporting the Use of Multiple Instances of Referenced Models
That are in normal mode
4-83
Debug C mex s-Functions
4-84
About Debugging C MEX S-Functions
鲁春
4-84
Debug in Simulink environment
4-84
Debug Using Third-Party Software
4-88
Convert level-1 C mEX S-functions
4-92
Guidelines for Converting Level-1 C MEX S-Functions to
Level-2
4-92
Obsolete macros
4-94
Creating C++ s-Functions
Create ac++ source file
5-2
C++ references
5-2
Make C++ objects Persistent
5-3
Build c++ s-functions
Creating Fortran S-Functions
6
Create Level-2 Fortran s-Functions
6-2
About Creating Level-2 Fortran S-Functions
6-2
Template File
6-2
C/Fortran Interfacing Tips
6-2
Constructing the Gateway
6-7
Example C MEX S-Function Calling Fortran Code
6-9
Port Legacy Code.........
6-11
Find the states
6-11
Sample times
6-11
Store data
6-12
Use Flints if Needed
6-12
Considerations for real time
6-12
Run S-Function Analvzer
Check S-Functions Using s-Function Analyzer APIs
7-2
rerequ
7-2
Setup the Working environment
7-2
Run the s-Function checks
7-3
Explore and Fix Problems
75
Troubleshooting S-Function Checks
7-14
Environment checks
714
Source Code checks
7-14
S-Function meX file Checks
Input Parameter Robustness Check
7-14
716
sing Work vectors
8
DWork vector basics
8-2
What is a dwork vector?
8-2
Advantages of D Work Vectors
8-2
DWork Vectors and the Simulink engine.........8-3
DWork vectors and the simulink coder product
8-4
Types of DWork Vectors
8-5
How to Use dwork vectors
8-7
Using DWork Vectors in C MEX S-Functions
8-7
DWork Vector C MEX macros
8-10
Using DWork Vectors in Level-2 MATLAB S-Functions
8-11
x Contents
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.