Returns "if x >= 0 then positiveSlope*x else negativeSlope*x" and handle x=0 in a meaningful way

semiLinear(x, positiveSlope, negativeSlope)

Returns "if x >= 0 then positiveSlope*x else negativeSlope*x". In some situations, equations with the semiLinear function become underdetermined if the first argument (x) becomes zero, i.e., there are an infinite number of solutions. It is recommended that the following rules are used to transform the equations during the translation phase in order to select one meaningful solution in such cases:

**Rule 1**: The equations

y =semiLinear(x, sa, s1); y =semiLinear(x, s1, s2); y =semiLinear(x, s2, s3); ... y =semiLinear(x, sN, sb);

may be replaced by

s1 =ifx >= 0thensaelsesb s2 = s1; s3 = s2; ... sN = sN-1; y =semiLinear(x, sa, sb);

**Rule 2**: The equations

x = 0; y = 0; y =semiLinear(x, sa, sb);

may be replaced by

x = 0 y = 0; sa = sb;

*[For symbolic transformations, the following property is
useful (this follows from the definition):*

semiLinear(m_flow, port_h, h);

is identical to

-semiLinear(-m_flow, h, port_h);

*The semiLinear function is designed to handle reversing flow
in fluid systems, such as*

H_flow =semiLinear(m_flow, port.h, h);

*i.e., the enthalpy flow rate H _flow is computed from the
mass flow rate m_flow and the upstream specific enthalpy depending
on the flow direction.]*

Generated at 2020-01-18T02:38:32Z by OpenModelicaOpenModelica 1.16.0~dev-112-ge6180d5 using GenerateDoc.mos