创建模块封装
为子系统和自定义模块创建自定义外观、创建用户定义的界面、封装逻辑以及隐藏数据
Simulink® 允许您创建模块封装。封装是用于模块的一种自定义用户界面。
通过封装模块,可以将模块图封装起来,使其拥有自己的参数对话框,以及自己的模块描述、参数提示和帮助文本。
您可以封装独立的自定义模块以作为独特模块重复使用,就像 Simulink 中定义的模块一样。
要了解如何创建模块封装,请参阅创建简单封装。
类
Simulink.Mask | 以编程方式控制封装 |
Simulink.Mask.Constraints | Create mask parameter constraint |
Simulink.Mask.PortConstraints | Create mask port constraints programmatically |
Simulink.Mask.ParameterCondition | Create mask parameter conditions |
Simulink.Mask.PortConstraintRule | Create instance of Simulink.Mask.PortConstraintRule to define
rules of port constraint |
Simulink.Mask.PortIdentifier | Create port identifiers to identify ports of block in mask object |
Simulink.MaskParameter | 以编程方式控制封装参数 |
Simulink.Mask.EnumerationBase | Derive an enumeration class to hold numeric values of any datatype |
Simulink.Mask.EnumerationTypeOptions | Parse information from enumeration file derived from
Simulink.IntEnumType and
Simulink.Mask.EnumerationBase |
Simulink.dialog.Control | 创建对话框控件的实例 |
Simulink.dialog.parameter.CustomTable | Create custom tables programmatically |
Simulink.dialog.ListboxControl | Control list box programmatically |
Simulink.dialog.TreeControl | Control Tree control programmatically |
Simulink.dialog.LookupTableControl | Control mask lookup tables programmatically |
Simulink.dialog.LookupTableControl.Table | Control table data for mask lookup table |
Simulink.dialog.LookupTableControl.Breakpoints | Control breakpoint data set for mask lookup table |
主题
封装简介
- 封装基础知识
了解有关封装和何时封装模块的基础知识。 - 创建简单封装
创建和自定义模块封装。 - Manage Existing Masks
View or edit an existing block mask.
封装编辑器用户界面
- 封装编辑器概述
使用封装编辑器界面创建和自定义封装。 - 使用“数据类型字符串”参数指定数据类型
为“编辑封装”参数添加数据类型约束。 - 设计封装对话框
尝试此示例以创建一个封装对话框并了解某些封装编辑器功能的用途。 - Handling Large Number of Mask Parameters
Add large number of mask parameters in a Table programmatically. - Customize Tables for Masked Blocks
Add custom tables to mask dialog box. - Control Custom Table Programmatically
Use a programmatic interface to control custom tables.
封装功能
- Validating Mask Parameters Using Constraints
Add validation to mask parameters using constraints. - Custom Constraint for Mask Parameter
A mask can contain parameters that accept user input values. - Share Parameter Constraints Across Multiple Block Masks
This example shows how to create a parameter constraint and share it across masks of different blocks in the same model or different models. - Validate Input and Output Port Signals Using Port Constraints
You can validate compile-time signal attributes on the input and output ports of a masked block by using port constraints. - 封装回调代码
添加并执行封装回调代码。 - 初始化封装
使用 MATLAB® 代码初始化模块封装。 - Promote Block Parameters on a Mask
Blocks and subsystems can have multiple parameters associated with them. - 以编程方式控制封装
Simulink® 定义了一组有助于设置和编辑封装的参数。要从 MATLAB® 命令行设置和编辑封装,您可以使用Simulink.Mask
和Simulink.MaskParameter
类方法。也可以使用get_param
和set_param
函数来设置和编辑封装。但是,由于这些函数使用的分隔符不支持 Unicode®(非英文)字符,建议您使用Simulink.Mask
方法和Simulink.MaskParameter
类方法来控制封装。 - 将值传递给封装下的模块
使用封装对话框指定输入值。 - Mask Linked Blocks
Add custom interface to linked blocks. - Approaches to Control Active Variant Choice of a Variant Block Using Mask or Model Workspace
This example shows different approaches to control the active choice of inline variant and Variant Subsystem blocks from a mask or a model workspace. - Define Measurement Units for Masked Blocks
Set measurement units for output and input ports of a masked block. - Add Images in Masks
Add images as mask icons and save them in the SLX file. - Create and Edit Masked Block Icon Using Graphical Icon Editor
You can create and edit the mask icon of a block using a graphical environment. - Create Hierarchical List in Mask Dialog
Create a hierarchical list of data on a mask. - Tune Mask Popup Parameters by Referencing an External Enumeration File
Reference external enumeration file to assign numerical values to popup parameter. - Visualize and Plot N-Dimensional Data Using Mask Lookup Table Control
Use a lookup table to evaluate a sampled representation of a function using simple lookup operations.
封装回调
- 动态封装对话框
基于用户输入更改封装对话框。 - 动态封装子系统
创建可以修改其结构性内容的封装库模块。 - Debug Masks That Use MATLAB Code
Troubleshoot errors in the mask initialization code.
系统封装
- Introduction to System Mask
Learn about masking a model. - Create and Reference a Masked Model
Mask a model interactively. - Control System Mask Programmatically
Simulink® defines a set of parameters to configure and edit a system mask.
示例模型
- Masking Example Models
View Simulink models that demonstrate masking capabilities.