当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《自动控制原理》课程教学资源(The MathWorks - MATLAB 相关电子书籍)09 SIMULINK Model-Based and System-Based Design Writing S-Functions Version 5

资源类别:文库,文档格式:PDF,文档页数:555,文件大小:3.77MB,团购合买
COPYRIGHT 1998-2002 by The Math Works, Inc. The software described in this document is fur d under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form The Math Works, Inc. FEDERAL ACQUISITI
点击下载完整版文档(PDF)

SIMULINK Model-Based and System-Based Design Modeling Simulation Implementation Writing S-Functions The mathWorks Version 5

Modeling Simulation Implementation Model-Based and System-Based Design ® Writing S-Functions Version 5

How to Contact The mathWorks Web comp.soft-sys matlab Newsgroup Technical support suggestemathworks.com Product enhancement suggestions bugs@mathworks.com Bug reports docamathworks. com Documentation error reports serviceamathworks. com Order status, license renewals, passcodes infoamathworks, com Sales, pricing, and general information 508-647-7000 Phone 508-647-7001 C The Math Works, Inc. Mail 3 Apple Hill Drive Natick. MA 01760-2098 For contact information about worldwide offices, see the math Works web site Writing S-Functions o COPYRIGHT 1998-2002 by The Math Works, Inc. The software described in this document is furnished under a license agreement. The software may be used he terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The Math Works, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the goven ions. If this licen y respect with federal procurement law, the government agrees to return the Program and Documentation. unused. to Math Works. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Box is a trademark of The MathWorks, Inc. arks of their respective holders. Printing History: October 1998 First printing Revised for Simulink 3.0(Release 11) November 2000 Second printing Revised for Simulink 4.0(Release 12) June 2001 nline only Revised for Simulink 4.1(Release 12.1) July 2002 Online only Revised for Simulink 5.0(Release 13)

How to Contact The MathWorks: www.mathworks.com Web comp.soft-sys.matlab Newsgroup support@mathworks.com Technical support suggest@mathworks.com Product enhancement suggestions bugs@mathworks.com Bug reports doc@mathworks.com Documentation error reports service@mathworks.com Order status, license renewals, passcodes info@mathworks.com Sales, pricing, and general information 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. Mail 3 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site. Writing S-Functions  COPYRIGHT 1998 - 2002 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro￾duced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and TargetBox is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History: October 1998 First printing Revised for Simulink 3.0 (Release 11) November 2000 Second printing Revised for Simulink 4.0 (Release 12) June 2001 Online only Revised for Simulink 4.1 (Release 12.1) July 2002 Online only Revised for Simulink 5.0 (Release 13)

Contents Overview of s-Functions What Is an S-Function? 2 Using S-Functions in Models 1-3 Passing Parameters to S-Functions 1-4 When to Use an s-Function 15 How S-Functions Work l-6 Mathematics of simulink blocks Simulation Stages... l-6 S-Function Callback methods 1-9 Implementing S-Functions 1-10 M-File s-Functions l-10 MEX-File S-Functions l-11 S-Function Concepts l-13 Direct Feedthrough 1-13 Dynamically Sized Arrays l-13 Setting Sample Times and Offsets 1-15 S-Function Examples l-18 Writing M s-Functions Introduction 2-2 S-Function Arguments 2-2 S-Function Outputs Defining S-Function Block Characteristics

i Contents 1 Overview of S-Functions What Is an S-Function? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Using S-Functions in Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Passing Parameters to S-Functions . . . . . . . . . . . . . . . . . . . . . . 1-4 When to Use an S-Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 How S-Functions Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Mathematics of Simulink Blocks . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Simulation Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 S-Function Callback Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Implementing S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 M-File S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 MEX-File S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 S-Function Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Direct Feedthrough . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Dynamically Sized Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Setting Sample Times and Offsets . . . . . . . . . . . . . . . . . . . . . . 1-15 S-Function Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18 2 Writing M S-Functions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 S-Function Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 S-Function Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Defining S-Function Block Characteristics . . . . . . . . . . . . . . 2-5

Processing S-Function Parameters Examples of M-File S-Functions 27 Simple M-File S-Function Example 27 Example- Continuous State S-Function Example- Discrete State S-Function 2-12 Example- Hybrid System S-Function 2-14 Example- Variable Sample Time S-Function Writing s-Functions in C 3 Introduction 3-2 Creating C MEX S-Functions Building S-Functions Automatically 3-5 S-Function Builder Dialog Box 3-8 Setting the Include Path Example of a Basic C MEX S-Function Defines and includes ..327 Callback Implementations Simulink/Real-Time Workshop Interface 3-29 Building the Timestwo Example 330 Templates for C S-Functions 3-3 S-Function Source File Requirements 3-31 The insTruct Compiling c s-Functions ..3-34 How Simulink interacts with C s-Functions Process view Data view Writing Callback Methods Converting Level 1 C MEX S-Functions to Level 2

ii Contents Processing S-Function Parameters . . . . . . . . . . . . . . . . . . . . . 2-6 Examples of M-File S-Functions . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Simple M-File S-Function Example . . . . . . . . . . . . . . . . . . . . . . 2-7 Example - Continuous State S-Function . . . . . . . . . . . . . . . . . . 2-9 Example - Discrete State S-Function . . . . . . . . . . . . . . . . . . . . 2-12 Example - Hybrid System S-Function . . . . . . . . . . . . . . . . . . . 2-14 Example - Variable Sample Time S-Function . . . . . . . . . . . . . 2-17 3 Writing S-Functions in C Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Creating C MEX S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Building S-Functions Automatically . . . . . . . . . . . . . . . . . . . . 3-5 S-Function Builder Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Setting the Include Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23 Example of a Basic C MEX S-Function . . . . . . . . . . . . . . . . . 3-25 Defines and Includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Callback Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Simulink/Real-Time Workshop Interface . . . . . . . . . . . . . . . . . 3-29 Building the Timestwo Example . . . . . . . . . . . . . . . . . . . . . . . . 3-30 Templates for C S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31 S-Function Source File Requirements . . . . . . . . . . . . . . . . . . . 3-31 The SimStruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-33 Compiling C S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34 How Simulink Interacts with C S-Functions . . . . . . . . . . . . 3-35 Process View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35 Data View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-39 Writing Callback Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-43 Converting Level 1 C MEX S-Functions to Level 2 . . . . . . . 3-44

Obsolete macros Creating C++S-Functions Source file format 4-2 Making C++ Objects Persistent Building C++ S-Functions 47 Creating Ada s-Functions 5 Introduction Ada s-Function Source file format 5-3 Ada S-Function Specification Ada S-Function body Writing Callback Methods in Ada 5-6 Callbacks Invoked by Simulink 5-6 Implementing Callbacks Omitting Optional Callback Methods 5-7 SimStruct functions Building an Ada s-Function ...5-9 Ada Compiler Requirement Example of an Ada s-Function

iii Obsolete Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46 4 Creating C++ S-Functions Source File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Making C++ Objects Persistent . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Building C++ S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 5 Creating Ada S-Functions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Ada S-Function Source File Format . . . . . . . . . . . . . . . . . . . . . 5-3 Ada S-Function Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 Ada S-Function Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Writing Callback Methods in Ada . . . . . . . . . . . . . . . . . . . . . . . 5-6 Callbacks Invoked by Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Implementing Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 Omitting Optional Callback Methods . . . . . . . . . . . . . . . . . . . . . 5-7 SimStruct Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 Building an Ada S-Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Ada Compiler Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Example of an Ada S-Function . . . . . . . . . . . . . . . . . . . . . . . . 5-10

Creating Fortran S-Functions 6 Introduction 6-2 Level 1 Versus level 2 S-Functions Creating Level 1 Fortran S-Functions The Fortran MEX Template File Example Inline Code Generation Example Creating Level 2 Fortran S-Functions 67 Template File .6-7 C/Fortran Interfacing Tips Constructing the Gateway 6-1 Example C-MeX S-Function Calling Fortran Code 6-13 Porting Legacy Code 6-14 Find the states 614 Sample Times 6-1 Multiple Instances 6-1 Use Flints If Needed 615 Considerations for real time 615 Implementing block Features 7 Dialog Parameters ......72 Tunable parameters Run-Time Parameters 7-5 Creating Run-Time Parameters 7-6 Updating Run-Time Parameters 77 Creating Input and Output Ports Creating Input Ports Creating Output Ports

iv Contents 6 Creating Fortran S-Functions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Level 1 Versus Level 2 S-Functions . . . . . . . . . . . . . . . . . . . . . . 6-2 Creating Level 1 Fortran S-Functions . . . . . . . . . . . . . . . . . . . 6-3 The Fortran MEX Template File . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Inline Code Generation Example . . . . . . . . . . . . . . . . . . . . . . . . 6-6 Creating Level 2 Fortran S-Functions . . . . . . . . . . . . . . . . . . . 6-7 Template File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 C/Fortran Interfacing Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Constructing the Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Example C-MEX S-Function Calling Fortran Code . . . . . . . . . 6-13 Porting Legacy Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 Find the States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 Sample Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 Multiple Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 Use Flints If Needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15 Considerations for Real Time . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15 7 Implementing Block Features Dialog Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Tunable Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 Run-Time Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 Creating Run-Time Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Updating Run-Time Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 7-7 Creating Input and Output Ports . . . . . . . . . . . . . . . . . . . . . . . 7-8 Creating Input Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Creating Output Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10

Scalar Expansion of Inputs 7-11 Masked Multiport s-Functions 7-12 Custom Data Types ample Times 7-1 Block-Based Sample Times 7 Specifying Port-Based Sample Times Hybrid Block-Based and Port-Based Sample Times Multirate s-function blocks 7-23 Synchronizing Multirate S-Function Blocks 7-24 Work Vectors 7-26 Work Vectors and Zero Crossings Example Involving a Pointer Work Vector 7-28 Memory Allocation 7-30 Function-Call Subsystems 7-31 Handling Errors Exception Free Code ss SetErrorStatus Termination Criteria ..7-34 Checking Array bounds 7-35 S-Function Examples ..7-36 Example of a Continuous State S-Function Example of a Discrete State S-Function Example of a Hybrid System S-Function 7-45 Example of a Variable-Step S-Function Example of a Zero Crossing S-Function Example of a Time-Varying Continuous Transfer Function..7-64 Writing S-Functions for Real-Time Workshop 8 Introduction Classes of Problems Solved by S-Functions

v Scalar Expansion of Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 Masked Multiport S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 Custom Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 Sample Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Block-Based Sample Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16 Specifying Port-Based Sample Times . . . . . . . . . . . . . . . . . . . . 7-18 Hybrid Block-Based and Port-Based Sample Times . . . . . . . . 7-22 Multirate S-Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23 Synchronizing Multirate S-Function Blocks . . . . . . . . . . . . . . 7-24 Work Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26 Work Vectors and Zero Crossings . . . . . . . . . . . . . . . . . . . . . . . 7-28 Example Involving a Pointer Work Vector . . . . . . . . . . . . . . . . 7-28 Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-30 Function-Call Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-31 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-33 Exception Free Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-33 ssSetErrorStatus Termination Criteria . . . . . . . . . . . . . . . . . . 7-34 Checking Array Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-35 S-Function Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-36 Example of a Continuous State S-Function . . . . . . . . . . . . . . . 7-36 Example of a Discrete State S-Function . . . . . . . . . . . . . . . . . . 7-41 Example of a Hybrid System S-Function . . . . . . . . . . . . . . . . . 7-45 Example of a Variable-Step S-Function . . . . . . . . . . . . . . . . . . 7-49 Example of a Zero Crossing S-Function . . . . . . . . . . . . . . . . . . 7-52 Example of a Time-Varying Continuous Transfer Function . . 7-64 8 Writing S-Functions for Real-Time Workshop Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Classes of Problems Solved by S-Functions . . . . . . . . . . . . . . . . 8-2

Types of s-Functions Basic Files Required for Implementation Noninlined S-Functions 87 S-Function Module Names for Real-Time Workshop Builds..8-7 Writing Wrapper S-Functions 8-9 MEX S-Function Wrapper ..8-9 TLC S-Function Wrapper The Inlined Code 8-18 Fully Inlined S-Functions Multiport S-Function Example 8-19 Fully Inlined S-Function with the mdIRTW Routine S-Function rtWdata 8-22 The Direct-Index Lookup Table algorithm The Direct-Index Lookup Table Example Creating Code-Reuse-Compatible s-Functions S-Function callback methods 9 md check Parameters ..9-2 mdlDerivatives mdGetTimeofNextvarHit 9-5 mdlInitialize Conditions 9-6 mdlInitialize SampleTimes 9-8 mdlInitializesizes ..9-12 mdlOutputs 9-16 mdlProcess Parameters 9-17 mdIRTW 9-19 mdIsetDefault Port Complex signals 920 mdISsetDefaultPortDataTypes 921 mdIsetDefaultPortDimensionInfo 922 mdlSetInput Port Complex Signal mdlSetInputPortData Type

vi Contents Types of S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 Basic Files Required for Implementation . . . . . . . . . . . . . . . . . . 8-5 Noninlined S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 S-Function Module Names for Real-Time Workshop Builds . . . 8-7 Writing Wrapper S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9 MEX S-Function Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9 TLC S-Function Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14 The Inlined Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18 Fully Inlined S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19 Multiport S-Function Example . . . . . . . . . . . . . . . . . . . . . . . . . 8-19 Fully Inlined S-Function with the mdlRTW Routine . . . . . 8-21 S-Function RTWdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-22 The Direct-Index Lookup Table Algorithm . . . . . . . . . . . . . . . . 8-23 The Direct-Index Lookup Table Example . . . . . . . . . . . . . . . . . 8-24 Creating Code-Reuse-Compatible S-Functions . . . . . . . . . . 8-42 9 S-Function Callback Methods mdlCheckParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 mdlDerivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4 mdlGetTimeOfNextVarHit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 mdlInitializeConditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 mdlInitializeSampleTimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8 mdlInitializeSizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 mdlOutputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16 mdlProcessParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17 mdlRTW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19 mdlSetDefaultPortComplexSignals . . . . . . . . . . . . . . . . . . . . . 9-20 mdlSetDefaultPortDataTypes . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21 mdlSetDefaultPortDimensionInfo . . . . . . . . . . . . . . . . . . . . . . 9-22 mdlSetInputPortComplexSignal . . . . . . . . . . . . . . . . . . . . . . . . 9-23 mdlSetInputPortDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24

mdISetInput PortDimensionInfo mdISetInputPortFrameData 927 mdlSetInputPortSampleTime 928 mdlSetlnputPortwidth 930 mdl SetOutput Port Complex signal 9-31 mdISetOutput PortDataType mdISetOutputPortDimensionInfo mdlSetOutput Time mdlSetOutput Width 936 mdIset Work Widths mdIStart mdTerminate mdlzero Crossings 9-41 Sim Struct functions 10 Introduction 102 Language Support 102 The insTruct 102 SimStruct Macros and Functions Listed by Usage 103 Miscellaneous 103 Error Handling and Status IO Port 10-4 Dialog box Parameters 0-9 Run-Time Parameters 10-10 Sample Time State and work vector 10-13 Simulation information 1017 Function call 10-19 Data Type 10-19 Real-Time Workshop 1020 Macro Reference 1022 ss CallExternalModeFcn 10-23

vii mdlSetInputPortDimensionInfo . . . . . . . . . . . . . . . . . . . . . . . . 9-25 mdlSetInputPortFrameData . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-27 mdlSetInputPortSampleTime . . . . . . . . . . . . . . . . . . . . . . . . . . 9-28 mdlSetInputPortWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-30 mdlSetOutputPortComplexSignal . . . . . . . . . . . . . . . . . . . . . . 9-31 mdlSetOutputPortDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-32 mdlSetOutputPortDimensionInfo . . . . . . . . . . . . . . . . . . . . . . . 9-33 mdlSetOutputPortSampleTime . . . . . . . . . . . . . . . . . . . . . . . . . 9-35 mdlSetOutputPortWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-36 mdlSetWorkWidths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-37 mdlStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-38 mdlTerminate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-39 mdlUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-40 mdlZeroCrossings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-41 10 SimStruct Functions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Language Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 The SimStruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 SimStruct Macros and Functions Listed by Usage . . . . . . . 10-3 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 Error Handling and Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 I/O Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 Dialog Box Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9 Run-Time Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10 Sample Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11 State and Work Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13 Simulation Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17 Function Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 Real-Time Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20 Macro Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22 ssCallExternalModeFcn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23

ss CallSystem WithTid 10-24 ss Getabs tol ......10-25 ssGet Block Reduction ssGetContStateaddress 10-27 ss Get Contstates ss Typed ss GetDataTypeName 10-30 ssGetData Type Size 10-31 ss GetData ssGetDiscStates ss GetDTypeld FromMxArray ssGetDWork 10-36 ss Work ComplexSignal 10-37 ss GetDWork DataTyp 10-38 ss GetDWorkName ssGetDWorkRTWIdentifier 10-40 ss GetDWorkRTWStorage Class 10-41 10-42 ssGetDWorkUsed AsDState 10-43 ssGetDWork width 0 ssGetdX 10-45 ss Get ErrorStatus 10-46 ss GetInlineParameters 10-47 ss GetInputPortBufferDstPort ss Getinput Port Complex Signal 10-49 ss GetInputPort Connected 10-50 ss GetInputPortDataType 10-51 ss GetInputPortDimensions ss GetInput PortDirect FeedThrough 10-53 sGetInput Data 1054 ss GetInputPortNumDimensions ss GetInputPortOffsetTime 10-56 s GetInput PortOver Writable 1057 ss GetInput Port RealSignal s Getlnput Port RealSignalPtrs 10-60 ss Getinput Port Required Contiguou ss GetInputPort Reusable 10-62 ssGetInputPortSampleTime.. .....10-63 ss GetInputPortSampleTimeIndex rlll Contents

viii Contents ssCallSystemWithTid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-24 ssGetAbsTol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25 ssGetBlockReduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26 ssGetContStateAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27 ssGetContStates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28 ssGetDataTypeId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29 ssGetDataTypeName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30 ssGetDataTypeSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31 ssGetDataTypeZero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32 ssGetDiscStates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33 ssGetDTypeIdFromMxArray . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34 ssGetDWork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-36 ssGetDWorkComplexSignal . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37 ssGetDWorkDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38 ssGetDWorkName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39 ssGetDWorkRTWIdentifier . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-40 ssGetDWorkRTWStorageClass . . . . . . . . . . . . . . . . . . . . . . . . 10-41 ssGetDWorkRTWTypeQualifier . . . . . . . . . . . . . . . . . . . . . . . 10-42 ssGetDWorkUsedAsDState . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-43 ssGetDWorkWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-44 ssGetdX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45 ssGetErrorStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-46 ssGetInlineParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47 ssGetInputPortBufferDstPort . . . . . . . . . . . . . . . . . . . . . . . . . 10-48 ssGetInputPortComplexSignal . . . . . . . . . . . . . . . . . . . . . . . . 10-49 ssGetInputPortConnected . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-50 ssGetInputPortDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-51 ssGetInputPortDimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-52 ssGetInputPortDirectFeedThrough . . . . . . . . . . . . . . . . . . . . 10-53 ssGetInputPortFrameData . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-54 ssGetInputPortNumDimensions . . . . . . . . . . . . . . . . . . . . . . . 10-55 ssGetInputPortOffsetTime . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-56 ssGetInputPortOverWritable . . . . . . . . . . . . . . . . . . . . . . . . . 10-57 ssGetInputPortRealSignal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-58 ssGetInputPortRealSignalPtrs . . . . . . . . . . . . . . . . . . . . . . . . 10-60 ssGetInputPortRequiredContiguous . . . . . . . . . . . . . . . . . . . . 10-61 ssGetInputPortReusable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-62 ssGetInputPortSampleTime . . . . . . . . . . . . . . . . . . . . . . . . . . 10-63 ssGetInputPortSampleTimeIndex . . . . . . . . . . . . . . . . . . . . . 10-64 ssGetInputPortSignal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-65

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共555页,可试读40页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有