Documentation Center

  • Trial Software
  • Product Updates

Speed Cruise Control System Using Simulink® and Stateflow®

Open up the "Controller" subsystem. Notice that this model uses a Triggered Stateflow® Chart to do the "Enable" and "Setpoint" calculation. It uses a discrete PID Controller to compute the "Throttle Command".

You can generate PLC Structured Text code for this subsystem by right-clicking on the subsystem block and select PLC Code -> Generate Code for Subsystem Alternatively, you can use the following command generatedFiles = plcgeneratecode('plcdemo_cruise_control/Controller');

After the code generation, the Diagnostic Viewer window is displayed with hyperlinks to the generated code files. You can open the generated files by clicking on the links.

Was this topic helpful?