OpenSimulationInterface / osi-sensor-model-packaging

This document specifies the ways in which sensor models are to be packaged for use in simulation environments with FMI 2.0
Other
41 stars 18 forks source link

How to generate OSI trace file when simulating the example FMUs? #53

Open Hela-Guesmi opened 4 years ago

Hela-Guesmi commented 4 years ago

Describe the problem

As a first test, I want to run the DummySource and the dummySensor FMUs in an FMI co-simulator. In order to be able to validate the simulation result, I would like to generate the trace files to read with the OSI visualizer.

Describe what you have already tried

I imported both FMUs in a middleware and simulated them. And I would like to validate the simulation result.

Ask your question

1- Is there any mechanism that allows to generate such trace files? I couldn't find in the documentation any C++ tutorial/example describing such option. 2- Is there also any reference trace file against which to compare?

vkresch commented 4 years ago

@Hela-Guesmi use for the trace files generation python for now (see here an example) because C++ is very verbose in that regard.

If you still want to use C++ see here for google's tutorial on how to encode messages. If you learned how to serialize one message you can append those serialized messages in a loop into a file with $$__$$ separation (.txt files) or length separation (.osi files). Those files can than be played with the osi-visualizer.

Currently there is no reference file but the osi-validator repo have an example trace file which is used for validation tests. It can also be played with osi-visualizer when you decompress the file. Use lzma -d data/small_test.txt.lzma for decompressing when you're on a linux machine.

Hope this helps :)