Opened 13 years ago

Last modified 12 years ago

#1694 closed defect

Tuple values in initial equations cause code generator to fail — at Version 1

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone:
Component: Backend Version:
Keywords: Cc: Martin Sjölund, Frenkel, TUD, Willi Braun

Description (last modified by Martin Sjölund)

model M
  function f
    input Real i1,i2,i3;
    output Real o1:=i1,o2:=i2,o3:=i3;
  end f;
  Real i1=1,i2=1,i3=1,o1,o2,o3;
initial equation
  (o1,o2,o3) = f(i1,i2,i3);
equation
  der(o1) = 1;
  der(o2) = 1;
  der(o3) = 1;
end M;

If we evaluate an equation like the function call above, we need to scalarize the tuples since you cannot create anonymous tuples in the C runtime.

o1 = i1;
o2 = i2;
o3 = i3;

For a larger example using this, see Modelica 3.2.Blocks.Examples.Filter

Change History (1)

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

Cc: Frenkel TUD added; Jens Frenkel removed
Component: Run-time
Description: modified (diff)
Note: See TracTickets for help on using tickets.