Want to simulate battery cooling system model

1 visualización (últimos 30 días)
Jungwoo Lee
Jungwoo Lee el 26 de Mayo de 2023
Respondida: Saksham el 24 de Ag. de 2023
% Parameters
Lx = 0.01; % m
Ly = 0.03; % m
Lz = 0.001; % m
T_ambient = 25; % degrees Celsius
heat_production = 80; % W per battery cell
thermal_conductivity = 400; % W/(m*K) for copper
rho = 8960; % kg/m^3 for copper
Cp = 385; % J/(kg*K) for copper
convective_coefficient = 25; % W/(m^2*K) for air
velocity = 10; % m/s
% Battery module configuration
num_cells_per_row = 9;
num_rows = 2;
Nx = num_cells_per_row;
Ny = num_rows;
Nz = 1;
% Discretization
dx = Lx/Nx;
dy = Ly/Ny;
dz = Lz/Nz;
dt = 1; % s
Nt = 100; % total number of timesteps
% Initialization
T = T_ambient*ones(Nx, Ny, Nz); % initial temperature distribution
% Main loop
for t = 1:Nt
T_old = T;
% Calculate new temperature distribution
for i = 2:Nx-1
for j = 2:Ny-1
for k = 2:Nz-1
dTdx = (T_old(i+1,j,k) - 2*T_old(i,j,k) + T_old(i-1,j,k))/dx^2;
dTdy = (T_old(i,j+1,k) - 2*T_old(i,j,k) + T_old(i,j-1,k))/dy^2;
dTdz = (T_old(i,j,k+1) - 2*T_old(i,j,k) + T_old(i,j,k-1))/dz^2;
% Convective heat transfer
convective_heat = convective_coefficient * (T_ambient - T_old(i,j,k)) * velocity;
convective_heat = convective_heat * (T_ambient > T_old(i,j,k)); % Only consider cooling effect
T(i,j,k) = T_old(i,j,k) + dt*(thermal_conductivity/(rho*Cp))*(dTdx + dTdy + dTdz) + dt*convective_heat/(rho*Cp);
end
end
end
% Heat production in the center of the battery module
center_i = round(Nx/2);
center_j = round(Ny/2);
center_k = round(Nz/2);
T(center_i, center_j, center_k) = T(center_i, center_j, center_k) + dt*heat_production/(rho*Cp);
end
% Create meshgrid for the faces
[X, Y, Z] = meshgrid(1:Nx, 1:Ny, 1:Nz);
% Create the faces for the battery module
faces = [
1, 2, 6, 5;
2, 3, 7, 6;
3, 4, 8, 7;
4, 1, 5, 8;
1, 2, 3, 4;
5, 6, 7, 8;
];
% Visualization
figure;
patch('Faces', faces, 'Vertices', [X(:) Y(:) Z(:)], 'FaceVertexCData', T(:), 'FaceColor', 'interp', 'EdgeColor', 'none');
colorbar;
title('Battery Module Temperature Distribution');
xlabel('x');
ylabel('y');
zlabel('z');
view(3);
This is my code, but I think I'm totally wrong.
What I wanted to make code is like this:
There are total 18 battery cells which is alligned 2 by 9
Like this
parameter of battery will be like this:
10mm width, 30 mm height, and 2mm thickness
Also, heat generation from battery is 80W for each
Air is flow from left side of picture to right side like this:
If I assume that the material of battery is copper
Then how can I get temperature difference of battery by time and position in 3D picture using matlab?
What I want to get from this code is like this:
I'm very sorry because I don't know matlab code (I started to study today.)
Plz help me...

Respuestas (1)

Saksham
Saksham el 24 de Ag. de 2023
Hi Jungwoo,
I understand that you wish to get temperature difference of battery by time and position a 3D picture using MATLAB.
Please follow the below resources to explore about battery and thermal management tasks:
To plot in 3D Space in MATLAB, ‘plot3’ can be helpful. Below is the link to its documentation:
I hope the above shared resources will be helpful to you.
Sincerely,
Saksham

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by