Opened 10 years ago

Closed 10 years ago

#3323 closed defect (fixed)

Weird results for the solution of a simple equation

Reported by: arvin84@… Owned by: Lennart Ochel
Priority: high Milestone: 1.9.3
Component: Backend Version: trunk
Keywords: Cc: Lennart Ochel, Willi Braun

Description (last modified by Adrian Pop)

OM ver.: 539229e

for the simple following model:

model a 
  Real x1; 
  Real x2; 
equation 
  x1 + x2 = 0; 
  x1 - x2 = 1; 
end a;

i get the following wrong answer:

x1=0.5;
x2=0;

Change History (6)

comment:1 by arvin84@…, 10 years ago

when i modify the code to the following:

model a 
parameter Real x1(fixed=false); 
parameter Real x2(fixed=false); 
initial equation 
x1 + x2 = 0; 
x1 - x2 = 1; 
end a;

i get the correct answer, x1=0.5, x2=-0.5;

comment:2 by Adrian Pop, 10 years ago

Cc: Lennart Ochel Willi Braun added
Component: UnknownBackend
Description: modified (diff)
Summary: weird results for the solution of a simple equation !!!!Weird results for the solution of a simple equation

comment:3 by Lennart Ochel, 10 years ago

Owner: changed from somebody to Lennart Ochel
Status: newaccepted

comment:4 by Lennart Ochel, 10 years ago

Thanks for the bug report.

Just to explain what happens:
x2 is detected as alias of –x1. Therefore, x2 is removed from the system and thus not handled properly during initialization. I have already a patch for the issue and I will contribute as soon as I tested it a bit more.

comment:5 by Lennart Ochel, 10 years ago

Well, actually this is not an initialization issue, since the system is already corrupted that is used to set up the initialization system.
The module that's not working correctly is removeSimpleEquations. I created now another patch to solve this problem at its root. Next, I will do again some testing.

comment:6 by Lennart Ochel, 10 years ago

Resolution: fixed
Status: acceptedclosed

Fixed with cc6a016/OMCompiler.

Note: See TracTickets for help on using tickets.