You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# **Optimizing Vehicle Design Using AI and Simscape™**
2
-
Copyright 2024 The MathWorks, Inc.
2
+
Copyright 2025 The MathWorks, Inc.
3
3
4
4
This example shows the workflow to create a surrogate AI model using
5
5
training data from a multibody model of a vehicle. The resulting AI
@@ -15,6 +15,9 @@ the optimal design parameters.
15
15
16
16
Open the project file SSVT_Susp_Opt.prj to get started.
17
17
18
+
View on File Exchange: [](https://www.mathworks.com/matlabcentral/fileexchange/180114-optimize-vehicle-design-with-ai-and-simscape)
19
+
You can also open in MATLAB Online: [](https://matlab.mathworks.com/open/github/v1?repo=simscape/Optimize-Vehicle-Design-with-AI-and-Simscape&project=SSVT_Susp_Opt.prj)
20
+
18
21
## **Vehicle Model**
19
22
20
23
**Simscape Multibody is used to model the vehicle**. The multibody model has
<h1>Create Virtual Test with Performance Metrics</h1>
80
80
<!--introduction-->
81
-
<p>This example individually tests the vehicle model with one parameter value set to one of its range limits. This simple sweep ensures that</p>
82
-
<div>
83
-
<ul>
84
-
<li>Parameter values are modified in parallel simulations without recompiling</li>
85
-
<li>Tests at parameter limits do not result in invalid tests (locked wheels, etc.)</li>
86
-
<li>Performance metrics are calculated properly</li>
87
-
</ul>
88
-
</div>
89
-
<p>A simple measure of the sensitivity to each metric is calculated by measuring the percent change in the performance metric as the parameter value is set to its limits. A more robust evaluation of the performance metric would require a design of experiments to test a distribution of the parameters.</p>
<p>The code used to create this documentation is here: <ahref="matlab:edit('suspOpt_sweep_param_limits.m');">suspOpt_sweep_param_limits.m</a>
93
-
</p>
94
-
<p>(<ahref="matlab:web('Vehicle_Design_Opt_with_AI_Overview.html')">return to Optimizing Vehicle Design Using AI and Simscape Overview</a>)</p>
95
81
<!--/introduction-->
96
82
<h2>Contents</h2>
97
83
<div>
98
84
<ul>
99
85
<li>
100
-
<ahref="#1">Open Vehicle Model</a>
86
+
<ahref="#1">Overview</a>
87
+
</li>
88
+
<li>
89
+
<ahref="#2">Open Vehicle Model</a>
101
90
</li>
102
91
<li>
103
-
<ahref="#3">Generate Table of Design Parameters</a>
92
+
<ahref="#4">Generate Table of Design Parameters</a>
104
93
</li>
105
94
<li>
106
-
<ahref="#4">Create Simulation Input Objects to Test Range Limits</a>
95
+
<ahref="#5">Create Simulation Input Objects to Test Range Limits</a>
107
96
</li>
108
97
<li>
109
-
<ahref="#5">Run Simulations Using Parallel Computing</a>
98
+
<ahref="#6">Run Simulations Using Parallel Computing</a>
110
99
</li>
111
100
<li>
112
-
<ahref="#6">Check Run Validity</a>
101
+
<ahref="#7">Check Run Validity</a>
113
102
</li>
114
103
<li>
115
-
<ahref="#7">Extract Performance Metrics</a>
104
+
<ahref="#8">Extract Performance Metrics</a>
116
105
</li>
117
106
<li>
118
-
<ahref="#9">Identify Sensitive Values Based on Variance Threshold</a>
107
+
<ahref="#10">Identify Sensitive Values Based on Variance Threshold</a>
119
108
</li>
120
109
<li>
121
-
<ahref="#10">Identify Top 10 Parameters Based on Variance Only</a>
110
+
<ahref="#11">Identify Top 10 Parameters Based on Variance Only</a>
122
111
</li>
123
112
</ul>
124
113
</div>
125
-
<h2id="1">Open Vehicle Model</h2>
114
+
<h2id="1">Overview</h2>
115
+
<p>This example individually tests the vehicle model with one parameter value set to one of its range limits. This simple sweep ensures that</p>
116
+
<div>
117
+
<ul>
118
+
<li>Parameter values are modified in parallel simulations without recompiling</li>
119
+
<li>Tests at parameter limits do not result in invalid tests (locked wheels, etc.)</li>
120
+
<li>Performance metrics are calculated properly</li>
121
+
</ul>
122
+
</div>
123
+
<p>A simple measure of the sensitivity to each metric is calculated by measuring the percent change in the performance metric as the parameter value is set to its limits. A more robust evaluation of the performance metric would require a design of experiments to test a distribution of the parameters.</p>
<p>Adjusting the design requires selecting a set of design parameters to tune and setting ranges for those values. That set is defined in a table. For each parameter we specify:</p>
<h2id="4">Create Simulation Input Objects to Test Range Limits</h2>
269
+
<h2id="5">Create Simulation Input Objects to Test Range Limits</h2>
266
270
<p>A suite of tests is defined using the table above. For each test, all parameters set to the default value and one parameter set to either of its range limits. The tests are created using a SimulationInput object so that the tests can be performed in series or parallel without modifying the original model. Parameter value changes and any model parameter setting overrides are applied temporarily during the test using the SimulationInput object.</p>
267
271
<preclass="codeoutput">
268
272
simInputFR =
@@ -281,14 +285,14 @@ <h2 id="4">Create Simulation Input Objects to Test Range Limits</h2>
281
285
VariantConfiguration
282
286
283
287
</pre>
284
-
<h2id="5">Run Simulations Using Parallel Computing</h2>
288
+
<h2id="6">Run Simulations Using Parallel Computing</h2>
285
289
<p>Using the parsim() command, the suite of tests is executed in parallel on multiple workers. Using Fast Restart, the model is only compiled once per worker. Because we have defined the design parameters as run-time parameters, we can modify their values even within the compiled model. This dramatically shortens the time it takes to execute the sweep.</p>
286
290
<p>Progress is reported using the Simulation Manager. We can see if any warnings or errors have occurred during any of the tests and see how long each run has taken.</p>
287
291
<preclass="codeoutput">Starting parallel pool (parpool) using the 'Processes' profile ...
288
292
Connected to parallel pool with 4 workers.
289
-
188 simulations completed in 745.5389 seconds.
293
+
188 simulations completed in 728.8652 seconds.
290
294
</pre>
291
-
<h2id="6">Check Run Validity</h2>
295
+
<h2id="7">Check Run Validity</h2>
292
296
<p>The outputs of the test sweep are checked to make sure the runs are all valid. A test run is deemed invalid if any of the following thresholds are exceeded for an unacceptable period of time:</p>
293
297
<div>
294
298
<ol>
@@ -300,7 +304,7 @@ <h2 id="6">Check Run Validity</h2>
300
304
<p>Plot show the values of the measurements for all the runs, and a count of the valid runs is displayed. If any run is invalid, we may need to reconsider our parameter ranges.</p>
<p>For all runs, performance metrics are calculated.</p>
305
309
<div>
306
310
<ol>
@@ -314,7 +318,7 @@ <h2 id="6">Check Run Validity</h2>
314
318
</div>
315
319
<p>The impact of the parameters on the performance metric are plotted. The plot shows (Metric with parameter at max value - Metric with parameter at min value)/(maximum observed performance metric value).</p>
316
320
<p>This simple measure indicates how sensitive the metric is to the parameter value. A more rigorous sensitivity analysis should be performed to truly determine parameter sensitivity. The plots show that the design parameters have a relatively small impact on the braking distance.</p>
317
-
<imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_07.png" alt=""><imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_08.png" alt=""><imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_09.png" alt=""><h2id="9">Identify Sensitive Values Based on Variance Threshold</h2>
321
+
<imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_07.png" alt=""><imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_08.png" alt=""><imgvspace="5" hspace="5" src="suspOpt_sweep_param_limits_09.png" alt=""><h2id="10">Identify Sensitive Values Based on Variance Threshold</h2>
318
322
<p>Based on the above result, we can see many parameters have a relatively small impact on the performance metrics. To limit the design space, we pick the parameters with the largest impact on the ride comfort and roll stability metrics and combine them into a single list.</p>
319
323
<preclass="codeoutput">
320
324
ans =
@@ -361,7 +365,7 @@ <h2 id="6">Check Run Validity</h2>
<h2id="10">Identify Top 10 Parameters Based on Variance Only</h2>
368
+
<h2id="11">Identify Top 10 Parameters Based on Variance Only</h2>
365
369
<p>That list is then trimmed to a list of the 10 parameters for the remainder of our design space investigation. Working with only 10 parameters accelerates the process of exploring the design workflow.</p>
366
370
<preclass="codeoutput">
367
371
ans =
@@ -392,6 +396,8 @@ <h2 id="10">Identify Top 10 Parameters Based on Variance Only</h2>
392
396
##### SOURCE BEGIN #####
393
397
%% Create Virtual Test with Performance Metrics
394
398
%
399
+
400
+
%% Overview
395
401
% This example individually tests the vehicle model with one parameter
396
402
% value set to one of its range limits. This simple sweep ensures that
397
403
%
@@ -678,8 +684,8 @@ <h2 id="10">Identify Top 10 Parameters Based on Variance Only</h2>
0 commit comments