﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
6054	The NF incorrectly renders the actualStream operator	Francesco Casella	Per Östlund	"Please consider the attached package, model {{{TestActualStream.Test}}}.

The {{{PressureLoss}}} component contains the following equation
{{{
h_a = actualStream(port_a.h_outflow);
}}}

which gets flattened in {{{ploss1}}} as
{{{
ploss1.h_a = smooth(0, 
  if ploss1.port_a.m_flow > 0.0 then source.ports[1].h_outflow
                                else ploss1.port_a.h_outflow);
}}}

This is of course wrong, because the expression inside the smooth operator is discontinuous in general.

The definition of actualStream in [https://specification.modelica.org/v3.4/Ch15.html#stream-operator-actualstream Section 15.3] of the Specification is
{{{
actualStream(c.h_outflow) = if c.m_flow > 0 then inStream(c.h_outflow)
                            else c.h_outflow;
}}}

with no {{{smooth()}}} operator. 

The {{{smooth}}} operator can be applied to expressions formed by multiplying the actualStream operator by its corresponding flow variable, as in case (1) mentioned in the Specification. That product is indeed smooth, because actualStream is discontinuous when the flow variable gets through zero. This case was indeed fixed in #5642.

However, the {{{actualStream()}}} operator by itself is ''not'' continuous and if not multiplied by its own flow variable it is explicitly recommended by the specification to generate an event when the flow variable crosses zero, so enclosing it in a {{{smooth(0, ...)}}} operator is not correct and should be avoided."	defect	closed	blocker	1.17.0	New Instantiation		fixed		Andrea Bartolini Karim Adbdelhak
