Main Content

Run Simulink PLC Coder Model Advisor Checks

The Simulink PLC Coder checks in Simulink Model Advisor checks a model or subsystem for variable names, name lengths, comments, and so on that can result in a failure to import the generated code. The Model Advisor produces a report that lists the checks that were run and the conditions that caused warnings.

Open the Model Advisor

To open the Model Advisor:

  • In the Modeling tab, select Model Advisor. In the System Selector dialog box, select the model or subsystem that you want to analyze, and click OK.

  • Open the PLC Coder app. Select the model or subsystem. In the PLC Code tab, select Model Advisor.

Run Checks in the Model Advisor

In the Model Advisor window, you can run individual checks or a group of checks. To run a check, Select that check and then click Run Checks. For example, to run the Check for safe model parameters, select the check box, and then click Run Checks.

To run a group of checks within a folder:

  1. Select the checks that you want to run.

  2. Select the folder that contains these checks, and then click Run Checks.

For example, to run all the checks in the Industry standard checks folder, select the folder, and then click Run Checks.

Display Check Results in the Model Advisor Report

To display an HTML report of the check results, click Report from the toolstrip. You can use the Report drop-down to change the report format to PDF or WORD.

This report shows typical results for a run of the Standard industry checks folder.

The report displays a run summary of the checks in the specified folder. As you run the checks, the Model Advisor updates the reports with the latest information for each check in the folder. When you run the checks at different times, timestamps appear at the top right of the report to indicate when checks have been run. Checks that occurred during previous runs have a timestamp following the check name. You can filter checks in the report to show checks that display a Warning, show checks that Passed, and so on.

Fix Warnings or Failures

When a model or referenced model has a suboptimal condition, checks can fail. After you run a Model Advisor analysis, indicates checks that have warnings. A warning result is informational. You can fix the reported issue or move on to the next task.

To fix warnings or failures, in the Result sub-pane, review the recommended actions to make changes to your model. When you fix a warning or failure, to verify that the check passes, re-run the check.

Some checks can use the Fix option from the toolstrip. Note that this option is available for selected checks that display violations with input parameters. This example displays the incorrect Reciprocal block settings that caused the check to display a warning.

When you select Fix, the Action Report window shows the changes that were applied. To verify that the check passes, rerun the check.