Skip to content

Add support for mosaik time resolutions different from 1 ms#35

Open
giacomo618 wants to merge 2 commits intoOFFIS-DAI:masterfrom
giacomo618:master
Open

Add support for mosaik time resolutions different from 1 ms#35
giacomo618 wants to merge 2 commits intoOFFIS-DAI:masterfrom
giacomo618:master

Conversation

@giacomo618
Copy link
Copy Markdown

Hello,
I noticed that setting a time_resolution for 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_resolution World 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 the stepSize field with a field of type double for the time resolution since the stepSize field was not actually used in the C++ side. I avoided the name stepSize to prevent confusion since stepSize has a different meaning in mosaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant