Opened 10 years ago

Last modified 7 years ago

#3294 new defect

Precalculate less functions — at Version 2

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 (2)

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)
Note: See TracTickets for help on using tickets.