Azzera filtri
Azzera filtri

Using Matlab pdepe solver

4 visualizzazioni (ultimi 30 giorni)
luckywell seyitini
luckywell seyitini il 6 Apr 2024
I want to simulate performance of a hybrid thermal energy storage system with a latent and sensible heat storage sections, but i am new to Matlab. I have developed a code for transient heat transfer in the latent heat storage section, between a heat transfer fluid and the PCM capsules. I am seeking for assistance on how to include a similar code for the sensible section. The conditon for linking the two sections is that, the HTF outlet temperature from the latent section is equal to the HTF inlet temperature for the sensible section. Please help on how I can link the two codes.

Risposta accettata

Gyan Vaibhav
Gyan Vaibhav il 16 Apr 2024
Hi luckywell,
I understand that you are trying to use the values you get in the LHS section of your code in to the SHS section during simulation. If you could have provided the code I could have been able to suggest you better, however here are a few tips that might help.
  1. Using functions, you can seperate each of the sections in to seperate function and make a call to both the functions return the values as requirement from one which can be used in the other depending on your system configuration. https://www.mathworks.com/help/matlab/ref/function.html
  2. You can simulate and modulate physical systems using "Simscape". Here is an example it might help provide some more information.
Hope this helps.
Thanks
Gyan
  1 Commento
luckywell seyitini
luckywell seyitini il 18 Apr 2024
Thanks very much Gyan for the advice and suggested options. here is the pdepe code for the latent section:
function pdex4
m = 1;
x = [0:0.02:0.3];
t = [0:1:30];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure
surf(x,t,u1)
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure
plot(x,u1(end,:))
title ('Variation of HTF temperature')
xlabel('Distance x')
ylabel('Temperature T')
figure
plot(x,u2(end,:))
title('Variation of PCM temperature')
xlabel('Distance x')
ylabel('Temperature T')
figure
imagesc(x,t,u1); colormap hot; colorbar; grid on
title('Temperature distribution in HTF');
xlabel('Distance x')
ylabel('Time t')
figure
imagesc(x,t,u2); colormap hot; colorbar; grid on
title ('Temperature distribution in PCM');
xlabel('Distance x')
ylabel('Time t')
figure
surf(x,t,u2)
title('u2(x,t)')
xlabel('Distance x')
ylabel('Time t')
% --------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c = [1138089.525; 1247264.07];
f = [DuDx(1); DuDx(2)];
y = u(1) - u(2);
U = 0.01685;
h = 80476.1032;
F = -U*DuDx(1)-h*y;
G = h*y;
s = [F; G];
% --------------------------------------------------------------
function u0 = pdex4ic(x);
u0 = [170;25];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [ul(1)-170; 0];
ql = [0; 1];
pr = [0; ur(2)-25];
qr = [1; 1];

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by