Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ymmsl/v0_2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
InconsistentTimelines,
ResolveTimelineException,
TooManyReducerFilters,
check_timelines,
resolve_timelines,
)

Expand All @@ -41,6 +42,7 @@
"CheckpointRule",
"CheckpointRangeRule",
"CheckpointAtRule",
"check_timelines",
"Checkpoints",
"Component",
"Ports",
Expand Down
23 changes: 21 additions & 2 deletions ymmsl/v0_2/timeline_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
MUSCLE_SETTINGS_IN = Identifier("muscle_settings_in")


def check_timelines(model: Model) -> "TimelineChecker":
"""Check that timelines for this model are consistent.

This function checks that the timelines are consistent, and raises any of below
subclasses of :class:`ResolveTimelineException` if they are not.

Raises:
CyclicDependency: When messages to an F_INIT port of a component depend in some
way on the output of that component.
TooManyReducerFilters: When a conduit filter is applied to messages in the root
timeline.
InconsistentTimelines: When a component's F_INIT ports are not all connected to
the same timeline.
ConduitTimelineError: When a conduit connects incompatible timelines.
"""
checker = TimelineChecker(model)
checker.check_consistent()
return checker


def resolve_timelines(model: Model) -> None:
"""Determine timelines for each component and their O_I and S ports in this model.

Expand All @@ -29,8 +49,7 @@ def resolve_timelines(model: Model) -> None:
the same timeline.
ConduitTimelineError: When a conduit connects incompatible timelines.
"""
checker = TimelineChecker(model)
checker.check_consistent()
checker = check_timelines(model)

# Update timeline attributes
for component in model.components.values():
Expand Down