|On this page…|
This example shows how to optimize a design to meet frequency-domain requirements using the Design Optimization tool. Simulink® Control Design™ software must be installed to optimize a design to meet frequency-domain design requirements.
In this example, you specify the design requirements in a Check Bode Characteristics block and optimize a rectifier filter parameters to meet gain and bandwidth requirements, and minimize a custom objective.
The model sdorectifier includes the following blocks:
The design optimization problem is multi-objective. The design must:
Have a –3db bandwidth of at least 2Hz
Limit the gain across the frequency range 2Hz—60Hz to at most 0db
Limit the gain above 60Hz to at most –20db
Maximize the filter resistance R
Minimize the filter inductance L
The requirements ensure that the rectifier filter combination has minimal high frequency content, responds quickly to voltage changes, and limits filter currents.
Open the Design Optimization tool for the model.
The plot shows the gain and bandwidth requirements specified in the Filter Design Requirements block. See their values in the Bounds tab of the Block Parameters dialog box.
Specify a custom objective to minimize the filter inductance and maximize the resistance.
The custom objective is specified in the sdorectifier_cost function. The function accepts the design variables R and L, and returns the objective to be minimized.
Select Custom Requirement in the New drop-down list.
A window opens where you specify the custom requirement.
Specify the following:
Enter MaxMinRL in Requirement Name
Enter @sdorectifier_cost in Requirement function. The optimization solver calls the specified function handle.
Select min in Requirement type
Click OK. A new variable MaxMinRL appears in Design Optimization Workspace of the Design Optimization tool.
Before you begin this task, specify the design requirements as described in Specify Design Requirements.
When you optimize the model response, the software modifies the design variable (parameter) values to meet the design requirements.
Select New in the Design Variables Set drop-down list.
A window opens where you specify design variables.
Click R, L and C to select them.
Click to add the selected parameters to a design variables set.
Specify the value range for each design variable:
R in the range 1–50 ohms
L in the range 1–500mH
C in the range 1µF–1mF
Because the variables are different orders of magnitude, specify scaling factors in the corresponding Scale column of the variables:
R by 25
L by 0.05
C by 0.0005
Click OK. A new variable DesignVars appears in Design Optimization Workspace of the Design Optimization tool.
(Optional) View the current response of the model. Click .
The plot shows that the model does not meet the specified gain and bandwidth requirements.
You also see that the filter voltage signal overshoots its steady-state value and contains significant harmonic content in the Voltage scope window.
An optimization progress window opens.
After the optimization completes, the optimization progress window resembles the next figure. After a few iterations, the optimization converges to satisfy the filter bandwidth requirements.
The filter voltage signal in the Voltage scope window also settles to within its steady-state value in around 0.08 seconds without any overshoot and the harmonic content is significantly reduced from the initial design.
Verify that the model meets the gain and bandwidth requirements.
The plot displays the last five iterations. The final response using the optimized parameter values appears as the thick line.
The optimized response lies in the white region bounded by the design requirement line segments and thus meets the requirements.
Click DesignVars in Design Optimization Workspace and view the updated values in the Variable Preview area.
The optimized values of the design variables are automatically updated in the Simulink model.