Simulink® PLC Coder™ software lets you generate IEC 61131-3 compliant Structured Text code from Simulink models. This software brings the Model-Based Design approach into the domain of PLC and PAC development. Using the coder, system architects and designers can spend more time fine-tuning algorithms and models through rapid prototyping and experimentation, and less time on coding PLCs.
Typically, you use a Simulink model to simulate a design for realization in a PLC. Once satisfied that the model meets design requirements, run the Simulink PLC Coder compatibility checker utility. This utility verifies compliance of model semantics and blocks for PLC target IDE code generation compatibility. Next, invoke the Simulink PLC Coder tool, using either the command line or the user interface. The coder generates Structured Text code that implements the design embodied in the model.
Usually, you also generate a corresponding test bench. You can use the test bench with PLC emulator tools to drive the generated Structured Text code and evaluate its behavior.
The test bench feature increases confidence in the generated code and saves time spent on test bench implementation. The design and test process are fully iterative. At any point, you can return to the original model, modify it, and regenerate code.
At completion of the design and test phase of the project, you can easily export the generated Structure Text code to your PLC development environment. You can then deploy the code.
Using Simulink PLC Coder, you can also generate Ladder Diagram code for your applications from a Stateflow® chart. The benefits are:
You can design your application by using states and transitions in a Stateflow chart. Once you complete the design, you can generate Ladder Diagram code in XML or another format. You then import the generated code to an IDE such as CODESYS 3.5 or RSLogix™ AOI 5000 and view the ladder diagram.
When you test your Stateflow chart by using a set of inputs, you can reuse these inputs to create a test bench for the Ladder Diagram code. You import the test bench to your PLC IDE and compare the results of simulation with the results of running the ladder diagram. If the results match, the original Stateflow chart is equivalent to the generated Ladder Diagram code.
The Simulink PLC Coder product is a tool for control and algorithm design and test engineers in the following applications:
You must be familiar with:
MATLAB® and Simulink software and concepts
Structured Text language
If you want to download generated code to a PLC IDE, you must also be familiar with your chosen PLC IDE platform. For a list of these platforms, see Supported IDE Platforms.
|PAC||Programmable automation controller.|
|PLC||Programmable logic controller.|
|IEC 61131-3||IEC standard that defines the Structured Text language for which the Simulink PLC Coder software generates code.|
|PLCopen||Vendor- and product-independent organization that works with the IEC 61131-3
standard. The Simulink
PLC Coder product can generate Structured Text using the PLCopen XML standard
format. See |
|Structured Text||High-level textual language defined by IEC 61131-3 standard for the programming of PLCs.|
|function block||Structured Text language programming concept that allows the encapsulation and reuse of algorithmic functionality.|
For a list of related products, see System Requirements at the MathWorks® website.
The Simulink PLC Coder software ships with IDE-specific executables that are used in the Import Structured Text Code Automatically workflows. Some anti-virus software identifies these files as malware. However, it has been determined that these cases are false positives and that the files are malware free. You can mark these files as malware free in your antivirus program.