Main Content

Ladder Diagram Integration

Import, simulate, and validate your existing ladder diagrams. Model, simulate, and generate code using the provided Ladder Diagram blocks and functions

Ladder Diagram is a graphical programming language that you use to develop software for programmable logic controllers (PLCs). It is one of the languages that the IEC 61131 standard specifies for use with PLCs. A program in ladder diagram notation is a circuit diagram that emulates circuits of relay logic hardware. The underlying program uses Boolean expressions that translate readily to switches and relays.

With Simulink® PLC Coder™, you can use ladder import to import ladder diagrams created with Rockwell Automation® IDEs, such as RSLogix™ 5000 and Studio 5000 into the Simulink environment as a model. You can create ladder diagrams in the Simulink environment as a model.

After importing or creating the ladder diagram models, you can:

  • Edit the imported Ladder Diagram model from within Simulink by using the plcladderlib library.

  • After importing the ladder diagram code into Simulink, simulate it.

  • Generate C code from the imported ladder diagram and integrate the code into your existing C language-based simulation environments.

  • Generate ladder diagram code from the imported ladder diagram and integrate the code into your Rockwell Automation IDE. You cannot generate structured text code from the Ladder Diagram blocks.

  • Generate PLC testbench code for the imported ladder diagram and verify the code in your Rockwell Automation IDE.


Simulink PLC CoderGenerate structured text and ladder diagram code from Simulink models, Stateflow charts, and MATLAB functions (Since R2019b)


expand all

plcimportladderImport ladder diagram into a Simulink subsystem
plcgeneratecodeGenerate structured text or ladder diagram (L5X) for the atomic subsystem
plcladderinstructionsLists ladder instructions identified by Simulink PLC Coder (Since R2020a)
plcladderlibOpen the Simulink PLC Coder Ladder Library
plcgeneraterunnertbGenerate L5X test bench code for specified AOI Runner block and AOI name
plcladderoptionGet or set parameter values associated with Ladder Diagram models
plcloadtypesLoad the data types for Simulink PLC Coder ladder models
plccleartypesClear the data types associated with the Simulink PLC Coder ladder models from the workspace


expand all

ONSOne Shot
OSROne Shot Rising
OSFOne Shot Falling
XICExamine If Closed
XIOExamine If Open
OTEOutput Energize
OTLOutput Latch
OTUOutput Unlatch
TONTimer On Delay
TOFTimer Off Delay
RTORetentive Timer On
CTUCount Up
CTDCount Down
TNDTemporary End
AFIAlways False
NOPNo Operation
MCRMaster Control Reset
ADDAdd inputs
SUBSubtract inputs
MULMultiply inputs
DIVDivide one input by another
CPTEvaluate expression
ANDBitwise AND
ORBitwise OR
NOTBitwise NOT
NEQNot Equal To
EQUEqual To
LEQLess Than or Equal To
GEQGreater Than or Equal To
LESLess Than
GRTGreater than
COPCopy File
FLLFile Fill
AOI RunnerAOI Runner
PLC Controller SuitePLC Controller
PLC ControllerPLC Controller
Ladder Diagram ProgramLadder Diagram Program
Ladder Diagram SubroutineLadder Diagram Subroutine
Ladder Diagram Function Block (AOI)Ladder Diagram Function Block (AOI)
Variable ReadVariable Read
Variable WriteVariable Write
Power Rail StartPower Rail Start
Power Rail TerminalPower Rail Terminal
Rung TerminalRung Terminal
Custom InstructionCreate custom ladder logic instruction (Since R2020a)