Compressor (2P) modeling

6 次查看(过去 30 天)
Zarielka
Zarielka 2016-5-2
编辑: Zarielka 2016-5-2
Problem with compressor component (2P) using two_port steady block. Please find the code below. Unable to raise mass flow and pressure at the same time. Errors associated with component equations.
component compressor_final2< foundation.two_phase_fluid.two_port_steady
% compressor_final2 inputs % Pressure differential %P = {0, 'MPa'}; % P:left
% Mass flow rate
%M = {0, 'kg/s'}; % M:left
end
nodes S = foundation.mechanical.rotational.rotational; % S:Left end outputs speed={90,'rad/s'}; %Wc:right torque={2,'N*m'}; %t:right P_b={20, 'kPa'}; % pressure at B end
parameters Vp={0.21,'m^3'}; % Plenum volume di={0.02,'m'}; % inlet diameter pi_c={1.5, '1'}; % pressure ratio length={1.253,'m'}; % L_c nvol={0.85,'1'}; % volumetric efficiency N_C={3500,'rpm'}; % Compressor required speed end
variables t={20,'N*m'}; % compressor torque
power= {0, 'kW' }; % Work done on the fluid by the source
%p_B={0,'MPa'}; % Pressure @ B
end
function setup % Geometry flow_area_A=pi*di^2/4; flow_area_B=pi*di^2/4; conduction_length=length; end
branches t:S.t->*; mdot_A: A.mdot ->* ; mdot_B: B.mdot ->*; end
equations
let
% Domain parameters
u_min = A.u_min;
u_max = A.u_max;
unorm_TLU = A.unorm_TLU;
p_TLU = A.p_TLU;
s_TLU = A.s_TLU;
u_sat_liq_TLU = A.u_sat_liq_TLU;
u_sat_vap_TLU = A.u_sat_vap_TLU;
% Across variables
p_A = A.p;
p_B = B.p;
% Mass flow rate from port A to port B
mdot = mdot_A;
% Isentropic work based on entropy
power_compressible = mdot * (u_B + p_B*v_B - u_A - p_A*v_A);
% Incompressible approximation based on pressure differential
power_incompressible = mdot * (p_B - p_A)*(v_A + v_B)/2;
% Average normalized internal energy
unorm_avg = (unorm_A + unorm_B)/2;
in
% Torque and speed calculations
%t==Tc;
%S.w==2*N_C*pi/60;
%Commanded mass flow rate
mdot==(1/v_A)*Vp*S.w*nvol;
% Energy balance
% Mass balance
% reconciliation
%mdot_A+mdot_B==0;
%Commanded pressure difference
p_B-pi_c*p_A==0;
% Energy balance
power == ...
if le(unorm_avg, 0), ...
power_incompressible ...
elseif ge(unorm_avg, 1), ...
power_compressible ...
else ...
(1-unorm_avg) * power_incompressible + unorm_avg * power_compressible ...
end;
S.w*t==power;
Phi_A+Phi_B+power==0;
% outputs equations
t==torque;
S.w==speed;
B.p==P_b;
end
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Foundation and Custom Domains 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by