Main Content

plcladderoption

Get or set parameter values associated with Ladder Diagram models

Description

example

currentState = plcladderoption(mdlname,Name,Value) sets the parameter to the specified value for the Simulink® ladder diagram model. Open or load the Simulink ladder diagram model first. If the Value argument is not specified this function returns the value of the specified parameter for the ladder diagram model.

Examples

collapse all

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')
mdlName = 
'simpleController'
mdlLib = 
'simpleController_lib'
busScript =

     []

The imported model contains 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');

Input Arguments

collapse all

Specifies the name of the generated Simulink model.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: plcladderoption('simpleController','Animation','on')

When 'on', this option disables all animation and data display. If 'FastSim' is set to 'on', then any change made to 'Animation' and 'DataDisplay' parameter would not change simulation behavior.

This option enables/disables animation of Ladder Diagram rungs, when 'FastSim' is in 'off' state

This option enables/disables data display of Ladder Diagram rungs, when 'FastSim' is in 'off' state

This option enables/disables using Simulink Design Verifier features with Ladder Diagrams. Set 'SLDV' parameter to 'on' before SLDV analysis. SLDV analysis could be still done without using 'SLDV' option, by setting 'FastSim' to 'on' and 'Prescan' to 'off'.

This option enables/disables Prescan for instructions and AOI blocks explicitly for Simulink Design Verifier analysis.

Output Arguments

collapse all

The value of the specified parameter name for the ladder diagram model.

Version History

Introduced in R2019a