Input/Output connectors causing Modelica model to be unbalanced

Viewed 148

I'm building a custom fluid model to eventually allow for a 3-dimensional velocity. I've designed the equations such that the model runs with the following boundary conditions:

  pressure_out = 500000;
  hin=3000e3;
   mdot[1] = 66.3;

The inlet pressure, outlet enthalpy, and outlet mass flow rates should then all be calculated via the model. I then put in an outlet connector (standard Modelica fluid port named Outlet):

     Outlet.m_flow + mdot[3]=0;
     Outlet.p = pressure_out;
     Outlet.h_outflow = hout;

and correspondingly remove the boundary condition for pressure_out so that:

  hin=3000e3;
  mdot[1] = 66.3;

and the model is still balanced. However, once I add in the Inlet connector and set its connections:

     Inlet.m_flow =mdot[1];
     Inlet.p = pressure_in;
     Inlet.h_outflow = hin;

I remove the boundary conditions because the model should be capable of being informed of a pressure, mass flow rate, and enthalpy. However, when I remove my boundary conditions the model believes that I'm missing an equation. I cannot for the life of me figure out what to do. If I re-add in any of the initial boundary conditions, the model breaks because a boundary is singularly over-determined. In summary,

 pout = 500000; replaced by  Outlet.p = pout;
 hout = states[2].h; add Outlet.h_outflow = hout;
 p[1] = pin; add Inlet.p = pin;
 hin=3000e3; replaced by Inlet.h_outflow = hin;
 mdot[1] = 66.3; replaced by Inlet.m_flow = mdot[1];

I've tried using inStream for the flow variables, I've tried bypassing my internal variables, and I've tried each port one at a time. The Inlet port is unhappy, and I'm at a loss as far as why it is.

1 Answers

As you point out yourself, the problem lies in the usage of stream connectors. When you use stream connectors in a model it must always provide a value of the outflowing stream variable for each connector. That is, in your case you need an expression of the outflowing enthalpy of each connector.

This Github Wiki page might be helpful to you

Best regards,

Rene Just Nielsen

Related