Skip to content

Commit

Permalink
Update markdown file locations (#22)
Browse files Browse the repository at this point in the history
* Update locations to store markdowns generated from live scripts.
  • Loading branch information
isaacito12 authored Jun 27, 2024
1 parent cc8a2c1 commit 5e17056
Show file tree
Hide file tree
Showing 1,578 changed files with 7,031 additions and 4,656 deletions.
195 changes: 112 additions & 83 deletions BEV/BEV_system_model.mdl

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions BEV/SimulationCases/BEV_Case_test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
classdef BEV_Case_test < matlab.unittest.TestCase

% This is class-based unit test implementation.
% To navigate test results and see code coverage, use Test Browser (testBrowser).
%
% Documentation
%
% - Run Tests in Editor
% https://www.mathworks.com/help/matlab/matlab_prog/run-tests-in-editor.html
%
% - Test Browser
% https://www.mathworks.com/help/matlab/ref/testbrowser-app.html
%
% - Author Class-Based Unit Tests in MATLAB
% https://www.mathworks.com/help/matlab/matlab_prog/author-class-based-unit-tests-in-matlab.html
%
% - matlab.unittest.TestCase Class
% https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html

% Copyright 2024 The MathWorks, Inc.

methods (Test)
% Functions in this "Test" section are the tests.
% Before a function in this section runs, the TestSetup function
% defined in the "TestMethodSetup" section runs.

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

function MQC_Constant_Basic_1(~)
BEV_Case_Constant_Basic
end

function MQC_Constant_Thermal_1(~)
BEV_Case_Constant_Thermal
end

function MQC_FTP75_Basic_1(~)
BEV_Case_FTP75_Basic
end

function MQC_HighSpeed_Basic_1(~)
BEV_Case_HighSpeed_Basic
end

function MQC_SimpleDrivePattern_Basic_1(~)
BEV_Case_SimpleDrivePattern_Basic
end

function MQC_SimpleDrivePattern_Thermal_1(~)
BEV_Case_SimpleDrivePattern_Thermal
end

function MQC_WLTP_Basic_1(~)
BEV_Case_WLTP_Basic
end

end % methods

methods(TestMethodSetup)
% Functions in this "TestMethodSetup" section always run before
% each test defined in the "Test" section runs.

function TestSetup(testcase)
%%
close all
bdclose all

% addTeardown adds a function which always runs after each test.
% Even if the execution of a test ends with an error, the teardown function runs.
% This is useful, for example, to close figure windows
% after a test which opens figure windows fails.
addTeardown(testcase, @close_all)

function close_all
close all
bdclose all
end % function
end % function

end % methods
end % classdef
39 changes: 0 additions & 39 deletions BEV/SimulationCases/Markdowns/BEV_Case_Constant_Thermal.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified BEV/Utility/Images/BEV_system_model_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions BEV/Utility/LocalTasks/BEV_generateMarkdown.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

% Copyright 2024 The MathWorks, Inc.

generateMarkdown_fromLiveScript( [
generateMarkdown_fromLiveScript( ...
LiveScriptFolderNames = [
fullfile(currentProject().RootFolder, "BEV")
fullfile(currentProject().RootFolder, "BEV", "SimulationCases")
])
], ...
MarkdownFolderPath = ...
fullfile(currentProject().RootFolder, "BEV", "markdown"), ...
ForceExport = true )

end % function
6 changes: 0 additions & 6 deletions BEV/Utility/LocalTasks/BEV_takeScreenshots.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
%% Takes screenshots and saves to file.
% This script takes screenshots of the top layer and some subsystems.

% Taking screenshot with `screenshotSimulink` uses `print` function.
% `print` is not supported in `-nodisplay` option for MATLAB,
% but `-nodisplay` is used in CI.
% Thus, running this in CI causes failure in CI process.


% Copyright 2022-2023 The MathWorks, Inc.

mdl = "BEV_system_model";
Expand Down
75 changes: 75 additions & 0 deletions BEV/markdown/BEVProject_main_script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

# <span style="color:rgb(213,80,0)">Battery Electric Vehicle Model in Simscape</span>

Open the Project by double\-clicking **<samp>BatteryElectricVehicle.prj</samp>** file if you have not opened the project yet. It will load shortcuts to scripts and models in **Project Shortcuts** in Toolstrip.

# Battery Electric Vehicle (BEV) Model for System Level Simulation

This is a simple, fast running BEV model which can estimate the electrical efficiency of the vehicle. It is also suitable for further customizations for more focused analysis of individual components at vehicle system level.


Open the [BEV system model](matlab:openFile('BEV_system_model')). You can also use the shortcut button **BEV system model** in the **Project Shortcuts** toolstrip.


Files related to the BEV system model can be found at **BEV** folder.


<img src="media/BEVProject_main_script_media/image_0.png" width="805" alt="image_0.png">

# Vehicle Components
## Longitudinal Vehicle

Longitudinal abstract vehicle model can be used to find required powertrain performance (such as motor torque and power etc.) given basic vehicle performance specifications.


Open the [Vehicle 1D harness model](matlab:openFile('Vehicle1D_harness_model')). You can also use the shorcut button **Vehicle1D** in the **Project Shortcuts** toolstrip to open harness model. You can simulate and analyse basic vehicle performance with the Vehicle1D harness model.


See **README.md** in the **Components > Vehicle1D** folder for more informaton.


<img src="media/BEVProject_main_script_media/image_1.png" width="404" alt="image_1.png">

## High Voltage Battery Pack

Four different abstract models are available as a high voltage battery pack component.

- **Basic** model simulates voltage and current.
- **Simple system** model simulates voltage, current, and temperature using equation\-based model.
- **System** model simulates voltage, current, temperature as well as charing dynamics, fading, and aging using equation\-based model.
- **Table\-based system** model simulates the same quantities as System model, but uses table data for terminal voltage and resistance.

Open the [Battery HV harness model](matlab:openFile('BatteryHV_harness_model')). You can also use the shortcut button **High Voltage Battery** in the **Project Shortcuts** toolstrip to open harness model.


See **README.md** in the **Components > BatteryHighVoltage** folder for more informaton.

## Motor Drive Unit

Four different abstract models are available as a motor drive unit component.

- **Basic** model simulates the high level behavior of power conversion between electrical and mechanical powers using abstract copper loss model.
- **Basic thermal** model is similar to Basic model, but this model considers temperature dynamics too.
- **System\-level** model is similar to the above models, but this model considers irons loss and constant/fixed loss too.
- **System\-level model with tabulated losses** is similar to the above models, but this model uses tabulated data for power conversion efficiency or losses.

Click the shortcut button **Motor Drive Unit** in the **Project Shortcuts** toolstrip to open harness model.


See **README.md** in the **Components > MotorDriveUnit** folder for more informaton including **single efficiency measurement model** used in Basic, Basic thermal, and System\-level models for electro\-mechanical power conversion.

## Other components

In addition to the above components, other components such as **Vehicle Speed Reference** component are stored in the **Components** folder too.

# Detailed Model Application

This project includes detailed model applications for permanent magnet synchronous motor (PMSM). See the **DetailedModelApplications > MotorDrivePmsmFem** folder for more information.

# About this project

For additional information about this project, see **About BEV Project** live script in the **Utility** folder.


*Copyright 2020\-2023 The MathWorks, Inc.*

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

# <span style="color:rgb(213,80,0)">BEV System Model - Simulation Case</span>
# <span style="color:rgb(213,80,0)">BEV System Model \- Simulation Case</span>
```matlab
modelName = "BEV_system_model";
load_system(modelName)
BEV_useComponents_Basic
```

```TextOutput
```matlabTextOutput
Use Basic models for all components.
```

Expand All @@ -18,7 +18,7 @@ VehSpdRef_loadCase_Constant( ...
"/Vehicle speed reference" )
```

```TextOutput
```matlabTextOutput
Setting up simulation...
Simulation case: Constant
Setting simulation stop time to 1000 sec.
Expand All @@ -31,7 +31,7 @@ simData = extractTimetable(simOut.logsout);
fig = BEV_plotResultsCompact( SimData = simData, PlotTemperature = false );
```

<center><img src="Media/BEV_Case_Constant_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>
<center><img src="media/BEV_Case_Constant_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>


*Copyright 2023 The MathWorks, Inc.*
Expand Down
40 changes: 40 additions & 0 deletions BEV/markdown/BEV_Case_Constant_Thermal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# <span style="color:rgb(213,80,0)">BEV System Model \- Simulation Case</span>
```matlab
modelName = "BEV_system_model";
load_system(modelName)
% Use thermal-model-enabled components.
BEV_useComponents_Thermal
```

```matlabTextOutput
Use thermal models for Motor Drive Unit and High Voltage Battery components.
Warning: BatteryHV_refsub_SystemSimple (systems/system_root.xml, line 342): Simulink.DataType object 'Bus_HighVoltage' is not in scope from 'BatteryHV_refsub_SystemSimple/Simscape Bus'
```

```matlab
VehSpdRef_loadCase_Constant( ...
ModelName = modelName, ...
TargetSubsystemPath = ...
"/Controller & Environment" + ...
"/Vehicle speed reference" )
```

```matlabTextOutput
Setting up simulation...
Simulation case: Constant
Setting simulation stop time to 1000 sec.
Selecting simulation case 5.
```

```matlab
simOut = sim(modelName);
simData = extractTimetable(simOut.logsout);
fig = BEV_plotResultsCompact( SimData = simData );
```

<center><img src="media/BEV_Case_Constant_Thermal_media/figure_0.png" width="702" alt="figure_0.png"></center>


*Copyright 2023 The MathWorks, Inc.*

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

# <span style="color:rgb(213,80,0)">BEV System Model - Simulation Case</span>
# <span style="color:rgb(213,80,0)">BEV System Model \- Simulation Case</span>
```matlab
modelName = "BEV_system_model";
load_system(modelName)
BEV_useComponents_Basic
```

```TextOutput
```matlabTextOutput
Use Basic models for all components.
```

Expand All @@ -18,7 +18,7 @@ VehSpdRef_loadCase_FTP75( ...
"/Vehicle speed reference" )
```

```TextOutput
```matlabTextOutput
Setting up simulation...
Simulation case: FTP-75 using Drive Cycle Source block
Setting simulation stop time to 2474 sec.
Expand All @@ -31,7 +31,7 @@ simData = extractTimetable(simOut.logsout);
fig = BEV_plotResultsCompact( SimData = simData, PlotTemperature = false );
```

<center><img src="Media/BEV_Case_FTP75_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>
<center><img src="media/BEV_Case_FTP75_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>


*Copyright 2023 The MathWorks, Inc.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

# <span style="color:rgb(213,80,0)">BEV System Model - Simulation Case</span>
# <span style="color:rgb(213,80,0)">BEV System Model \- Simulation Case</span>
```matlab
modelName = "BEV_system_model";
load_system(modelName)
BEV_useComponents_Basic
```

```TextOutput
```matlabTextOutput
Use Basic models for all components.
```

Expand All @@ -18,7 +18,7 @@ VehSpdRef_loadCase_HighSpeed( ...
"/Vehicle speed reference" )
```

```TextOutput
```matlabTextOutput
Setting up simulation...
Simulation case: High speed driving
Setting simulation stop time to 200 sec.
Expand All @@ -31,7 +31,7 @@ simData = extractTimetable(simOut.logsout);
fig = BEV_plotResultsCompact( SimData = simData, PlotTemperature = false );
```

<center><img src="Media/BEV_Case_HighSpeed_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>
<center><img src="media/BEV_Case_HighSpeed_Basic_media/figure_0.png" width="702" alt="figure_0.png"></center>


*Copyright 2023 The MathWorks, Inc.*
Expand Down
Loading

0 comments on commit 5e17056

Please sign in to comment.