📄 walkthrough.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"><html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document. --> <title>Optimization of a Double Wishbone Suspension System</title> <meta name="generator" content="MATLAB 7.3"> <meta name="date" content="2006-10-31"> <meta name="m-file" content="walkthrough"><style>body { background-color: white; margin:10px;}h1 { color: #990000; font-size: x-large;}h2 { color: #990000; font-size: medium;}/* Make the text shrink to fit narrow windows, but not stretch too far in wide windows. */ p,h1,h2,div.content div { max-width: 600px; /* Hack for IE6 */ width: auto !important; width: 600px;}pre.codeinput { background: #EEEEEE; padding: 10px;}@media print { pre.codeinput {word-wrap:break-word; width:100%;}} span.keyword {color: #0000FF}span.comment {color: #228B22}span.string {color: #A020F0}span.untermstring {color: #B20000}span.syscmd {color: #B28C00}pre.codeoutput { color: #666666; padding: 10px;}pre.error { color: red;}p.footer { text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;} </style></head> <body> <div class="content"> <h1>Optimization of a Double Wishbone Suspension System</h1> <introduction> <p>This demo shows how to use MATLAB, Optimization Toolbox, and Genetic Algorithm and Direct Search Toolbox to optimize the design of a double wishbone suspension system. </p> <p><i>Note: You will need to have the following products installed in order to run this demo: MATLAB, Simulink, Optimization Toolbox, Genetic Algorithm and Direct Search Toolbox, and SimMechanics. Optional: Virtual Reality Toolbox.</i></p> </introduction> <h2>Contents</h2> <div> <ul> <li><a href="#1">Introduction to the Problem</a></li> <li><a href="#2">Double Wishbone Model</a></li> <li><a href="#3">Input Geometry Definition</a></li> <li><a href="#4">Problem Formulation</a></li> <li><a href="#5">Objective Function</a></li> <li><a href="#6">Constraint Definition</a></li> <li><a href="#7">Solve the Problem Using Optimization Toolbox</a></li> <li><a href="#8">Solve the Problem Using a Different Start Point</a></li> <li><a href="#10">Solve the Problem Using Genetic Algorithm and Direct Search Toolbox</a></li> <li><a href="#12">Summary</a></li> </ul> </div> <h2>Introduction to the Problem<a name="1"></a></h2> <p>We wish to optimize the response of a double wishbone suspension system. The response we are evaluating is the camber angle vs. travel distance as shown in the figure below. Our current design is shown in green. We want to achieve the profile shown in blue. </p> <p>Camber angle is the angle of the tire relative to the perpendicular axis to the road. A negative camber angle is beneficial to handling. </p> <p>Travel distance is the amount of verticle motion of the car as a result of traveling over a bump or pothole in the road.</p><pre class="codeinput">verifyInstalled <span class="comment">% verify products installed</span>wbOptimSetUp <span class="comment">% Load in geometry</span>wbPlotFun(idealProfile) <span class="comment">% Plot ideal profile</span>wbPlotFun(x,time,<span class="string">'initial'</span>) <span class="comment">% Simulate and Plot current profile</span></pre><img vspace="5" hspace="5" src="walkthrough_01.png"> <h2>Double Wishbone Model<a name="2"></a></h2> <p>A model of the double wishbone suspension system was created using Simulink with SimMechanics. We will use this model to simulate the performance of our suspension system. </p><pre class="codeinput"><span class="keyword">if</span> license(<span class="string">'test'</span>,<span class="string">'virtual_reality_toolbox'</span>) simName = <span class="string">'DoubleWishboneVR.mdl'</span>;<span class="keyword">else</span> simName = <span class="string">'DoubleWishbone.mdl'</span>;<span class="keyword">end</span>open(simName)sim(simName)</pre><img vspace="5" hspace="5" src="walkthrough_02.png"> <img vspace="5" hspace="5" src="walkthrough_03.png"> <h2>Input Geometry Definition<a name="3"></a></h2> <p>The wishbone geometry is defined according to diagram below. We have 15 inputs that we specify, denoted as X1 - X15, that determine the double wishbone connection points and rod lengths. These are defined as: </p><pre> Upper Arm Length X1 = AG Upper Arm Connection Point B (X2, X3, X4) = (xB, yB, zB) Upper Arm Connection Point C (X5, X6, X7) = (xC, yC, zC) Lower Arm Length X8 = DG Upper Arm Connection Point E (X9, X10, X11) = (xE, yE, zE) Upper Arm Connection Point F (X12, X13, X14) = (xF, yF, zF) Connecting Ling Length X15 = AD</pre><p>All dimensions are input to the model in inches.</p><pre class="codeinput">x <span class="comment">%Current geometric definition</span>figure(<span class="string">'Position'</span>,[1 700 700*317/545 700])image(imread(<span class="string">'schematic.png'</span>,<span class="string">'BackgroundColor'</span>,[1 1 1]))axis <span class="string">equal</span>, axis <span class="string">tight</span>, axis <span class="string">off</span></pre><pre class="codeoutput">x = 10.8000 14.2000 18.4000 4.0000 13.1000 17.3000 -2.3000 14.3000 9.1000 7.2000 -0.5000 15.1000 8.2000 12.5000 12.5000</pre><img vspace="5" hspace="5" src="walkthrough_04.png"> <h2>Problem Formulation<a name="4"></a></h2> <p>Our objective is to minimize the difference between the 'Actual' profile and the 'Ideal' profile by changing the geometry parameters X1 - X15. Our problem is formulated as a constrained minimization problem: </p> <p>Objective function:</p> <p><img vspace="5" hspace="5" src="walkthrough_eq1531.png"> </p> <p>where</p> <p><img vspace="5" hspace="5" src="walkthrough_eq544273.png"> </p> <p>Subject to (constraints):</p> <p><img vspace="5" hspace="5" src="walkthrough_eq3424.png"> </p> <p><img vspace="5" hspace="5" src="walkthrough_eq2993.png"> </p> <h2>Objective Function<a name="5"></a></h2> <p>Our objective function is defined to return a single value, which is a measure of how close the 'Actual' profile is to the 'Ideal' profile. Our objective function is defined in the function <tt>wbObjFun</tt>. </p><pre class="codeinput">type <span class="string">wbObjFun</span></pre><pre class="codeoutput">function varargout = wbObjFun(x,time,profile)% Simulate the wishbone model in Simulink and get camber vs. distance% profile and/or norm of profile%% Use:% F = wbObjFun(x,time,profile) returns norm of profile and sim profile% [F,P] = wbObjFun(x,time,profile) returns profile in Pif isstruct(x), x = x.x; end% Run simulationsimopt = simset('SrcWorkspace','Current');[unused1,unused2,yout]= sim('DoubleWishbone',time,simopt);% Return norm value]if isempty(profile) varargout{1} = NaN;else varargout{1} = norm(yout(:,1) - profile(:,1)) + norm(yout(:,2) - profile(:,2));endif nargout > 1 % return profile if requested varargout{2} = yout;end</pre><h2>Constraint Definition<a name="6"></a></h2> <p>The constraint specified for the model are (refer to previous figure):</p><pre>BAC Angle (degrees) 25 <= BAC <= 35 -|EDF Angle (degrees) 15 <= EDF <= 30 |- APoint B/C rotation (degrees) BC <= 10 |Point E/F rotation (degrees) EF <= 5 -|Upper Arm Length Limits 6 <= X1 <= 16Point B X-Axis Limits 10 <= X2 <= 16Point C X-Axis Limits 10 <= X5 <= 16Lower Arm Length Limits 8 <= X8 <= 18Point E X-Axis Limits 6 <= X9 <= 14Point F X-Axis Limits 12 <= X12 <= 20Ling Length X15 <= 18 |__________|__________| | | lb ub</pre><p>Coefficient matrix A and upper and lower bounds are defined in <tt>wbOptimSetup</tt>. </p> <h2>Solve the Problem Using Optimization Toolbox<a name="7"></a></h2> <p>The problem can be solved using the <tt>fmincon</tt> solver in Optimization Toolbox. To use the <tt>optimtool</tt> GUI to set up an run the problem, load the optimization problem definition in <tt>optimtoolProblem.mat</tt>, then type <tt>optimtool</tt> at the command line and once the GUI is open, select <i>File --> Import Problem --> optimtoolProblem.</i> The problem is now defined in the GUI, select <b>Start</b>. </p><pre class="codeinput">load <span class="string">optimtoolProblem</span><span class="comment">% optimtool % uncomment this line to run interactively in the GUI</span><span class="comment">%</span><span class="comment">% Command line equivalent</span><span class="comment">% -----------------------</span><span class="comment">% Start with the default options (may want to comment out this section if</span><span class="comment">% running interactively.</span>options = optimset;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -