Skip to Main Content Skip to Search
Product Documentation

Designing the Experiment

Overview of Design Process

Creating a design in the Model Browser comprises several steps. You need to open the tool and create a new two-stage test plan. Then you need to enter the ranges and names of the input variables being used and choose a default model. Then you can create an initial design and set up the constraints on the input space. These constraints will be the same for all designs. From this constrained design, a series of child designs can be made with varying numbers of points added and slightly different models used. The final design can be chosen by comparing statistics of the various child designs and considering how many points you can afford to run. These steps are described next.

Creating a Test Plan

  1. Start the Model Browser part of the toolbox by typing mbcmodel at the MATLAB command line.

  2. From the startup project view, to create a new test plan, click New in the Test Plans list pane at the bottom.

    The New Test Plan dialog box appears.

  3. Click the Two-Stage test plan icon and click OK.

    The default name of the new test plan, Two-Stage, appears in the Model Browser tree, in the All Models pane.

    The view switches to the new test plan node in the tree, Two-Stage.  The Model Browser window displays a diagram representing the two-stage model.

Specifying the Model Inputs

The models you are building are intended to predict the torque, fuel flow, and manifold pressure of the engine as a function of spark angle at specified operating points defined by the engine's speed, load, and cam timings. The input to the local model is the spark angle.

  1. To specify spark angle as the local input, double-click the Local Inputs icon on the model diagram.

    The Local Input Factor Setup dialog box appears.

    1. Set Symbol to S.

    2. Set Signal to SPARK. This is optional and matches the raw data.

    3. Set the range you want to model by changing Max to 50 (and leave Min at 0).

  2. Click OK to dismiss the dialog box.

    Notice that the new name of the local model input now appears on the two-stage model diagram.

    The global inputs are the variables that are held constant at each operating point while spark is swept. In this case, these global variables are engine speed, scaled throttle area, intake cam angle, and exhaust cam angle.

  3. To specify the global inputs, double-click the Global Inputs icon on the model diagram.

    The Global Input Factor Setup dialog box appears.

    By default, there is one input to the global model. Because this engine model has four input factors, you need to edit the input factors as follows:

    1. Click the up arrow button to increase the number of factors to four.

    2. Edit the four factors to create the engine model input. In each case, change the symbols, signal names, and ranges to the following:

      SymbolSignalMinMax

      N

      SPEED

      500

      6000

      L

      LOAD

      0.05

      0.95

      ICP

      INT_ADV

      -5

      50

      ECP

      EXH_RET

      -5

      50

      Load = aircharge/maximum aircharge.

      Cam angles are in units of degrees crankshaft, with intake values indicating advance from base timing, and exhaust values indicating retard from base timing.

    3. Click OK to dismiss the dialog box.

  4. To change the global model type, double-click the Global Model block in the two-stage model diagram. The Global Model Setup dialog box appears.

    Deciding on the model to design for is vital for optimal designs only, when you already have some knowledge of how you expect the system to behave. In these cases, optimal designs can help you find the most efficient points for fitting the most robust models. In this case, you will create a space-filling design, which is best for exploring a new system where prior knowledge is low and you want to spread the available points to capture as much information as possible. These do not depend on model type; however, for this example you set a new model type now.

    Remember that the statistical properties of different designs depend on the model type. For example, if you think you need cubic instead of quadratic in a factor, the number of points required rises dramatically and this has a highly adverse effect on the statistical quality of the designs. However, you do need to bear in mind that the final model will not be either of the possibilities listed here, because some terms will have been removed, or it might even be an RBF. You choose the most suitable model you can to construct a design, then when you have collected the data, you might find that a different model type produces the best fit.

  5. Polynomial should already be selected from the Linear model subclass pop-up menu. Under Model options, verify the order for each of the four variables is two, to fit quadratic curves in each case.

  6. Set Stepwise to Minimize PRESS (PREdicted Sum Square error).

    This option will be important when you are fitting models to the data. You use the Stepwise feature to avoid overfitting the data; that is, you do not want to use unnecessarily complex models that "chase points" in an attempt to model random effects. Predicted error sum of squares (PRESS) is a measure of the predictive quality of a model. Minimize PRESS throws away terms in the model to improve its predictive quality, removing those terms that reduce the PRESS of the model. See PRESS statistic in the Model Browser documentation. You can also open the Stepwise window after model fitting to try to improve the fit with the Stepwise tools.

  7. Click OK to dismiss the dialog box.

Creating Designs

Now you have set up the modeling test plan you can create an initial design and set up the constraints on the input space — these will be the same for all designs. From this constrained design, a series of child designs can be made with varying numbers of points added and slightly different models used. The final design can be chosen by comparing statistics of the various child designs and considering how many points you can afford to run.

  1. Right-click the global model in the diagram and choose Design Experiment.

    The Design Editor appears.

  2. Click the   button in the toolbar or select File > New Design. A new node called Linear Model Design appears.

    The new Linear Model Design node is automatically selected. An empty Design Table (or any view you last used in the Design Editor) appears because you have not yet chosen a design.

  3. Constrain the design space. Select File > Import Constraints. The Import Constraints dialog box appears.

  4. In the Import from list, select Boundary Constraints (.mat file). You will import a boundary model from an example file. In this way, you can use a boundary constraint from a previous investigation on a similar engine to constrain new designs.

  5. Browse to the file Gasoline_project.mat in the mbctraining directory.

  6. Click to select the Boolean type constraint as shown. This is the combination of both boundary constraint models.

  7. Click OK to import the boundary constraint.

    Click OK in the following data matching dialog as all the signal names are automatically selected in this case.

  8. Examine the constrained design space by right-clicking the title bar of a Design Table view and selecting Current View > 3D Constraints.

  9. Select Design > Space Filling > Design Browser, or click the Space Filling Design button on the toolbar.

    The Space Filling Design Browser appears.

    Space-filling designs are best when there is little or no information about the underlying effects of factors on responses. For example, they are most useful when you are faced with a new type of engine, with little knowledge of the operating envelope. These designs do not assume a particular model form. The aim is to spread the points as evenly as possible around the operating space. Space-filling designs are also best for radial basis function models. You can use a mix-and-match approach: start with a space-filling design to survey the space, then continue testing with an optimal design once you have more understanding of the response and constraints. Once you have an idea of what model type will fit the response best, you can optimally add points in the most efficient places for the most robust model fit.

    The most important thing to decide is how many design points you want. Testing is expensive and time-consuming, so you need to bear in mind how many points you have time for. When you consider the number of points, you also need to remember that a sweep will be done at each point and this will take some time. Do you need to allow time to fix problems or redo experimental points that can't be achieved?

  10. Enter 800 for the Number of points and press Enter. A space-filling design is constructed, using the latin hypercube sampling method. Click the 3-D and 2-D tabs to examine the plots of new design distribution.

  11. Click Generate to create a different design, and repeat until you achieve approximately 200 points in the Size of constrained design reported above the preview. This iteration is necessary because the space-filling design uses the whole variable space and some of the points will be removed if they fall outside the constraint. The preview is identical to the final design.

  12. Click OK when you are satisfied with the design.

  13. Right-click a view and select Split View > 3D Design Projection to view the design points.

  14. Add another space-filling design for some points with parked cam phasers. These points are important because we need an accurate model when cams are parked.

    1. Click the   button in the toolbar to add a new design. The view switches to the new design in the tree. You could rename it CAM_Parked. The design inherits the same constraints as the parent design.

    2. Select Design > Space Filling > Design Browser, or click the Space Filling Design button on the toolbar.

      In the dialog that appears, choose to replace the current points with a new design and click OK.

    3. Enter a number of points (try 40) and click Generate until you achieve a constrained design of about 10 points, and click OK.

    4. Display the design as a table, and edit the values of ICP and ECP in the new design to be zero.

  15. Select File > Merge Designs. Select both your designs in the list, leave the Merge to new design option button selected, and click OK. Examine the merged design in the table view to confirm the parked cam points (ICP and ECP values of 0) are at the end of the list of design points.

  16. Add another space-filling design for collecting validation data.

    1. Click the   button in the toolbar to add a new design. The view switches to the new design in the tree. You could rename it Validation. The design inherits the same constraints as the parent design.

    2. Select Design > Space Filling > Design Browser, or click the Space Filling Design button on the toolbar.

      In the dialog that appears, choose to replace the current points with a new design and click OK.

    3. Enter a number of points (try 100) and click Generate until you achieve a constrained design of about 25 points, and click OK.

    4. To add a point where the cams are parked, select Edit > Add Point.

      In the dialog that appears, select User-specified from the Augment method list, edit ICP and ECP to zero, and click OK.

You can use the Design Editor to make a selection of child designs to compare. When you have chosen the best design you can export it to file. In this case, you will import the example design for this case study. This design was used to collect the data for this case study, and you will later match these design points to data. Import the design as follows:

  1. Select File > Import Design.

  2. Leave the default Design Editor file (.mvd) in the Import from drop-down menu.

  3. Browse to the design file DIVCP.mvd in the mbctraining directory, select it and click Open, then click OK to import the design. A new design node appears.

  4. Rename the imported design (click, and press F2) DIVCP. You can right-click to change the Current View to examine the design points in 2D and 3D.

  5. Choose DIVCP as the preferred design for future reference by selecting Edit > Select As Best.

  6. Close the Design Editor.

Data Source

The data was collected using a constrained space-filling design on speed, load, intake cam phase, and exhaust cam phase. The points specified in the design were measured using the GT-Power engine simulation tool from Gamma Technologies (see http://www.gtisoft.com).

Simulink and StateFlow® simulation tools controlled the GT-Power model, running on a cluster of 14 desktop PC machines. The simulation time for the testing was 20 hours. The GT-Power model used predictive combustion, which gives good realistic results but is computationally expensive. Ten cycles were run at each spark advance setting after attaining steady-state speed/load conditions.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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