Simcape two phase fluid custom component

7 次查看(过去 30 天)
I am trying to write a custom component for a non-isentropic compressor in Simscape. However, I saw a convection term that I don't understand. A snippet of the source code from the controlled_mass_flow_rate_source is shown below:
% Specific total enthalpy for outflow
ht_out_A == convection_A.ht_I;
ht_out_B == convection_B.ht_I;
% Equate variables for internal components that calculate energy convection at ports A and B
convection_A.mdot == mdot_A;
convection_A.Phi == Phi_A;
convection_B.mdot == mdot_B;
convection_B.Phi == Phi_B;
convection_A.ht_I == convection_B.ht_I;
What is the convection_A, convection_B, and the ht_I term?
Thank you!
  1 个评论
Tech Logg Ding
Tech Logg Ding 2021-4-19
I will also include a snippet of my code:
% 1 is the input and 2 is the output of the block
% NI is the isentropic efficiency
% _isen indicates the case for the isentropic efficiency
% isentropic relationship
s_1 == s_2_isen;
% isentropic efficiency balance
NI*(ht_2-ht_1) == (ht_2_isen-ht_1);
% power calculation
power == mdot_A*(ht_2-ht_1);
% Specific total enthalpy for outflow
% not sure which one to use to balance the equations
(ht_2+ht_1)/2 == convection_B.ht_I;
%ht_2 == convection_B.ht_I;
%ht_1 == convection_A.ht_I;
% Equate variables for internal components that calculate energy convection at ports A and B
convection_A.mdot == mdot_A;
convection_A.Phi == Phi_A;
convection_B.mdot == mdot_B;
convection_B.Phi == Phi_B;
convection_A.ht_I == convection_B.ht_I;
As shown above, I am not sure what the ht_I, convection_A, and convection_B terms do.

请先登录,再进行评论。

采纳的回答

Yifeng Tang
Yifeng Tang 2021-4-26
The convection_A & convection_B are two components that defines the behavior at the "port" or boundary of this block. If you look further down the source code, you should find something like:
% Internal components that calculate energy convection at ports A and B
components (ExternalAccess=none)
convection_A = foundation.two_phase_fluid.port_convection(flow_area = area_A, length_scale = sqrt(4*area_A/pi));
convection_B = foundation.two_phase_fluid.port_convection(flow_area = area_B, length_scale = sqrt(4*area_B/pi));
end
That "foundation.two_phase_fluid.port_convection" is a 2P module that defines the upwind scheme at the ports. All fluids domains have a similar component. You can select "foundation.two_phase_fluid.port_convection" and do a Ctrl+D to read its source code. The idea behind the upwind scheme maybe found on this Documentation page:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Two-Phase Fluid Library 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by