﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5146	FMU export in ME 1.0 mode broken for OMEdit (but works with omc)	anatoly.trosinenko@…	Adeel Asghar	"When exported through OMEdit menu, FMU is exported successfully in ME 1.0 mode, but when loaded with FMUChecker, complains about inability to load some JSON resource, and then crashes with Segmentation Fault. Interestingly, when manually specifying FMI version ""1.0"" instead of ""1"" (which is issued by OMEdit), FMU works correctly.

== How to reproduce ==
Open OMEdit and select Model Exchange 1.0 FMU format in settings, then compile the following model:
TestFMU.mo
{{{
#!modelica
model TestFMU
  output Real x;
equation
  der(x) = x;
end TestFMU;
}}}

It is compiled successfully, but when run with FMUChecker 2.0.4, I got the following error:
{{{
$ ~/tmp/FMUChecker-2.0.4/build/fmuCheck.linux64 TestFMU.fmu
[INFO][FMUCHK] FMI compliance checker Test [FMILibrary: Test] build date: Sep 14 2018
[INFO][FMUCHK] Called with following options:
[INFO][FMUCHK] /home/work/tmp/FMUChecker-2.0.4/build/fmuCheck.linux64 TestFMU.fmu
[INFO][FMUCHK] Will process FMU TestFMU.fmu
[INFO][FMILIB] XML specifies FMI standard version 1.0
[INFO][FMUCHK] Model name: TestFMU
[INFO][FMUCHK] Model identifier: TestFMU
[INFO][FMUCHK] Model GUID: {2bbc49eb-1f4d-472a-a0b7-863d017f7c5e}
[INFO][FMUCHK] Model version: 
[INFO][FMUCHK] FMU kind: ModelExchange
[INFO][FMUCHK] The FMU contains:
0 constants
0 parameters
0 discrete variables
2 continuous variables
0 inputs
1 outputs
1 internal variables
0 variables with causality 'none'
2 real variables
0 integer variables
0 enumeration variables
0 boolean variables
0 string variables

[INFO][FMUCHK] Printing output file header
""time"",""x""
[INFO][FMILIB] Loading 'linux64' binary with 'standard32' platform types
[INFO][FMUCHK] Version returned from FMU:   1.0
assert            | debug   | Failed to open file (null)/TestFMU_info.json for reading: No such file or directory
Segmentation fault
}}}

When instead of 
{{{
buildModelFMU(TestFMU,""1"",""me"",""<default>"",{""static""},true)
}}}
issued by OMEdit, according to its OMC console, I use
{{{
buildModelFMU(TestFMU,""1.0"",""me"",""<default>"",{""static""},true)
}}}
(which looks more in accordance with the `buildModelFMU` documentation), it initializes well:

{{{
$ ~/tmp/FMUChecker-2.0.4/build/fmuCheck.linux64 TestFMU.fmu
[INFO][FMUCHK] FMI compliance checker Test [FMILibrary: Test] build date: Sep 14 2018
[INFO][FMUCHK] Called with following options:
[INFO][FMUCHK] /home/work/tmp/FMUChecker-2.0.4/build/fmuCheck.linux64 TestFMU.fmu
[INFO][FMUCHK] Will process FMU TestFMU.fmu
[INFO][FMILIB] XML specifies FMI standard version 1.0
[INFO][FMUCHK] Model name: TestFMU
[INFO][FMUCHK] Model identifier: TestFMU
[INFO][FMUCHK] Model GUID: {d9f4657f-5c5b-4351-8f2f-b7083da52709}
[INFO][FMUCHK] Model version: 
[INFO][FMUCHK] FMU kind: ModelExchange
[INFO][FMUCHK] The FMU contains:
0 constants
0 parameters
0 discrete variables
2 continuous variables
0 inputs
1 outputs
1 internal variables
0 variables with causality 'none'
2 real variables
0 integer variables
0 enumeration variables
0 boolean variables
0 string variables

[INFO][FMUCHK] Printing output file header
""time"",""x""
[INFO][FMILIB] Loading 'linux64' binary with 'standard32' platform types
[INFO][FMUCHK] Version returned from FMU:   1.0
[INFO][FMUCHK] Checking that FMI set functions can be called with zero length arrays
[INFO][FMUCHK] Initialized FMU for simulation starting at time 0
[INFO][FMUCHK] Checking that FMI get functions can be called with zero length arrays
0.0000000000000000E+00,0.0000000000000000E+00
...
1.0000000000000000E+00,0.0000000000000000E+00
[INFO][FMUCHK] Simulation finished successfully at time 1
FMU check summary:
FMU reported:
        0 warning(s) and error(s)
Checker reported:
        0 Warning(s)
        0 Error(s)
}}}

== How to fix ==

This probably uncovers some strange backend behavior, but as a quick fix, this should be as simple as using ""1.0"" instead of ""1"" for the FMU version argument in OMEdit.

This was tested on a fresh nightly build on Ubuntu 18.04 64 bit."	defect	closed	high	1.13.0	OMEdit	v1.13.0-dev-nightly	fixed		
