Turning Real
variables into discrete-valued ones is probably not possible considering the constraints on how such variables may be solved in Modelica models: each discrete-valued variable needs to be solved from an equation in solved form, and must not form cyclic dependencies with other discrete-valued variables. In addition, having many discrete-valued variables in a mixed system generally makes it more difficult to deal with.
By looking at the case of nNodes
= 1, which also simulates without problems, I made some additional observations that might be of interest. The discrete-valued variables are only region
and phase
variables. Moreover, there's just a single region
that actually contributes to mixedness in a non-trivial way. When the equation system tearing succeeds, this non-trivial discrete-valued variable becomes hidden as an intermediate variables of the computation that actually doesn't affect the mixedness of the equation block, so from the outside it becomes a system in only continuous-valued variables. This probably matches well what one would expect of a heat exchanger.
The first open question that remains is how to conclude that the region
and phase
variables can be given similar roles also for nNodes
> 1. Once that has been established, the next question becomes to think about what this means for our current approach of introducing temporary records for the results of function calls, especially when combined with equation tearing as a method of "hiding" the discrete-valued variables.
None of this is easy for someone who isn't an expert on media modeling in general, and modeling with Modelica and its Media
in particular. I'm also afraid it isn't really of any help to you.