modelInversion2
Extends from ThermofluidStream.Idealized.Tests.Inversion.BaseClasses.PartialInverse (Base model defining the mixing problem), Modelica.Icons.Example (Icon for runnable examples).
Information
Mixing of two fluid flows A and B. Assuming constant specific heat capacities c_p, the mixing equation is:
m_flow_A * T_A + m_flow_B * T_B = (m_flow_A + m_flow_B) * T_mix;
This equation can be easily solved for a single unknown.
In this test, we solve for the temperature T_B such that the mixing temperature is T_mix = 25 °C. The solution is:
T_B = ((m_flow_A + m_flow_B) * T_mix - m_flow_A * T_A) / m_flow_B
= (2*25 - 1*20) / 1 °C
= 30 °C
Dymola uses the temperature sourceB.T0 as the iteration variable and defaults the start value to T0 = 0, which causes the simulation to fail.
By specifying sourceB(T0(start=Medium.T_default)), Dymola can solve the 'nonlinear' equation.
Since T0 is protected, giving it a start value generates a warning, and removing the protected modifier would cause an error due to the current implementation of the source.
However, using sourceB(T0_var(start=Medium.T_default)) (which is not protected) allows Dymola to solve the nonlinear equation correctly.
Components
| Type | Name | Default | Description |
|---|---|---|---|
| ThermofluidStream.DropOfCommons | dropOfCommons (from PartialInverse) | ||
| ThermofluidStream.Boundaries.Source | sourceA (from PartialInverse) | ||
| .ThermofluidStream.Idealized.Boundaries.Sink_free | sink (from PartialInverse) | ||
| ThermofluidStream.Idealized.Topology.JunctionT2 | junction (from PartialInverse) | ||
| ThermofluidStream.Boundaries.Source | sourceB (from PartialInverse) | ||
| .ThermofluidStream.Idealized.Boundaries.MassFlowRate | massFlowRateB (from PartialInverse) | ||
| .ThermofluidStream.Idealized.Boundaries.MassFlowRate | massFlowRateA (from PartialInverse) | ||
| ThermofluidStream.Sensors.SingleSensorSelect | singleSensorSelect (from PartialInverse) | ||
| Modelica.Blocks.Math.InverseBlockConstraints | inverseBlockConstraints | ||
| Modelica.Blocks.Sources.RealExpression | temperatureSetpoint |
Revisions
-
2026, by Raphael Gebhart (raphael.gebhart@dlr.de):
Initial version.