Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Fluid Port Connection

Fluid Port Connection

Hi everyone,
I am new to modelica and got a few issues with a fluid model i created.
I created a moist air System, where locally the rel. hum. rises above 1, so I wanted to create a simple volume, where the in real condensed air can be separated. The model itself and the math works fine, but I have Problems connecting it to the surrounding with fluid ports. The check function says it is underdetermined, but when I am replaceing the fluid port Connection with discrete values, the System works fine. Can someone explain to me which variable from the port I am missing? I already tried the Tracer Connection, but this did not work either. Or if someone knows how to define the problem with standard models, feel free as well current/wink.
Here my model:

Code:


model water separator

    import Modelica.SIunits.*;
    import Modelica.Constants.e;
    replaceable package Medium = Modelica.Media.Air.MoistAir;


  MassFlowRate m_in;
  MassFraction X_steam_in;
  MassFlowRate m_out;
  MassFlowRate m_liquid;
  MassFraction x_sat;
  MassFraction X_sat;

  parameter Pressure p=1000;  //Pa
  Pressure p_sat;

  EnthalpyFlowRate H_in;
  EnthalpyFlowRate H_out;
  parameter HeatFlowRate Q=200;
  parameter SpecificEnthalpy h_boil=2257000;

  Temp_K T(start=288);

  Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium =
        Modelica.Media.Air.MoistAir)
    annotation (Placement(transformation(extent={{-10,74},{10,94}})));
  Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium =
        Modelica.Media.Air.MoistAir)
    annotation (Placement(transformation(extent={{-10,-94},{10,-74}})));

equation
port_a.p=p;
m_in=port_a.m_flow;
X_steam_in=port_a.Xi_outflow[1];
H_in=port_a.h_outflow*port_a.m_flow;


  p_sat=e^(19.016-4064.95/(T-273.15+236.25));
  x_sat=0.622*p_sat/(p-p_sat);
  X_sat=x_sat/(1+x_sat);

  m_liquid=(X_steam_in+X_sat)*m_in;
  m_out=m_in-m_liquid;


  0=H_in-H_out-Q;
  H_out=m_out*(1-X_sat)*Constants.c_p_air*T
        +m_out*X_sat*(Constants.c_p_steam*T+h_boil)
        +m_liquid*Constants.c_p_water*T;

port_b.p=port_a.p;
port_b.m_flow=m_out;
port_b.Xi_outflow[1]=X_sat;
port_b.h_outflow=H_out/m_out;
port_b.C_outflow = instream(port_a.C_outflow);


  annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
            -100},{100,100}})));
end water separator;

There are 0 guests and 0 other users also viewing this topic