Skip to content

Commit e40622e

Browse files
committed
Updated air density-related functionalities in Linearization, Certification, AeroDyn, and WindTurbineDesign.m
1 parent 2e6c7fc commit e40622e

4 files changed

Lines changed: 19 additions & 13 deletions

File tree

subfunctions/AeroDyn.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function AeroDyn(Blade,Airfoil,Tower,mode)
1+
function AeroDyn(Blade,Airfoil,Tower,mode,AirDensity)
22

33
if contains(mode,'Linearize')
44
AFAeroMod = 1;
@@ -22,7 +22,7 @@ function AeroDyn(Blade,Airfoil,Tower,mode)
2222
fprintf(fid, 'False TwrAero - Calculate tower aerodynamic loads? (flag)\n');
2323
fprintf(fid, 'False FrozenWake - Assume frozen wake during linearization? (flag) [used only when WakeMod=1 and when linearizing]\n');
2424
fprintf(fid, '====== Environmental Conditions ===================================================================\n');
25-
fprintf(fid, ' 1.225 AirDens - Air density (kg/m^3)\n');
25+
fprintf(fid, ' %4.3f AirDens - Air density (kg/m^3)\n', AirDensity);
2626
fprintf(fid, ' 1.464E-05 KinVisc - Kinematic air viscosity (m^2/s)\n');
2727
fprintf(fid, ' 335 SpdSound - Speed of sound (m/s)\n');
2828
fprintf(fid, '====== Blade-Element/Momentum Theory Options ====================================================== [used only when WakeMod=1]\n');

subfunctions/Certification.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function Certification_OpeningFcn(hObject, eventdata, handles, varargin)
3535
handles.Drivetrain = varargin{5};
3636
handles.Control = varargin{6};
3737
handles.CertificationSettings = varargin{7};
38+
handles.AirDensity = varargin{8};
3839

3940
% Disable simulation time and wind speed if a stepped wind is requested
4041
if handles.CertificationSettings.Wind.Type == 2
@@ -478,6 +479,7 @@ function Start_Callback(hObject, eventdata, handles)
478479
Drivetrain = handles.Drivetrain;
479480
Control = handles.Control;
480481
CertificationSettings = handles.CertificationSettings;
482+
AirDensity = handles.AirDensity;
481483
TMax = CertificationSettings.Run.Time;
482484
T = CertificationSettings.Wind.T;
483485
Ly = CertificationSettings.Wind.Ly;
@@ -519,11 +521,11 @@ function Start_Callback(hObject, eventdata, handles)
519521
% Steady state curves
520522
disp('Determining steady state rotational speeds and pitch angles...')
521523
if CertificationSettings.Wind.Type == 2
522-
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, CertificationSettings.Wind.Step);
524+
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, CertificationSettings.Wind.Step, AirDensity);
523525
OmegaU = OmegaU*ones(length(CertificationSettings.Run.WindSpeed));
524526
PitchAngle = PitchAngle*ones(length(CertificationSettings.Run.WindSpeed));
525527
else
526-
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, CertificationSettings.Run.WindSpeed);
528+
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, CertificationSettings.Run.WindSpeed, AirDensity);
527529
end
528530
RPM = OmegaU * 60/(2*pi);
529531

@@ -535,7 +537,7 @@ function Start_Callback(hObject, eventdata, handles)
535537
% Turbine input files
536538
TMax = CertificationSettings.Run.Time;
537539
FASTinput(Control.DT, TMax);
538-
AeroDyn(Blade,Airfoil,Tower,string(CertificationSettings.Mode.Type));
540+
AeroDyn(Blade,Airfoil,Tower,string(CertificationSettings.Mode.Type), AirDensity);
539541

540542
% Send to base workspace and make structures available for Simulink and run the simulation
541543
assignin('base', 'FAST_InputFileName', [pwd, filesep 'subfunctions' filesep 'inputfiles' filesep 'FAST.fst']);

subfunctions/Linearization.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function Linearization_OpeningFcn(hObject, eventdata, handles, varargin)
2626
handles.Nacelle = varargin{4};
2727
handles.Control = varargin{5};
2828
handles.Drivetrain = varargin{6};
29+
handles.AirDensity = varargin{7};
2930

3031
% Propose values for the wind speed range
3132
set(handles.WindSpeed_From, 'String', int2str(ceil(handles.Control.WindSpeed.Cutin)))
@@ -71,6 +72,7 @@ function SetFullLoad_Callback(hObject, eventdata, handles)
7172
Airfoil = handles.Airfoil;
7273
Drivetrain = handles.Drivetrain;
7374
Control = handles.Control;
75+
AirDensity = handles.AirDensity;
7476

7577
% Find rated wind speed by comparing demanded torque at rotational speed C
7678
disp('Searching for rated wind speed...')
@@ -91,7 +93,7 @@ function SetFullLoad_Callback(hObject, eventdata, handles)
9193
for iter = 1:100
9294
U_new = U1 + abs((Control.Torque.Demanded-Qr1)/(Qr1-Qr2))*(U2-U1);
9395
[~, CQr] = PerformanceCoefficients(Blade, Airfoil, Control.Pitch.Fine, (OmegaC/Drivetrain.Gearbox.Ratio)*Blade.Radius(end)/U_new);
94-
Qr_new = 0.5*CQr*1.225*U_new^2*pi*Blade.Radius(end)^3*Drivetrain.Gearbox.Efficiency/Drivetrain.Gearbox.Ratio;
96+
Qr_new = 0.5*CQr*AirDensity*U_new^2*pi*Blade.Radius(end)^3*Drivetrain.Gearbox.Efficiency/Drivetrain.Gearbox.Ratio;
9597
if abs((Qr_new - Control.Torque.Demanded)/Control.Torque.Demanded) < 0.005
9698
success = true;
9799
break
@@ -167,6 +169,7 @@ function Linearize_Callback(hObject, eventdata, handles)
167169
Nacelle = handles.Nacelle;
168170
Control = handles.Control;
169171
Drivetrain = handles.Drivetrain;
172+
AirDensity = handles.AirDensity;
170173

171174
% Run modal analysis for 0 rpm
172175
disp('Finding non-rotating mode shapes...')
@@ -199,7 +202,7 @@ function Linearize_Callback(hObject, eventdata, handles)
199202

200203
% Steady state curves
201204
disp('Determining steady state rotational speeds and pitch angles...')
202-
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, WindSpeeds);
205+
[~, ~, OmegaU, PitchAngle] = SteadyState(Blade, Airfoil, Drivetrain, Control, WindSpeeds, AirDensity);
203206
RPM = OmegaU * 60/(2*pi);
204207

205208
% Avoid some common errors with linearization
@@ -224,7 +227,7 @@ function Linearize_Callback(hObject, eventdata, handles)
224227
FAST_InputFileName = [pwd, filesep 'subfunctions' filesep 'inputfiles' filesep 'FAST.fst'];
225228

226229
% Turbine input files
227-
AeroDyn(Blade,Airfoil,Tower,LinMode);
230+
AeroDyn(Blade,Airfoil,Tower,LinMode,AirDensity);
228231
ServoDyn(Drivetrain,Control,LinMode);
229232

230233
% Preload the OutList
@@ -304,11 +307,10 @@ function Linearize_Callback(hObject, eventdata, handles)
304307
% Set input
305308
Blade = handles.Blade;
306309
Drivetrain = handles.Drivetrain;
307-
308-
rhoAir = 1.225; % Density of air [kg/m3]
310+
AirDensity = handles.AirDensity;
309311

310312
% Calculate aerodynamic torque
311-
Q = 0.5*CQr*rhoAir*windSpeed^2*pi*Blade.Radius(end)^3*Drivetrain.Gearbox.Efficiency/Drivetrain.Gearbox.Ratio;
313+
Q = 0.5*CQr*AirDensity*windSpeed^2*pi*Blade.Radius(end)^3*Drivetrain.Gearbox.Efficiency/Drivetrain.Gearbox.Ratio;
312314

313315
%% Wind speed steps
314316
function WindSpeed_From_Callback(hObject, eventdata, handles)

subfunctions/WindTurbineDesign.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,8 @@ function Linearization_Callback(hObject, eventdata, handles)
30253025
handles.Tower, ...
30263026
handles.Nacelle, ...
30273027
handles.Control, ...
3028-
handles.Drivetrain);
3028+
handles.Drivetrain,...
3029+
handles.AirDensity);
30293030

30303031
% Enable window
30313032
for i = 1:length(buttons)
@@ -3058,7 +3059,8 @@ function Certification_Callback(hObject, eventdata, handles)
30583059
handles.Nacelle, ...
30593060
handles.Drivetrain, ...
30603061
handles.Control, ...
3061-
handles.CertificationSettings);
3062+
handles.CertificationSettings,...
3063+
handles.AirDensity);
30623064

30633065
% Enable window
30643066
for i = 1:length(buttons)

0 commit comments

Comments
 (0)