How to create a mixer block in Simscape that mixes two fluids and leaves as one?

2 次查看(过去 30 天)
component mixer
nodes
A = mysimscape.thermohydraulic.thermohydraulics; % A:right
B = mysimscape.thermohydraulic.thermohydraulics; % B:right
C = mysimscape.thermohydraulic.thermohydraulics; % C:left
end
parameters
density = {1000, 'kg/m^3'};
cp = {4.19, 'kJ/(kg*K)'};
end
variables(Access = protected)
qf1 = { 0 ,'m^3/s' }; % Flow rate 1
qf2 = { 0 ,'m^3/s' }; % Flow rate 2
qf3 = { 0 ,'m^3/s' }; % Flow rate 3
Phi1 = { 0, 'kW'};
Phi2 = { 0, 'kW'};
Phi3 = { 0, 'kW'};
end
branches
qf1 : A.qf -> *;
qf2 : B.qf -> *;
qf3 : C.qf -> *;
end
equations
% No pressure drop
A.p == C.p;
% B.p == C.p;
% Energy flow equations
Phi1 == qf1 * density * cp * A.t;
Phi2 == qf2 * density * cp * B.t;
Phi3 == qf3 * density * cp * C.t;
% Energy conservation
Phi1 + Phi2 + Phi3 == 0;
% Mass conservation
qf1 + qf2 + qf3 == 0;
end
end
Is this code correct? My domain is a customised thermohydraulic domain that includes variables p, t and q.

回答(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