﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3294	Precalculate less functions	Rüdiger Franke	somebody	"The example `Modelica.Utilities.Examples.readRealParameterModel` is all about reading model parameters at simulation time.
{{{#!mo
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. It would be fine if the string parameter `file` was fixed, but the contents of 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 intented, without tricks?
"	defect	new	high	1.9.3	Frontend	trunk			
