Documentation Center

  • Trial Software
  • Product Updates

Speed Cruise Control System Using Variable-Step Continuous Solver

In this model, the model solver is set to variable-step continuous (ode45); the sample time of the controller subsystem is set to 0.05. To set the controller sample time, right click on the controller block and select Subsystem Parameters, on the Main tab, set the Sample time parameter. This method allows combined modeling of discrete-time controller and continuous-time plant in the same model with PLC code generation support.

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_continuous/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?