2.1.1 Defining a vehicle
2.1.2 Running a simulation
2.1.3 Looking at outputs
2.2 Converting old component files to the current version of ADVISOR
2.3 Running ADVISOR without the GUI
2.4 Helper Classes and Functions
* * * * *
This section should get you started using ADVISOR both by using the GUI and by entering simple commands at the Matlab command line.
The ADVISOR GUI can be started using one of the two following methods.
Method 1
NOTE: MATLAB runs files from the current working directory first, then the directories in the path from top to bottom. This may cause problems if you have two files named the same thing in different directories. Therefore, make sure you delete the paths for the older versions of ADVISOR.
Method 2 Creating ADVISOR shortcut icon to launch ADVISOR and MATLAB
The first figure is the startup figure. Here you will have the options to select US or metric units, start using ADVISOR, click helpto go to a local ADVISOR web page, exit ADVISOR or read the copyright and disclaimer.
MENU PROFILES: From the startup figure you can also select a menu profile from the pull down menu above the start button. This profile list contains the names of *.mat files that define what will be listed in the component menus in the input figure and what cycles are listed in the simulation setup figure. Editing the profile is simply done by having the profile that you want to edit selected and going through each ADVISOR figure and deleting or adding to the component lists using the pushbuttons next to the components. You may also add, delete or create new profiles by selecting ‘edit list’ from the pull down menu on the startup figure. See also custom menus.
NOTE: Throughout the GUI there are help buttons which will either access the Matlab help window or open a web page with appropriate context information.
Starttakes you to the input figure. The input figure opens and you will see the default values for a specific vehicle.
Drivetrain selection
From the drivetrain popup menu you will be able to select the drivetrain configuration of the vehicle (Series, Parallel, etc.) which will cause the schematic of the vehicle configuration in the left portion of the figure to change accordingly. This will also modify which components are available for the type of drivetrain chosen.
Selecting components
After selecting the drivetrain configuration, all the components of the vehicle can be selected using the popup menus, or by clicking on the component in the picture. To the left of the component popup menus is a pushbutton that will allow you to add or delete components by selecting their corresponding listed m-files. The m-file of a specific component can be accessed for viewing or modifying from either the component pushbutton or by clicking on the component of the picture.
Editing Variables
After selecting all the desired components for the vehicle, scalar input variables can be modified. One way this can be done is with the variable list at the bottom of the figure and the Edit Var. button. First select the variable to change and then click the edit button to change its value. The default value is always shown for your reference. The View All button allows you to see all of the variables you have altered. You can click on the help button to see a brief description and the units used for the input variables.
A second way in which you can edit variables is by typing in a desired value in the edit boxes next to the component. For example, adjusting the maximum power of a fuel converter adjusts the variable fc_trq_scale, or increasing the peak efficiency increases the variable fc_eff_scale accordingly.
A final way to edit the mass of the vehicle is to use the override mass button. The calculated mass is ignored and the value input into the box is used instead.
Loading and Saving vehicle configurations
To load or save a particular vehicle configuration click on the Load Vehicle button on the top of the figure or click on Save at the bottom of the figure. The file will be saved in the format ’filename_in.m’. A saved vehicle can be accessed by pushing the load button.
Viewing component information
At the bottom left portion of the figure there is a popup menu and axes with the ability to view information on components such as their efficiency maps, emissions maps, fuel use maps, etc. These are plotted along with their maximum torque envelopes where appropriate.
Any component m-file can be viewed by clicking the component buttons.
Auto-Size
The auto-size button takes the selected vehicle and adjusts vehicle parameters until it meets acceleration and gradeability goals. The parameters it alters are the fuel converter torque scale (fc_trq_scale), the motor controller torque scale (mc_trq_scale), the number of energy storage system modules, and the vehicle mass. The minimum torque scale is set so that its peak power output is 45 kW. The number of battery modules is limited to yield a maximum nominal voltage of 480 V. The default performance targets are maintaining at least a 6% grade at 55 mph, and obtaining less than a 12 second 0-60 mph time, 23.4 second 0-85 mph time, and 5.3 second 40-60 mph time.
Back and Continue Buttons
The Back button will take you to the opening screen, losing all unsaved information, and the Continue button will take you to the simulation setup figure.
The simulation setup figure gives you several options on how to test the currently defined vehicle.
Drive Cycle selection
If the drive cycle radio button is selected you can use the pull down menu to select from a list of available driving cycles. You can then select how many times you want the cycle repeated as well as if you want SOC correction. Initial conditions can also be set from here. The filtering allows you to smooth out the selected drive cycle.
A cycle can be created by combining many different cycles back to back using this functionality. This new cycle is then saved in the normal cycle format and can be run as such.
Auxiliary Loads
Selecting this button brings up a graphical interface to select different auiliary loads and their on/off times as related to the drive cycle.
SOC Correct
There are two SOC correct options: linear and zero delta. The Linear SOC correction routine runs two simulations—one that gives a positive change in the state of charge and one that gives a negative change in SOC. The corrected value of the variables of interest (e.g. miles per gallon and emissions) are then interpolated from the zero change in SOC from a linear fit to the two data points. The Zero-Delta correction routine adjusts the initial SOC until the simulation run yields a zero change in SOC +/- a 0.5% tolerance band.
Constant Road Grade
By selecting the checkbox you can run the drive cycle using a constant road grade in place of the drive cycle’s elevation profile.
Interactive Simulation
Selecting the Interactive Simulation checkbox causes a real-time interactive simulation interface to activate while the simulation is running.
You can speed up the process of running many different cycles with the same initial conditions using this functionality. Multiple Cycles saves the setup information including initial conditions and then runs each of the cycles selected and saves the results. From the results figure you can access all the different results with the aid of a results list.
Test Procedure
If the test procedure radio button is selected you can use the pull down menu to select what kind of test to run.
Acceleration Test
By selecting this checkbox, an acceleration test will be run in addition to the chose cycle. Acceleration times, maximum accelerations, and distanced traveled in 5 seconds will be displayed in the results figure. This test will be run in addition to the chosen cycle. To see the second by second output of an acceleration test, choose the CYC_ACCEL from the cycle menu.
Gradeability Test
If the gradeability checkbox is selected, a gradeability test will be run in addition to the chosen cycle. The grade displayed in the results figure will be the maximum grade maintainable at the input mph.
Parametric Study
To see the effect that up to three variables have on the vehicle, select a parametric study. The low and high values may be set, as well as the number of points desired for that variable. A parametric study runs a set of simulations to cover the matrix of input points, such that if 3 variables are selected with 3 points each, 27 simulations will run.
Load Sim Setup
A previously saved simulation setup can be reloaded using the Load Sim. Setuppush button. See Save below.
Optimize cs vars
The Optimize cs vars push button opens the control strategy optimization setup window. Checking the radio boxes selects the design variables used to optimize for the chosen objectives and constraints below.
Save
Saves the simulation setup.
Run
To run the simulation click Run and wait for the results figure to popup.
Results Figure
The results figure presents some summary results (fuel economy, emissions, total distance, etc.) and allows the user to plot up to four time series plots by selecting a variable from the popup menu. If the acceleration and gradeability checkboxes were picked in the simulation setup screen, appropriate results will also be displayed.
By clicking the Energy Use Figure button, a new figure is opened showing how energy was used and transferred for the vehicle during the simulation. The Output Check Plots button pulls up plots that show the vehicle’s performance, some of which are not available under the time series plots. The Replay button replays the dynamic interactive interface. Replay is not available for Test Procedures or Multiple Cycles.
Fuel used over the simulation run and the operation points of the fuel converter can be viewed as a function of speed and torque of the fuel converter by clicking on the ‘tools’ menu and selecting ‘FC operation’.
Parametric Results Figure
The parametric results figure plots the summary results as a function of your chosen variable(s). For two and three variable studies, the Rotate button allows you to view the plot from all sides. For three variable studies, you can plot any slice of the results.
Trace Miss Analysis
When a simulated vehicle deviates from the requested drive cycle, the trace_miss_analysis class (found in <ADVISOR directory>/gui/@trace_miss_analysis) is automatically called into play. The trace_miss_analysis class displays statistical information on the severity of cycle trace-miss in the “Warnings/Messages” window of the Results screen.
Information includes:
The trace_miss_analysis class is accessible for normal use (ADVISOR start-up not required). For details type: help trace_miss_analysis on the command line.
Updating files from older versions of ADVISOR can now(4/9/99) be done using the user interface. First, make sure the file you want to update is on the matlab path or in the current working directory. We suggest you place it in the ADVISOR main directory. Second, run ADVISOR and go to the Vehicle Input figure by pressing start. From there click on the button of the component that you would like to convert. There is a convert button that will ask you for the file name. Enter the file name and ok and it will update your file(same name). If your file is not up to date and you try to add it to a component list, ADVISOR will prompt you to convert it. Details and notes on file auto-update can be found here.
The purpose of the ADVISOR GUI is to help guide and assist the user to use the fundamental data and models that compose ADVISOR. However, at times it is desirable to automate some of the processes in ADVISOR, especially when linking to external tools such as optimization packages. Functionality to run ADVISOR without the GUI has been provided to the user in an m-function called adv_no_gui. This is a function to be called from the Matlab Command window. It accepts 2 arguments and returns 2 arguments. To use ADVISOR without the gui you must select the save path option when you initially start ADVISOR so that Matlab will always be able to find the ADVISOR files. The function takes the following form,
[error_code,resp]=adv_no_gui(action,input)
Action is a string that defines the specific action you want ADVISOR to take. The list of available actions includes the following,
Action |
Description |
initialize |
Used to prepare the workspace to run simulations. This action must be initiated prior to executing any other action. |
modify |
Used to change the value of specific parameters. This is like the Edit Var button functionality. At this time only scalar values can be modified. |
grade_test |
Used to run a grade test. |
accel_test |
Used to run an acceleration test. |
drive_cycle |
Used to run a drive cycle. |
test_procedure |
Used to run a test procedure. |
other_info |
Used to probe the workspace for simulation results or current parameter settings |
save_vehicle |
Used to save the current vehicle configuration for future use. |
autosize |
Runs the autosize function (same as on the GUI) |
Input is a structure that contains the input parameters to be passed to ADVISOR while executing the specific actions. Only the data contained in the field associated with the specified action will be used any other data will be ignored. The fields of input may include,
Action |
Field |
Sub-Field |
Usage |
initialize |
init |
saved_veh_file |
This contains a string that specifies a previously saved vehicle. This is the simplest way to get started using the adv_no_gui functionality. input.init.saved_veh_file=’PARALLEL_defaults_in’ |
|
|
comp_files |
Contains two fields comp and name. Each field contains a cell array with the name of the component and the corresponding data file. For example, input.init.comp_files.comp={’fuel_converter’,’energy_storage’,’transmission’}; input.init.comp_files.name={’FC_SI41_emis’,’ESS_PB25’,’TX_5SPD’}; input.init.comp_files.ver={'ic','rint','man'}; input.init.comp_files.type={'si','pb','man'}; This functionality is especially useful for performing discrete studies in which the vehicle configuration is fixed but it is of interest to evaluate the impact of different component technologies. |
|
|
overrides |
Contains three fields name, value, default. Examples include input.init.overrides.name={’mc_trq_scale’,’fc_trq_scale’} input.init.overrides.value={0.75,1.2} input.init.overrides.default={1,1} |
|
|
init_conds_file |
The name of the initial conditions file to load. For example, input.init.init_conds_file=’init_conds_hot’ %hot start initial conditions. |
modify |
modify |
param |
This is a cell array containing the names of parameters to be modified. input.modify.param={’mc_trq_scale’,’fc_trq_scale’} |
|
|
value |
This is a cell array containing the new values of parameters specified in the field name. input.modify.value={0.75,1.2} |
grade_test |
grade |
param |
This is a cell array containing the names of grade test parameters to be passed to the grade test function. input.grade.param={’speed’,’duration’} For a list of available parameters see help on the grade test. |
|
|
value |
This is a cell array containing the values associated with the grade test parameters specified in the field name. input.grade.value={45,300} |
accel_test |
accel |
param |
This is a cell array containing the names of acceleration test parameters to be passed to the acceleration test function. input.accel.param={’ess_init_soc’,’spds’} For a list of available parameters see help on the accel test. |
|
|
value |
This is a cell array containing the values associated with the acceleration test parameters specified in the field name. input.accel.value={0.75,[0 30; 0 60]} |
drive_cycle |
cycle |
param |
This is a cell array containing the names of drive cycle simulation parameters to be passed to the workspace. input.cycle.param={’cycle.name’,’cycle.soc’,’cycle.socmenu’,’cycle.SOCiter’} Available parameters include, cycle.name - name of the drive cycle (e.g. ‘CYC_HWFET’,’CYC_US06’,…) cycle.soc - run soc correction? (’on’ or ‘off’) cycle.socmenu - type of soc correction (’linear’ or ‘zero delta’) cycle.soc_tol_method - constraint on energy balance (’soctol’ or ‘ess2fuel’) cycle.SOCiter - max iterations during zero delta soc correction cycle.SOCtol - tolerace during zero delta soc corrections cycle.number - number of repeat cycles to run |
|
|
value |
This is a cell array containing the values associated with the drive cycle parameters specified in the field name. input.cycle.value={’CYC_UDDS’,’on’,’zerodelta’,15} |
|
|
aux_load_file_name |
The name of a *.mat file for use with variable auxiliary loads. Example files are located in [ADVISOR directory]/data/accessory |
test_procedure |
procedure |
param |
This is a cell array containing the names of test procedure simulation parameters to be passed to the workspace. input.procedure.param={’test.name’} Currently, name is the only available input parameter. |
|
|
value |
This is a cell array containing the values associated with the test procedure parameters specified in the field name. input.procedure.value={’TEST_CITY_HWY’} Currently the list of options include, TEST_CITY_HWY TEST_CITY_HWY_HYBRID TEST_FTP TEST_FTP_HYBRID |
|
|
aux_load_file_name |
The name of a *.mat file for use with variable auxiliary loads. Example files are located in [ADVISOR directory]/data/accessory |
other_info |
resp |
param |
This is a cell array containing the names of parameters of which the values should be passed back to the calling function. input.resp.param={’mpg’;’gear_ratio’;’fc_brake_trq’} These could include any variable defined in the Matlab workspace, input or output. |
save_vehicle |
save |
filename |
Contains a string identifying the filename in which to save the current vehicle parameter settings. |
autosize |
autosize |
autosize |
INPUT.autosize.autosize is the same as vinf.autosize when autosize is run in the GUI. |
|
|
grade_test |
INPUT.autosize.grade_test is the same as vinf.grade_test when autosize is run in the GUI. |
|
|
accel_test |
INPUT.autosize.accel_test is the same as vinf.accel_test when autosize is run in the GUI. |
After execution, the function will return to arguments. The first, error_code will be a boolean value identifying whether the action was completed successfully (error_code=0) or of there was an error during execution (error_code=1). The second, is a structure that contains the default results of the specified action.
Action |
Field |
Sub-Field |
Usage |
initialize |
– |
– |
not used |
modify |
– |
– |
not used |
grade_test |
grade |
grade |
Max grade sustained during the grade test. |
|
|
gear |
Gear ratio in which the grade test was performed. |
accel_test |
accel |
times |
Matrix of acceleration times associated with specified speed ranges. |
|
|
dist_in_time |
Distance traveled during specified time. |
|
|
time |
Time to travel specified distance. |
|
|
max_rate |
Max acceleration rate. |
|
|
max_speed |
Max speed. |
drive_cycle |
cycle |
mpgge |
Gasoline equivalent fuel economy |
|
|
hc_gpm |
g/mi of HC emissions |
|
|
co_gpm |
g/mi of CO emissions |
|
|
nox_gpm |
g/mi of NOx emissions |
|
|
pm_gpm |
g/mi of particulate emissions |
|
|
delta_trace |
Maximum difference between the requested and achieved vehicle speed during the cycle. |
|
|
delta_soc |
Difference between the initial and final SOC during the drive cycle. |
test_procedure |
procedure |
mpgge |
gasoline equivalent fuel economy |
|
|
hc_gpm |
g/mi of HC emissions |
|
|
co_gpm |
g/mi of CO emissions |
|
|
nox_gpm |
g/mi of NOx emissions |
|
|
pm_gpm |
g/mi of particulate emissions |
|
|
delta_trace |
Maximum difference between the requested and achieved vehicle speed during the cycle. |
|
|
delta_soc |
Difference between the initial and final SOC during the drive cycle. |
other_info |
other |
value |
This is a cell array containing the values of parameters specified in the param field. |
save_vehicle |
– |
– |
Not used. |
autosize |
– |
– |
Not used. |
Example 1: Evaluation of a single design point
input.init.saved_veh_file='Parallel_defaults_in';[a,b]=adv_no_gui('initialize',input)
This will load the default parallel hybrid configuration and initialize the workspace.
input.grade.param={'speed'};input.grade.value={55};[a,b]=adv_no_gui('grade_test',input)
This will run the grade test using all defaults other than the specified speed of 55 mph. b.grade.grade will contain the maximum grade achieved.
input.modify.param={'veh_mass'};input.modify.value={1500};[a,b]=adv_no_gui('modify',input)
input.grade.param={'speed'};input.grade.value={55};[a,b]=adv_no_gui('grade_test',input)
You should see a decrease in the grade performance.
Example 2: Mapping of a design space
To map out the design space of a certain configuration (i.e. similar to a parametric study), do the following;
input.init.saved_veh_file='Parallel_defaults_in';[a,b]=adv_no_gui('initialize',input)
% to load the default parallel hybrid configuration and initialize the workspace.
trq_range=[0.25:0.25:1.25];
for I=1:length(trq_range)
input.modify.param={'fc_trq_scale'};input.modify.value={trq_range(I)};[a,b]=adv_no_gui('modify',input)
% to modify the engine torque scale (i.e. change the peak power output of the engine)
input.procedure.param={'test.name'};input.procedure.value={'TEST_CITY_HWY'};[a,b]=adv_no_gui('test_procedure',input)
fuel(I)=b.procedure.mpgge
% to run the city hwy test procedure and obtain the default fuel and emissions performance
input.accel.param={'spds'};input.accel.value={[0 30; 50 70]};[a,b]=adv_no_gui('accel_test',input)
accel1(I)=b.accel.times(1);
accel2(I)=b.accel.times(2);
% to run the acceleration test and obtain the 0 to 30 mph and 50 to 70 mph accel times
input.resp.param={'veh_mass';'fc_trq_scale'};[a,b]=adv_no_gui('other_info',input)
mass(I)=b.other.value{1};
scale(I)=b.other.value{2};
% to obtain the resulting vehicle mass
end
figure; plot(scale,accel1,'b-',scale,accel2,'r-') % to plot accel times vs. power
xlabel('Torque Scale Factor')
ylabel('Acceleration Time (s)')
legend('0-30','50-70')
figure; plot(scale,mass) % to plot mass vs power
xlabel('Torque Scale Factor')
ylabel('Vehicle Mass (kg)')
figure; plot(scale,fuel) % to plot fuel economy vs power
xlabel('Torque Scale Factor')
ylabel('Fuel Economy (mpg)')
Example 3: Running Autosize
First, run the autosize feature from the GUI. Setup a test case the way you want adv_no_gui to run autosize. Run this case. When finished, switch to the MATLAB command window and type the following:
autosize.grade_test=vinf.grade_test;autosize.accel_test=vinf.accel_test;autosize.autosize=vinf.autosize;save fname autosize;
After this is complete, you will have made and saved a structure ready for use with adv_no_gui. Consult autosize.m and adv_no_gui.m for details on how the sub-fields *.autosize.autosize, *.autosize.grade_test, and *.autosize.accel_test are used. Next, clear the matlab workspace and start working with adv_no_gui:
clear all;input=load('fname'); % creates input.autosize.autosize, *.*.grade_test, & *.*.accel_test[a,b]=adv_no_gui('autosize',input);
The model will be automatically autosized. Results are accessible from the base workspace or via the [a,b]=adv_no_gui(’other_info’,input) command.
An executable file has been include with ADVISOR to allow users to perform automated analysis external to ADVISOR and MATLAB. The executable file is named advisor_script.exe and can be found in the C:\ADVISOR\gui directory. The ADVISOR_script executable (advisor_script.exe) can be used in conjunction with adv_no_gui to automate the process of running analyses from the windows command line.
Format:
advisor_script.exe WorkingDirectory ScriptFilename ADVISORRootDirectory SupportDirectory
This command can be executed from a command window and will perform the following functions:
1) Open the MATLAB Engine
2) Update the MATLAB path to include directories necessary for ADVISOR to execute
3) Add the SupportDirectory to the top of the path
4) Update the current working directory to be WorkingDirectory
5) Run ScriptFilename at the MATLAB command prompt
6) Close the MATLAB engine when calculations are complete
ADVISOR_script does not return any results or output so the ScriptFilename must handle input and output data management with ADVISOR. The scriptfile will typically include a series of adv_no_gui calls that build the ADVISOR workspace, run the cycles or tests, and saves the results for review later. A sample script file has been included (see SampleScriptFile.m) to serve as a template for creating your own routines.
CAUTION: At this time directory names with spaces are not supported!!!
The source code for advisor_script.exe is included in advisor_script.c.
### 2.4 Helper Classess and Functions
Back to Chapter 1
Forward to Chapter 3
ADVISOR Documentation Contents
Last Revised: [04-Aug-2003]: mpo