Generate Code from a Partitioned Model - MATLAB & Simulink (original) (raw)

Main Content

Partitioning and scheduling a model has an impact on the order of the function calls in the generated code. Using the Schedule Editor to edit the schedule of a rate-based model or a referenced export-function model, the order of the functions in the generated code depends on the specified schedule in the Schedule Editor. The resulting code shows every partition as an entry point. The generated code does not include the scheduler and it must be provided by the user.

Note

To use the code generation functionality, Embedded Coder® and Simulink® Coder™ are required.

To see the impact of the Schedule Editor on the generated code, use the model that is created in Create Rate-Based Model.

  1. Open the Schedule Editor from the section of the tab. Use the Manage Partitions panel to create partitions for Scheduled Subsystem 1 and Scheduled Subsystem 2 with 0.01 sample time. Update the diagram.
  2. Change the order of the partitions by draggingScheduled_Subsystem_2 aboveScheduled_Subsystem_1.
  3. Generate code for the component model. From the tab, select C/C++ Code > Build Model.

In the generated code, the order of the functions depends on the schedule specified in the Schedule Editor.

Note

Changing the constraints on the connections does impact the generated code. The changes with respect to connections are useful to set preferences about delays and dependencies.

See Also

Schedule Editor

Topics