Opened 11 years ago

Closed 7 years ago

#2242 closed defect (worksforme)

function with multiple outputs is treated strange

Reported by: wbraun Owned by: somebody
Priority: normal Milestone: 1.12.0
Component: Frontend Version: trunk
Keywords: Cc: perost, adrpo, vitalij

Description

In the following model the function f1 is simplified wrong to 1.
For some reasons the function f is constant, when f1 is simplified.

function f
  input Real x;
  output Real y;
  output Real y1;
algorithm
  y := exp(x);
end f;

function f1
  input Real x;
  output Real y;
algorithm
  y := 1 / f(x); // don't work
  //y := (-f(x)) / (-2); // works
  //y := f(x) / 2; // don't work
  //y := f(x) + f(x); // don't work !!!
end f1;

model A
  Real y;
equation
  y = f1(time);
end A;

Change History (11)

comment:1 Changed 11 years ago by wbraun

  • Priority changed from high to normal

Okay, I found a missing case for tuples in ExpressionSimplify(r16348). So that the first 3 cases are fixed.

But following is still open:

function f
  input Real x;
  output Real y;
  output Real y1;
algorithm
  y := exp(x);
end f;

function f1
  input Real x;
  output Real y;
algorithm
  y := f(x) + f(x); // fails !!!
  y := (-f(x)) + f(x); // works
  y := f(x) + (-f(x)); // works
  y := (-f(x)) + (-f(x)); //works
end f1;

model A
  Real y;
equation
  y = f1(time);
end A;

I guess we need to expand tuples somewhere.

Last edited 11 years ago by wbraun (previous) (diff)

comment:2 Changed 11 years ago by sjoelund.se

I think these probably just lack the DAE.TSUB on the right side. Factors, etc, should not handle tuples!

Last edited 11 years ago by sjoelund.se (previous) (diff)

comment:3 Changed 11 years ago by sjoelund.se

  • Milestone changed from 1.9.0 to 1.9.1

Postponed until 1.9.1

comment:4 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.1 to 1.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:5 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:6 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:7 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:8 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:9 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:10 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:11 Changed 7 years ago by casella

  • Resolution set to worksforme
  • Status changed from new to closed

Works as expected in v1.13.0-dev-155-g68350e9

Note: See TracTickets for help on using tickets.