Add support for mosaik time resolutions different from 1 ms#35
Open
giacomo618 wants to merge 2 commits intoOFFIS-DAI:masterfrom
Open
Add support for mosaik time resolutions different from 1 ms#35giacomo618 wants to merge 2 commits intoOFFIS-DAI:masterfrom
giacomo618 wants to merge 2 commits intoOFFIS-DAI:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
I noticed that setting a
time_resolutionfor the mosaik World different from 0.001 (1 ms) does not affect the time step at which the messages are received. This effectively means that, for example, by setting a time resolution to 0.0001 (0.1 ms), messages are received in a tenth of the simulated time compared to setting the time resolution to 0.001.Looking into the code I discovered that the C++ side of cosima assumes that each simulation step of mosaik corresponds to 1ms (i.e. 0.001 time resolution), but the duration of simulated time each time step of mosaik corresponds to can be set to any value with the
time_resolutionWorld parameter. In this pull request I generalized the logic converting from mosaik time steps to simulation time in such a way to account for the time resolution. The time resolution is now passed to the CosimaScheduler in the initial message. Additionally, in the protobuf definition of the messages, I have replaced thestepSizefield with a field of typedoublefor the time resolution since thestepSizefield was not actually used in the C++ side. I avoided the namestepSizeto prevent confusion sincestepSizehas a different meaning in mosaik.