This section will provide a more in-depth explanation of how the GUI interacts with the function files. As previously mentioned, the GUI needs to accept inputs from the user as well as display results. In order to do so, the inputs must be of the correct data type and within an acceptable range before being passed to the function files.
The sensitivities design tool function file requires seven main inputs:
1. SDT_params: Minimum, maximum, and nominal values for each of the seven parameters to be tested. This means it must be a 7x3 array.
2. SDT_checked: A 7x1 array of Boolean values, each corresponding to one parameter. The Boolean is cleared if a parameter is to not be tested (e.g. if Wheel Radius is to be excluded from the study,
- 52 -
then SDT_checked (2) = 0). NOTE: If any of the values are 0, the corresponding minimum and maximum values in the SDT_params array must be 0.
3. SDT_Engine_Performance: Engine data from a dyno test that includes engine speed, torque, and fuel consumption rates. In the case that an electric motor is being studies, these parameters are replaced with motor speed, torque, and power consumed.
4. SDT_mech_pwr_type: Indicator of engine type used (0 if combustion engine, 1 if electric motor) 5. SDT_cutoffs: A 3x1 array consisting of the minimum cutoff value (e.g. burn time of 80 seconds),
the maximum cutoff value (e.g. burn time of 150 seconds), and the cutoff type indicated by a 0 for Percent of Maximum Engine Speed and 1 for Burn Time.
6. SDT_step_size: A 3x1 array consisting of the number of parameter elements to test (e.g. 20 different vehicle weights are studied), the number of cutoff elements to test (e.g. 3 different burn times are studied), and the time step that Simulink should use (default is 0.05 seconds).
7. Prog_obj: A progress bar dialogue object that the function file updates while running the study, and listens for a Cancel Request, which returns the program from the function file to the invoking script. Each of these inputs have default values upon creating a new instance of the app. As the user inputs more data, the GUI program updates the corresponding values in the correct locations. Once the user pushes the “Calculate MPG” button, a function called SDT_ready( ) is executed to check that all the inputs are valid. The logic is shown in Figure 45 below.
Figure 45. A process flow diagram explaining the logic behind the SDT_ready( ) function.
Once the program confirms the inputs are valid, it passes them to the correct function (single or full depending on which one the user chose). During each loop within the function, the program checks for a Cancel Request, which is generated when the user presses ‘Cancel’ on the progress bar window. If pressed, the study is terminated, and no results are displayed. However, if the study finishes successfully, it passes four output values to the GUI:
- 53 -
1. SDT_cut_array: An array consisting of the cutoff values that were studied (e.g. burn times of 50, 75, and 100 seconds).
2. SDT_vehi_params: An array of all the vehicle parameters that were studied.
3. SDT_MPG: A 3-dimensional array of the resulting MPG values that were calculated in the study. Each 2-D array consists of all the MPG values that were calculated at one specific cutoff value (e.g. SDT_MPG (: , : , 1) are MPG values calculated with a burn time of 50 seconds).
4. SDT_flag: An array of indication values (1, 2, or 3) that specify if the required speed of 15.3 mph was possible using the corresponding combination of values, or if the minimum velocity is greater than or equal to 0. (NOTE: the information in this array is not used in the GUI but can be useful for debugging purposes.)
Figure 46. Diagram of the actions that follow the "Calculate MPG" Button being pressed. The Velocity Profile tool function requires six inputs, which are passed from the GUI as:
- 54 -
1. VPT_params: A 7x1 array containing nominal vehicle parameters to study.
2. VPT_cutoffs: A 2x1 array consisting of the cutoff value (e,g, 50 seconds) and the cutoff type (e.g. type = 1, which corresponds to burn time).
3. VPT_Engine_Performance: A table of engine dyno data that is loaded when the user selects a spreadsheet file to load from.
4. VPT_mech_pwr_type: The engine type (0 = combustion engine, 1 = electric motor). 5. VPT_tstep: The time step in seconds used in Simulink.
6. VPT_prog_obj: The progress bar object that is updated
Once a successful study is run, the function returns these arrays to the GUI as:
1. VPT_w: Velocity, position, time, and fuel consumption values from the single burn and coast cycle. 2. VPT_w_B: Velocity, position, time, and fuel consumption values from the full race simulation. 3. VPT_want: Contains multiple important values such as MPG, flag, and distance traveled. 4. VPT_torque: engine torque/power over a single burn and coast cycle.
5. VPT_forces: resistive forces (road loads) over a single burn and coast cycle.
The information in these arrays are sorted by the GUI and used to create four plots explaining the velocity, fuel consumption, and road loads.
A summary of the information exchanged between the GUI and the function files are shown in the figure below.
Figure 47. Information Exchange from between GUI, Design Sensitivities Tool, and Velocity Tool. For details on how the GUI was assembled, see Section 6.4.