.StreamConnectors.Components.Valve

Information

This is probably the simplest model of a heated/cooled pipe.

Governing equations

The equations "on paper" are:

min = mout

pin - pout = deltaP=u.K.min|min|

mout.hout = min.hin + Q

Representing the conservation of mass, momentum and energy.

Implementation

To understand the implementation and the concept of stream connectors:

  1. comment all code in the equation section.
  2. 'check' the model (in Dymola, hit the F8 key). The code checker will say that the model is unbalanced with six unknowns and two equations.
  3. try to understand why four equations are needed when the model can be described with only three equations on paper.


The fact is that in Modelica, for each stream connector you need to provide a value for the outgoing stream variable (h_outflow in this case) when or if the mass flow leaves the connector.

In the pipe case it means that you must provide an expression for port_b.h_outflow (obviously) and port_a.h_outflow (for the case of flow reversal).

On the Github Wiki page on Stream connectors, I've provided one more example similar to this.


Generated at 2024-04-25T18:15:59Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos