PLC Model Advisor Checks
The PLC Model Advisor checks in Simulink® PLC Coder™ verify and update your Simulink model or subsystem for compatibility with PLC code generation. The Model Advisor has checks for:
Model Configuration settings
Blocks and block settings
Industry standard guidelines
When you run a check, the Model Advisor displays the result as a pass or failure. You can fix warnings or failures by using the Model Advisor recommended settings.
Model configuration checks
To prepare your model for compatibility with PLC code generation, use the checks in this folder. This folder contains checks that verify whether:
The components in data store memory blocks resolve to
The model uses Stateflow messages.
The model uses row-major algorithms.
The model mask parameters use the
The model tunable parameters uses the
The model uses machine-parented data.
The model has signal lines that resolve to
|Check Data Store Memory blocks|
Check that the Data Store Memory block has the option to resolve the data
store memory object to
|Check model for Stateflow messages|
Check that the model does not use Stateflow® messages.
|Check if signal lines are configured properly|
Check that the model does not have signal lines that resolve to
|Check if model uses row-major algorithms|
Check that the model does not use row-major algorithms.
|Check model mask parameters|
Check that the model does not contain masked parameters that use the
|Check if model uses machine parented data|
Check that the model does not contain blocks or events that use machine-parented data.
|Check if model uses custom code|
Check that the model does not use custom code.
|Check model tunable parameters|
Check that the model does not have tunable parameters that use the
Checks for blocks and block settings
These checks verify whether blocks in your model are supported for PLC code generation and whether the supported blocks have PLC coder-compatible settings. You can verify whether:
The models use Event-Based blocks, Probe blocks, or Environment Controller blocks.
The model Stateflow chart has a
Continuouschart update rate.
The model has Discrete Integrator blocks that have settings not supported for PLC code generation.
The model contains blocks that are not supported for PLC code generation.
The top-level subsystem has inputs and outputs when testbench generation is enabled.
The subsystem block parameter function packaging is not set to
The model does not contain Trigonometric Function blocks that have settings not supported for PLC code generation.
|Check if model uses event based blocks|
Check that the model does not use Event-Based blocks.
|Check if model uses probe blocks|
Check that the model does not use the Probe block.
|Check if model uses environment controller blocks|
Check that the model does not use the Environment Controller block.
|Check Stateflow chart update|
Check that the model does not have Stateflow charts containing update rates set to
|Check issues with integrator blocks|
Check that the model does not have Discrete-Time Integrator blocks that have conditions not supported for PLC code generation.
|Check if model uses unsupported blocks|
Check that the model does not have blocks that are not supported for PLC code generation.
|Check if model can generate testbench|
Check that the model top-level subsystem has inputs and outputs when the generate testbench option is enabled.
|Check function packaging configuration|
Check that the subsystem block Function packaging
parameter is not set to
|Check trigonometric blocks|
Check that the trigonometric functions in the model do not have settings that are not supported for PLC code generation.
Industry standard checks
These checks verify whether your Simulink model conforms to the coding best practices as described in the
PLCOpen standard and other industry standards. Use the checks in this
folder to verify whether:
Names in your model are not reserved keyword names.
Names in your model have consistent upper case or lower case utilization.
Subsystem names, top-level subsystem and port names, and signal and port names have the recommended number of characters in length.
Your model has comments that describe the role of the subsystem, functions, and so on.
Your model does not have nested comments.
Your model subsystem inputs and outputs do not exceed the user defined maximum input and output variables.
Your model variables use prefixes defined as part of the model PLC code generation configuration settings.
|Define names to avoid|
Check that model does not contain names that are reserved keywords.
|Define use of case (capitals)|
Check that model consistently uses capital letters.
|Define maximum variable name length|
Check that a model contains names that do not exceed a predefined length.
|Comments must describe purpose of component|
Check that a model component for code generation contains comments describing the purpose of the component.
|Avoid nested comments|
Check that a model component for code generation does not contain nested comments.
|Define maximum number of input/output/in-out variables of a Program Organization Unit (POU)|
Check that model's input variables, output variables, and in-out variables are within a predefined limit.
|Define type prefixes for variables (if used)|
Check that model's data types use a predefined prefix.