This example shows how to simulate and generate code for the ControlModule stateflow chart from the plcdemo_stateflow_controller
model.
open_system('plcdemo_stateflow_controller')
To start the simulation, click Run.
To generate code for the ControlModule chart, use plcgeneratecode. For more information, see plcgeneratecode
:
generatedfiles = plcgeneratecode('plcdemo_stateflow_controller/ControlModule');
The plcdemo_stateflow_controller consists of stateflow charts to simulate a drive module. The TestHarness chart provides a test scenatio of starting, holding, and resetting the drive.
open_system('plcdemo_stateflow_controller/TestHarness');
The BehaviorModel chart provides a simple chart to test the ControlModule chart behavior by injecting faults.
open_system('plcdemo_stateflow_controller/BehaviorModel');
The ControlModule chart performs the drive control logic.
open_system('plcdemo_stateflow_controller/ControlModule');