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

structuraly singular problem for fluid compression

structuraly singular problem for fluid compression

hello, I am new at modelica language. I want to model a vapor compressor using fluid connector of modelica. It is the firt time I use fluid connectors and I don't understand where is the error in my code. Can you help me ?

CODE

model compressor2 "compressor model"
  /*FLUID*/
replaceable package Medium =
      Modelica.Media.Water.StandardWater                                                                   constrainedby
    Modelica.Media.Interfaces.PartialTwoPhaseMedium "Medium model" annotation (choicesAllMatching = true);

  /*PARAMETERS*/

  parameter Real epsilon_is "isentropic efficicency";
  parameter Modelica.SIunits.Pressure P_dis "Outlet pressure start value";



  Modelica.SIunits.Temperature T_su "Suction Temperature";

  Modelica.SIunits.Temperature T_dis
                                    "discharge Temperature";
  Modelica.SIunits.Power W_is "isentropic compression power";
  Modelica.SIunits.Power W_r "real compression power";

  Medium.ThermodynamicState vaporIn
    "Thermodynamic state of the fluid at the inlet";
  Medium.ThermodynamicState vaporOut
    "Thermodynamic state of the fluid at the outlet - isentropic";
  Modelica.SIunits.SpecificEntropy s_su;
  Modelica.SIunits.SpecificEnthalpy h_su;
  Modelica.SIunits.SpecificEnthalpy h_dis;
  Modelica.SIunits.SpecificEnthalpy h_is;

   Modelica.Fluid.Interfaces.FluidPort_a InFlow(redeclare package Medium=Medium)
    annotation (Placement(transformation(extent={{-122,-22},{-78,20}}),
        iconTransformation(extent={{-122,-22},{-78,20}})));
  Modelica.Fluid.Interfaces.FluidPort_b OutFlow(redeclare package Medium=Medium)
    annotation (Placement(transformation(extent={{78,-20},{122,22}}),
        iconTransformation(extent={{78,-20},{122,22}})));

equation

  T_su = Medium.temperature_ph( InFlow.p,h_su);
  h_su = InFlow.h_outflow;

  vaporIn = Medium.setState_ph(InFlow.p,h_su);
  s_su = Medium.specificEntropy(vaporIn);
  vaporOut = Medium.setState_ps(P_dis,s_su);
  h_is = Medium.specificEnthalpy(vaporOut);

  W_is= InFlow.m_flow*(h_is-h_su);
  W_r = W_is/epsilon_is;
  h_dis=W_r/InFlow.m_flow + h_su;
  T_dis= Medium.temperature_ph(P_dis,h_dis);

  OutFlow.h_outflow = h_dis;
  OutFlow.m_flow=-InFlow.m_flow;
  OutFlow.p=P_dis;

  annotation (
    Icon(coordinateSystem(preserveAspectRatio=false), graphics={Ellipse(
          extent={{-80,-80},{80,80}},
          lineColor={0,0,0},
          lineThickness=1), Polygon(
          points={{-46,66},{-46,-66},{80,0},{-46,66}},
          lineColor={0,0,0},
          lineThickness=1)}),
    Diagram(coordinateSystem(preserveAspectRatio=false)));
end compressor2;

Edited by: verdet - Jun-22-20 09:56:36
There are 0 guests and 0 other users also viewing this topic
You are here: