Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ba1abdc
Update the prototype branch.
isaacito12 Feb 13, 2026
1602a9d
Add .gitlab-ci.yml file.
isaacito12 Feb 13, 2026
89f8caf
Make the repo status clean.
isaacito12 Jun 23, 2026
3d0bd9c
Update buildfile.m in the project top folder. Then run all tests and …
isaacito12 Jun 23, 2026
a60bb26
Clean up repo status.
isaacito12 Jul 9, 2026
f3e6075
Clean up repo status.
isaacito12 Jul 9, 2026
bf6faf1
Sync repo and project.
isaacito12 Jul 9, 2026
e5808a3
Add the bev1mus.
isaacito12 Jul 9, 2026
78edb7b
Update repo status
isaacito12 Jul 14, 2026
d1b5ad2
Update Vehicle1D.
isaacito12 Jul 14, 2026
e983a2d
Clean up the repo status.
isaacito12 Jul 15, 2026
4e57178
Introduce the bevutil1.
isaacito12 Jul 15, 2026
b4a48c5
Update BatteryHighVoltage, Reducer, Vehicle1D etc. in the Components.
isaacito12 Jul 20, 2026
89df3c9
Update the Elevation Profile component.
isaacito12 Jul 31, 2026
608c792
Recover files from wrong edits by the tool.
isaacito12 Jul 31, 2026
d9f6d4c
Update the Elevation Profile component. Make all tests pass.
isaacito12 Aug 5, 2026
0fce6c1
Update BEVController and ControllerAndEnvironment components. Make al…
isaacito12 Aug 6, 2026
8bc98e9
Update all components and the BEV system. Remove Markdowns from minor…
isaacito12 Aug 7, 2026
a469945
Update the MUS to use the latest one. Update the Motor Drive Unit com…
isaacito12 Aug 14, 2026
4efe3a4
Wrap up updating the whole project. Make all tests pass.
isaacito12 Aug 17, 2026
0c62390
Update README and ChangeLog files.
isaacito12 Aug 17, 2026
bf9162f
Update GitHub Actions config files for 26a.
isaacito12 Aug 17, 2026
7f46cff
Update README file.
isaacito12 Aug 17, 2026
cd19f63
Clean up the project status.
isaacito12 Aug 17, 2026
bfd2c67
Update tests that fail in CI. Run them only in the local environment.
isaacito12 Aug 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ name: CI using MATLAB on Linux

on:
push:
branches: [ R2025b, R2025b-devel ]
branches: [ R2026a, R2026a-devel ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand All @@ -25,7 +25,7 @@ on:
- '**.xml'

pull_request:
branches: [ R2025b, R2025b-devel ]
branches: [ R2026a, R2026a-devel ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand All @@ -48,8 +48,8 @@ jobs:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow
strategy:
matrix:
matlab_version: [R2025b]
#matlab_version: [R2025b, R2026a]
matlab_version: [R2026a]
#matlab_version: [R2026a, R2026b]

name: Test in ${{ matrix.matlab_version }} on Linux

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ name: CI using MATLAB on Windows

on:
push:
branches: [ R2025b, R2025b-devel ]
branches: [ R2026a, R2026a-devel ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand All @@ -25,7 +25,7 @@ on:
- '**.xml'

pull_request:
branches: [ R2025b, R2025b-devel ]
branches: [ R2026a, R2026a-devel ]
paths-ignore:
- 'docs/**'
- '**.md'
Expand All @@ -44,8 +44,8 @@ jobs:

strategy:
matrix:
matlab_version: [R2025b]
#matlab_version: [R2025b, R2026a]
matlab_version: [R2026a]
#matlab_version: [R2026a, R2026b]

name: Test in ${{ matrix.matlab_version }} on Windows

Expand Down
20 changes: 20 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GitLab CI configuration file

# Copyright 2026 The MathWorks, Inc.

variables:
LOCATION: "AH"

26a-test:
stage: test
tags:
- long-jobs
script:
- mw -using BR2026ad matlab -nodesktop -batch "openProject(pwd); buildtool -buildFile buildfile.m -verbosity Verbose Test"

25b-test:
stage: test
tags:
- long-jobs
script:
- mw -using BR2025bd matlab -nodesktop -batch "openProject(pwd); buildtool -buildFile buildfile.m -verbosity Verbose Test"
53 changes: 24 additions & 29 deletions BEV/BEV_main_script.html

Large diffs are not rendered by default.

82 changes: 61 additions & 21 deletions BEV/BEV_main_script.m

Large diffs are not rendered by default.

279 changes: 142 additions & 137 deletions BEV/BEV_setup.m
Original file line number Diff line number Diff line change
@@ -1,137 +1,142 @@
%% Model Parameters for the Battery Electric Vehicle (BEV) system model.
%
% This script defines parameters for the BEV model.
% Use this script to load default values.
% Override any of them elsewhere later as needed.
%
% The BEV_system_model automatically runs this script in the PostLoadFcn callback.

% Copyright 2020-2025 The MathWorks, Inc.

%% Bus definitions

defineBus_HighVoltage
defineBus_Rotational

%% Vehicle block parameters

vehicle.mass_kg = 2400;
vehicle.tireRollingRadius_m = 0.34;

vehicle.tireRollingCoeff = 0.0136;
vehicle.airDragCoeff = 0.31;
vehicle.frontalArea_m2 = 0.9 * 1.921 * 1.624;
vehicle.gravAccel_m_per_s2 = 9.81;

smoothing.vehicle_speedThreshold_kph = 1;
smoothing.vehicle_axleSpeedThreshold_rpm = 1;

%% Battery parameters

batteryHV.nominalVoltage_V = 340;

batteryHV.nominalCapacity_kWh = 60;

batteryHV.nominalCharge_Ahr = ...
BatteryHV_getAmpereHourRating( ...
Voltage_V = batteryHV.nominalVoltage_V, ...
Capacity_kWh = batteryHV.nominalCapacity_kWh, ...
StateOfCharge_pct = 100 );

batteryHV.internalResistance_Ohm = 0.01;

batteryHV.ThermalMass_J_per_K = 10e3;

% Voltage is 90 % of the nominal when SOC is 50 %.
batteryHV.measuredVoltage_V = batteryHV.nominalVoltage_V * 0.9;
batteryHV.measuredCharge_Ahr = batteryHV.nominalCharge_Ahr * 0.5;

% More thermal model parameters
% These parameters are used when thermal model is enabled
% in the Battery block from Simscape Electrical.
batteryHV.measurementTemperature_K = 273.15 + 25;
batteryHV.secondMeasurementTemperature_K = 273.15 + 0;
batteryHV.secondNominalVoltage_V = batteryHV.nominalVoltage_V * 0.95;
batteryHV.secondInternalResistance_Ohm = batteryHV.internalResistance_Ohm * 2;
batteryHV.secondMeasuredVoltage_V = batteryHV.nominalVoltage_V * 0.9;

% Ambient parameters for battery thermal simulation

batteryHV.ambientTemp_K = 273.15 + 20;

batteryHV.ambientMass_t = 10000;
batteryHV.ambientSpecificHeat_J_per_Kkg = 1000;

batteryHV.RadiationArea_m2 = 1;
batteryHV.RadiationCoeff_W_per_K4m2 = 5e-10;

%% Motor drive unit parameters

motorDriveUnit.trqMax_Nm = 420;
motorDriveUnit.powerMax_kW = 220;
motorDriveUnit.responseTime_s = 0.02;

motorDriveUnit.rotorInertia_kg_m2 = 5*0.01^2;
motorDriveUnit.rotorDamping_Nm_per_radps = 1e-5;

% Single efficiency measurement
motorDriveUnit.efficiency_pct = 95;
motorDriveUnit.spd_eff_rpm = 2000;
motorDriveUnit.trq_eff_Nm = 50;
motorDriveUnit.ironLoss_W = 55;
motorDriveUnit.fixedLoss_W = 40;

motorDriveUnit.rotorInertia_kg_m2 = 5*0.01^2;
motorDriveUnit.rotorDamping_Nm_per_radps = 1e-5;

motorDriveUnit.ThermalMass_J_per_K = 90e3;

% Ambient parameters for the thermal simulation of motor drive unit.

motorDriveUnit.ambientTemp_K = 273.15 + 20;

motorDriveUnit.ambientMass_t = 10000;
motorDriveUnit.ambientSpecificHeat_J_per_Kkg = 1000;

motorDriveUnit.RadiationArea_m2 = 1;
motorDriveUnit.RadiationCoeff_W_per_K4m2 = 5e-10;

%% Reducer parameters

reducer.GearRatio = 9.1;

reducer.Efficiency_normalized = 0.98;

smoothing.Reducer_PowerThreshold_W = 1;

%% BEV controller parameters

% Parameters for converting vehicle speed to motor speed
bevControl.MotorSpdRef_tireRollingRadius_m = vehicle.tireRollingRadius_m;
bevControl.MotorSpdRef_reductionGearRaio = 9.1;

% PI controller gains for motor torque control
bevControl.MotorSpdRef_Ki = 15;
bevControl.MotorSpdRef_Kp = 15;

% Bounds for torque command
bevControl.MotorDriveUnit_trqMax_Nm = motorDriveUnit.trqMax_Nm;

%% Initial conditions

initial.vehicle_speed_kph = 0;
initial.motorDriveUnit_RotorSpd_rpm = 0;
initial.hvBattery_SOC_pct = 70;

initial.hvBattery_Charge_Ahr = ...
BatteryHV_getAmpereHourRating( ...
Voltage_V = batteryHV.nominalVoltage_V, ...
Capacity_kWh = batteryHV.nominalCapacity_kWh, ...
StateOfCharge_pct = initial.hvBattery_SOC_pct );

initial.hvBattery_Temperature_K = batteryHV.ambientTemp_K;

initial.ambientTemp_K = batteryHV.ambientTemp_K;

initial.motorDriveUnit_Temperature_K = motorDriveUnit.ambientTemp_K;
initial.ambientTemp_K = motorDriveUnit.ambientTemp_K;
%% Model Parameters for the Battery Electric Vehicle (BEV) system model.
%
% This script defines parameters for the BEV model.
% Use this script to load default values.
% Override any of them elsewhere later as needed.
%
% The BEV_system_model automatically runs this script in the PostLoadFcn callback.

% Copyright 2020-2026 The MathWorks, Inc.

%% Bus definitions

defineBus_HighVoltage
defineBus_Rotational

%% Common parameters

CommonParameter.Temperature = simscape.Value(273.15 + 20, "K");

%% Vehicle block parameters

vehicle.mass_kg = 2400;
vehicle.tireRollingRadius_m = 0.34;

vehicle.tireRollingCoeff = 0.0136;
vehicle.airDragCoeff = 0.31;
vehicle.frontalArea_m2 = 0.9 * 1.921 * 1.624;
vehicle.gravAccel_m_per_s2 = 9.81;

smoothing.vehicle_speedThreshold_kph = 1;
smoothing.vehicle_axleSpeedThreshold_rpm = 1;

%% Battery parameters

batteryHV.nominalVoltage_V = 340;

batteryHV.nominalCapacity_kWh = 60;

batteryHV.nominalCharge_Ahr = ...
BatteryHV_getAmpereHourRating( ...
Voltage_V = batteryHV.nominalVoltage_V, ...
Capacity_kWh = batteryHV.nominalCapacity_kWh, ...
StateOfCharge_pct = 100 );

batteryHV.internalResistance_Ohm = 0.01;

batteryHV.ThermalMass_J_per_K = 10e3;

% Voltage is 90 % of the nominal when SOC is 50 %.
batteryHV.measuredVoltage_V = batteryHV.nominalVoltage_V * 0.9;
batteryHV.measuredCharge_Ahr = batteryHV.nominalCharge_Ahr * 0.5;

% More thermal model parameters
% These parameters are used when thermal model is enabled
% in the Battery block from Simscape Electrical.
batteryHV.measurementTemperature_K = 273.15 + 25;
batteryHV.secondMeasurementTemperature_K = 273.15 + 0;
batteryHV.secondNominalVoltage_V = batteryHV.nominalVoltage_V * 0.95;
batteryHV.secondInternalResistance_Ohm = batteryHV.internalResistance_Ohm * 2;
batteryHV.secondMeasuredVoltage_V = batteryHV.nominalVoltage_V * 0.9;

% Ambient parameters for battery thermal simulation

batteryHV.ambientTemp_K = CommonParameter.Temperature.value("K");

batteryHV.ambientMass_t = 10000;
batteryHV.ambientSpecificHeat_J_per_Kkg = 1000;

batteryHV.RadiationArea_m2 = 1;
batteryHV.RadiationCoeff_W_per_K4m2 = 5e-10;

%% Motor drive unit parameters

MotorDriveUnit.MaxTorque = simscape.Value(420, "N*m");
MotorDriveUnit.MaxPower = simscape.Value(220, "kW");
MotorDriveUnit.ResponseTime = simscape.Value(20, "ms");

MotorDriveUnit.ElectricalEfficiencyPercent = 95;
MotorDriveUnit.MeasuredAngularSpeed = simscape.Value(2000, "rpm");
MotorDriveUnit.MeasuredTorque = simscape.Value(50, "N*m");
MotorDriveUnit.MeasuredIronLosses = simscape.Value(55, "W");
MotorDriveUnit.FixedLosses = simscape.Value(40, "W");

MotorDriveUnit.RotorInertia = simscape.Value(5*0.01^2, "kg*m^2");
MotorDriveUnit.RotorDamping = simscape.Value(1e-5, "N*m/(rad/s)");

% Used in the Status subsystem of the Basic model to output a constant temperature value.
% Not used in the BasicThermal model.
MotorDriveUnit.AmbientTemperature = CommonParameter.Temperature;

% Used in the BasicThermal model.
% Not used in the Basic model.
MotorDriveUnit.ThermalMass = simscape.Value(90, "kJ/K");
MotorDriveUnit.RadiationArea = simscape.Value(1, "m^2");
MotorDriveUnit.RadiationCoefficient = simscape.Value(5e-10, "W/K^4/m^2");
MotorDriveUnit.AmbientMass = simscape.Value(10000, "t");
MotorDriveUnit.AmbientSpecificHeat = simscape.Value(1000, "J/K/kg");

%% Reducer parameters

reducer.GearRatio = 9.1;

reducer.Efficiency_normalized = 0.98;

smoothing.Reducer_PowerThreshold_W = 1;

%% BEV controller parameters

% Parameters for converting vehicle speed to motor speed
bevControl.MotorSpdRef_tireRollingRadius_m = vehicle.tireRollingRadius_m;
bevControl.MotorSpdRef_reductionGearRaio = 9.1;

% PI controller gains for motor torque control
bevControl.MotorSpdRef_Ki = 15;
bevControl.MotorSpdRef_Kp = 15;

% Bounds for torque command
bevControl.MotorDriveUnit_trqMax_Nm = MotorDriveUnit.MaxTorque.value("N*m");

%% Inputs to the model

% Load the "Simple" drive pattern for the Lookup-Table-based subsystem.
loadLUTData_VehSpdRef_Simple

%% Initial conditions

initial.vehicle_speed_kph = 0;
initial.hvBattery_SOC_pct = 70;

initial.MotorDriveUnit_RotorAngularSpeed = simscape.Value(0, "rpm");

initial.MotorDriveUnit_Temperature = CommonParameter.Temperature;

initial.hvBattery_Charge_Ahr = ...
BatteryHV_getAmpereHourRating( ...
Voltage_V = batteryHV.nominalVoltage_V, ...
Capacity_kWh = batteryHV.nominalCapacity_kWh, ...
StateOfCharge_pct = initial.hvBattery_SOC_pct );

initial.hvBattery_Temperature_K = CommonParameter.Temperature.value("K");

initial.ambientTemp_K = CommonParameter.Temperature.value("K");
Loading
Loading