Skip to content

Commit

Permalink
Fourth version
Browse files Browse the repository at this point in the history
  • Loading branch information
dciliberti committed Aug 23, 2019
1 parent 3181dbc commit 41a77c2
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 10 deletions.
Binary file removed example/shaftPowerContourPlot.png
Binary file not shown.
Binary file removed example/shaftPowerSurfacePlot.png
Binary file not shown.
126 changes: 116 additions & 10 deletions performanceCharts.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% Calculate the Lehner 2280-40 electric motor map from performance data
% issued by the manufacturer. Plot propeller operating points on the map.
% Version 3. Same as Version 2, but with X and Y axes swapped. Some
% variables have been renamed.
% Version 4. Same as Version 3, but add more charts.
close all; clearvars; clc

% Operative points: J, Power (W), RPM
%% User-provided data
% Operative points: J, Shaft Power (W), RPM
MXCL = [1.46 403 9801
1.95 174 7351];

Expand All @@ -14,7 +14,7 @@
2.99 77 4804
3.22 63 4461];

% Lehner performance charts
%% Lehner performance data
V1 = csvread('data\V5.csv');
V2 = csvread('data\V10.csv');
V3 = csvread('data\V15.csv');
Expand Down Expand Up @@ -57,14 +57,13 @@
limEta = [V1(end,6); V2(end,6); V3(end,6); V4(end,6); V5(end,6); V6(end,6); V7(end,6); ...
V8(end,6); V9(end,6); V10(end,6); V11(end,6); V12(end,6)];

[xa, ya] = meshgrid(0:10:11000, 0:0.1:15); % x: RPM, y: Ampere
za = griddata(r,c,s,xa,ya);

% Calculate current from expected output power and RPM (propeller data)
%% Calculate CURRENT from expected shaft power and RPM (propeller data)
MXCL(:,4) = griddata(s,r,c,MXCL(:,2),MXCL(:,3));
MXCR(:,4) = griddata(s,r,c,MXCR(:,2),MXCR(:,3));
[xa, ya] = meshgrid(0:100:11000, 0:0.1:15); % x: RPM, y: Ampere
za = griddata(r,c,s,xa,ya);

%% Plot section
% Plot section
figure
hold on
surf(xa,ya,za,'FaceColor','interp','LineStyle','none')
Expand Down Expand Up @@ -161,4 +160,111 @@
text(MXCR(i,3),MXCR(i,4),...
['J = ',num2str(MXCR(i,1)), ' \rightarrow'], ...
'HorizontalAlignment','right')
end
end

%% Calculate TORQUE and motor EFFICIENCY from expected shaft power and RPM (propeller data)
MXCL(:,5) = griddata(s,r,t,MXCL(:,2),MXCL(:,3));
MXCR(:,5) = griddata(s,r,t,MXCR(:,2),MXCR(:,3));
MXCL(:,6) = griddata(s,r,h,MXCL(:,2),MXCL(:,3));
MXCR(:,6) = griddata(s,r,h,MXCR(:,2),MXCR(:,3));
[xt, yt] = meshgrid(0:100:11000, 0:1:60); % x: RPM, y: Ncm
zt = griddata(r,t,h,xt,yt,'natural');

% Plot section
figure
hold on
surf(xt,yt,zt,'FaceColor','interp','LineStyle','none')
plot3(V1(:,3),V1(:,4),V1(:,6),'k--')
plot3(V2(:,3),V2(:,4),V2(:,6),'k--')
plot3(V3(:,3),V3(:,4),V3(:,6),'k--')
plot3(V4(:,3),V4(:,4),V4(:,6),'k--')
plot3(V5(:,3),V5(:,4),V5(:,6),'k--')
plot3(V6(:,3),V6(:,4),V6(:,6),'k--')
plot3(V7(:,3),V7(:,4),V7(:,6),'k--')
plot3(V8(:,3),V8(:,4),V8(:,6),'k--')
plot3(V9(:,3),V9(:,4),V9(:,6),'k--')
plot3(V10(:,3),V10(:,4),V10(:,6),'k--')
plot3(V11(:,3),V11(:,4),V11(:,6),'k--')
plot3(V12(:,3),V12(:,4),V12(:,6),'k--')
plot3(limRPM,limMom,limEta,'k-','LineWidth',2)
climb = plot3(MXCL(:,3),MXCL(:,5),MXCL(:,6)+2,'or-','LineWidth',1.5);
cruise = plot3(MXCR(:,3),MXCR(:,5),MXCR(:,6)+2,'ob-','LineWidth',1.5);
hold off, grid on, view(-20,30)
xlabel('RPM'), ylabel('Torque, Ncm'), zlabel('Efficiency')
legend([climb,cruise], 'MXCL', 'MXCR','Location','Best','Color','cyan')

% Annotations on surf
% text(V1(end,3),V1(end,1),V1(end,5),'5 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V2(end,3),V2(end,1),V2(end,5),'10 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V3(end,3),V3(end,1),V3(end,5),'15 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V4(end,3),V4(end,1),V4(end,5),'20 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V5(end,3),V5(end,1),V5(end,5),'25 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V6(end,3),V6(end,1),V6(end,5),'30 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V7(end,3),V7(end,1),V7(end,5),'35 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V8(end,3),V8(end,1),V8(end,5),'40 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V9(end,3),V9(end,1),V9(end,5),'45 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V10(end,3),V10(end,1),V10(end,5),'50 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V11(end,3),V11(end,1),V11(end,5),'55 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V12(end,3),V12(end,1),V12(end,5),'60 V \rightarrow', 'HorizontalAlignment', 'right')

% for i = 1:size(MXCL,1)
% text(MXCL(i,3),MXCL(i,4),MXCL(i,2)+20,...
% ['J = ',num2str(MXCL(i,1)), ' \rightarrow'], ...
% 'HorizontalAlignment','right')
% end
%
% for i = 1:size(MXCR,1)
% text(MXCR(i,3),MXCR(i,4),MXCR(i,2)+20,...
% ['J = ',num2str(MXCR(i,1)), ' \rightarrow'], ...
% 'HorizontalAlignment','right')
% end

% Contour plot
figure
hold on
[C,H] = contourf(xt,yt,zt,0:10:100);
% plot(V1(:,3),V1(:,1),'k--')
% plot(V2(:,3),V2(:,1),'k--')
% plot(V3(:,3),V3(:,1),'k--')
% plot(V4(:,3),V4(:,1),'k--')
% plot(V5(:,3),V5(:,1),'k--')
% plot(V6(:,3),V6(:,1),'k--')
% plot(V7(:,3),V7(:,1),'k--')
% plot(V8(:,3),V8(:,1),'k--')
% plot(V9(:,3),V9(:,1),'k--')
% plot(V10(:,3),V10(:,1),'k--')
% plot(V11(:,3),V11(:,1),'k--')
% plot(V12(:,3),V12(:,1),'k--')
% plot(limRPM,limCur,'k-','LineWidth',2)
% climb = plot(MXCL(:,3),MXCL(:,4),'or-','LineWidth',1.5);
% cruise = plot(MXCR(:,3),MXCR(:,4),'oy-','LineWidth',1.5);
hold off
clabel(C,H,'FontSize',15,'Color','white')
xlabel('RPM'), ylabel('Torque, Ncm'), title('Efficiency')
legend([climb,cruise], 'MXCL', 'MXCR','Location','Best','Color','cyan')

% Annotations on contour
% text(V1(end,3),V1(end,1),'5 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V2(end,3),V2(end,1),'10 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V3(end,3),V3(end,1),'15 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V4(end,3),V4(end,1),'20 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V5(end,3),V5(end,1),'25 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V6(end,3),V6(end,1),'30 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V7(end,3),V7(end,1),'35 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V8(end,3),V8(end,1),'40 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V9(end,3),V9(end,1),'45 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V10(end,3),V10(end,1),'50 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V11(end,3),V11(end,1),'55 V \rightarrow', 'HorizontalAlignment', 'right')
% text(V12(end,3),V12(end,1),'60 V \rightarrow', 'HorizontalAlignment', 'right')

% for i = 1:size(MXCL,1)
% text(MXCL(i,3),MXCL(i,4),...
% ['J = ',num2str(MXCL(i,1)), ' \rightarrow'], ...
% 'HorizontalAlignment','right')
% end
%
% for i = 1:size(MXCR,1)
% text(MXCR(i,3),MXCR(i,4),...
% ['J = ',num2str(MXCR(i,1)), ' \rightarrow'], ...
% 'HorizontalAlignment','right')
% end

0 comments on commit 41a77c2

Please sign in to comment.