Nonlinear Control Design Blockset    

Nonlinear Control Design Blockset Command-Line Interaction

You can conduct an Nonlinear Control Design Blockset session from the command line without using Nonlinear Control Design Blockset constraint figures or even the NCD block. We expect, however, that you will prefer the convenience and efficiency of the constraint figure. Without the constraint figure, constraint bounds are difficult to visualize. Also during optimization, you can watch the cost function decrease, but you cannot observe the evolution of the system response. Thus you cannot tell which constraints prohibit further decrease in the cost function.

Before beginning the optimization, you must declare ncdStruct as global and initialize the fields of this structure. See the Appendix for details about the fields in ncdStruct. You can use the script file ncdglob.m to define ncdStruct as global and set up its fields. If you have already saved a set of constraints (by selecting Save... from the Nonlinear Control Design Blockset constraint figure File menu), you can declare and define the necessary global variables by typing

at the MATLAB prompt, where myfile is the file to which you saved your constraints.

Once you declare and define the necessary global variables, you can start the optimization by typing

at the MATLAB prompt where sfunc is the name of your Simulink system. If ncdStruct.OptmOptns(1) = 1, the Nonlinear Control Design Blockset displays optimization information in the command window. The rest of this section describes which fields in ncdStruct need to be defined in order to conduct Nonlinear Control Design Blockset sessions from the MATLAB command line.

The NCD block is a masked outport block, which calls the constraint figure creation routine optblock when you double-click on it. Since nlinopt directly looks for these masked outport blocks in your model, the constraint figures need not be open to start the optimization routine. However, you must initialize the fields in ncdStruct for nlinopt to work. Specifically, you must initialize the following fields: ncdStruct.CnstrLB, ncdStruct.CnstrUB,ncdStruct.TvarStr, ncdStruct.Tdelta, ncdStruct.CostFlag,ncdStruct.GradFlag, ncdStruct.RngLmts, and ncdStruct.SysName. Consult the Appendix for more information about these variables, and see the demo initialization scripts ncd1init, ncd2init, ncd3init, and ncd4init for more examples on how to define these variables. If you want to perform an optimization with uncertainty in your plant dynamics, you must further initialize and the following variables: ncdStruct.UvarStr, ncdStruct.UvlbStr, ncdStruct.UvubStr, ncdStruct.NumMC, and ncdStruct.PlntON. Again, the Appendix and demo initialization files can help you understand how to use and define these variables.


  Solving the Optimization Problem Nonlinear Control Design Blockset and the Simulink Accelerator