Opened 10 years ago
Last modified 7 years ago
#3294 new defect
Precalculate less functions
Reported by: | Rüdiger Franke | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
The example Modelica.Utilities.Examples.readRealParameterModel
is all about reading model parameters at simulation time.
model readRealParameterModel "Demonstrate usage of Examples.readRealParameter/.expression" import SI = Modelica.SIunits; extends Modelica.Icons.Example; parameter String file = Modelica.Utilities.Files.loadResource("modelica://Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt") "File on which data is present"; parameter SI.Inertia J = readRealParameter(file, "J") "Inertia"; parameter SI.Angle phi_rel0 = readRealParameter(file, "phi_rel0") "Relative angle"; parameter SI.AngularVelocity w_rel0 = readRealParameter(file, "w_rel0") "Relative angular velocity"; end readRealParameterModel;
OpenModelica evaluates everything at translation time. This can hardly be counted as a passed test. The file
must be read at simulation time.
As of today one can generally introduce some dummy inputs, whose values are not known at translation time, and pass them to a function like readReadParameter
. Then the evaluation of the function is shifted to the simulation time -- and it works fine typically.
How can the translation of OpenModelica be changed to evaluate less functions, so that models like readRealParameterModel
work as intended, without tricks?
Change History (10)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Description: | modified (diff) |
---|
comment:3 by , 10 years ago
Thanks, it works when taking over +d=nogen,initialization
from the nightly tests.
Shouldn't this be made a default setting, i.e. the nightly tests run with default options?
comment:4 by , 9 years ago
It appears that omc has changed. The above example works with default settings now. Can someone confirm the change?
comment:9 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:10 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
You can use +d=nogen and it won't generate any dlls during translation.
Some models might not work. However, we do run all the coverage testing with +d=nogen so most of the models in the libs that work in the coverage should be fine.
I'm working on not evaluating any function during translation (if not needed).