调度模型组件
创建导出函数、基于速率的模型和分区,以便为代码生成调度模型
调度模型组件进行仿真或与外部调度器集成需要将算法存在于原子 Subsystem 或 Model 模块中。将执行速率指定为周期(调度子系统)或非周期(函数调用子系统)。
分区是作为原子任务独立执行的模型组件。在多任务模型中,分区是从模型组件创建的。使用分区,您可以分离模型中可在调度编辑器工具中显式控制的各部分。
调度编辑器是一个调度工具,它表示模型中称为分区的组件、它们之间的数据连接以及这些分区的顺序。调度编辑器只能用于现有组件,如原子子系统、导出函数和模型模块。调度编辑器是一个交互式工具,通过它可以轻松查看和编辑模型组件的调度情况。
模块
工具
调度编辑器 | View and edit the schedule of model components (partitions) (自 R2019a 起) |
对象
simulink.schedule.OrderedSchedule | Creates an OrderedSchedule object containing priority order of
the partitions of a model (自 R2020a 起) |
simulink.event.InputWrite | Trigger event when input port value updates (自 R2022b 起) |
simulink.event.InputWriteTimeout | Trigger event when input port value does not update within specified time (自 R2022b 起) |
simulink.event.InputWriteLost | Trigger event when input port value update overwrites unprocessed data (自 R2022b 起) |
函数
Simulink.BlockDiagram.getExecutionOrder | Open Execution Order pane (自 R2022b 起) |
simulink.schedule.createSchedule | Create a new schedule using provided schedule and ordering (自 R2020a 起) |
主题
导出函数模型
- 导出函数模型概述
导出函数模型概述和模型编译要求。 - Create Export-Function Model
Take the first step for creating independent functions in the generated code. - Test Export-Function Model Simulation Using Input Matrix
Use an input matrix to specify and test function-call event scheduling. - Test Export-Function Model Simulation Using Function-Call Generators
Use multiple Function-Call Generator blocks to test function-call event scheduling. - Test Export-Function Model Simulation Using Stateflow Chart
Use a Stateflow chart to test function-call event scheduling. - Test Export-Function Model Simulation Using Schedule Editor
Use the Schedule Editor to test function-call event scheduling. - Generate Code for Export-Function Model
Generate code for functions that can be integrated with an external scheduler. - Generate Code for Export-Function Model with Rate-Based Model
Generate code from models with function-call and scheduled subsystems.
基于速率的模型
- Create Rate-Based Model
Explicitly schedule rates for models and subsystems. - Test Rate-Based Model Simulation Using Function-Call Generators
Simulate rate-based model using test harness and function-call generators. - Generate Code from Rate-Based Model
Generate code from rate-based model, view report, and examine entry points.
执行顺序
- 控制和显示执行顺序
确定任务中模块之间的执行顺序。 - Sorting Rules for Explicitly Scheduled Model Components
Simulink® determines the execution order for model components, that is, subsystems and referenced models.
使用调度编辑器进行分区操作
- Create Partitions
Learn the concept of partitions and how to create them from a model. - Schedule the Partitions
Learn about the order of the partitions and how to edit the schedule. - Generate Code from a Partitioned Model
Learn about the impact of partitioning and editing the schedule on code generation. - Events in Schedule Editor
An event is a construct that represents an action, transition, or condition.