Opened 6 years ago
Last modified 4 years ago
#5390 assigned defect
The NF should not evaluate final record parameters unless they only depend on structural or final parameters
Reported by: | Francesco Casella | Owned by: | Karim Adbdelhak |
---|---|---|---|
Priority: | high | Milestone: | 2.1.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Karim Adbdelhak |
Description
Please consider the Modelica.Mechanics.MultiBody.Examples.Elementary.HeatLosses
model. The final
parameter body1.R_start
is currently constant-evaluated, to avoid the bindings ending up in the initial equation sections, where the back-end doesn't handle them correctly.
However, the Body
model contains the following declaration:
final parameter Frames.Orientation R_start= Modelica.Mechanics.MultiBody.Frames.axesRotations( sequence_start, angles_start, zeros(3)) "Orientation object from world frame to frame_a at initial time";
where angles_start
is not final
, nor it has an Evaluate = true
annotation. Hence, R_start
should not be constant evaluated, and it should be possible to get it automatically updated if angles_start
is changed at run time, without the need to recompile the model from scratch. In fact, that's exactly what Dymola does.
Notice that with the current new front-end and backend, simply moving the final binding to the initial equation section produces incorrect results, see the original bug report in #5288.
Change History (3)
comment:1 by , 6 years ago
Component: | New Instantiation → Backend |
---|---|
Owner: | changed from | to
comment:2 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
@Karim, feel free to reassign it to Andreas.
comment:3 by , 4 years ago
It seems I accidentally fixed HeatLosses in 632d2164, see report (there are some regressions, but I was expecting worse and will fix those later). body1.R_start
is still evaluated though, so I guess it somehow got fixed when I improved the handling of record expressions in the backend.
So the model is fixed but the ticket is still valid in that the compiler probably shouldn't evaluate that parameter, and disabling the evaluation in the frontend still causes simulation issues for some models.
Changing to backend, since the only reason the NF evaluates the binding is to work around backend issues. All that's needed to stop evaluating it and instead move it to an initial equation is to revert the small change in e11c6c60 (the results of that commit might be of interest to anyone who wants to try).
Edit: Updated link due to repository changes.