import l5x ladder diagram files into simulink -凯发k8网页登录
simulate, test, and validate your .l5x
ladder diagram files by importing your ladder diagram files into simulink®. use the plcimportladder
function to import your ladder diagram files into simulink. simulink plc coder™ supports only import of ladder diagram files created by using rockwell automation® rslogix 5000® and studio 5000 ® integrated development environments (ides).
ladder diagram description
the ladder diagram in the simple_timer.l5x
file controls a motor by using an input switch (switch_a)
and a timer (motor_timer).
this ladder diagram was created using the studio 5000 ide.
light1, light2, and motor
are the outputs of this ladder diagram.
import ladder diagram
before using the plcimportladder
function to import your ladder diagram files into simulink:
verify that your .
l5x
ladder diagramverify that the
.l5x
ladder diagram file uses blocks that are supported by simulink plc coder. for a list of supported blocks at the matlab® command line, enter:
plcladderlib
if your ladder diagram contains custom instructions that are not supported use the
custom instruction
block to create your instructions in simulink. for more information, see . to create a custom instruction, see .
to import the simple_timer.l5x
ladder diagram file into simulink, use the plcimportladder
function.
plcimportladder('simple_timer.l5x');
the ladder diagram is imported into simulink and a simple_timer.slx
file is created. the current folder also contains a simple_timer_value.mat
file that loads the initial values for motor_timer
into the model data store memory. the data store memory also contains state information of elements of the ladder diagram. this state information is updated by the model during simulation.
during the ladder diagram import, simulink plc coder:
imports rung comments. for example, rung two of
simple_timer.l5x
has the commentmotor on delay timer.
this comment also appears in the simulink model as well.imports add on instruction (aoi) with mixed-order arguments, while preserving the order of the arguments. this order argument is preserved during ladder diagram code generation as well.
imported ladder diagram structure
the simple_timer.l5x ladder diagram file is located in
controller simple_timer > maintask > mainprogram > mainroutine.
the simple_timer.slx
ladder diagram is located in simple_timer > maintask > mainprogram > _logic.
this structure is similar to the structure in the rockwell automation ide.
verify imported ladder diagram
to verify the imported ladder diagram:
connect a
signal editor
block toswitch_a.
connect a
scope
block to themotor
andswitch_a
signals.open the
simple_timer_verify.slx
model.open the
scope
block and click therun
button.
open_system("simple_timer_verify.slx")
this image shows the scope
block output for the model simulation. the motor (simple_timer)
output turns on three seconds after switch_a is turned on
and turns off as soon as switch_a
is turned off. this behavior is the expected behavior of the ladder diagram.
see also
| | | | | |