%% Set Parameter Values for Ladder Diagram Models
% This example shows how to import a ladder diagram from a .L5X file into Simulink® and set options for simulating the imported ladder file by using the plcladderoption function.
%
%% Import Ladder File
% Import the simpleController.L5X file by using the plcimportladder function.

[mdlName,mdlLib,busScript] = plcimportladder('simpleController.L5X','OpenModel','On')

% The imported model conatins a PLC Controller block named simpleController, a Task block named MainTask and a Ladder Diagram Program block named MainProgram.
%
%% Enable Fast Simulation of Imported Ladder Diagram Model
% Enable FastSim by using the plcladderoption function.

currentState = plcladderoption('simpleController','FastSim','on');

% Copyright 2020 The MathWorks, Inc.