Model Architecture and Design

Design models intended for Simulink® PLC Coder™ code generation

When developing Simulink models for generating structured text or ladder logic code, consider:

  • Blocks and libraries for which code generation is supported. For a list of Simulink blocks supported for PLC code generation, see Simulink Block List (PLC Code Generation).

  • Setting up a model for fixed point data type code generation.

  • Setting up a multirate model for code generation.

  • Setting up a MATLAB Function for code generation.

  • Existing limitations when using Simulink PLC Coder to generate either structured text or ladder logic code.

Topics

Structured Text Code Generation Guidelines and Limitations

Prepare Model for Structured Text Generation

Guidelines for setting up model and subsystem block parameters for Simulink PLC Coder structured text code generation.

Fixed Point Simulink PLC Coder Structured Text Code Generation

Configure model parameters and subsystem block parameters containing a fixed point data type for Simulink PLC Coder code generation.

Generating Simulink PLC Coder Structured Text Code For Multirate Models

Guidelines for setting up model and subsystem block configuration parameters for a multirate model Simulink PLC Coder code generation.

MATLAB Function Block Simulink PLC Coder Structured Text Code Generation

Describes support for, and limitations on, use of MATLAB Function block in Simulink PLC Coder code generation.

Structured Text Code Generation Limitations

Limitations that apply to structured text code generation.

Considerations for Nonintrinsic Math Functions

Range considerations for nonintrinsic math functions.

Structured Text Code Generation Support for Simulink Data Dictionary

Improve traceability between your model and generated code, code reusability, and data sharing by using Simulink data dictionary.

IDE Limitations

IDEs which support enum data type.

Distributed Code Generation Limitations

Overview of code generation limitations for distributed systems.

Ladder Logic Code Generation Guidelines and Limitations

Simulink PLC Coder Ladder Diagram Code Generation

Learn about the workflow for Ladder Diagram generation from Stateflow® charts.

Prepare Chart for Simulink PLC Coder Ladder Diagram Code Generation

Check Stateflow chart for unsupported features and add tests to chart for later validation of code.

Generate Simulink PLC Coder Ladder Diagram Code from Stateflow Chart

Generate Ladder Diagram code from a Stateflow chart and test bench for validation.

Import Ladder Diagram Code to CODESYS 3.5 IDE and Validate Diagram

View a Ladder Diagram and test bench in the IDE, and validate the diagram against an original Stateflow chart by using the test bench.

Restrictions on Stateflow Chart for Ladder Diagram Generation

See which advanced Stateflow features are not supported for Ladder Diagram code generation.

Ladder Logic Code Generation Limitations

Limitations that apply to ladder logic code generation.

Motion Instruction Simulation and Code Generation

Simulation and Code Generation of Motion Instructions

Create model for simulation and code generation of motion instructions in the Rockwell Automation® RSLogix™ 5000 IDE.

Featured Examples