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

vslicesplot_torques(models,avail,what,v,Z,vmax,Fmax,Pmax,deltav,deltaF,tit)
function vslicesplot_torques(models,avail,what,v,Z,vmax,Fmax,Pmax,deltav,deltaF,tit)
%vslicesplot_forces
%vslicesplot_forces(model,Z,vmax,Tmax,Pmax,deltav,deltaT,tit)
%this function plots slices for 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 = v;
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


% doorsnedes per snelheid
for i=1:length(vgrid)
    Fslice(:,i)=Xnew((i-1)*length(Fgrid)+1:i*length(Fgrid),2);
    vslice(:,i)=Xnew((i-1)*length(Fgrid)+1:i*length(Fgrid),1);
   for j=1:4
    Tslice(:,i,j)=Ynew((i-1)*length(Fgrid)+1:i*length(Fgrid),j);
   end
end

colors=['y','g','b','r'];
amodes=['ZA '
        'MAe'
        'MAn'
        'MAp'];
amodesstr=cellstr(amodes);

if max(v)>vmax
    errordlg(['Elements of v must be smaller than ', num2str(vmax)],'Bad Input','modal')
end
%doorsnede voor k km/h    

hold on
set(text,'fontsize',14)
for i=1:length(v);
    k=round(2*max(Fslice)/max(v)*i*1/deltav);
    l=round(k);
    %index=v(i)*1/deltav+1;
    for j=1:4
        if what(j)==1
            if avail(j)==0
                errordlg(['The ',amodes(j,:),' mode is not available for this pedelec'],'Bad Input','modal');
            else
                plot(Fslice(:,i),Tslice(:,i,j),colors(j))
                text(Fslice(k,i),Tslice(k,i,j),['\leftarrowv_{',amodes(j,:),'}= ',num2str(vslice(1,i)),'km/h'],'color',colors(j));
                %text(Tslice(k,1),Fslice(k,1,j),['\leftarrowv_{NA}= ',num2str(vslice(1,i)),'km/h'],'color',colors(j));
            end
        end
    end
end

title(tit,'fontsize',14);
xlabel('Traction force [N]');
ylabel('Torque [Nm]');
%vektor(i,:)=[tekstZA(i) tekstMAp(i) titel(i) x(i) y(i)];
%set(vektor(k,:),'fontsize',14);
axis([0 Fmax 0 80]);
hold off
end

% 

Contact us at files@mathworks.com