Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop Embedded Coder   

Determining Whether the Model is Configured for Specified Objectives

You can use the Code Generation Advisor to review your model and identify the parameters that are not configured for your objective. The Code Generation Advisor reviews a subset of model configuration parameters and displays the results in the Check model configuration settings against code generation objectives check.

The Code Generation Advisor uses the information presented in Mapping of Application Requirements to the Optimization Pane to determine the recommended values. When there is a conflict due to multiple objectives, the higher-priority objective takes precedence.

Specifying Code Generation Objectives Using the GUI

To specify code generation objectives in the Configuration Parameters dialog box:

  1. Open the Configuration Parameters dialog box and select the Real-Time Workshop pane.

  2. Specify a system target file. If you specify an ERT-based target, more objectives are available. For the purposes of this example, choose an ERT-based target such as ert.tlc.

  3. Click Set objectives. The Configuration Set Objectives dialog box opens.

  4. In the Configuration Set Objectives dialog box, specify your objectives. For example, if your objectives are efficiency and traceability, in that priority, do the following:

    1. In Available objectives, double-click Efficiency. Efficiency is added to Prioritized objectives.

    2. In Available objectives, double-click Traceability. Traceability is added to Prioritized objectives below Efficiency.

    3. Click OK to accept the objectives. In the Configuration Parameters dialog box, Prioritized objectives is updated.

Specifying Code Generation Objectives at the Command Line

To specify code generation objectives by scripting an M-file or entering commands at the command line:

  1. Specify a system target file. If you specify an ERT-based target, more objectives are available. For the purposes of this example, specify ert.tlc, where model_name is the name or handle to the model.

    set_param(model_name, 'SystemTargetFile', 'ert.tlc');
  2. Specify your objectives. For example, if your objectives are efficiency and traceability, in that priority, enter:

    set_param(model_name, 'ObjectivePriorities', {'Efficiency', 'Traceability'});

Reviewing Objectives in Referenced Models

When you review a model during the code generation process, you must specify the same objectives in the top model and referenced models. If you specify different objectives for the top model and referenced model, the build process generates an error.

To specify different objectives for the top model and each referenced model, review the models separately without generating code.

Reviewing the Model Without Generating Code

To review a model without generating code using the Code Generation Advisor:

  1. Specify your code generation objectives.

  2. In the Configuration Parameters > Real-Time Workshop pane, click Check model. The System Selector window opens.

  3. Select the model or subsystem that you want to review and click OK. The Code Generation Advisor opens and reviews the model or subsystem that you specified.

  4. In the Code Generation Advisor window, review the results by selecting a check from the left pane. The right pane populates the results for that check.

  5. After reviewing the check results, you can choose to fix warnings and failures, as described in Fixing a Warning or Failure in the Simulink User's Guide.

      Caution   When you specify an efficiency or safety precaution objective, the Code Generation Advisor includes additional checks. When you make changes to one of these checks, the other check results are no longer valid and you must run the check again for accurate results.

Reviewing the Model During Code Generation

To review a model as part of the code generation process using the Code Generation Advisor:

  1. Specify your code generation objectives.

  2. In the Configuration Parameters > Real-Time Workshop pane, select one of the following from Check model before generating code:

    • On (proceed with warnings)

    • On (stop for warnings)

  3. Select Generate code only if you only want to generate code; otherwise clear the check box to build an executable.

  4. Apply your changes and then click Generate code/Build. The Code Generation Advisor starts and reviews the top model and subsystems.

    If there are no failures or warnings in the Code Generation Advisor, the build process proceeds. If there are failures or warnings and you specified:

    • On (proceed with warnings) — The Code Generation Advisor window opens while the build process proceeds. You can review the results after the build process is complete.

    • On (stop for warnings) — The build process halts and displays the diagnostics viewer. To continue, you must review and resolve the Code Generation Advisor results or change the Check model before generating code selection.

  5. In the Code Generation Advisor window, review the results by selecting a check from the left pane. The right pane populates the results for that check.

  6. After reviewing the check results, you can choose to fix warnings and failures as described in Fixing a Warning or Failure in the Simulink User's Guide.

      Caution   When you specify an efficiency or safety precaution objective, the Code Generation Advisor includes additional checks. When you make changes to one of these checks, the other check results are no longer valid and you must run the check again for accurate results.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS