Opened 13 years ago

Last modified 13 years ago

#1697 closed defect (fixed)

Modelica.Media issues with code generation.

Reported by: adrpo Owned by: adrpo
Priority: high Milestone:
Component: Backend Version:
Keywords: Cc: adrpo, Frenkel TUD, wbraun

Description

Francesco C. made a small test for Media (attached).
TestMedia.TestModels.TestWater, TestMedia.TestModels.TestSteam have issues in the code generation.

Attachments (2)

TestMedia.mo (2.0 KB) - added by adrpo 13 years ago.
TestMedia.mos (904 bytes) - added by adrpo 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by adrpo

comment:1 Changed 13 years ago by wbraun

Actually, the issue is to support records in the Backend.
For example in "TestMedia.TestModels.TestWater" we inline a function parameter to one record expression.

record R1
 Real a;
end R1;

function foo
 input R1 in;
 output R1 out;
algorithm
  out.a := in.a;
end foo;

class A
 parameter R1 r1(a=3.0);
  R1 r2;
equation
  r2 = foo(r1);
end A;

results in

class A
 parameter Real r1.a = 3.0;
 Real r2.a;
equation
 r2.a = in.a;
end A;

Of course "in.a" is here not available in the global scope and that results into the code generation error.

As far as I can see, one easy way to support records in expressions like "rec = f(...)",
is to handle them exactly like tuple-function calls "(out1,out2) = func(...)".
Those are just transformed to algorithms for the Backend issues, this should be easier to
implement than handle them as array equations.

comment:2 Changed 13 years ago by sjoelund.se

Well, the inlining should of course take care to replace in.a with r1.a ... Just like it would change in to r1 if it was an Integer...

comment:3 Changed 13 years ago by Frenkel TUD

solved in revision 11285

Note: See TracTickets for help on using tickets.