Opened 7 years ago

Last modified 7 years ago

#4746 new enhancement

Trace back where a given component is defined (or modified) in a class

Reported by: Francesco Casella Owned by: Adrian Pop
Priority: high Milestone: Future
Component: Frontend Version:
Keywords: Cc:

Description

Inheritance is widely used to build Modelica models a) to factor out common behaviour and b) to customize models via replaceable classes and models.

Consider this simple example.

model A
  Real x "Amount of stuff XXX";
  Real y "Amount of stuff YYY";
  ...
end A;

model B
  extends A(y(start = 10));
  Real z "Amount of stuff ZZZ";
end B;

model C
  extends B;
  Real w;
equation
  x + y = 10;
  y + z = 15;
  x/z = w;
  w = 3;
end C;

Suppose I am inspecting model C, and I want to understand its equations. Unfortunately, the definitions of variables x, y, z, and of their start attribute (which could be critical for convergence) is not found in class C.

What I need to do as of today is to manually traverse the inheritance chain to discover the definition of z in B, of x,y in A, and the redeclaration of the start attribute of y in B.

The compiler knows about all this stuff, so it would be really nice if it could spare me the waste of time of the manual search and give me this information. For example, if I right click on y in model C, it will tell me that the variable is defined in model A and the start attribute modified in class B, and possibly open extra tabs in OMEdit where those definitions are highlighted.

BTW, this feature would be immensely useful to allow people to really understand models from complex libraries like Modelica.Media and Modelica.Fluid.

Would this be doable without too much effort?

Change History (2)

comment:1 by Francesco Casella, 7 years ago

Summary: Trace back where a given component is defined (or last modified) in a classTrace back where a given component is defined (or modified) in a class

comment:2 by Francesco Casella, 7 years ago

Component: Installation programFrontend
Note: See TracTickets for help on using tickets.