Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » bertl
  • » Profile

Posts

Posts

Jan-07-19 12:37:20
fmiSetReal from FMU-DLL not called from OM

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.current/sad

Thx!

Greetings,
Robert

Jan-01-19 21:27:18
fmiSetReal from FMU-DLL not called from OM

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);
[...]

Jan-01-19 20:09:38
fmiSetReal from FMU-DLL not called from OM

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

Dec-18-18 16:07:37
FMU Export - Predefined blocks and own classes/blocks/...

Hi everyone,

i was on testing the FMU-exporter (1.13.0-dev.beta1).

I want to co-simulate with RecurDyn (as master).

So, i have exported (for testing purposes) a single block (source ramp) as a FMU and imported the generated FMU into RecurDyn. Works well!
export options: FMI2.0, Co-Simulation

Output:
-----
C:\TestRecurDyn : RecurDyn_FMI starting...
FMU2 Log Information Start...
fmiModelDescription
  fmiVersion=2.0
  modelName=Modelica.Blocks.Sources.Ramp
  guid={fc385efd-d705-4c32-8c5f-68785fc49deb}
  description=Generate ramp signal
CoSimulation
  modelIdentifier=Modelica_Blocks_Sources_Ramp
  needsExecutionTool=false
  canBeInstantiatedOnlyOncePerProcess=false
  canNotUseMemoryManagementFunctions=false
  canGetAndSetFMUstate=false
-----


Second test: I connected a ramp and downstream a gain (not a very useful item but for testing ok). I generated the FMU and imported it into RecurDyn again. Now failure:

------
C:\TestRecurDyn : RecurDyn_FMI starting...
FMU2 Log Information Start...
fmiModelDescription
  fmiVersion=2.0
  modelName=Test
  guid={12c34485-3e90-4bd0-a830-f3a69dbe3172}
  description=
CoSimulation
  modelIdentifier=Test
  needsExecutionTool=false
  canBeInstantiatedOnlyOncePerProcess=false
  canNotUseMemoryManagementFunctions=false
  canGetAndSetFMUstate=false
Test : The number of output is not match with that of FMU
-----

I have tested with "class", "model" and also as as a "block" for the composed work (of the 2 blocks).

But always the same error occures. Both models have one output.

What am i doing wrong? Do i have to specify the number of output(s) (and how?)?

Thanks in advance for your help!

Greetings,
Robert




Hi everyone,

i tried to import a FMU (from RecurDyn) to OmEdit (1.12.0, x64) on Win10. The FMU version is 1.0 and "Co-Simulation" (FMI2.0 doesn't work in OmEdit and fails with error message that FMI2.0 is not supported).

When to co-simulate, RecurDyn should open, load its model file (.rdyn) and start to simulate (with animation). I have tested the FMU with FMUChecker and it seems ok.

When i start simulation (compilation finished successfully), i get following output messages:
c:/Users/Robert/AppData/Local/Temp/OpenModelica/OMEdit/Test.exe -port=51069 -logFormat=xmltcp -override=startTime=0,stopTime=10,stepSize=0.001,toleranze=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=Test.res.mat -w -lv=LOG_STATS


[INFO][RDFMICS][log][FMU status:OK] fmiSetDebugLogging: loggingOn=0

The initialization finished successfully without homotopy method.
    fmiInitializeSlave,....
   
    endtime = 1.00000000
   
=== Error Message ======================================

The RecurDyn model has already opened or isn't in working foler. (sic!)

=== Error Message ======================================

The RecurDyn model has abnormally stopped.

...


Last error message, i get hundreds of times. RecurDyn does not open or start its application! So, no Co-Simulation is in process.

I think it is a simple path problem, but i have also tried unsuccessfully:
-Importing FMU and set/unset unzipping path manually. I copied my .rdyn-File to unzip path.
-Copying my .rdyn-File also to working path (-> got path from "Tools"->"Open Working Directory")
-Synchronized time steps with FMU, also time end.
-I have also edited the XML from the FMU to an absolute file path for the .rdyn-File.
-I have set to debug level when importing the FMU, i get some additional lines in my output:
[INFO][RDFMICS][log][FMU status:OK] fmitGetReadl: #r151# = 0
[INFO][RDFMICS][log][FMU status:OK] fmitGetReadl: #r152# = 0
[INFO][RDFMICS][log][FMU status:OK] fmiDoStep: currentCommunicationPoint = 0e-99,
and so on.

Some other mysterious things:
-No batch-file is created to start RecurDyn - is this correct? From others tools i recognized there will be a batch file created to start RecurDyn.
-In RDFMICS_cs_st_FMU.mo there is on second line:
constant String fmuLocation = "file://c:/Users/Robert/AppData/Local/Temp/OpenModelica/OMEdit/resources";
This path does not exist (and is also not created)! I have also tested with manually creating the path and copying all possible files (FMU, unzipped FMU, xml, .rdyn etc.) to this path. Also same errors.

Some additional notes:
-After importing the FMU, i see the FMU in the navigator and it seems to be ok (FMI1CoSimulation with constructor, destructor and fmi1Functions ...)
-Check of the model: All seems to be ok: "Check of RDFMICS_cs_st_FMU completed successfully. Class RDFMICS_cs_st_FMU has 4 equation(s) and 4 variable(s). 2 of these are trivial equation(s)."
-I have also tested with nightly build (1.13.0) from 10-10-18: Same problems.

My questions:
-What am i doing wrong?
-Is FMI1.0-Co-Simulation possible with/in OmEdit when the FMI slave application needs to be started? I have also tried to simulate a FMU1.0Co-Simulation from another programm a while ago and it also fails, but it seems there was a bug with the FMU itself (FMUChecker generated errors) and not with OmEdit.

Thanks in advance for your help!

Greetings,
Robert





  • Index
  • » Users
  • » bertl
  • » Profile
You are here: