Opened 8 years ago

Closed 8 years ago

#3763 closed defect (fixed)

FMI 2.0 export broken in OpenModelica 1.9.4

Reported by: rfranke Owned by: sjoelund.se
Priority: blocker Milestone: 1.9.x
Component: Backend Version:
Keywords: Cc: sjoelund.se

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 Changed 8 years ago by adrpo

  • Owner changed from lochel to sjoelund.se
  • Status changed from new to assigned

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 Changed 8 years ago by adeas31

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 Changed 8 years ago by sjoelund.se

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 Changed 8 years ago by sjoelund.se

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 Changed 8 years ago by rfranke

I will add a test.

comment:6 Changed 8 years ago by rfranke

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 Changed 8 years ago by sjoelund.se

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 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:9 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.9.x

comment:10 Changed 8 years ago by adrpo

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 Changed 8 years ago by rfranke

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 Changed 8 years ago by adrpo

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

comment:13 follow-up: Changed 8 years ago by 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.

comment:14 in reply to: ↑ 13 Changed 8 years ago by adrpo

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 Changed 8 years ago by rfranke

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 Changed 8 years ago by adrpo

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

comment:17 follow-up: Changed 8 years ago by 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.

comment:18 in reply to: ↑ 17 Changed 8 years ago by adrpo

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 Changed 8 years ago by adrpo

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 Changed 8 years ago by sjoelund.se

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.