This example shows how to simulate and generate code for the Controller subsystem from a speed cruise control model by using Simulink® and Stateflow®.
To start the simulation, click Run.
To generate code for the Controller subsystem, use
generatedfiles = plcgeneratecode('plcdemo_cruise_control/Controller');
The Controller subsystem performs the Enable and Setpoint calculations by using a Triggered Stateflow® chart. The Throttle Command is computed by using a discrete PID controller.