Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Code flattening inner/outer failure

Code flattening inner/outer failure

Flattening of the model results in losing aliases of inner/outer variables.

Here's a test case:

Code:


model teststate3

  block Common
    Integer b;
  end Common;

  model Hookup
    outer Common global;
    Boolean active;
    parameter Integer m;
  algorithm
    when (active) then
      global.b := m;
    end when;
  end Hookup;

  inner Common global;

  Hookup fred (m = 0, active = true);
  Hookup ginger (m = 1, active = false);

end teststate3;

This produces (output of instantiateModel()):

Code:


class teststate3
  Integer global.b;
  Boolean fred.active = true;
  parameter Integer fred.m = 0;
  Boolean ginger.active = false;
  parameter Integer ginger.m = 1;
algorithm
  when fred.active then
    fred.global.b := fred.m;
  end when;
  when ginger.active then
    ginger.global.b := ginger.m;
  end when;
end teststate3;

In this example, "ginger.global.b" should be "global.b" etc.

Re: Code flattening inner/outer failure

Please consider creating tickets for bug reports instead of forum posts: https://trac.openmodelica.org/OpenModelica/newticket. Most of our developers don't read the forums.

If you want to subscribe to the ticket, CC yourself on https://trac.openmodelica.org/OpenModelica/ticket/2078

There are 0 guests and 0 other users also viewing this topic
You are here: