Simscape thermal liquid domain - Custom component (Mixing element)

9 views (last 30 days)
Hello, I am currently trying to create a custom component that mixes two fluid flows with/without any pressure loss. Basically, two flows shall combine into one by obeying to conservation of mass and energy flows. The ports of the components would look as in the following picture:
Basically, port C should serve as outflow, ports A and B as inflow. The code for my component looks as pasted below. Basically, simscape keeps telling me that I have not enough equations for the amout of variables (underdefined system). I am however unsure what I should add, I've been trying quite a lot of things. I do not want to introduce equations relating the temperature at port C to A and B since I think the temperature should be directly given by the energy and mass balance. Any suggestions? Thank you!
component mixing_element
nodes
A = foundation.thermal_liquid.thermal_liquid; % A:left
B = foundation.thermal_liquid.thermal_liquid; % B:left
C = foundation.thermal_liquid.thermal_liquid; % C:right
end
variables (Access = protected)
% Through variables
mdot_A = {0, 'kg/s'}; % Mass flow rate into port A
mdot_B = {0, 'kg/s'}; % Mass flow rate into port B
mdot_C = {0, 'kg/s'}; % Mass flow rate out of port C
Phi_A = {0, 'kW' }; % Energy flow rate into port A
Phi_B = {0, 'kW' }; % Energy flow rate into port B
Phi_C = {0, 'kW' }; % Energy flow rate out of port C
end
branches
mdot_A : A.mdot -> *;
mdot_B : B.mdot -> *;
mdot_C : C.mdot -> *;
Phi_A : A.Phi -> *;
Phi_B : B.Phi -> *;
Phi_C : C.Phi -> *;
end
equations
let
p_A = A.p;
p_B = B.p;
p_C = C.p;
in
% No pressure drop
p_A == p_B;
p_C == p_A;
% Mass balance
mdot_A + mdot_B == mdot_C;
% Energy balance
Phi_A + Phi_B == Phi_C;
end
end
end

Answers (1)

Manikanta Aditya
Manikanta Aditya on 9 Jan 2024
This answer was flagged by Michal
Hi Joel,
As per my understanding, you’re trying to create a custom component in ‘Simscape’ that mixes two fluid flows. You’ve already set up equations for mass and energy balance, as well as the pressure relationships.
However, you’re encountering an issue where ‘Simscape’ is indicating that your system is underdefined, meaning there are not enough equations for the number of variables.
One potential issue could be the assumption of no pressure drop across the mixing element. In real physical systems, there might be pressure loss or gain due to mixing. Try to add an equation to account for this.
Another suggestion would be to break down your system into subsystems and test each unit until you’re sure that each behaves as expected. This approach can help you identify which part of your system is causing the underdefined system error. You can then gradually increase the complexity of your system, building, simulating, and testing your model incrementally.
Also, ensure that your model configuration is correct. Check for wrong connections and verify that the model makes sense as a physical system. For example, look for actuators connected against each other, so that they try to move in opposite directions, or incorrect connections to reference nodes that prevent movement.
Please refer to the following references to know more about:
I hope this resolves the issue you were facing.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!