- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » fmiSetReal not called
fmiSetReal not called
fmiSetReal not called
Hello everyone,
i tried to build my own FMU (FMI1.0, Co-Simulation with a DLL). Initialization, Steps (fmiDoStep) and Output (fmiGetReal) etc. is working fine.
But: I get no input into my FMU. I debugged my DLL - and fmiSetReal seems to be never called from OM.
I'm using OM 1.13.0 64bit (Windows version)
My fmiSetReal is like this:
fmiStatus fmiSetReal(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal value[])
{
...
}
and function signature (like the other fmi-functions):
#define DllExport __declspec( dllexport )
DllExport fmiStatus fmiSetReal (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal value[]);
I have also looked into my compiled DLL with "Dependency Walker": fmiSetReal-function is there.
In OM, the input connector is also available and in XML-file it looks like this:
<ScalarVariable name="inp1" valueReference="1" description="Inp1" variability="continuous" causality = "input" alias="noAlias">
<Real start="0"/>
</ScalarVariable>
I have tried with several options (with/without variability; with/without alias; with/without fixed) but same results.
Thanks in advance for your help!
Greetings,
Robert
Re: fmiSetReal not called
From the used models:
class Test
Modelica.Blocks.Sources.Sine sine1 annotation(
Placement(visible = true, transformation(origin = {-70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inc_cs_st_FMU inc_cs_st_FMU1(startTime = 0, stopTime = 10) annotation(
Placement(visible = true, transformation(origin = {-30, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(sine1.y, inc_cs_st_FMU1.inp1) annotation(
Line(points = {{-58, 30}, {-40, 30}, {-40, 40}, {-42, 40}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "3.2.2")));
end Test;
From the FMU:
[...]
equation
{out1} = fmi1Functions.fmi1GetReal(fmi1cs, {0.0}, flowInitialized);
{fmi_input_inp1} = fmi1Functions.fmi1SetReal(fmi1cs, {1.0}, {inp1});
flowStep = fmi1Functions.fmi1DoStep(fmi1cs, time, communicationStepSize, true, flowInitialized);
[...]
Re: fmiSetReal not called
Update: fmiSetReal in OMEdit is called (seen in Algorithmic Debugger), also the C-function is created. But the C-code is very hard to debug in detail because it's generated code.
Is there any possibility to run a C-code debugger in a graphical user interface to trace the problem? I have tried to compile with Visual Studio (easy to debug!) but get errors, only the shipped GCC/MINGW seems to run correctly.
I have seen further the fmisetReal-function is not called directly from my FMU-DLL: It's onyl a call for a wrapper in fmilib(.a). Now, i think the error must be there (fmilib.a).
OM is great, but a hard piece of work to get co-simulation running.
Thx!
Greetings,
Robert
Re: fmiSetReal not called
Did you finally find a way to resolve this?
Could it be caused by this function having an empty body:
https://github.com/OpenModelica/OpenMod … .cpp#L1245
??
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » fmiSetReal not called