loopsstreammodelicaconnectordymola

Dymola, inStream, enthalpy, connecting FluidPorts cant wrap my head around


I'm struggling with enthalpy forwarding in fluid ports. My connector includes m_flow (Medium.MassFlowRate), p (Medium.AbsolutePressure), and h (stream Medium.SpecificEnthalpy). I'm building an Organic Rankine Cycle from scratch with basic components (HEX_hot, Turbine, HEX_cold, Pump), each with 2 fluid ports, connected in a closed circuit. I also have a tank and a boundry.

The pump has a constant mass flow (mass balance), pressure change via Quadratic Pump Characteristic (F(delta p, m_flow)), and an energy balance. I specify the pump power with a value, expecting to determine the outlet enthalpy. However, I get underdetermined errors, likely because port_in.h is not assigned a value.

To pass the check, I add port_in.h = inStream(port_out.h), but this seems redundant since I'm inputting power into the pump. From my research, I understand that actualStream can insert correct enthalpies into the energy balance (I did that). So, why is the additional equation necessary? Isn't that double then? Is it the case that my pump doesn't know (although it is clear via the Quadric Pump characterisic?) which value m_flow, i.e. in which direction the mass flow goes?

So can I assume that I have to cover both flow directions (m_flow < 0 and m_flow > 0) with each one equation, eventhough I will only end up using one? Do I need both equations to cover both scenarios or am I getting something totally wrong here?

In other words, if m_flow < 0 then use the equation port_in.h = inStream(port_out. h) (because only in this case is something actually flowing into the port_out) or otherwise (something is flowing into the port_in) use the "correct EB" through which I can then also introduce P_pump. Can I interpret it like this? And another question for the evaluation: Isn't it really stupid that the port is then assigned "dummy" values?

Thanks for your help!

this is my Pump model


Solution

  • yes, you have to provide an expression for the outflowing enthalpy for both directions. Please see https://github.com/justnielsen/ModelicaTutorials/wiki/Stream-connectors in which the "reverse enthalpy" equation is written as port_in.h = port_out.h instead of port_in.h = inStream(port_out.h)

    It's very hard to comment further on your model without the code but, yes, pumps models can be tricky. Dual solutions could be a problem unless you ensure a monotonically decreasing pump head/pressure curve as a function of volume flow rate. Also, see paper https://simulationresearch.lbl.gov/wetter/download/2013-IBPSA-Wetter.pdf