plcprepareforladder

(Has been removed) Change some Stateflow chart properties to enable Ladder Diagram code generation

plcprepareforladder will be removed in a future release. For more information, see Compatibility Considerations.

Description

example

plcprepareforladder(chartPath) changes certain properties of a Stateflow® chart (Stateflow) so that the chart is ready for Ladder Diagram code generation. The following properties are changed:

  • The data types of inputs and outputs are changed to Boolean.

  • The action language of the chart is changed to C.

  • Super step semantics and chart initialization at execution are disabled.

Examples

Preparation of Stateflow Chart for Ladder Diagram Code Generation

Open the model plcdemo_ladder_three_aspect.

open_system('plcdemo_ladder_three_aspect')

The model contains a subsystem Subsys, which contains a Stateflow chart, 3Aspect. Save the model elsewhere with the name plcdemo_ladder_three_aspect_copy.

Enable super step semantics for the chart. In the chart properties, select Enable Super Step Semantics.

Check whether the Stateflow chart is ready for Ladder Diagram code generation.

plccheckforladder('plcdemo_ladder_three_aspect_copy/Subsys/3Aspect')

You see the following error message in the Diagnostic Viewer window:

Chart must not have superstep semantics enabled in Objects: 'Subsys/3Aspect'

Prepare the chart for Ladder Diagram code generation.

plcprepareforladder('plcdemo_ladder_three_aspect_copy/Subsys/3Aspect')

Check again whether the chart is ready for Ladder Diagram code generation.

plccheckforladder('plcdemo_ladder_three_aspect_copy/Subsys/3Aspect')

There are no more error messages. The function plcprepareforladder has disabled super step semantics for the chart.

Tips

  • Before you use this function, make a backup copy of your model because the function changes chart properties.

  • The function does not change all properties that would allow for Ladder Diagram code generation. You must explicitly change certain properties. For the full list of chart properties that are not allowed, see Restrictions on Stateflow Chart for Ladder Diagram Generation.

Input Arguments

collapse all

Full path name of the Stateflow chart relative to the top level Simulink® model, specified as a character vector. To obtain the full path, select the Stateflow chart in your model and use the gcb function.

Example: gcb, 'ThreeAspectAutoSignal/Subsystem/AutoSignalChart'

Compatibility Considerations

expand all

Not recommended starting in R2019a

Introduced in R2016b