-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrunAVL.m
88 lines (72 loc) · 2.2 KB
/
runAVL.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
%% Joseph Moster DEC 2011
%runAVL.m
%
%You must edit the avlLocation variable to contain the filename and
%location of the avl executable.
%This script creates an avl batch script and then executes it.
%Requires the following files to be in the same directory:
% ag35.dat
% ag36.dat
% ag37.dat
% ag38.dat
% allegro.avl
% allegro.mass
%% INPUT variables
filename = '.\sampleData\allegro';
velocity = 10;%m/s
%Define a base file name to save
basename = '.\sampleData\newData1';
%Location of avl
avlLocation = '.\avl.exe';
%% Directory Preparation
%Purge Directory of interfering files
[status,result] =dos(strcat('del ',basename,'.st'));
[status,result] =dos(strcat('del ',basename,'.sb'));
[status,result] =dos(strcat('del ',basename,'.run'));
[status,result] =dos(strcat('del ',basename,'.eig'));
%% Create run file
%Open the file with write permission
fid = fopen(strcat(basename,'.run'), 'w');
%Load the AVL definition of the aircraft
fprintf(fid, 'LOAD %s\n', strcat(filename,'.avl'));
%Load mass parameters
fprintf(fid, 'MASS %s\n', strcat(filename,'.mass'));
fprintf(fid, 'MSET\n');
%Change this parameter to set which run cases to apply
fprintf(fid, '%i\n', 0);
%Disable Graphics
fprintf(fid, 'PLOP\ng\n\n');
%Open the OPER menu
fprintf(fid, '%s\n', 'OPER');
%Define the run case
fprintf(fid, 'c1\n', 'c1');
fprintf(fid, 'v %6.4f\n',velocity);
fprintf(fid, '\n');
%Options for trimming
%fprintf(fid, '%s\n', 'd1 rm 0'); %Set surface 1 so rolling moment is 0
%fprintf(fid, '%s\n', 'd2 pm 0'); %Set surface 2 so pitching moment is 0
%Run the Case
fprintf(fid, '%s\n', 'x');
%Save the st data
fprintf(fid, '%s\n', 'st');
fprintf(fid, '%s%s\n',basename,'.st');
%Save the sb data
fprintf(fid, '%s\n', 'sb');
fprintf(fid, '%s%s\n',basename,'.sb');
%Drop out of OPER menu
fprintf(fid, '%s\n', '');
%Switch to MODE menu
fprintf(fid, '%s\n', 'MODE');
fprintf(fid, '%s\n', 'n');
%Save the eigenvalue data
fprintf(fid, '%s\n', 'w');
fprintf(fid, '%s%s\n', basename,'.eig'); %File to save to
%Exit MODE Menu
fprintf(fid, '\n');
%Quit Program
fprintf(fid, 'Quit\n');
%Close File
fclose(fid);
%% Execute Run
%Run AVL using
[status,result] = dos(strcat(avlLocation,' < ',basename,'.run'));