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

run_demo.m
bdclose all;
clear;
clc;

% The following code is for Bug Report 383811. The fix prevents sporadical
% crashing when using Simulink Context menus. You can find more information
% about this bug at the following URL:
% http://www.mathworks.com/support/bugreports/details.html?rp=383811
pathstr=fullfile(matlabroot,'toolbox', 'shared', 'dastudio');
copyfile('R2007b/Models/callbackinfo_get_selection.m',pathstr,'f');

release = version('-release');      % Check MATLAB version

switch release
    case {'2007b'}
        % Add all relevant directories
        addpath(genpath([pwd '\R2007b\GUI_Files']));
        addpath(genpath([pwd '\R2007b\Models']));
        addpath(genpath([pwd '\R2007b\Script']));

        helpdlg({'We have detected that you are running R2007b.';...
                 '';...
                 'We will load the HEV demo for this release.';...
                 '';...
                 'We''ll compensate by adding a modified demo model to your working directory.';...
                 '';...
                 ['You can find the model files in the following directory: ' pwd '\R2007b\Models'];});

    case {'2008a'}
        % Add all relevant directories
        addpath(genpath([pwd '\R2007b\GUI_Files']));
        addpath(genpath([pwd '\R2007b\Models']));
        addpath(genpath([pwd '\R2008a\Models']));
        addpath(genpath([pwd '\R2008a\Script']));

        helpdlg({'We have detected that you are running R2008a.';...
                 '';...
                 'We will load the HEV demo for this release.';...
                 '';...
                 ['You can find the model files in the following directory: ' pwd '\R2008a\Models'];...
                 '';...
                 ['All other models: ' pwd '\R2007b\Models']});        

    case {'2008b'}
        % Add all relevant directories
        addpath(genpath([pwd '\R2007b\GUI_Files']));
        addpath(genpath([pwd '\R2007b\Models']));
        addpath(genpath([pwd '\R2008b\Models']));
        addpath(genpath([pwd '\R2008b\Script']));

        helpdlg({'We have detected that you are running R2008b.';...
                 '';...
                 'We will load the HEV demo for this release.';...
                 '';...
                 ['You can find the model files in the following directory: ' pwd '\R2008b\Models'];...
                 '';...
                 ['All other models: ' pwd '\R2007b\Models']});
        
    otherwise
        errordlg({'The HEV demo only runs on R2007b, R2008a, and R2008b.';...
                  '';...
                  'Please run the demo on one of these releases';});
end

mkdir('work');      % Create a working directory
cd Work;            % Change directory to work

% Open the HTML script
web('HEV_script_short_html.html');

Contact us