Documentation

Rapid Control Prototyping Process

Use rapid control prototyping to test a design with a physical system plant model.

  1. Create a Simulink® or Stateflow® model.

    Create block diagrams in Simulink by dragging blocks to your model. If possible, set model and block parameters to use a fixed-step solver and specify a sample time compatible with the real-time requirements of your model.

  2. Simulate the model as a non-real-time application.

    Simulink uses a computed time vector to step the model. After computing the outputs for a given time value, Simulink immediately repeats the computation for the next time value until it reaches the stop time.

    Because the computed time vector is not connected to a physical clock, the outputs are calculated as fast as your computer can run. The elapsed time of the simulation can differ significantly from the elapsed time of the real system.

    You can log simulation results for later comparison.

  3. Configure the development and target computers.

    Configure the communication method between the development and target computers.

    Configure the development and target computers using:

  4. Prepare the model for real-time execution.

    Set the model Configuration Parameters to values compatible with real-time execution:

    • In the Code Generation pane, set System target file to slrt.tlc or slrtert.tlc.

    • In the Solver pane:

      • Set Type to Fixed-step.

      • Set Fixed-step size to a step size compatible with the real-time requirements of your model.

    Add Simulink Real-Time™ I/O blocks representing your I/O boards. If you have a custom I/O board, create a custom driver block representing the board. See Add I/O Blocks to Simulink Model.

    To visualize the simulation results, add real-time scope blocks. See Add Simulink Real-Time Scope Block.

  5. Configure the build environment.

    To create a real-time application that runs on the target computer, configure the build environment. The environment includes Simulink Coder™ options, Simulink Real-Time build options, and C compiler options.

  6. Connect to hardware under test.

    Install I/O modules in the target computer and connect the modules to the hardware under test.

  7. Restart the target computer.

    Restart the target computer with the Simulink Real-Time real-time kernel using:

  8. Build and download the real-time application.

    Build and download the real-time application using:

  9. Execute the real-time application.

    Execute the real-time application under command from the development computer or by restarting the target computer in standalone mode.

    The Simulink Real-Time software uses real-time resources on the target computer. Based on your sample rate, the Simulink Real-Time software uses interrupts to step the model at the sample rate. With each new interrupt, the real-time application computes the block outputs from your model.

    Execute using:

  10. Visualize signals.

    Create real-time scopes and Simulink Real-Time Explorer instruments. Use them to acquire and display signal data from the real-time application.

    Scopes created by real-time scope blocks acquire data according to Simulink sample time rules. Scopes can gather data at the top level or in an enabled or triggered subsystem. Scopes created dynamically (from the MATLAB® Command Window or the API) sample at the base rate, irrespective of the sample time of their signals.

    To create instrument panels, use Simulink Real-Time Explorer to create instrument panels. You can drag graphical instruments to the instrument panels, and drag signals to the instruments to display signal data.

    Visualize signals using:

  11. Tune parameters.

    Tune observable parameters such as time delays, input and output amplitudes, and input and output frequencies.

      Note:   Simulink Real-Time does not support parameters of multiword data types.

    Tune parameters using:

  12. Prepare regression and stress tests.

    Write MATLAB scripts that perform parameter sweep and extreme-value testing in a repeatable manner, accumulating results as known good data for later use.

Was this topic helpful?