Generate Code from a Partitioned Model
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.
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 A Rate-Based Model.
Open the Schedule Editor from the Design section of the Modeling 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.
Change the order of the partitions by dragging
Generate code for the component model. From the Apps 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.
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.