Opened 9 years ago

Last modified 9 years ago

#3511 assigned defect

BackendDAEUtil.tryToSolveOrDerive don't use functionTree

Reported by: Vitalij Ruge Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: Willi Braun, Patrick Täuber

Description (last modified by Vitalij Ruge)

Differentiate.differentiateExpSolve,ExpressionSolve.solve2 in tryToSolveOrDerive need for correct handling of functions the functionTree.

Example:

model testTearing
  function f
    input Real t;
    output Real y;
  algorithm
    y := 2 * t;
  end f;

  Real a annotation(tearingSelect = always);
  Real b;
  Real _a annotation(tearingSelect = always);
  Real _b;
equation
  a = b + f(b);
  b = sin(a) + 3 * f(b);
  _a = _b + 2 * _b;
  _b = sin(_a) + 3 * 2 * _b;
end testTearing;

It should be possible to find same tearing for a,b loke for _a,_b

Change History (14)

comment:1 by Vitalij Ruge, 9 years ago

Cc: Willi Braun added

comment:2 by Vitalij Ruge, 9 years ago

Cc: Patrick Täuber added

comment:3 by Lennart Ochel, 9 years ago

Component: UnknownBackend

Can you provide a (small) test case?

comment:4 by Vitalij Ruge, 9 years ago

Description: modified (diff)

comment:5 by Vitalij Ruge, 9 years ago

Description: modified (diff)

comment:6 by Lennart Ochel, 9 years ago

You put yourself as owner. Does it mean that you are working on this?

comment:7 by Vitalij Ruge, 9 years ago

Status: newaccepted

comment:8 by Lennart Ochel, 9 years ago

You are right, once the functionTree is passed through the call hierarchy, the example from the description works as expected. This are my changes: ec9085. Should I push the commit, or would you like to fix it differently?

comment:9 by Vitalij Ruge, 9 years ago

Owner: changed from Vitalij Ruge to Lennart Ochel
Status: acceptedassigned

comment:10 by Vitalij Ruge, 9 years ago

Good!
The Output value for the functionTree is missing.
OM should remember function derivatives in functionTree.

comment:11 by Vitalij Ruge, 9 years ago

proposal:
If possible extends you changes for output functionTree.
In the next step we should extend the outputs from Differentiate.differentiateExpSolve
and ExpressionSolve.solve2.

comment:12 by Lennart Ochel, 9 years ago

Do you want something like 0a05f1 and da9f032?
I would leave ExpressionSolve.solve2 for #3512.

comment:13 by Vitalij Ruge, 9 years ago

yes :).
It would nice to have getAdjacencyMatrixEnhancedScalar update shared with functionTree and return new shared e.g. for selectStatesWork1 and then selectStatesWork or for tearingSystemWork ....

Otherwise we losing the information in the functionTree?? (I don't know)

comment:14 by Lennart Ochel, 9 years ago

The changes causes problems for some models:

./simulation/libraries/3rdParty/ThermoPower/Bug2537.mos
./simulation/libraries/3rdParty/ThermoPower/ThermoPower.Examples.CISE.CISESim2States120501.mos
./simulation/modelica/initialization/OverdeterminedInitialization.Fluid.DynamicPipesSeriesLargeNSteadyStateInitial.mos
Note: See TracTickets for help on using tickets.