Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#2136 closed defect (fixed)

FMI Export: _info.xml not found

Reported by: christian.richter@… Owned by: Martin Sjölund
Priority: high Milestone: 1.9.0
Component: FMI Version: trunk
Keywords: Cc: Willi Braun

Description

I'm using the FMU Export for a coupled multibody - discrete element model. The simple models (pendulum) are working fine, but more complex models are showing the following error:


fmusim Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot.fmu 1 0.00001 1 .
cmd='7z x -aoa -ofmuTmpZqLbnD/ "Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot.fmu" > /dev/null'
fmiModelDescription
  fmiVersion=1.0
  modelName=Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot
  modelIdentifier=Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot
  guid={8c4e810f-3df3-4a00-8276-176fa3c9f9e0}
  generationTool=OpenModelica Compiler 1.9.0 beta4+dev (r15723)
  generationDateAndTime=2013-04-03T13:51:01Z
  variableNamingConvention=structured
  numberOfContinuousStates=36
  numberOfEventIndicators=31
dllPath = fmuTmpZqLbnD/binaries/linux64/Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot.so
FMU Simulator: run 'Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot.fmu' from t=0..1 with step size h=1e-05, loggingOn=1, csv separator='.'
ok Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot (log): fmiSetTime: time=0
ok Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot (log): fmiInitialize: toleranceControlled=0 relativeTolerance=0
assert            | assert  | Failed to open file Modelica_Mechanics_MultiBody_Examples_Systems_RobotR3_fullRobot_info.xml: No such file or directory
|                 | |       | 
Speicherzugriffsfehler (Speicherabzug geschrieben)

This is not the case with releases smaller R14929.
What's wrong with the FMU Export ?

Thanks,
Christian

Change History (19)

comment:1 by Adeel Asghar, 12 years ago

Status: newaccepted

comment:2 by Adrian Pop, 12 years ago

Cc: Willi Braun added

Oh, we generate the file model_info.xml and we don't add it to the fmu.
https://trac.openmodelica.org/OpenModelica/changeset/15865
The question is where to add it? At the same place with modelDescription.xml or some other place?

comment:3 by Adrian Pop, 12 years ago

There are several alternatives (feel free to comment on them):

  • We add the model_info.xml file to the resources/ directory in the .fmu (which is specified in the FMI spec). The question is how we read it from there.
  • We xxd the model_info.xml file into a .c file and compile it in and read it from the array
  • We generate .c file for FMU instead of model_info.xml for the equation data.
  • We don't put the model_info.xml file into the .fmu and we don't have any debugging info. We just report that the file is not present and continue.

The xxd generates big files and gcc needs a lot of time to compile them:

adrpo@ida-liu050 ~/dev/OpenModelicaNoChanges/testsuite/simulation/libraries/msl32
$ time xxd -i Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.xml > Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.c

real    0m1.227s
user    0m0.936s
sys     0m0.264s

adrpo@ida-liu050 ~/dev/OpenModelicaNoChanges/testsuite/simulation/libraries/msl32
$ time gcc -c -O2 Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.c

real    0m28.778s
user    0m0.000s
sys     0m0.031s

adrpo@ida-liu050 ~/dev/OpenModelicaNoChanges/testsuite/simulation/libraries/msl32
$ ls -lah *_info.*
-rw-r--r-- 1 adrpo Administrators  25M Apr 26 22:32 Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.c
-rw-r--r-- 1 adrpo Administrators 4.0M Apr 26 22:32 Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.o
-rw-r--r-- 1 adrpo Administrators 4.0M Apr 25 00:44 Modelica.Fluid.Examples.IncompressibleFluidNetwork_info.xml

so I guess is quite impractical.

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

I would say use xxd and compile it as a separate object. Then link it in. That should be fast enough.

comment:5 by Adrian Pop, 11 years ago

This was already fixed by Willi (wbraun) a while back by including the .xml in the FMI.

comment:6 by Martin Sjölund, 11 years ago

No, it is not fixed!

[martin@mega tmp2]$ ~/dev/fmusdk/source/fmusim/fmusim ../M.fmu 
warning: Could not get value of FMUSDK_HOME, assuming 7zip is in your path.
cmd='7z x -aoa -ofmuTmpANYCuK/ "../M.fmu" > /dev/null'
dllPath = fmuTmpANYCuK/binaries/linux64/M.so
FMU Simulator: run '../M.fmu' from t=0..1 with step size h=0.1, loggingOn=0, csv separator=';'
assert            | assert  | simulation_input_xml.cpp: Error: can not read file M_init.xml as setup file to the generated simulation code.
Segmentation fault

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

Anyway, xxd and then gcc -O0 works rather well. I think bin2c might be faster though.

comment:8 by Adrian Pop, 11 years ago

Strange. I remember Willi fixing this. Maybe some other issues appeared. Or is maybe because you used relative path?

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

It is because the FMI spec does not allow you to read objects in the FMU. Who says it was even decompressed?

comment:10 by Adrian Pop, 11 years ago

As far as I know it does. You can have stuff in a Resources directory.

comment:11 by Willi Braun, 11 years ago

Yes, my solution was bad in that case, so one need to copy the *.xml files to the place, where the binary is executed. We need to change that, again. Martin solution sound reasonable.

comment:12 by Adrian Pop, 11 years ago

Just let me know as in this case I will need to compile and add xxd or bin2c to our MinGW in Windows.

in reply to:  10 comment:13 by Martin Sjölund, 11 years ago

Replying to adrpo:

As far as I know it does. You can have stuff in a Resources directory.

Yes, but:

  • It is not standardized how to access this using relative path
  • We do not put it in resources

Also, do not use xxd. I created a small python script that does not hexdump the string. This is *much* faster for the gcc lexer!

[martin@mega tmp2]$ ls -lh a.c && time gcc -O0 -c a.c
-rw-rw-r-- 1 martin martin 3.7M Jun 26 17:24 a.c

real	0m0.144s
user	0m0.120s
sys	0m0.020s

The downside is this script is slower than bin2c or xxd. I will see if I can create a small utility that we can ship with omc. Or maybe we just add it to systemimpl.c. It is not hard to escape to C-strings.

comment:14 by Adrian Pop, 11 years ago

Ok. But please don't use Python as we don't have it by default in Windows. Perl should be fine (we already have that in MinGW shipped with OpenModelica).

comment:15 by Martin Sjölund, 11 years ago

I think we have code to escape to C-strings already in templates. Should be possible to skip generation of xml...

comment:16 by Martin Sjölund, 11 years ago

Owner: changed from Adeel Asghar to Martin Sjölund

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

Resolution: fixed
Status: acceptedclosed

Fixed in r16498.

comment:18 by placemesiva@…, 11 years ago

Summary: FMI Export: _info.xml not foundFMU Simulation error
Type: defectdiscussion

Hello I tried to build simple models and could generate the below for
1) me
--- binaries
--- source
--- documentation

2) cs
--- binaries
--- source
--- documentation

But when i run the command fmusim me bouncingBall.fmu 5 0.1 0 s... is throws error message
As
fmiModelDescription
Assertion failed: modelId, file ..\shared\xml_parser.c, line 137

Please help..

regards,
Siva

comment:19 by Martin Sjölund, 11 years ago

Summary: FMU Simulation errorFMI Export: _info.xml not found
Type: discussiondefect

Create a new ticket if you have a new ticket; don't change a closed ticket for what seems to be an unrelated bug.

Note: See TracTickets for help on using tickets.