.ModelicaReference.Operators.'actualStream()'

Information

The actualStream(v) operator is provided for convenience, in order to return the actual value of the stream variable, depending on the actual flow direction. The only argument of this built-in operator needs to be a reference to a stream variable. The operator is vectorizable, in the case of vector arguments. For the following definition it is assumed that an (inside or outside) connector c contains a stream variable h_outflow which is associated with a flow variable m_flow in the same connector c:

actualStream(port.h_outflow) = if port.m_flow > 0 then inStream(port.h_outflow)
                                                  else port.h_outflow;

Example

The actualStream(v) operator is typically used in two contexts:

der(U) = c.m_flow*actualStream(c.h_outflow); // (1)energy balance equation
h_port = actualStream(port.h);               // (2)monitoring the enthalpy at a port

In the case of equation (1), although the actualStream() operator is discontinuous, the product with the flow variable is not, because actualStream()) is discontinuous when the flow is zero by construction. Therefore, a tool might infer that the expression is smooth(0, ...) automatically, and decide whether or not to generate an event. If a user wants to avoid events entirely, he/she may enclose the right-hand side of (1) with the noEvent() operator.

Equations like (2) might be used for monitoring purposes (e.g. plots), in order to inspect what the actual enthalpy of the fluid flowing through a port is. In this case, the user will probably want to see the change due to flow reversal at the exact instant, so an event should be generated. If the user does not bother, then he/she should enclose the right-hand side of (2) with noEvent(). Since the output of actualStream() will be discontinuous, it should not be used by itself to model physical behaviour (e.g., to compute densities used in momentum balances) - inStream() should be used for this purpose. The operator actualStream() should be used to model physical behaviour only when multiplied by the corresponding flow variable (like in the above energy balance equation), because this removes the discontinuity.


Generated at 2024-12-21T19:25:56Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos