The Static Code Metrics report is a section included in the HTML code generation report. The report provides generated code statistics. The report is generated when you select Generate Traceability Report in the Configuration Parameters dialog box. You can use the Static Code Metrics Report to evaluate the generated PLC code before implementation in your IDE. You can use information in the report to:
Find the number of files and lines of code in each file.
Estimate the number of lines of code and stack usage per function.
For more information, see Working with the Static Code Metrics Report.
This example shows how to generate a code generation report that contains the Static Code Metrics section.
Open the PLC Coder app. Click the PLC Code tab.
Click Settings and navigate to the Code Generation pane.
To enable report generation, select Report > Generate traceability report.
Click Generate PLC Code to initiate code and report generation. The code generation report for the top model opens in a MATLAB® web browser.
On the left navigation pane, in the Contents section, select Code Metrics report.
To see the generated files and how many lines of code are generated for each file, look at the File Information section.
To view the global constants in their generated code and their size, see the Global Constants section.
To view the function metrics such as stack size, number of inputs, and number of outputs, see the Function Block Information section.