Simulink Control Design™ - MathWorks

(Tuis.) #1

Batch Compute Steady-State Operating Points Reusing


Generated MATLAB Code


This example shows how to batch-compute steady-state operating points for a model
using generated MATLAB code. You can either simulate or linearize your model at these
operating points and study the change in model behavior.

If you are new to writing scripts, interactively configure your operating points search
using the Steady State Manager or Linear Analysis Tool.

Before generating code for batch trimming, first compute an operating point to meet an
instance of your specifications. For more information on computing operating points in:


  • Steady State Manager, see “Compute Operating Points from Specifications Using
    Steady State Manager” on page 1-23.

  • Linear Analysis Tool, see “Compute Operating Points from Specifications Using
    Linear Analysis Tool” on page 1-41.


After computing an operating point, generate a MATLAB script. To do so in the:


  • In Steady State Manager, on the Specification tab, click Trim , and select
    Script.

  • In Linear Analysis, in the Trim the model dialog box, click Generate MATLAB
    Script.


For more information on generating scripts, see “Generate MATLAB Code for Operating
Point Configuration” on page 1-145.

The generated script opens in the MATLAB Editor window. You can then modify the script
to trim the model at multiple operating points.

This example demonstrates batch trimming using the magball Simulink model.

(^1) Open the model.
open_system('magball')
(^2) To open the Steady State Manager, in the Simulink model window, select Analysis



Control Design > Steady State Manager.
(^3) On the Steady State tab, click Trim Specification.
Batch Compute Steady-State Operating Points Reusing Generated MATLAB Code


Free download pdf