I am modelling a compressor with input taken from the source ( p = 1 atm, T =25 C). I want the compressor to calculate the outlet pressure( given that pressure ratio rp = 6); The code attached here. Can anyone help me?
model Compressor332 "Generic volumetric compressor model"
/****************************************** FLUID ******************************************/
replaceable package Medium =
Modelica.Media.Air.DryAirNasa constrainedby
Modelica.Media.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching = true);
/*Ports */
ThermoCycle.Interfaces.Fluid.FlangeA InFlow(redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{-78,68},{-58,88}}),
iconTransformation(extent={{-78,68},{-58,88}})));
ThermoCycle.Interfaces.Fluid.FlangeB OutFlow(redeclare package Medium =
Medium) annotation (Placement(transformation(extent={{76,-50},{96,-30}}),
iconTransformation(extent={{76,-50},{96,-30}})));
/****************************************** SELECT TYPE OF EXPANDER ******************************************/
parameter Real epsilon_s=0.7 "Isentropic Efficiency"
annotation (Dialog(enable=(ExpType == ExpTypes.UD)));
annotation (Dialog(tab="Initialization"));
/****************************************** VARIABLES ******************************************/
Medium.ThermodynamicState vaporIn
"Thermodynamic state of the fluid at the inlet";
Medium.ThermodynamicState vaporOut
"Thermodynamic state of the fluid at the outlet - isentropic";
Modelica.Units.SI.Power W_dot;
parameter Modelica.Units.SI.MassFlowRate M_dot = 0.01;
Medium.SpecificEntropy s_su;
Medium.SpecificEnthalpy h_su;
Medium.SpecificEnthalpy h_ex;
Medium.AbsolutePressure p_su;
parameter Medium.AbsolutePressure p_ex = 20e5;
Medium.SpecificEnthalpy h_ex_s;
parameter Real rp = 6;
equation
/* Fluid Properties */
vaporIn = Medium.setState_ph(p_su,h_su);
s_su = Medium.specificEntropy(vaporIn);
vaporOut = Medium.setState_ps(p_ex,s_su);
h_ex_s = Medium.specificEnthalpy(vaporOut);
/*equations */
h_ex = h_su + (h_ex_s - h_su)/epsilon_s;
W_dot = M_dot*(h_ex - h_su) "Consumed Power";
//BOUNDARY CONDITIONS //
/* Enthalpies */
h_su = if noEvent(InFlow.m_flow <= 0) then h_ex else inStream(InFlow.h_outflow);
OutFlow.h_outflow = if noEvent(-M_dot <= 0) then h_ex else inStream(
OutFlow.h_outflow);
/*Mass flows */
OutFlow.m_flow = -M_dot;
/*pressures */
//flange.p = vapor_su.p;
InFlow.p = p_su;
OutFlow.p = p_ex;
p_ex /p_su = rp;
annotation (Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,
-100},{100,100}}), graphics), Icon(coordinateSystem(
preserveAspectRatio=false,extent={{-120,-120},{120,120}}), graphics={
Text(
extent={{-62,-56},{80,-84}},
lineColor={0,0,0},
fillPattern=FillPattern.Solid,
fillColor={0,0,0},
textString="Compressor"),
Polygon(
points={{-60,80},{-60,-60},{80,-40},{80,40},{-60,80}},
lineColor={0,0,255},
smooth=Smooth.None,
fillColor={0,0,255},
fillPattern=FillPattern.Solid)}),Documentation(info="<html>
<p>The <i>Compressor</i> model represents the expansion of a fluid in a volumetric machine. It is a lumped model based on performance curves. It is characterized by two flow connector for the fluid inlet and outlet and by a mechanical connector for the connection with the generator.</p>
<p>The assumptions for this model are:</p>
<p><ul>
<li>No dynamics ( it is considered negligible when compared to the one characterizing the heat exchanger).</li>
<li>No thermal energy losses to the environment</li>
<li>Isentropic efficiency based on empirical performance curve</li>
<li>Filling factor based on empirical performance curve</li>
</ul></p>
<p><h4>Modelling options</h4></p>
<p>In this model, the user has the choice of providing constant isentropic and volumetric efficiencies, or providing performance curves for these two variables.</p>
</html>"));
end Compressor332;
This is for multi-stage compression. When I translated the model, I am getting the following error mentioned in the figure. I already given the mass flow rate for the compressor but still, it is not considering.
1.Is modeling possible without outlet boundary condition using fluid library components. 2. Is it possible to have outlet mass flow rate from the data I have give. 3. Are equations solving order can be changed? (Here from mass flow rate, the equations are getting solved like reverse. I want the model solved from top to bottom, is there any possibility to manupulate the equations order?)