Main Content

Implicit and Explicit Partitioning of Models

在Simulink中为您的应用程序实施多项编程时金宝app®, there are two ways to partition your model for running on individual processing nodes. If you are new to multicore programming in Simulink, use the default (implicit partitioning) for your first iteration of implementing multicore programming.

The automated way of creating tasks and mapping them to your processing nodes is called隐式分区。金宝app基于根级别的块的样本时间对模型进行模拟分区。模型中的每个示例时间都对应于一个分区,单个速率或样本时间的所有块都属于同一分区。金宝appSimulink将这些分区映射到处理器上运行的任务。隐式分区假设您的体系结构是单个多核心CPU。CPU任务调度程序处理所有分区任务。

如果要指定如何分区模型,请使用explicit partitioning。In explicit partitioning, you create partitions in the root-level model by using referenced models, MATLAB®system blocks, MATLAB Function blocks, Stateflow®图表和模拟子系统。金宝app例如,如果您的模型具有数据采集和控制器,请通过将这些组件放入模型根级的两个引用模型中来分区您的模型。模型中块的每个样本时间都对应于分区。您可以在“并发执行”对话框中添加任务以在处理节点上运行,并将分区分配给这些任务。如果某些分区未分配,Simulink会自动将其分配给任务。金宝app

In explicit partitioning, you can specify your own architecture. The default architecture is a multicore CPU, the same as the assumed architecture in implicit partitioning. Explicit partitioning has more restrictions on your root-level model than implicit partitioning. For more information, seeLimitations with Multicore Programming in Simulink

Partitioning Guidelines

There are multiple ways to partition your model for concurrent execution in Simulink. Rate-based and model-based approaches give you primarily graphical means to represent concurrency for systems that are represented using Simulink and Stateflow blocks. You can partition MATLAB code using theMATLAB System块和MATLAB Function堵塞。您还可以使用多层方法分区物理系统的模型。

Each method has additional considerations to help you decide which to use.

Goal Valid Partitioning Methods Considerations

Increase the performance of a simulation on the host computer.

No partitioning method

金宝app仿真软件试图优化主机性能rmance regardless of the modeling method you use. For more information on the ways that Simulink helps you to improve performance, seeOptimize Performance

Increase the performance of a plant simulation in a multicore HIL (hardware-in-the-loop) system.

You can use any of the partitioning methods and their combinations.

The processing characteristics of the HIL system and the embedded processing system can vary greatly. Consider partitioning your system into more units of work than there are number of processing elements in the HIL or embedded system. This convention allows flexibility in the mapping process.

Create a valid model of a multirate concurrent system to take advantage of a multicore processing system.

You can use any of the partitioning methods and their combinations.

Partitioning can introduce signal delays to represent the data transfer requirements for concurrent execution. For more information, seeConfigure Data Transfer Settings Between Concurrent Tasks

Create a valid model of a heterogeneous system to take advantage of multicore and FPGA processing.

  • Multicore processing: Use any of the partitioning methods.

  • FPGA processing: Partition your model usingModelblocks.

Consider partitioning for FPGA processing where your computations have bottlenecks that could be reduced using fine-grained hardware parallelism.

Related Examples

More About