Opened 9 years ago

Last modified 6 years ago

#3997 assigned defect

Missing replacement of identifiers when inlining functions — at Version 4

Reported by: Rüdiger Franke Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: Willi Braun, Vitalij Ruge

Description (last modified by Rüdiger Franke)

OpenModelica generated unnecessarily large and non-linear equation systems for the PowerSystems library so far. The reason was missing annotation(Inline=true) for small one-liner functions.

Commit
https://github.com/modelica/PowerSystems/commit/61ba3296af8b2ebdcb86adff0c222291a6a820d7
introduces these annotations.

In some models the compilation fails due to missing identifier xx now. This comes from inlining PhaseSystems.ThreePhase_dq0.jj. See an example:

model InlineMatrixFunction
  function jj "Vectorized version of j"
    input Real[:,:] xx "array of voltage or current vectors";
    output Real[size(xx,1),size(xx,2)] yy "array of rotated vectors";
  algorithm
    yy := cat(1, {-xx[2,:], xx[1,:]}, zeros(size(xx,1)-2, size(xx,2)));
    annotation(Inline=true);
  end jj;
  Real[3, 1] v = {{1}, {2}, {3}};
  Real[3, 1] jv = jj(v);
end InlineMatrixFunction;

See e.g.:

PowerSystems.Examples.Spot.AC3ph.Line
PowerSystems.Examples.Spot.TransmissionAC3ph.FaultTline
PowerSystems.Examples.Spot.TransmissionAC3ph.Tline

Unfortunately the nightly tests don't report backenddaeinfo. Shouldn't the nightly tests use the same options for MSL and for other libraries, like PowerSystems?

Change History (4)

comment:1 by Vitalij Ruge, 9 years ago

Cc: Vitalij Ruge added

possible connect to #3687 and cat

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

Milestone: Future1.10.0

It does not seem to be cat. Where is the function inlined, in the frontend module referred in comment:1 or in the new backend module?

comment:3 by Vitalij Ruge, 9 years ago

In the defaulte case the function is inliened from backend modul, which call the Frontend functions for expresion modification.
(Note: --inlineMethod=append and --inlineMethod=replace return different systems)

If we disable the backend module.

--preOptModules-=normalInlineFunction  +d=optdaedump --postOptModules-=lateInlineFunction > dump.log

then a other modul (possible: in index reduction inlineOrgEqns) will inline the function.
Disable inlining for evry modul with

+d=noinlineFunctions // INLINE_FUNCTIONS=False

help to start simulation.

Last edited 9 years ago by Vitalij Ruge (previous) (diff)

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

Component: *unknown*Backend
Description: modified (diff)
Owner: changed from somebody to Lennart Ochel
Note: See TracTickets for help on using tickets.