Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#2588 closed defect (fixed)

+modelicaOutput does not work properly.

Reported by: lochel Owned by: fbergero
Priority: high Milestone: 1.9.4
Component: Frontend Version: trunk
Keywords: Cc:

Description (last modified by lochel)

The configuration flag + modelicaOutput does not work properly as the following script illustrates:

loadString("
package foo
  connector bInput = input Boolean \"'input Boolean' as connector\";
  connector bOutput = output Boolean \"'output Boolean' as connector\";

  model M1
    bOutput signal(start=true, fixed=false);
  equation
    signal = time > 0.5;
  end M1;

  model M2
    bInput signal;
    Real x(start=1, fixed=true);
    discrete Real t0(start=0, fixed=true);
  equation
    when edge(signal) then
      t0 =  time;
    end when;
    der(x) = if signal then 1 else 0;
  end M2;

  model M1_M2
    M1 control;
    M2 machine;
  equation
    connect(control.signal, machine.signal);
  end M1_M2;
end foo;
"); getErrorString();

setCommandLineOptions("+modelicaOutput"); getErrorString();
instantiateModel(foo.M1_M2); getErrorString();

The generated output is the following:

class foo.M1_M2
  output Boolean control__signal(start = true, fixed = false);
  input Boolean machine__signal;
  Real machine__x(start = 1.0, fixed = true);
  discrete Real machine__t0(start = 0.0, fixed = true);
equation
  control.signal = time > 0.5;
  when edge(machine.signal) then
  machine.t0 = time;
  end when;
  der(machine.x) = if machine.signal then 1.0 else 0.0;
  control__signal = machine__signal;
end foo.M1_M2;

Change History (9)

comment:1 Changed 11 years ago by lochel

  • Description modified (diff)

comment:2 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.1 to 1.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:3 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:4 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:5 Changed 9 years ago by fbergero

  • Owner changed from somebody to fbergero
  • Status changed from new to accepted

comment:6 Changed 9 years ago by fbergero

I have a fix for this bug and for generating valid modelica output when dumping the DAE in general. I checked the dot operator in variable names, expressions and funcion names. Also the names of (multi-dimensional) arrays variables were fixed since before an array

Real a[10];

would generate

Real a[1];
Real a[2];
...
Real a[10];

Can anybody think of any other language structure that would generate invalid Modelica when dumped?

comment:7 Changed 9 years ago by fbergero

  • Resolution set to fixed
  • Status changed from accepted to closed

This is fixed with changes introduced in pull request
https://github.com/OpenModelica/OMCompiler/pull/303

comment:8 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:9 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.