Weird flow reversals through in Simscape Thermal Liquid network using custom pressure drop element
13 次查看(过去 30 天)
显示 更早的评论
Hello there,
I am testing some custom components on a simple network in using the Simscape Thermal Liquid (TL) domain. I built up my component analogously to the Flow Resistance (TL) element. My block equations read as follows:
intermediates % The intermediate terms for use in equations
% Across variable - pressure
p_A = A.p;
p_B = B.p;
% Through variable - mass flow rate through port A
mdot = abs(mdot_A);
% Average value of density
rho_avg = (rho_A + rho_B)/2;
% Calculate average volumetric flow rate
q_avg = mdot/rho_avg;
end
equations
% Pressure drop
if q_avg >= 0
p_A - p_B == {f_dp*value(L,'m')*c_pow*cRe*value(q_avg,'lpm')^(a_pow+aRe),'kPa'};
% Mass Balance
mdot_A + mdot_B == 0;
% Energy Balance
Phi_A + Phi_B + P == 0;
end
The weird thing I am experiencing often is some kind of flow reversal. See outputs of volumetric flow rate sensors 11 and 12. There the flow rate should be approximately 0.5 and 0.5 (flow rate on the left a little lower because there is an extra element in between). See screenshot:

Why does this happen? The pressure at port A should always be higher than at port B and thus all flow should go from A to B.
The pressure drop formula can be summarized as dp = c*q^a. (Some more factors that are read in through parameters but that is essentially it)
I am using the abs() function to ensure that the flowrate inserted into the pressure drop function is positive (does not work with negative values). Maybe the issue lies somewhere there.
I have included the following if-else case into the equation section to make it work.
intermediates % The intermediate terms for use in equations
% Across variable - pressure
p_A = A.p;
p_B = B.p;
% Through variable - mass flow rate through port A
%mdot = abs(mdot_A);
% Average value of density
rho_avg = (rho_A + rho_B)/2;
% Calculate average volumetric flow rate
q_avg = mdot_A/rho_avg;
end
equations
% Pressure drop
if q_avg >= 0
p_A - p_B == {f_dp*value(L,'m')*c_pow*cRe*value(q_avg,'lpm')^(a_pow+aRe),'kPa'};
% Mass Balance
mdot_A + mdot_B == 0;
% Energy Balance
Phi_A + Phi_B + P == 0;
else
p_A - p_B == {10000000000000000000, 'kPa'};
% Mass Balance
mdot_A + mdot_B == 0;
% Energy Balance
Phi_A + Phi_B + P == 0;
end
end
end
Basically, I am not using the abs() function anymore but I am ensuring that the flow does not reverse by causing an extremely high pressure drop if mdot_A --> q_avg should become negative. This is not at all the nicest way to do it. Any help on how to tackle this in the best manner is well appreciated.
Thank you in advance.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Foundation and Custom Domains 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!