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

The following example demonstrates how to import a simple ladder diagram from an L5X file (simpleController.L5X) into the Simulink environment and set ladder options. The ladder L5X file was created using RSLogix™ 5000 IDE and contains contacts and coils representing switches and motor. The following is a snapshot of the ladder structure.

Use the plcladderimport function to import the ladder into Simulink. For this example, the program Name of the ladder is MainProgram and the MainRoutineName is MainRoutine.

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

The imported model contains a PLC Controller block named simpleController, followed by a Task block named MainTask and finally a Ladder Diagram Program block named MainProgram. The model imported into Simulink has blocks that implement the functionality of the contacts and coils.

Use the plcladderoption function to enable FastSim.

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

Input Arguments

collapse all

Specifies the name of the generated Simulink model.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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.

Introduced in R2019a