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 Rüdiger Franke)

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 Adrian Pop, 10 years ago

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).

comment:2 by Rüdiger Franke, 10 years ago

Description: modified (diff)

comment:3 by Rüdiger Franke, 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 Rüdiger Franke, 9 years ago

It appears that omc has changed. The above example works with default settings now. Can someone confirm the change?

comment:5 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:6 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:8 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:9 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:10 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

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.

Note: See TracTickets for help on using tickets.