How to make output of first input as new input to the second pipe, if n numbers of pipes are connected in parallel?

9 views (last 30 days)
% How to make output of first input as new input to the second pipe, if n numbers of pipes are connected in parallel?
% Here c_p is also function of fluid inlet temperature (T_fi)
clc
clear
close all
L_step = 0 : 0.1 : 1;
T_fi = 305;
T_a = 300;
F_r = 0.92;
A_c = 2;
S = 900;
U_l = 4.5;
m_w = 0.01;
c_p = zeros(length(T_fi),1);
Q_u = zeros(1,length(L_step));
T_step = zeros(1,length(L_step));
T_step(1) = T_fi;
Q_u(1) = F_r*A_c*(S - U_l*(T_fi - T_a));
[c_p(i)] = refpropm('C', 'T', T_fi(i), 'P', 9e3, 'CO2');
for i = 1 : (length(L_step)-1)
[c_p(i+1)] = refpropm('C', 'T', T_fi, 'P', 9e3, 'CO2');
T_step(i+1) = (Q_u(i)/(m_w*c_p(i))) + T_step(i);
T_wo(i) = (Q_u(i)/(m_w*c_p(i))) + T_fi(i);
end
  1 Comment
Karanjot
Karanjot on 1 Sep 2023
Hi Wasim,
I understand that you want to utilise use the output of the first pipe as an input to another pipe connected in parallel.
In the code given below, I added an additional array T_wo to store the outlet temperatures of each pipe. The output of the previous pipe (T_step(i)) is assigned as the new input (T_fi(i+1)) for the next pipe in the loop. This way, the output of the first input becomes the new input for the second pipe, and so on for n numbers of pipes connected in parallel.
L_step = 0 : 0.1 : 1;
T_fi = 305;
T_a = 300;
F_r = 0.92;
A_c = 2;
S = 900;
U_l = 4.5;
m_w = 0.01;
c_p = zeros(length(T_fi),1);
Q_u = zeros(1,length(L_step));
T_step = zeros(1,length(L_step));
T_wo = zeros(1,length(L_step));
T_step(1) = T_fi;
Q_u(1) = F_r*A_c*(S - U_l*(T_fi - T_a));
[c_p(1)] = refpropm('C', 'T', T_fi(1), 'P', 9e3, 'CO2'); % Initialise 1st index instead of i
for i = 1 : (length(L_step)-1)
[c_p(i)] = refpropm('C', 'T', T_fi(i), 'P', 9e3, 'CO2');
T_step(i+1) = (Q_u(i)/(m_w*c_p(i))) + T_step(i);
T_wo(i) = (Q_u(i)/(m_w*c_p(i))) + T_fi(i);
T_fi(i+1) = T_step(i+1); % Set the output of the previous pipe as the new input
end
I hope this helps!
Regards,
Karanjot Singh

Sign in to comment.

Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!