How can I integrate PLCs with MATLAB or Simulink?

106 views (last 30 days)
I would like to know how MATLAB/Simulink can communicate with PLCs from manufacturers such as Schneider Electric, Rockwell Automation (Allen-Bradley), Siemens, B&R Automation, Beckhoff, WAGO, ABB, Honeywell, etc.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Oct 2024
Edited: MathWorks Support Team on 14 Oct 2024
Integrating MATLAB/Simulink with PLCs is essential for optimizing automation and control systems. It enables prototyping, plant simulation, and optimization across industries like manufacturing and automotive. There are several methods to integrate MATLAB/Simulink with PLCs, each suited to different needs and environments:
 

Desktop Simulation

MATLAB/Simulink provides toolboxes supporting a wide range of communication protocols commonly used with PLCs, for example:
* Configuring this Serial blocks to work with the Allan-Bradley DF-1 RS-232 protocol would require an understanding of the DF-1 messaging. This option would not work "out of the box".
Desktop simulations with MATLAB/Simulink operate in non-real-time. Use Simulation Pacing to slow down the Simulink simulation to approximate real-world time.
 

Real-Time Simulation

Simulink Real-Time can be used to run control algorithms and plant models on a dedicated Speedgoat real-time target machine, enabling Hardware-in-the-Loop (HIL) testing of PLCs. Speedgoat machines can communicate with PLCs through an extensive range of I/O modules and advanced fieldbus protocols, such as CAN, CANopen, EtherCAT®, EtherNet/IP™, Modbus (TCP and RTU), OPC UA, PROFINET®.
.

Programming PLCs with MATLAB/Simulink

Simulink PLC Coder generates hardware-independent IEC 61131 structured text from Simulink models, compatible with PLCOpen XML and other file formats supported by widely used integrated development environments (IDEs). As a result, you can compile and deploy your application to numerous programmable logic controller (PLC) and programmable automation controller (PAC) devices. It also creates test benches that help you verify the structured text using IDEs and simulation tools. Support for industry standards is available through IEC Certification Kit. More information about Simulink PLC Coder and IEC Certification Kit is available here:
Some PLCs can be programmed using C code. Simulink Coder & Embedded Coder generates C code from Simulink and Stateflow models that has the clarity and efficiency of professional handwritten code. Support for industry standards is available through IEC Certification Kit (for IEC 61508 and ISO 26262) and DO Qualification Kit (for DO-178).

More Answers (0)

Categories

Find more on Simulink PLC Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!