Skip to content

Commit

Permalink
Update everything impacted by the removal of WLTP simulation case. Ma…
Browse files Browse the repository at this point in the history
…ke all tests pass.
  • Loading branch information
isaacito12 committed Aug 1, 2024
1 parent 004850e commit a69bbe1
Show file tree
Hide file tree
Showing 304 changed files with 4,580 additions and 4,024 deletions.
228 changes: 112 additions & 116 deletions BEV/Test/BEV_UnitTest_MQC.m
Original file line number Diff line number Diff line change
@@ -1,123 +1,119 @@
classdef BEV_UnitTest_MQC < BEVTestCase
%% Class implementation of unit test
%
% These are tests to achieve the Minimum Quality Criteria (MQC).
% MQC is achieved when all runnables (models, scripts, functions) run
% without any errors.
%
% You can run this test by opening in MATLAB Editor and clicking
% Run Tests button or Run Current Test button.
% You can also run this test using test runner (the *_runtests.m script)
% which can not only run tests but also generates test summary and
% a code coverage report.

% Copyright 2022-2023 The MathWorks, Inc.
%% Class implementation of unit test
%
% These are tests to achieve the Minimum Quality Criteria (MQC).
% MQC is achieved when all runnables (models, scripts, functions) run
% without any errors.
%
% You can run this test by opening in MATLAB Editor and clicking
% Run Tests button or Run Current Test button.
% You can also run this test using test runner (the *_runtests.m script)
% which can not only run tests but also generates test summary and
% a code coverage report.

% Copyright 2022-2024 The MathWorks, Inc.

methods (Test)

%% Top folder

function MQC_TopFolder_1(~)
BEV_main_script
end

function MQC_TopFolder_2(~)
mdl = "BEV_system_model";
load_system(mdl)
BEV_setup
end

function MQC_TopFolder_3(~)
mdl = "BEV_system_model";
load_system(mdl)
sim(mdl);
end

%% SimlationCases folder

function MQC_SimulationCases_1_1(~)
BEV_Case_Constant_Basic
end

function MQC_SimulationCases_1_2(~)
BEV_Case_FTP75_Basic
end

function MQC_SimulationCases_1_3(~)
BEV_Case_HighSpeed_Basic
end

function MQC_SimulationCases_1_4(~)
BEV_Case_SimpleDrivePattern_Basic
end

function MQC_SimulationCases_2_1(~)
BEV_Case_Constant_Thermal
end

function MQC_SimulationCases_2_2(~)
BEV_Case_SimpleDrivePattern_Thermal
end

%% Utility > Configuration folder

function MQC_Configuration_1(~)
load_system("BEV_system_model")
BEV_useComponents_Basic
end

function MQC_Configuration_2(~)
load_system("BEV_system_model")
BEV_useComponents_Thermal
end

%% Utility folder

function MQC_Utility_1(~)
BEV_getMotorSpeedFromVehicleSpeed
end

function MQC_Utility_2(~)
mdl = "BEV_system_model";
load_system(mdl)
simOut = sim(mdl);
simData = extractTimetable(simOut.logsout);
% Test target
BEV_plotResultsCompact(SimData = simData);
end

end % methods (Test)

%% Test callback buttons

properties
FilesAndFolders {mustBeText} = ""
end

methods (TestClassSetup)

function buildFilesFoldersList(testCase)
%%
projectFiles = [currentProject().Files.Path]';
% logical index
lix = not(contains(projectFiles, [".git", "resources", "simcache"]));
testCase.FilesAndFolders = projectFiles(lix);
end % function

methods (Test)

%% Top folder

function MQC_TopFolder_1(~)
BEV_main_script
end

function MQC_TopFolder_2(~)
mdl = "BEV_system_model";
load_system(mdl)
BEV_setup
end

function MQC_TopFolder_3(~)
mdl = "BEV_system_model";
load_system(mdl)
sim(mdl);
end

%% SimlationCases folder

function MQC_SimulationCases_1_1(~)
BEV_Case_Constant_Basic
end

function MQC_SimulationCases_1_2(~)
BEV_Case_FTP75_Basic
end

function MQC_SimulationCases_1_3(~)
BEV_Case_HighSpeed_Basic
end

function MQC_SimulationCases_1_4(~)
BEV_Case_SimpleDrivePattern_Basic
end

function MQC_SimulationCases_1_5(~)
BEV_Case_WLTP_Basic
end

function MQC_SimulationCases_2_1(~)
BEV_Case_Constant_Thermal
end

function MQC_SimulationCases_2_2(~)
BEV_Case_SimpleDrivePattern_Thermal
end

%% Utility > Configuration folder

function MQC_Configuration_1(~)
load_system("BEV_system_model")
BEV_useComponents_Basic
end

function MQC_Configuration_2(~)
load_system("BEV_system_model")
BEV_useComponents_Thermal
end

%% Utility folder

function MQC_Utility_1(~)
BEV_getMotorSpeedFromVehicleSpeed
end

function MQC_Utility_2(~)
mdl = "BEV_system_model";
load_system(mdl)
simOut = sim(mdl);
simData = extractTimetable(simOut.logsout);
% Test target
BEV_plotResultsCompact(SimData = simData);
end

end % methods (Test)

%% Test callback buttons

properties
FilesAndFolders {mustBeText} = ""
end

methods (TestClassSetup)

function buildFilesFoldersList(testCase)
%%
projectFiles = [currentProject().Files.Path]';
% logical index
lix = not(contains(projectFiles, [".git", "resources", "simcache"]));
testCase.FilesAndFolders = projectFiles(lix);
end % function
end % methods

end % methods
methods (Test)

methods (Test)
function MQC_CallbackButtons_1(testCase)
mdl = "BEV_system_model";
load_system(mdl)
checkCallbackButton(mdl, testCase.FilesAndFolders)
end

function MQC_CallbackButtons_1(testCase)
mdl = "BEV_system_model";
load_system(mdl)
checkCallbackButton(mdl, testCase.FilesAndFolders)
end

end % methods
end % methods

end % classdef
Binary file modified BEV/results/BEV_SimulationResultPlot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions BEVProjectNavigator.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@
row = NewRow(layout, column);
LiteAppComponent.Label(NewSlot(layout, row, Width=indent), Text="");

target_BEV_Case_WLTP_Basic = "BEV_Case_WLTP_Basic";
[~, error_message] = LiteAppUtility.GetFileFolderPath(target_BEV_Case_WLTP_Basic);
assert(error_message == "", error_message)

link_ui = LiteAppComponent.Hyperlink(NewSlot(layout, row));
link_ui.HyperlinkText = "Simulation case: WLTP";
link_ui.HyperlinkClickedCallback = @() open_target_script(target_BEV_Case_WLTP_Basic);

%%
row = NewRow(layout, column);
LiteAppComponent.Label(NewSlot(layout, row, Width=indent), Text="");

target_BEV_Case_FTP75_Basic = "BEV_Case_FTP75_Basic";
[~, error_message] = LiteAppUtility.GetFileFolderPath(target_BEV_Case_FTP75_Basic);
assert(error_message == "", error_message)
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ function MQC_SimpleDrivePattern_1(~)
CtrlEnv_Case_SimpleDrivePattern
end

function MQC_WLTP_1(~)
CtrlEnv_Case_WLTP
end

end % methods

methods(TestMethodSetup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ function MQC_SimulationCase_4(~)
CtrlEnv_Case_SimpleDrivePattern
end

function MQC_SimulationCase_5(~)
CtrlEnv_Case_WLTP
end

%% Utility > Configuration folder

function MQC_Configuration_1(~)
Expand Down Expand Up @@ -76,11 +72,6 @@ function MQC_Configuration_5(~)
CtrlEnv_loadCase_SimpleDrivePattern
end

function MQC_Configuration_6(~)
load_system("CtrlEnv_harness_model")
CtrlEnv_loadCase_WLTP
end

%% Utility folder

function MQC_Utility_1(~)
Expand Down
2 changes: 0 additions & 2 deletions Components/ControllerAndEnvironment/Test/CtrlEnv_runtests.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@
fullfile(TopFolder, "SimulationCases", "CtrlEnv_Case_FTP75.mlx")
fullfile(TopFolder, "SimulationCases", "CtrlEnv_Case_HighSpeed.mlx")
fullfile(TopFolder, "SimulationCases", "CtrlEnv_Case_SimpleDrivePattern.mlx")
fullfile(TopFolder, "SimulationCases", "CtrlEnv_Case_WLTP.mlx")
...
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase.m")
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase_Constant.m")
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase_FTP75.m")
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase_HighSpeed.m")
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase_SimpleDrivePattern.m")
fullfile(TopFolder, "Utility", "Configuration", "CtrlEnv_loadCase_WLTP.m")
...
fullfile(TopFolder, "Utility", "CtrlEnv_plotResults.m")
], ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function CtrlEnv_loadCase_Constant(nvpairs)
%% Sets up simulation
% Model must be loaded for this function to work.

% Copyright 2023 The MathWorks, Inc.
% Copyright 2023-2024 The MathWorks, Inc.

arguments
nvpairs.ModelName {mustBeTextScalar} = "CtrlEnv_harness_model"
Expand All @@ -12,7 +12,7 @@ function CtrlEnv_loadCase_Constant(nvpairs)

CtrlEnv_loadCase( ...
CaseName = "Constant", ...
CaseNumber = 5, ...
CaseNumber = 4, ...
StopTime = 1000, ...
...
ModelName = nvpairs.ModelName, ...
Expand Down

This file was deleted.

Loading

0 comments on commit a69bbe1

Please sign in to comment.