Main Content

plcladderoption

Get or set parameter values for ladder diagram model

Description

plcladderoption(mdlName,Name=Value) sets the parameter Name, to the value, Value, for the ladder diagram model, mdlName. If you do not specify the Value argument, the function returns the value of the parameter specified by Name. You must open or load the Simulink® ladder diagram model before you use the plcladderoption function. . You must specify at least one Name argument or one name-value argument.

example

currentState = plcladderoption(mdlName,Name=Value) returns the parameter value for the ladder diagram model parameter specified by Name when you do not specify a value for the Value argument.

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.

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 fast simulation mode by using the plcladderoption function.

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

Input Arguments

collapse all

Simulink model name, specified as a string or character array. If you do not know the model name you can use the mdlname output value of the plcimportladder function.

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')

Enable fast simulation mode, specified as "on" or "off". Setting this parameter to "on" disables ladder diagram animation and data display. If FastSim is set to "on", then any changes you make to the Animation and DataDisplay parameters do not change the simulation behavior.

Option to enable animation of ladder diagram rungs, specified as "on" or "off". When you set FastSim to "on", Animation is set to "off".

Option to enable ladder diagram data display, specified as "on" or "off". When you set FastSim to "on", DataDisplay is set to "off".

Option to enable Simulink Design Verifier checks for ladder diagrams, specified as "on" or "off". Alternatively, if you set FastSim to "on" and Prescan to "off", the function sets SLDV to "on".

Option to enable prescan logic for ladder diagram instructions and AOI blocks, specified as "on" or "off". Use this option to enable or disable Simulink Design Verifier analysis of prescan logic for instructions and AOI blocks.

Output Arguments

collapse all

Current value of input parameter returned as "off" or "on".

Version History

Introduced in R2019a