-
Notifications
You must be signed in to change notification settings - Fork 0
/
aeronastranui.m
136 lines (97 loc) · 4.66 KB
/
aeronastranui.m
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function aeronastranui
% Create the main figure window
W = aeronastran;
W.gen_fem;
W.lattice;
fig = uifigure('Name', sprintf('aeronastran (version %s)',W.version), 'Position', [100, 100, 800, 600]);
% Geometry
% Create labels and input fields for wingspan, chord, angle, and case
lblWingspan = uilabel(fig, 'Text', 'Wingspan:', 'Position', [50, 500, 100, 22]);
% Create a numeric input field for the wingspan
txtWingspan = uieditfield(fig, 'numeric', 'Position', [150, 500, 100, 22]);
% Set the initial value of the input field
txtWingspan.Value = W.geom.span;
txtWingspan.ValueChangedFcn = @(txt, event) set_span(W, txt.Value);
lblChord = uilabel(fig, 'Text', 'Chord:', 'Position', [50, 450, 100, 22]);
txtChord = uieditfield(fig, 'numeric', 'Position', [150, 450, 100, 22]);
txtChord.Value = W.geom.chord;
txtChord.ValueChangedFcn = @(txt, event) set_chord(W, txt.Value);
lblAngle = uilabel(fig, 'Text', 'Angle:', 'Position', [50, 400, 100, 22]);
txtAngle = uieditfield(fig, 'numeric', 'Position', [150, 400, 100, 22]);
txtAngle.Value = W.geom.angle;
txtAngle.ValueChangedFcn = @(txt, event) set_angle(W, txt.Value);
% FEM nodes
% Create labels and input fields for wingspan, chord, angle, and case
lblchordnodes = uilabel(fig, 'Text', 'Chord nodes:', 'Position', [300, 500, 100, 22]);
% Create a numeric input field for the wingspan
txtchordnodes = uieditfield(fig, 'numeric', 'Position', [400, 500, 100, 22]);
% Set the initial value of the input field
txtchordnodes.Value = W.model.chorddiv;
txtchordnodes.ValueChangedFcn = @(txt, event) set_chordnodes(W, txt.Value);
lblspannodes = uilabel(fig, 'Text', 'Span nodes:', 'Position', [300, 450, 100, 22]);
txtspannodes = uieditfield(fig, 'numeric', 'Position', [400, 450, 100, 22]);
txtspannodes.Value = W.model.spandiv;
txtspannodes.ValueChangedFcn = @(txt, event) set_spannodes(W, txt.Value);
lblspanpanels = uilabel(fig, 'Text', 'Span Panels:', 'Position', [300, 400, 100, 22]);
txtspanpanels = uieditfield(fig, 'numeric', 'Position', [400, 400, 100, 22]);
txtspanpanels.Value = W.model.panspan;
txtspanpanels.ValueChangedFcn = @(txt, event) set_spanpanels(W, txt.Value);
lblchordpanels = uilabel(fig, 'Text', 'Span Panels:', 'Position', [300, 350, 100, 22]);
txtchordpanels = uieditfield(fig, 'numeric', 'Position', [400, 350, 100, 22]);
txtchordpanels.Value = W.model.panchord;
txtchordpanels.ValueChangedFcn = @(txt, event) set_chordpanels(W, txt.Value);
lblCase = uilabel(fig, 'Text', 'Case:', 'Position', [550, 350, 100, 22]);
dropdownCase = uidropdown(fig, 'Items', {'flutter', 'divergence'}, 'Position', [650, 350, 100, 22]);
dropdownCase.ValueChangedFcn = @(dd, event) set_case(W, dd.Value);
% Create a "Calculate" button
btnCalculate = uibutton(fig, 'Text', 'Calculate', 'Position', [50, 300, 100, 22], ...
'ButtonPushedFcn', @(btnCalculate, event) calculateButtonPushed(txtWingspan.Value, txtChord.Value, txtAngle.Value, ax));
% Create a "Close" button
btnClose = uibutton(fig, 'Text', 'Close', 'Position', [200, 300, 100, 22], ...
'ButtonPushedFcn', @(btnClose, event) closeButtonPushed(fig));
% Create "Show Nodes" button
btnShowNodes = uibutton(fig, 'Text', 'Show Nodes', 'Position', [50, 250, 100, 22], ...
'ButtonPushedFcn', @(btnShowNodes, event) showNodesButtonPushed(W));
% Create "Show Panels" button
btnShowPanels = uibutton(fig, 'Text', 'Show Panels', 'Position', [200, 250, 100, 22], ...
'ButtonPushedFcn', @(btnShowPanels, event) showPanelsButtonPushed(W));
end
function showNodesButtonPushed(W)
W.mesh_plot;
end
function set_span(W, txt)
W.geom.span = txt;
W.gen_fem;
end
function set_spanpanels(W,txt)
W.model.panspan = txt;
W.lattice;
end
function set_chordpanels(W, txt)
W.model.panchord = txt;
W.lattice;
end
function set_chordnodes(W, txt)
W.model.chorddiv = txt;
W.gen_fem;
end
function set_spannodes(W, txt)
W.model.spandiv = txt;
W.gen_fem;
end
function set_chord(W, txt)
W.geom.chord = txt;
W.gen_fem;
end
function set_angle(W, txt)
W.geom.angle = txt;
W.gen_fem;
end
function set_case(W, selectedValue)
switch selectedValue
case 'flutter'
W.model.analysis = 1; % Update this to the appropriate parameter in your class
case 'divergence'
W.model.analysis = 2; % Update this to the appropriate parameter in your class
end
end