Opened 13 years ago

Last modified 12 years ago

#1734 closed defect (fixed)

Compiler generates bad flattened version of function from MSL

Reported by: Bill Janssen Owned by: Bill Janssen
Priority: high Milestone: 1.9.0
Component: Frontend Version:
Keywords: Cc: Bill Janssen, Per Östlund

Description

If you flatten the attached model (RC_ideal.RC_driveline), you'll see that it includes a copy of Math.tempInterpol1 from the MSL 3.1. However, it changes the assignment of the result! In the MSL, that assignment is

y := y1 + (y2 - y1) * (u - u1) / (u2 - u1);

In the flattened code, it comes out as

y := y1 + (y2 - y1 * (u - u1)) / (u2 - u1);

Don't know if this is a parser bug or DAE bug.

Attachments (1)

RC_ideal.mo (18.8 KB ) - added by Bill Janssen 13 years ago.

Download all attachments as: .zip

Change History (5)

by Bill Janssen, 13 years ago

Attachment: RC_ideal.mo added

comment:1 by Per Östlund, 13 years ago

This is a bug in the dumping of the flattened code. So it doesn't affect the DAE or simulation, it's just a visual error in the flattened code. It seems to be non-trivial to fix this the way the expression dumping works right now, so it's probably best to just rewrite the expression dumping as a template as planned instead. For now it's safe to use this function though, the bug doesn't change the result.

comment:2 by Per Östlund, 13 years ago

This has now been fixed in revision 11885 by the implementation of a shiny new expression dumping module. If you find any other issues with the expression dumping, just open a new ticket and assign it to me.

comment:3 by Bill Janssen, 13 years ago

Looks good here. You can close this one.

comment:4 by Martin Sjölund, 12 years ago

Component: Frontend
Milestone: 1.9.0
Note: See TracTickets for help on using tickets.