Opened 9 years ago

Last modified 7 years ago

#3464 new defect

Failing variable lookup during array creation — at Version 1

Reported by: Rüdiger Franke Owned by: Marcus Walther
Priority: high Milestone: Future
Component: Cpp Run-time Version:
Keywords: Cc: Niklas Worschech, Marcus Walther

Description (last modified by Rüdiger Franke)

Some models from MSL trunk initialize arrays with expressions like TransformationMatrix:

function ToSpacePhasor
  input Real x[:];
  ...
protected
  parameter Integer m=size(x, 1);
  parameter Modelica.SIunits.Angle phi[m]=MultiPhase.Functions.symmetricOrientation(m);

  parameter Real TransformationMatrix[2, m]=2/m*{+cos(+phi),+sin(+phi)} for k in 1:m};
  ...
end ToSpacePhasor;

The Cpp runtime generates separate createArray functions that don't see the used variables. See e.g. Modelica.Electrical.Machines.Examples.Transformers.TransformerTestbench,

https://test.openmodelica.org/libraries/MSL_trunk_cpp/BuildModelRecursive.html

Shouldn't these functions be removed and the array be created in situ?

Change History (1)

comment:1 by Rüdiger Franke, 9 years ago

Description: modified (diff)

Commit

https://github.com/OpenModelica/OMCompiler/commit/e6cfb0d7575f47ffe80d5524db0bbc722ec3afa8

solves another problem with these examples -- the sizing of the array is wrong and appears not needed there.

Note: See TracTickets for help on using tickets.