Join/Login

Business Software

Open Source Software

For Vendors

Blog

About

More

Articles

Create

SourceForge Podcast

Site Documentation

Subscribe to our Newsletter

Support Request

For Vendors Help Create Join Login

Business Software

Open Source Software

SourceForge Podcast

Resources

Articles

Case Studies

Blog

Menu

Help

Create

Join

Login

Home

Browse

Matlab wind turbine model

Code

Matlab wind turbine model Code

Generic Matlab model of a wind turbine drive train.

Status: Alpha
Brought to you by: crobarcro, mcmullenjoe

Summary

Reviews

Support

Code

Menu ▾ ▴

Browse Commits

Browse Files

[r18]: / odefun.m  Maximize  Restore  History

Download this file

93 lines (70 with data), 2.3 kB

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

function dydt = odefun(t,y,u,beta)

% Calculates the acceleration and velocity of a wind or tidal turbine

%

% This function is intended for use with the Matlab/Octave ode integrators

% to perform a time series simulation of the turbine

%

% Syntax

%

% dydt = odefun(t,y)

%

% Input

%

% t - the current time step

%

% y - the values of the integrated quantities at the previous time step,

% these quantites are:

%

% y(1): angular position

% y(2): angular velocity

%

% Output

%

% dydt - the derivatives of the turbine quantities at the current time

% step:

%

% dydt(1): angular velocity

% dydt(2): angular acceleration

%

%

% Description

%

% This works by doing stuff from [1].

%

% [1] Doe, J., "Super paper title", Journal or Awsome, blah

% Define variables and constants no user input to speed matters

density = 1.2041; % density of air

R = 20; % rotor radius

% set the differential of position from ode45 equal to angular velocity

% of the rotor

ang_vel = y(2);

% Use if and else logical statements to set ang_vel to 0.0000001 when

% ang_vel actually equals 0, this avoids a division by zero error

% later in the model

if ang_vel == 0

lambda = 0.0000001 * R/u;

else

lambda = ang_vel * R/u;

end

% Detect the number of arguments to determine if there is a defined pitch

% angle, if not pitch angle is calculated by maximising cp

if nargin < 4

[beta fval] = fminbnd(@(beta)(-(0.5176.*(116./(1./((1./(lambda + 0.08.*beta))-(0.035./(beta.^3+1)))) - 0.4.*beta - 5).*exp(-21./(1./((1./(lambda +0.08.*beta))-(0.035./(beta.^3+1)))))) + 0.0068* lambda),0,90);

end

% Calculate Cp, the coefficient of performance

lambda_i = (1/((1/(lambda+0.08*beta))-(0.035/(beta^3+1))));

cp = 0.5176 .* (116/lambda_i - 0.4 * beta - 5) * exp(-21/lambda_i) + 0.0068 * lambda;

% Compute rotor torque

rotor_torque = 0.5 * pi * density * R^3 * u^2 * cp / lambda;

% Set a value of generator torque a constant value is used as an

% initial simplification

gen_torque = 500;

% Output the shaft torque

shaft_torque = rotor_torque - gen_torque;

% Define inertia

inertia = 0.212 * (2.95 * R^2.13) * R^2;

% Set up the ode

dydt = [y(2); shaft_torque/inertia];

end

% function beta = pitch_angle(lambda)

% end

SourceForge

Create a Project

Open Source Software

Business Software

Top Downloaded Projects

Company

About

Team

SourceForge Headquarters
225 Broadway Suite 1600
San Diego, CA 92101
+1 (858) 422-6466

Resources

Support

Site Documentation

Site Status

SourceForge Reviews

© 2025 Slashdot Media. All Rights Reserved.

Terms Privacy Opt Out Advertise

×
Want the latest updates on software, tech news, and AI?

Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.

Submit