For the model of a heat generating device, I want to have the optional possibility to extract the heat via a fluid flow. This is related to question "conditional component declaration and a following if equation". In my code the model is derived from Modelica.Fluid.Interfaces.PartialTwoPortTransport. I have written an equivalent partial class having conditional fluidport connectors using the 'internalize équation' méthode. Now I must add two equations like:
port_b.h_outflow *m_flow=inStream(port_a.h_outflow)*m_flow+prescribedTemperature.port.Q_flow;
It can be internalized with a division by m_flow, but if I do that it will lose the ability to detect that Q_flow=0.
What other approach can work?