﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4529	[c runtime] FMI setReal/getReal doesn't work	Lennart Ochel	Lennart Ochel	"Updating an input value using the FMI interface `setReal` doesn't affect the connected output values using the FMI interface `getReal`. This can be tested using the following example:

{{{#!mo
model A
  input Real p;
  input Real u;
  output Real y;
equation
  y = u * p;
end A;
}}}

Generate FMUs with both, c and cpp runtime:
{{{#!mo
setCommandLineOptions(""--simCodeTarget=C""); getErrorString();
buildModelFMU(A, version=""2.0"", fmuType=""me"", fileNamePrefix=""me_A_c"", platforms={""static""}); getErrorString();
setCommandLineOptions(""--simCodeTarget=Cpp""); getErrorString();
buildModelFMU(A, version=""2.0"", fmuType=""me"", fileNamePrefix=""me_A_cpp"", platforms={""static""}); getErrorString();

// workaround
system(""mv A.fmu me_A_cpp.fmu""); getErrorString();
}}}

Run the test using OMFMISimulator:
{{{#!lua
function printAllValues(model)
  print(""A.p: "" .. getReal(model, ""A.p""))
  print(""A.u: "" .. getReal(model, ""A.u""))
  print(""A.y: "" .. getReal(model, ""A.y"") .. ""\n"")
end

tests = {""me_A_c.fmu"", ""me_A_cpp.fmu""}
for _,test in ipairs(tests) do
  print(""Testing "" .. test)

  model = newModel()
  instantiateFMU(model, test, ""A"")

  initialize(model)

  printAllValues(model)

  setReal(model, ""A.p"", 1.0)
  setReal(model, ""A.u"", 2.0)
  printAllValues(model)

  setReal(model, ""A.p"", 1.5)
  printAllValues(model)

  terminate(model)
  unload(model)
end

}}}

This will result in the following output:
{{{
Testing me_A_c.fmu
A.p: 0.0
A.u: 0.0
A.y: 0.0

A.p: 1.0
A.u: 2.0
A.y: 0.0

A.p: 1.5
A.u: 2.0
A.y: 0.0

Testing me_A_cpp.fmu
A.p: 0.0
A.u: 0.0
A.y: 0.0

A.p: 1.0
A.u: 2.0
A.y: 2.0

A.p: 1.5
A.u: 2.0
A.y: 3.0
}}}

The issue is that `A.y` is not updated if the c runtime is used."	defect	closed	critical	1.12.0	FMI		fixed		Rüdiger Franke Adeel Asghar
