Check Model and Configuration for Code Generation
You can use the Model Advisor checks to assess model readiness to generate code. To check and configure your model for code generation application objectives such as traceability or debugging, use the Code Generation Advisor.
|For information about||See|
|Model Advisor||Run Model Advisor Checks|
|Code Generation Advisor||Application Objectives Using Code Generation Advisor|
|Checks available with Simulink® Coder™||Model Advisor Checks|
|Checks available with Embedded Coder®||Embedded Coder Checks (Embedded Coder)|
Check Model for Code Efficiency with Model Advisor
To check model
ThrottleControl for code efficiency, use the Model Advisor.
2. To start the Model Advisor, on the Modeling tab, click Model Advisor. A dialog box opens showing the model system hierarchy.
ThrottleControl and then click OK. The Model Advisor window opens.
4. Expand By Task > Code Generation Efficiency. To check your model for code generation efficiency, use the checks in the folder. By default, checks that do not trigger an Update Diagram are selected. The checks available for code generation efficiency depend on whether you have a Simulink Coder or Embedded Coder license.
5. In the left pane, select the remaining checks. Right-click on the Code Generation Efficiency folder and select Run Selected Checks.
The results shows a Run Summary that flags check warnings. The warnings identify issues that impact code efficiency. For more information about the report, see Save and View Model Advisor Check Reports.
Check Model During Code Generation by using the Code Generation Advisor
To review a model as part of the code generation process, use the Code Generation Advisor.
To specify your code generation objectives, on the Configuration Parameters > Code Generation pane, choose a value for the Select objective parameter.
Select one of the following values for the parameter Check model before generating code:
On (proceed with warnings)
On (stop for warnings)
If you want to only generate code, select Generate code only. Otherwise clear the check box to build an executable.
Apply your changes, and press Ctrl+B to generate code. The Code Generation Advisor starts and reviews the top model and subsystems.
If the Code Generation Advisor issues failures or warnings, and you specified:
On (proceed with warnings)— The Code Generation Advisor window opens while the build process proceeds. After the build process is complete, you can review the results.
On (stop for warnings)— The build process halts and displays the Diagnostic Viewer. To continue, you must review and resolve the Code Generation Advisor results or clear the Check model before generating code parameter.
In the Code Generation Advisor dialog box, review the results by selecting a check from the left pane. The results for that check display in the right pane.
After reviewing the check results, you can choose to fix warnings and failures as described in Fix a Model Advisor Check Warning or Failure.
When you specify an efficiency or Safety precaution objective, the Code Generation Advisor includes additional checks. When you make changes to one of these additional checks, previous check results can potentially become invalid and need to be rerun.
For more information, see Set Objectives — Code Generation Advisor Dialog Box (Embedded Coder)