Skip to content
Snippets Groups Projects
Commit d02ffa99 authored by JuanPi Carbajal's avatar JuanPi Carbajal
Browse files

analysis of results 3rd campaign

parent 0b123057
No related branches found
No related tags found
No related merge requests found
## Copyright (C) 2018 Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
## Created: 2018-02-02
## Script to preprocess measured data
#
## Load Friction
# Torque due to friction as indentified independently, see |s_friction.m| for
# the generation of the file used here
fname_F = '../campaign1_20180110/tauF.dat';
load (fname_F)
## Load pre-processed data
# The raw data, collected with |s_rawdata.m|, is pre-processed in the script
# |s_preprocess_rawdata.m|.
fname_vp = @(w) sprintf ("vp%s.dat", strrep (num2str (w), '.', '_'));
fname_raw = @(w) sprintf ("rawdata_vp%s.dat", strrep (num2str (w), '.', '_'));
##
# We load the data form the two wind speeds we used
vp = 6;
for i=1:length(vp)
load (fname_raw(vp(i)),'Temp', 'Hum', 'Pres','v','v_std');
load (fname_vp(vp(i)));
A = 2 * radiusR * HR;
A_std_rel = dr/radiusR + dH / HR;
v_w{i} = v;
v_w_std_rel = v_std ./ v_w{i};
vt{i} = vtR_data;
vt_std{i} = vtR_data_std;
tsr{i} = vt{i} / v_w{i};
tsr_std{i} = (vt_std{i} ./ vt{i} + v_w_std_rel) .* tsr{i};
tau{i} = - tauR - tauF(omegaR);
tau_std{i} = tauR_std; % + tauF_std; # TODO
rho{i} = air_density (Temp, Pres, Hum);
Pw{i} = 0.5 * A * v_w{i}^3 * rho{i};
Pw_std_rel = 3 * v_w_std_rel + A_std_rel;
Cp{i} = tau{i} .* omegaR ./ Pw{i};
Cp_std{i} = (tau_std{i} ./ tau{i} + omegaR_std ./ omegaR + Pw_std_rel) .* Cp{i};
endfor
## Plots
#
txt_label = @(v) {sprintf('%.1f m/s down',v), sprintf('%.1f m/s up',v)};
figure (1)
clf
h1 = errorbar (vt{1}, tau{1}, vt_std{1}, tau_std{1}, '~>o');
hold on
vtf = linspace (0, max (vt{1})*1.5, 100).';
h3 = plot (vtf, -tauF(vtf/radiusR),'k-');
hold off
axis tight
xlabel ('Tangential speed rotor [m/s]')
ylabel ('\tau_W [Nm]')
set (h1, 'markerfacecolor', 'auto')
legend ([h1; h3], {txt_label(v_w{1}){:}, '\tau_F'}, ...
'Location', 'NorthOutside','Orientation', 'horizontal');
print ('-dpng', 'TauW_vs_vt.png');
%print ('-dpng', 'TauW_vs_tsr.png');
figure (2)
clf
h1 = errorbar (tsr{1}, Cp{1}, tsr_std{1}, Cp_std{1}, '~>o');
axis tight
xlabel ('TSR [a.u.]')
ylabel ('C_p [a.u.]')
legend (h1, txt_label(v_w{1}), ...
'Location', 'NorthOutside','Orientation', 'horizontal');
print ('-dpng', 'Cp_vs_tsr.png');
## Copyright (C) 2018 Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
## Created: 2018-02-02
## Script to preprocess measured data
#
# add folder with data analysis functions
fname_raw = @(w) sprintf ("rawdata_vp%s.dat", strrep (num2str (w), '.', '_'));
fname = @(w) sprintf ("vp%s.dat", strrep (num2str (w), '.', '_'));
vars = {'gearGP52', 'radiusR', 'HR', 'dr', 'dH', ...
'tauM', 'tauR', 'tauM_std', 'tauR_std', ...
'omegaM', 'omegaR', 'omegaM_std', 'omegaR_std', ...
'omegaR_data', 'omegaR_data_std', ...
'vtR', 'vtR_std', 'vtR_data', 'vtR_data_std', 'v'};
txt_label = @(v) {sprintf('%.1f m/s down',v), sprintf('%.1f m/s up',v)};
vp = 6;
load (fname_raw(vp))
if ~exist ('vtR', 'var')
# properties of gearbox installed in motor
gearGP52 = struct ('ratio', 4.3, 'efficiency', 0.91);
# Properties of the rotor
radiusR = 0.35; # in meters
dr = 0.01;
HR = 0.50;
dH = 0.01;
# Error of the mean from interval
# Measurements are consider 0.99 confidence intervals
coeff = 1 ./ erfinv (0.99);
lu2std = @(LU) squeeze (std (LU, 0, 2)) * coeff / sqrt (2);
##
# Motor/rotor torque and rotation
[TM, WM, TR, WR] = maxonRE50_model (U, I, gearGP52);
[TMlu, WMlu, TRlu, WRlu] = maxonRE50_model (U, I_lu, gearGP52);
tauM = TM; tauM_std = lu2std (TMlu);
tauR = TR; tauR_std = lu2std (TRlu);
omegaM = WM; omegaM_std = lu2std (WMlu);
omegaR = WR; omegaR_std = lu2std (WRlu);
omegaR_data = 2 * pi * fe;
omegaR_data_std = 2 * pi * fe_err;
vtR_data = omegaR_data * radiusR;
vtR_data_std = omegaR_data_std * radiusR .* ones(size(fe));
endif
## Plots
#
##
# Motor voltage and current at stead state
# The voltage was scanned with increasing (up) and decreasing values (down)
# for two values of the wind speed.
figure (1)
clf
h = plot (U,I,'o-');
axis tight
xlabel ('Voltage [V]')
ylabel ('Current [A]')
legend (h, txt_label(v));
##
# Motor rotational frequency as measured from the encoder and
# as caculated using the manufacturer's model.
# The plots show that the error propagated through the model
# is an over estimation of the uncertainty in the angular speed.
# Therefore we assign the erro of th emeasured speed to the model output.
figure (2)
clf
fm = omegaM / 2 / pi;
if ~exist ('vtR', 'var')
subplot (1,2,1)
errf = omegaM_std / 2 / pi;
h = errorbar (fm, fe, errf, fe_err*ones(size(errf)),'~>o');
ff = [fm(:) fe(:)]; ff(!isfinite(ff(:,2)),:) = [];
vax = [min(ff(:)) max(ff(:))];
vax = vax([1 2 1 2]);
axis (vax);
line (vax(1:2), vax(3:4));
xlabel ('Freq. motor (model) [Hz]')
ylabel ('Freq. encoder (measured) [Hz]')
legend (h, txt_label(v), ...
'Location', 'NorthOutside','Orientation', 'horizontal');
omegaM_std = fe_err * 2 * pi;
omegaR_std = omegaM_std / gearGP52.ratio;
subplot (1,2,2)
endif
ferr = fe_err * ones(size(fm));
h = errorbar (fm, fe, ferr, ferr,'~>o');
if exist ('vtR', 'var')
axis tight;
vax = axis ();
else
axis (vax);
endif
line (vax(1:2), vax(3:4));
xlabel ('Freq. motor (model) [Hz]')
ylabel ('Freq. encoder (measured) [Hz]')
legend (h, txt_label(v), ...
'Location', 'NorthOutside','Orientation', 'horizontal');
print ('-dpng', sprintf('freqR_vs_freqRmodel_%d.png',v))
##
# Torque of the motor applied to the turbine rotor vs. tangential speed of
# turbine rotor
# Tangential speed
vtR = omegaR * radiusR;
vtR_std = omegaR_std * radiusR;
figure (3)
clf
errV = vtR_std * ones (size (vtR));
h = errorbar (vtR, tauR, errV, tauR_std, '~>o');
axis tight
xlabel ('Tangetial speed rotor (model) [rad/s]')
ylabel ('\tau_M [Nm]')
legend (h, txt_label(v), ...
'Location', 'NorthOutside','Orientation', 'horizontal');
figure (4)
clf
h = errorbar (vtR_data / v, tauR, vtR_data_std / v, tauR_std, '~>o');
axis tight
xlabel ('TSR [a.u.]')
ylabel ('\tau_M [Nm]')
legend (h, txt_label(v), ...
'Location', 'NorthOutside','Orientation', 'horizontal');
print ('-dpng', sprintf('tauR_vs_tsr_%d.png',v))
## Save data
#
fn = fname (vp);
save (fn, vars{:});
printf ("Saved to %s\n", fn); fflush (stdout);
## Copyright (C) 2018 Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
## Created: 2018-02-02
## Script to collect and save measured data
#
fname = @(w) sprintf ("rawdata_vp%s.dat", strrep (num2str (w), '.', '_'));
vars = {'vp', 'v', 'v_std', 'U', 'I', 'I_lu', 'fe', 'fe_err', 'Temp', 'Pres', 'Hum'};
## Voltage ramp up and down
# Last index is down (=1) and up (=2)
nU = 7;
U = zeros (nU,2);
U(:,1) = [30 26 22 18 14 10 6].';
U(:,2) = flipud (U(:,1));
## Wind power 6 %
# Wind speed from anemometer @ 12.5 %
vp = 6;
v = 1.9; # m/s
v_std = 0.1;
##
# Current @ 6 %
I_lu = zeros (nU,2,2);
I_lu(:,:,1) = [18.8 19.9;15.8 17.0; 12.2 13.6; 9 10; 7.3 7.8; ...
5.7 6.3; 4.4 5.1] * 1e-2.';
;
I_lu(:,:,2) = [4.3 5.1; 6.2 6.8; 7.1 7.9; 9.2 10; 10.7 12; ...
15.8 16.2; 19.4 20]*1e-2;
I = squeeze (mean (I_lu, 2));
##
# Encoder rotation frequency
fe = NA (nU,2);
fe(:,1) = [19.1; 16.5; 14.0; 11.5; 8.8; 6.3; 3.7];
fe(:,2) = [3.6; 6.3; 8.9; 11.4; 14; 16.6; 19.1].';
# Resolution in frequency measurement [Hz]
fe_err = 0.1;
##
# Temprature, Pressure and Relative humidity
Pres = 978.1e2 * [1 1]; #Pa
Hum = [0.52 0.53];
Temp = [11.7 10.3]; #C
fn = fname (vp);
save (fn, vars{:});
printf ("Saved to %s\n", fn); fflush (stdout);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment