CAGE User's Guide Previous page   Next Page

Using the Worked Example Optimization

In order to run any optimization, you first need to set up your CAGE session. You need the following:

For this example, the CAGE session requires

There is a preconfigured session provided that contains the model, variable dictionary, and data set.

  1. Select File -> Open Project and load the file optimworkedexample.cag. This should be in the mbctraining directory.

  1. Select File -> New -> Optimization.

  1. The Optimization Wizard appears.

  1. Select Worked Example, and click Next.

  2. Associate each pair of inputs and variables, for example by clicking spark in the left and right lists, and then click the large Select button. Similarly associate Speed with N, Load with L, and afr with A. Click Next.

  1. The next screen of the wizard automatically shows the tq model selected and Maximize chosen; these are specified in the function. Click the button to match the tq CAGE model with the Torque optimization model, then click Next.

  2. The next screen of the wizard automatically shows the New_Dataset selected (as it is the only one in the session). Click the button to match it to the operating point set SpeedLoadPoints, then click Finish.

This completes the optimization setup. CAGE switches to the Optimization view and the new WorkedExample node appears in the tree. The setup details appear in the right pane: the model to be maximized and the operating point set to use, as shown in the following example.

  1. Click Run Optimization  in the toolbar.

The Free Variable Set Up dialog box appears. These bounds and initial values are taken from the Variable Dictionary (where you also could change them if you wanted). Click OK to accept these values.

You will see the Optimization progress bar as the optimization runs.

  1. When the progress bar disappears, click the new WorkedExample_Output node in the tree. First you must expand the WorkedExample node as shown below.

The output display should look like the following. The optimization has found the values of SPK and AFR that give the maximum model value of torque at each operating point specified. Select different operating points by clicking in the table: the model plots at the selected operating point are shown. There is only one solution per operating point, so you cannot scroll through the solutions.

For a discussion of the worked example code and how the external optimization algorithm is implemented in the CAGE optimization, see About the Worked Example Optimization Algorithm. For a detailed walk-through of incorporating an example user-defined optimization algorithm into a CAGE optimization function, see the next tutorial section, Creating an Optimization from Your Own Algorithm.


Previous page  Worked Example Optimization Creating an Optimization from Your Own Algorithm Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS