Skip to content

Commit

Permalink
Merge pull request #228 from dos-group/behind-threshold
Browse files Browse the repository at this point in the history
Increasing Real-Time Factor Offset "Fix"
  • Loading branch information
marvin-steinke authored Jul 15, 2024
2 parents a45aedc + 8de4765 commit 648d3b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions vessim/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ def to_simtime(self, dt: datetime) -> int:
def disable_rt_warnings(behind_threshold: float):
"""Disables Mosaik's rt_check warnings.
The simulation is always behind by a few fractions of a second (which is
fine, code needs time to execute) which Mosaik logs as a Warning. These
Warnings are flagged as bugs in Mosaik's current developement and should be
fixed within its next release. Until then, this function should do.
Mosaik's current implementation of the real-time checks are faulty and a new
implementation is already outlined in
https://gitlab.com/mosaik/mosaik/-/issues/172. As this issue was opened in
June 2023, it is unlikely that the issue will be resolved soon. Therefore,
we disable the warnings with a threshold after which these offsets are
logged.
Args:
behind_threshold: Time the simulation is allowed to be behind schedule.
Expand Down
2 changes: 1 addition & 1 deletion vessim/cosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def run(
until: Optional[int] = None,
rt_factor: Optional[float] = None,
print_progress: bool | Literal["individual"] = True,
behind_threshold: float = 0.01,
behind_threshold: float = float("inf"),
):
if until is None:
# there is no integer representing infinity in python
Expand Down

0 comments on commit 648d3b3

Please sign in to comment.