Open congtoantran opened 11 months ago
@HansOlsson I can reproduce in Dymola 2024x, but not in SimulationX 4.4. Is it a tool-issue (of one of the tools)?
It works though (in both tools) if the variability is changed to parameter
.
model Model1b
replaceable package Medium = Modelica.Media.R134a.R134a_ph "Medium model"
annotation (choicesAllMatching=true);
Medium.ThermodynamicState state_a;
parameter Modelica.Units.SI.AbsolutePressure p=Medium.p_default;
parameter Modelica.Units.SI.SpecificEnthalpy h=Medium.h_default;
equation
//state_a = Medium.setState_phX(Medium.p_default, Medium.h_default);
state_a = Medium.setState_phX(p, h);
end Model1b;
I would say it is a library issue that can be corrected.
The issue is that this record has a Boolean member (phase), and a Boolean equation requires that both sides are discrete-time valued, section 3.8.4.
The correction would be that the phase-functions get inlined with events.
I checked @HansOlsson's pull request PR #4263 and it looks good to me.
@arunkumar-narasimhan please back-port this to maint/4.1.0
This issue is actually a regression from v.4.0.0 but I also marked it with the 4.1.0-dev label so we don't forget about it
@Esther-Devakirubai please back-port this to maint/4.1.x, then you can close this ticket. Thanks!
I have a library which works well on Modelica 3.3.2, but when converted to Modelica 4.0.0, it doesn't work anymore, and the message error is "Non-real equation in continuous time are not legal:".
I'm trying to understand the problem by using a very simple example (see below):
The above model runs sucessfully. But when I redefine the variable state_a by using the second line in the equation part, the model does not work and the error is :
Any help to understand the error? Many thanks. I use Dymola 2021, Modelica 4.0.0