Opened 9 years ago

Closed 9 years ago

#3763 closed defect (fixed)

FMI 2.0 export broken in OpenModelica 1.9.4

Reported by: Rüdiger Franke Owned by: Martin Sjölund
Priority: blocker Milestone: 1.9.x
Component: Backend Version:
Keywords: Cc: Martin Sjölund

Description

The generation of the model structure does not work anymore for non-trivial models with 0e2f188/OMCompiler (Handle bootstrapping DoubleEndedList.mo) onwards. See the following example:

  loadModel(Modelica);
  translateModelFMU(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler);

The file modelDescription.xml just contains

  <ModelStructure>
  </ModelStructure>

It worked until 3094539/OMCompiler. The model structure should read:

  <ModelStructure>
    <Outputs>
      <Unknown index="27" dependencies="3" dependenciesKind="dependent" />
      <Unknown index="28" dependencies="2" dependenciesKind="dependent" />
      <Unknown index="42" dependencies="3" dependenciesKind="dependent" />
      <Unknown index="56" dependencies="3" dependenciesKind="dependent" />
    </Outputs>
    <Derivatives>
      <Unknown index="4" dependencies="2" dependenciesKind="dependent" />
      <Unknown index="5" dependencies="1 2 3" dependenciesKind="dependent dependent dependent" />
      <Unknown index="6" dependencies="1 2 3" dependenciesKind="dependent dependent dependent" />
    </Derivatives>
    <InitialUnknowns>
    </InitialUnknowns>
  </ModelStructure>

Btw. it's no fun to analyze this because the automatic build dependencies don't work between these two commits. Non-insiders have to do a complete new build.

Change History (20)

comment:1 by Adrian Pop, 9 years ago

Owner: changed from Lennart Ochel to Martin Sjölund
Status: newassigned

I'm assigning this to Martin. We should add a test where we output the generated xml to make sure we don't break this again.

comment:2 by Adeel Asghar, 9 years ago

We already have some tests which check for the generated xml e.g., testBug3049.mos, testBug2764.mos etc. But I think we need more tests.

comment:3 by Martin Sjölund, 9 years ago

Those tests are horrible, by the way. Better to just query the XML for the thing you are testing for. If any variable changes index, you can't tell anything from the diff in the XML...

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

6d761ce5 fixes the problem in master, but there are still 0 tests for this and no decision on what to call the maintenance branch.

comment:5 by Rüdiger Franke, 9 years ago

I will add a test.

comment:6 by Rüdiger Franke, 9 years ago

Done in 4c4b39f/OpenModelica-testsuite. We might improve the test to not look at particular variable indices later this year, e.g. in conjunction with an importing tool that cares about model structure.

One more question about a problem that arises from time to time:

  1. checkout 3094539/OMCompiler and build omc
  2. checkout 0e2f188/OMCompiler and call make -- it will fail

Is it possible to extend the make dependencies to make it work?

comment:7 by Martin Sjölund, 9 years ago

It builds fine for me after building both of them. If you are bootstrapping in the local build directory, it might not work. It is hard for make to know which exact version of omc that is part of the build/bin directory, so we just assume you will do rm build/bin/omc.exe if you need a newer one (or that you do what I do and just use /usr/bin/omc as the omc.exe used for bootstrapping).

You can also do some tricks like forcing a build of only the front-end omc.exe and continue building the full omc.exe using that version:

rm Compiler/boot/Makefile.sources
OPENMODELICA_BACKEND_STUBS=1 make -j4 omc
rm Compiler/boot/Makefile.sources
make -j4 omc

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:9 by Martin Sjölund, 9 years ago

Milestone: 1.10.01.9.x

comment:10 by Adrian Pop, 9 years ago

Something seems to be fishy with the fix or I'm doing something wrong building omc.

I built from source via:

> cd om
> git checkout v1.9.5
> cd OMCompiler
> git checkout v1.9.5
> cd ..
> make gitclean
> autoconf
> ./configure CC=gcc-4.4 CXX=g++-4.4 CFLAGS='-O2 -falign-functions' --without-omc
> make -j12

and running:

loadModel(Modelica);
translateModelFMU(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler);

still gives me an empty ModelStructure.

comment:11 by Rüdiger Franke, 9 years ago

I just tried under Jessie (gcc 4.9.2), starting from the current master (./configure --with-cppruntime):

$ cd om/OMCompiler
$ git checkout v1.9.5
$ cd ..
$ make

Afterwards translateModelFMU(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler) generated a model structure.

comment:12 by Adrian Pop, 9 years ago

@rfranke try to do a make gitclean before building again.

comment:13 by Rüdiger Franke, 9 years ago

make gitclean does not work on the om-level. I tried make clean; make instead ... and then waited ... and waited ... on my -j1 virtualbox. The FMU still has a model structure.

in reply to:  13 comment:14 by Adrian Pop, 9 years ago

Replying to rfranke:

make gitclean does not work on the om-level. I tried make clean; make instead ... and then waited ... and waited ... on my -j1 virtualbox. The FMU still has a model structure.

Strange, for me the master branch is fine but the v1.9.5 tag doesn't work. We'll wait for Martin to wake up to put me on the right track :)

comment:15 by Rüdiger Franke, 9 years ago

You are right! 1.9.5 does NOT work for Modelica.Fluid.Examples.DrumBoiler.DrumBoiler! It does work for the test though:

loadString("
model DrumBoiler
  extends Modelica.Fluid.Examples.DrumBoiler.DrumBoiler(use_inputs=true);
end DrumBoiler;
");
translateModelFMU(DrumBoiler);

use_inputs makes the difference.

comment:16 by Adrian Pop, 9 years ago

Maybe the fixes by Per a5957d/OMCompiler are needed also in v1.9.5.

comment:17 by Martin Sjölund, 9 years ago

I guess they are. I will add better testing of the function in question for maintenance and cherry-pick it into master. Then cherry-pick a5957d into maintenance.

in reply to:  17 comment:18 by Adrian Pop, 9 years ago

Replying to sjoelund.se:

I guess they are. I will add better testing of the function in question for maintenance and cherry-pick it into master. Then cherry-pick a5957d into maintenance.

Thanks! Let me know when is done.

comment:19 by Adrian Pop, 9 years ago

Ok. I think we can close this bug now.
We have an OpenModelica 1.9.6 out now:
https://openmodelica.org/newss/169-march-16-openmodelica-196
which I tested and it works.
The ModelStructure is present in the DrumBoiler example.

comment:20 by Martin Sjölund, 9 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.