-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunner.asv
49 lines (38 loc) · 1.19 KB
/
runner.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function [FOPT, planet_d1_act, planet_d2_act, sun_d1_act, ring_d2_act, ...
dp, gr_act] = runner(pop_factor)
%% Planetary Gearbox GA Runner Script
% Elliot Stockwell 1/12/21
%% Constants
backup_ratio = 1.25;
planet_extrusion_d = 0.5; % inches
sun_extrusion_d = 0.71; % inches
bearing_d = 4.48; % inches
GR = 6.25; % dimensionless
%% Calculations
Pn = pi / 16;
Root_diameter =
%% Executables
vlb = [planet_extrusion_d, planet_extrusion_d, sun_extrusion_d, 1];
vub = [0.45 * bearing_d, 0.45 * bearing_d, bearing_d, 8];
bits = [16, 16, 16, 3];
l = sum(bits);
parain = zeros(14, 1);
parain(1) = 0;
parain(11) = 4 * l * pop_factor;
parain(13) = (l + 1) / (2 * l * parain(11));
parain(14) = 200;
options = goptions(parain);
[X,FOPT,STATS,NFIT,FGEN,LGEN,LFIT] = GA550('theFitness', ...
[], options, vlb, vub, bits, bearing_d, GR);
%% Explain Results
planet_d1 = X(1);
planet_d2 = X(2);
sun_d1 = X(3);
dp = 14 + 2 * X(4);
%% Print Real Design
planet_d1_act = round(dp * planet_d1) / dp;
planet_d2_act = round(dp * planet_d2) / dp;
sun_d1_act = round(dp * sun_d1) / dp;
ring_d2_act = planet_d1_act + planet_d2_act + sun_d1_act;
gr_act = (planet_d1_act * ring_d2_act / sun_d1_act / planet_d2_act) + 1;
end