Code covered by the BSD License  

Highlights from
SAE Paper Demo: Model-Based Design of Hybrid Electric Vehicles

image thumbnail

SAE Paper Demo: Model-Based Design of Hybrid Electric Vehicles

by

 

07 Nov 2010 (Updated )

Demo files to accompany the paper by the same name

determinePowerFlow(Eng_Planet_Power, Sun_Gen_Power, Gen_Bat_Power,...
function powerFlow = determinePowerFlow(Eng_Planet_Power, Sun_Gen_Power, Gen_Bat_Power,...
                  Bat_Mot_Power, Bat_Power, Mot_Ring_Power,...
                  Ring_Diff_Power, pause_time)
              
%Check to see if engine is outputting power

% 7 and 8 stand for the two tires. negative sign means "In"(shaft_tire1, 2)
% 9 is from generator to Motor with +1 going from the same order
% 6 is from gear to drive shaft
% 5 is from engine to planet(eng_planet)
% 4 is from generator to sun(sun_gen)
% 3 is from Motor to Ring(mot_ring)
% 2 is battery to motor(bat_mot)
% 1 is from generator to battery (gen_bat)
i=1;
pause(10e-5+ (1/(str2num(pause_time))));

if((Eng_Planet_Power-0)*(Eng_Planet_Power+0)<=0)
    eng_planet=[];
    eng_planet0=[];
else  
   eng_planet0=5;
   if(Eng_Planet_Power>0)
      eng_planet=1;
   end

   if(Eng_Planet_Power<-0)
      eng_planet=-1;
   end
end


if((Sun_Gen_Power-0)*(Sun_Gen_Power+0)<=0)
       sun_gen=[];
       sun_gen0=[];
else   
       sun_gen0=4;
     if (Sun_Gen_Power>0)
        sun_gen=-1;
     end
     if (Sun_Gen_Power<-0)
        sun_gen=1;
     end
end

% if(Sun_Gen_Power==0)
%        sun_gen=[];
%        sun_gen0=[];
% else   
%        sun_gen0=4;
%      if (Sun_Gen_Power>0)
%         sun_gen=-1;
%      end
%      if (Sun_Gen_Power<0)
%         sun_gen=1;
%      end
% end


if((Mot_Ring_Power-0)*(Mot_Ring_Power+0)<=0)
      mot_ring=[];
      mot_ring0=[];  
else 
     mot_ring0=3;
     if (Mot_Ring_Power>0)
        mot_ring=1;
     end
     if (Mot_Ring_Power<-0)
        mot_ring=-1;
     end
end
 
if((Ring_Diff_Power-0)*(Ring_Diff_Power+0)<=0)
      shaft_tire1=[];
      shaft_tire2=[];
      gear_shaft=[];
      shaft_tire10=[];
      shaft_tire20=[];
      gear_shaft0=[];
else  
      shaft_tire10=8;
      shaft_tire20=7;
      gear_shaft0=6;
     if (Ring_Diff_Power>0)
        shaft_tire1=1;
        shaft_tire2=1;
        gear_shaft=1;
     end
     if (Ring_Diff_Power<-0)
        shaft_tire1=-1;
        shaft_tire2=-1; 
        gear_shaft=-1;
     end
end


if((Bat_Mot_Power-0)*(Bat_Mot_Power+0)<=0)
      bat_mot=[];
      bat_mot0=[];  
else 
     bat_mot0=2;
     if (Bat_Mot_Power>0)
       bat_mot=1;
     end
     if (Bat_Mot_Power<-0)
       bat_mot=-1;
     end
end


if((Gen_Bat_Power-0)*(Gen_Bat_Power+0)<=0)
      gen_bat=[];
      gen_bat0=[];  
else 
     gen_bat0=1;
     if (Gen_Bat_Power>0)
       gen_bat=-1;
     end
     if (Gen_Bat_Power<-0)
       gen_bat=1;
     end
end
%if (Bat_Power>0)
      
      
      
      gen_mot=[];
      gen_mot0=[];
    
 powerFlow.arr{i} =[gen_bat0  bat_mot0  mot_ring0  sun_gen0  eng_planet0  gear_shaft0  shaft_tire10  shaft_tire20  gen_mot0];
 powerFlow.dir{i} = [gen_bat  bat_mot  mot_ring  sun_gen  eng_planet  gear_shaft  shaft_tire1  shaft_tire2  gen_mot];
 
 i=i+1;

              

Contact us