No BSD License  

Highlights from
GUI for the performance analysis of pedelecs

image thumbnail
from GUI for the performance analysis of pedelecs by Jan Cappelle
Modeling the behaviour of electric bicycles

plot_torques3D_more(models,avail,what,Z,vmax,Fmax,Pmax,deltav,deltaF,tit)
function  plot_torques3D_more(models,avail,what,Z,vmax,Fmax,Pmax,deltav,deltaF,tit)
%PLOT_FORCES3D
%plot_forces3D(model,Z,vmax,Tmax,Pmax,deltav,deltaT,tit,cmap)
%this function plots the 3D traction force as a function of speed and
%torque for a given model, maximum values for speed, torque and power
%should be given, and also speedstep and torquestep, a title and a colormap
%are inputs.


% make a new grid with max speed, max Torque and Speed step and Torque step
vgrid = 0:deltav:vmax;
Fgrid = 0:deltaF:Fmax;
model1=models.ZA;
model2=models.MAe;
model3=models.MAn;
model4=models.MAp;

for k=1:length(vgrid)
hulp(((k-1)*(length(Fgrid))+1):k*length(Fgrid),:)=[vgrid(k).*ones(length(Fgrid),1) Fgrid'];
end
Xnew = hulp;
if isstruct(model1)
Ynew(:,1) = simlssvm(model1,Xnew);
else
Ynew(:,1)=Xnew(:,1); %nonsense input, is never displayed    
end
if isstruct(model2)
Ynew(:,2) = simlssvm(model2,Xnew);
else
Ynew(:,2)=Xnew(:,1);
end
if isstruct(model3)
Ynew(:,3) = simlssvm(model3,Xnew);
else
Ynew(:,3)=Xnew(:,1);
end
if isstruct(model4)
Ynew(:,4) = simlssvm(model4,Xnew);
else
Ynew(:,4)=Xnew(:,1);
end

%Remove point above the powerlimit and the torquelimit
for i=1:length(Xnew)
    if Xnew(i,1)/3.6*Xnew(i,2)>Pmax
            Ynew(i,:)=NaN;
    end
    if Xnew(i,2)>Fmax
            Ynew(i,:)=NaN;
    end
end

for i=1:length(Xnew)
    for j=1:4;
    if Ynew(i,j)>80
            Ynew(i,j)=NaN;
    end
    end
end

%colors=['y','g','b','r'];
colors=['.y'
        '.g'
        '.b'
        '.r'];
    howtoplot=cellstr(colors);
amodes=['ZA '
        'MAe'
        'MAn'
        'MAp'];
    
set(text,'fontsize',12)
for i=1:4
    if what(i)==1
        if avail(i)==0
             errordlg(['The ',amodes(i,:),' mode is not available for this pedelec'],'Bad Input','modal');
        else
            hold on
       plot3(Xnew(:,2),Xnew(:,1),Ynew(:,i),char(howtoplot(i)))
        end
    end
end
grid on
view(150,-30);
axis([0 Fmax 0 vmax 0 80])
title(tit,'fontsize',14)
ylabel('Speed [km/h]','rotation',30)
xlabel('F_t [N]','rotation',-10)
zlabel('T_c [Nm]','rotation',90)
hold off

Contact us at files@mathworks.com