Skip to content

Commit 0adf39a

Browse files
jjhajjha
authored andcommitted
Commit R2023b
1 parent d9058a5 commit 0adf39a

File tree

90 files changed

+459
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+459
-194
lines changed
-18 Bytes
Binary file not shown.
6.14 KB
Binary file not shown.

Components/HVAC/HVACthermal.slx

-304 Bytes
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
component (Propagation = blocks) compressorPower
2+
% This block computes theoretical compressor power.
3+
% This block Computes theoretical compressor power. Carnot coefficient of performance is computed from the input evaporator and condenser temperature.
4+
% Ideal compressor power is obtained by dividing condenser heat Qcond with Carnot coefficient of performance.
5+
% The output compressor power is obtained by dividing ideal compressor with system efficiency.
6+
7+
% Copyright 2024 The MathWorks, Inc.
8+
9+
inputs
10+
compOn = {1,'1'};
11+
Tevap = {0, 'K'};
12+
Qcond = {0, 'W'};
13+
Tcond = {0, 'K'};
14+
end
15+
outputs
16+
compressPow = {0, 'W'};
17+
end
18+
parameters
19+
systemEfficiency = {0.7, '1'}; % Overall system efficiency
20+
end
21+
intermediates (ExternalAccess = none)
22+
denomAdd = {((Tcond - Tevap)==0)*eps,'K'}
23+
carnotCOP = Tcond/((Tcond - Tevap) + denomAdd); % Carnot CoP for an Ideal refrigeration cycle
24+
end
25+
equations
26+
compressPow == compOn*(Qcond*(Qcond>0))/(systemEfficiency*carnotCOP); % Compressor power
27+
end
28+
end
484 KB
Binary file not shown.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
%% Parameters for BEV model Thermal system - run impirical refrigeration test harness
2+
3+
% Copyright 2024 The MathWorks, Inc.
4+
5+
%% Initial conditions
6+
7+
vehicleThermal.cabin_p_init = 0.101325; % [MPa] Initial air pressure
8+
vehicleThermal.cabin_RH_init = 0.4; % Initial relative humidity
9+
vehicleThermal.cabin_CO2_init = 4e-4; % Initial CO2 mole fraction
10+
vehicleThermal.cabin_T_init = 298.15; % [K] Initial Temperature
11+
vehicleThermal.cabin_battVoltage = 100; % [V] Battery Voltage
12+
vehicleThermal.cabin_battVoltage = 1; % Battery SOC
13+
vehicleThermal.coolant_p_init = 0.101325; % [MPa] Initial coolant pressure
14+
vehicleThermal.ambient = 298.15; % [K] Ambient temperature
15+
vehicleThermal.CabinSpTp = 293.15 ; % [K] Cabin setpoint temperature
16+
vehicleThermal.AConoff = 1; % Set AC compressor on/off
17+
%% Vehicle Cabin
18+
19+
vehicleThermal.cabin_duct_area = 0.04; % [m^2] Air duct cross-sectional area
20+
vehicleThermal.cabin_duct_volume= 0.0015; % [m^3] Aier duct volume
21+
vehicleThermal.cabin_perPersonCO2 = 0.01; % [g/s] Adult CO2 exhale rate
22+
vehicleThermal.cabin_perPersonMoisture = 0.04; % [g/s] Adult moisture exhale rate
23+
vehicleThermal.cabin_perPersonHeat = 70; % Average heat tranfer from human body
24+
vehicleThermal.cabin_exhaleTemperature = 30; % [degC] Adult exhale air temperature
25+
vehicleThermal.cabin_numberPassanger = 1; % Number of onboard passangers
26+
vehicleThermal.cabin_airRecirculation = 0.5; % Cabin air recirculation
27+
28+
%% Liquid Coolant System
29+
30+
vehicleThermal.coolant_pipe_D = 0.019; % [m] Coolant pipe diameter
31+
vehicleThermal.coolant_channel_D = 0.0092; % [m] Coolant jacket channels diameter
32+
vehicleThermal.coolant_valve_displacement = 0.0063; % [m] Max spool displacement
33+
vehicleThermal.coolant_valve_offset = 0.001; % [m] Orifice opening offset when spool is neutral
34+
vehicleThermal.coolant_valve_D_ratio_max = 0.95; % Max orifice diameter to pipe diameter ratio
35+
vehicleThermal.coolant_valve_D_ratio_min = 1e-3; % Leakage orifice diameter to pipe diameter ratio
36+
vehicleThermal.pump_displacement = 0.02; % [l/rev] Coolant pump volumetric displacement
37+
vehicleThermal.pump_speed_max = 1000; % [rpm] Coolant pump max shaft speed
38+
vehicleThermal.coolant_tank_volume = 2.5 / 2; % [l] Volume of each coolant tank
39+
vehicleThermal.coolant_tank_area = 0.11^2; % [m^2] Area of one side of coolant tank
40+
%% Refrigeration System
41+
vehicleThermal.refrigeration.evapTubeMass = 1; % [kg]
42+
43+
%% Radiator
44+
45+
vehicleThermal.radiator_L = 0.6; % [m] Overall radiator length
46+
vehicleThermal.radiator_W = 0.015; % [m] Overall radiator width
47+
vehicleThermal.radiator_H = 0.2; % [m] Overal radiator height
48+
vehicleThermal.radiator_N_tubes = 25; % Number of coolant tubes
49+
vehicleThermal.radiator_tube_H = 0.0015; % [m] Height of each coolant tube
50+
vehicleThermal.radiator_fin_spacing = 0.002; % Fin spacing
51+
vehicleThermal.radiator_wall_thickness = 1e-4; % [m] Material thickness
52+
vehicleThermal.radiator_wall_conductivity = 240; % [W/m/K] Material thermal conductivity
53+
54+
vehicleThermal.radiator_gap_H = (vehicleThermal.radiator_H - vehicleThermal.radiator_N_tubes*vehicleThermal.radiator_tube_H) / (vehicleThermal.radiator_N_tubes - 1); % [m] Height between coolant tubes
55+
vehicleThermal.radiator_air_area_flow = (vehicleThermal.radiator_N_tubes - 1) * vehicleThermal.radiator_L * vehicleThermal.radiator_gap_H; % [m^2] Air flow cross-sectional area
56+
vehicleThermal.radiator_air_area_primary = 2 * (vehicleThermal.radiator_N_tubes - 1) * vehicleThermal.radiator_W * (vehicleThermal.radiator_L + vehicleThermal.radiator_gap_H); % [m^2] Primary air heat transfer surface area
57+
vehicleThermal.radiator_N_fins = (vehicleThermal.radiator_N_tubes - 1) * vehicleThermal.radiator_L / vehicleThermal.radiator_fin_spacing; % Total number of fins
58+
vehicleThermal.radiator_air_area_fins = 2 * vehicleThermal.radiator_N_fins * vehicleThermal.radiator_W * vehicleThermal.radiator_gap_H; % [m^2] Total fin surface area
59+
vehicleThermal.radiator_tube_Leq = 2*(vehicleThermal.radiator_H + 20*vehicleThermal.radiator_tube_H*vehicleThermal.radiator_N_tubes); % [m] Additional equivalent tube length for losses due to manifold and splits
60+
61+
vehicleThermal.fan_area = 0.25 * 2; % [m^2] Fan flow area (2 fans)
62+
63+
%% Workspace variables
64+
65+
66+
67+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
classdef ImpiricalRef_UnitTest_MQC < matlab.unittest.TestCase
2+
%% Class implementation of unit test
3+
%
4+
% These are tests to achieve the Minimum Quality Criteria (MQC).
5+
% MQC is achieved when all runnables (models, scripts, functions) run
6+
% without any errors.
7+
%
8+
% You can run this test by opening in MATLAB Editor and clicking
9+
% Run Tests button or Run Current Test button.
10+
% You can also run this test using test runner (the *_runtests.m script)
11+
12+
13+
% Copyright 2024 The MathWorks, Inc.
14+
15+
16+
%% Simple tests ... just run runnables
17+
18+
methods (Test)
19+
20+
function MQC(~)
21+
close all
22+
bdclose all
23+
mdl = "HVACEmpericalRefHarnessModel";
24+
load_system(mdl)
25+
BatteryTestHarnessParam;
26+
sim(mdl);
27+
close all
28+
bdclose all
29+
end
30+
31+
end
32+
33+
end % classdef
34+
35+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
%% Run unit tests
2+
% This script runs unit test for battery testbench
3+
4+
% Copyright 2024 The MathWorks, Inc.
5+
6+
RelStr = matlabRelease().Release;
7+
disp("This is MATLAB " + RelStr + ".")
8+
9+
TopFolder = fullfile(currentProject().RootFolder, "Components", "HVAC");
10+
11+
%% Test Suite & Runner
12+
13+
% suite_1 = matlab.unittest.TestSuite.fromFile( ...
14+
% fullfile(TopFolder, "Test", "BatteryHV_UnitTest.m"));
15+
16+
suite1 = matlab.unittest.TestSuite.fromFile( ...
17+
fullfile(TopFolder, "Test", "ImpiricalRef_UnitTest_MQC.m"));
18+
19+
suite= [suite1];
20+
21+
runner = matlab.unittest.TestRunner.withTextOutput( ...
22+
OutputDetail = matlab.unittest.Verbosity.Detailed );
23+
24+
%% JUnit Style Test Result
25+
26+
TestResultFile = "ImpiricalRef_TestResults_" + RelStr + ".xml";
27+
28+
plugin = matlab.unittest.plugins.XMLPlugin.producingJUnitFormat( ...
29+
fullfile(TopFolder, "Test", TestResultFile));
30+
31+
addPlugin(runner, plugin)
32+
33+
%% Run tests
34+
results = run(runner, suite);
35+
assertSuccess(results)
-1.07 MB
Binary file not shown.

0 commit comments

Comments
 (0)