Skip to content

Commit

Permalink
Update VehicleSpeedReference component: Remove the WLTP drive cycle s…
Browse files Browse the repository at this point in the history
…imulation case. Updtae the test-related files and folders.
  • Loading branch information
isaacito12 committed Aug 1, 2024
1 parent b2cdc59 commit 004850e
Show file tree
Hide file tree
Showing 108 changed files with 3,402 additions and 3,507 deletions.
582 changes: 300 additions & 282 deletions BEV/BEV_system_model.mdl

Large diffs are not rendered by default.

Binary file modified BEV/SimulationCases/BEV_Case_WLTP_Basic.mlx
Binary file not shown.
15 changes: 14 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Change Log

## Version 2.3.0 (July, 2023)
## Version 2.3.3 (wip)

## Version 2.3.2 (August, 2024)

- Make sure buildtool-based tests all pass.
- Update live script to markdown.
- Add the project navigator app. Clean up project shortcuts.

## Version 2.3.1 (June, 2024)

- Use easy-to-find locations to store markdowns generated from live scripts.
- Add a project shortcut to Vehicle1D performance design app.

## Version 2.3.0 (June, 2024)

App

Expand Down
23 changes: 12 additions & 11 deletions Components/VehicleSpeedReference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

This is a vehicle speed reference component for
BEV system level simulation
and provides 5 different speed reference patterns by default:
and provides 4 different speed reference patterns by default:

1. Simple drive pattern (100 s)
2. High speed driving (200 s)
3. FTP-75 drive cycle (2474 s)
4. WLTP Class 3 drive cycle(1800 s)
5. Constant (1000 s)

You can use other drive cycles provided by
Drive Cycle Source block too.
1. Simple drive pattern
2. High speed driving
3. FTP-75 drive cycle
4. Constant

This component is used in the **Controller and Environment** component.

The harness model (`VehSpdRef_harness_model`)
in the `Harness` folder is used to test that
all the cases load and run.
all the cases can be loaded and run.

You can use other drive cycles, such as WLTP, provided by Drive Cycle Source block
if you install the [support package][url-pkg].

_Copyright 2023-2024 The MathWorks, Inc._

_Copyright 2023 The MathWorks, Inc._
[url-pkg]: https://www.mathworks.com/help/autoblks/ug/install-drive-cycle-data.html
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,25 @@
% Before a function in this section runs, the TestSetup function
% defined in the "TestMethodSetup" section runs.

%% Minimum quality check
%% Minimum quality check (MQC)
% Check that models, scripts, functions, and classes run right out of the box.

function MQC_Constant_1(~)
function MQC_SimCase_Constant_1(~)
VehSpdRef_Case_Constant
end

function MQC_FTP75_1(~)
function MQC_SimCase_FTP75_1(~)
VehSpdRef_Case_FTP75
end

function MQC_HighSpeed_1(~)
function MQC_SimCase_HighSpeed_1(~)
VehSpdRef_Case_HighSpeed
end

function MQC_SimpleDrivePattern_1(~)
function MQC_SimCase_SimpleDrivePattern_1(~)
VehSpdRef_Case_SimpleDrivePattern
end

function MQC_WLTP_1(~)
VehSpdRef_Case_WLTP
end

end % methods

methods(TestMethodSetup)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
function VehSpdRef_loadCase(NameValuePair)
%% Sets up simulation
% This function sets up the followings:
% - Simulation stop time
% - Input signals
%
% Model must be loaded for this function to work.

% Copyright 2023-2024 The MathWorks, Inc.

arguments
NameValuePair.CaseName {mustBeTextScalar} = "Default"

NameValuePair.ModelName {mustBeTextScalar} = "VehSpdRef_harness_model"
NameValuePair.TargetSubsystemPath {mustBeTextScalar} = "/Vehicle speed reference"

NameValuePair.CaseNumber (1,1) {mustBeMember(NameValuePair.CaseNumber, 1:5)} = 1
NameValuePair.StopTime (1,1) {mustBePositive} = 100

NameValuePair.DisplayMessage (1,1) logical = true
end

dispMsg = NameValuePair.DisplayMessage;

if dispMsg
disp("Setting up simulation...")
disp("Simulation case: " + NameValuePair.CaseName)
end

mdl = NameValuePair.ModelName;

t_end = NameValuePair.StopTime;

if dispMsg
disp("Setting simulation stop time to " + t_end + " sec.")
end

set_param(mdl, StopTime = num2str(t_end));

caseNumStr = num2str(NameValuePair.CaseNumber);
if dispMsg
disp("Selecting simulation case " + caseNumStr + ".")
end

sysPath = mdl + NameValuePair.TargetSubsystemPath;

set_param( sysPath + "/Simulation Case", ...
Value = caseNumStr)

end % function
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function VehSpdRef_loadCase_Constant(NameValuePair)
%% Sets up simulation
% Model must be loaded for this function to work.

% Copyright 2023-2024 The MathWorks, Inc.

arguments
NameValuePair.ModelName {mustBeTextScalar} = "VehSpdRef_harness_model"
NameValuePair.TargetSubsystemPath {mustBeTextScalar} = "/Vehicle speed reference"
NameValuePair.DisplayMessage (1,1) logical = true
end

VehSpdRef_loadCase( ...
CaseName = "Constant", ...
CaseNumber = 4, ...
StopTime = 1000, ...
...
ModelName = NameValuePair.ModelName, ...
TargetSubsystemPath = NameValuePair.TargetSubsystemPath, ...
DisplayMessage = NameValuePair.DisplayMessage )

end % function
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function VehSpdRef_loadCase_FTP75(NameValuePair)
%% Sets up simulation
% Model must be loaded for this function to work.

% Copyright 2023-2024 The MathWorks, Inc.

arguments
NameValuePair.ModelName {mustBeTextScalar} = "VehSpdRef_harness_model"
NameValuePair.TargetSubsystemPath {mustBeTextScalar} = "/Vehicle speed reference"
NameValuePair.DisplayMessage (1,1) logical = true
end

VehSpdRef_loadCase( ...
CaseName = "FTP-75 using Drive Cycle Source block", ...
CaseNumber = 3, ...
StopTime = 2474, ...
...
ModelName = NameValuePair.ModelName, ...
TargetSubsystemPath = NameValuePair.TargetSubsystemPath, ...
DisplayMessage = NameValuePair.DisplayMessage )

end % function
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function VehSpdRef_loadCase_HighSpeed(NameValuePair)
%% Sets up simulation
% Model must be loaded for this function to work.

% Copyright 2023 The MathWorks, Inc.

arguments
NameValuePair.ModelName {mustBeTextScalar} = "VehSpdRef_harness_model"
NameValuePair.TargetSubsystemPath {mustBeTextScalar} = "/Vehicle speed reference"
NameValuePair.DisplayMessage (1,1) logical = true
end

VehSpdRef_loadCase( ...
CaseName = "High speed driving", ...
CaseNumber = 2, ...
StopTime = 200, ...
...
ModelName = NameValuePair.ModelName, ...
TargetSubsystemPath = NameValuePair.TargetSubsystemPath, ...
DisplayMessage = NameValuePair.DisplayMessage )

end % function
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function VehSpdRef_loadCase_SimpleDrivePattern(NameValuePair)
%% Sets up simulation
% Model must be loaded for this function to work.

% Copyright 2023-2024 The MathWorks, Inc.

arguments
NameValuePair.ModelName {mustBeTextScalar} = "VehSpdRef_harness_model"
NameValuePair.TargetSubsystemPath {mustBeTextScalar} = "/Vehicle speed reference"
NameValuePair.DisplayMessage (1,1) logical = true
end

VehSpdRef_loadCase( ...
CaseName = "Simple drive pattern", ...
CaseNumber = 1, ...
StopTime = 100, ...
...
ModelName = NameValuePair.ModelName, ...
TargetSubsystemPath = NameValuePair.TargetSubsystemPath, ...
DisplayMessage = NameValuePair.DisplayMessage )

end % function
53 changes: 0 additions & 53 deletions Components/VehicleSpeedReference/Test/VehSpdRef_UnitTest_MQC.m

This file was deleted.

71 changes: 0 additions & 71 deletions Components/VehicleSpeedReference/Test/VehSpdRef_runtests.m

This file was deleted.

Loading

0 comments on commit 004850e

Please sign in to comment.