@@ -138,19 +138,41 @@ Timelines
138138Different components of a coupled simulation typically run at their own pace: a fast,
139139detailed micro model may take many small steps for every single step of the macro model
140140driving it, and a meso model may sit somewhere in between the two. yMMSL captures this
141- idea of " running at a different pace" as a * timeline* . Wiring a component' s ``o_i``/``s``
142- ports to another component' s ``f_init``/``o_f`` ports puts that other component, and anything
143- it in turn drives, on a timeline nested inside the first. yMMSL works this out automatically
144- from how components are wired together with conduits.
145-
146- A component that nobody calls sits on the outermost, root timeline, written `` :`` . Every
147- level of nesting adds one more name, giving each timeline in the model an addressable
148- path, a bit like a folder structure.
141+ idea of " running at a different pace" as a * timeline* .
142+
143+ Timelines are determined separately for each model under `` models`` , and are named
144+ relative to that model. Each component has two timelines associated with it:
145+
146+ - Its * parent timeline* is the timeline of whatever calls it, i.e. the timeline on which
147+ the messages to its `` f_init`` ports are sent and the messages from its `` o_f`` ports
148+ are received. For a component that isn' t called by any other component in the model,
149+ the parent timeline is empty.
150+ - Its * component timeline* is the timeline it runs on itself. Its name is the name of
151+ the parent timeline followed by the name of the component, joined with a colon. A
152+ component that isn' t called by anything therefore gets a timeline named after itself.
153+
154+ A component is called by another one through a call- and - release coupling, in which the
155+ caller' s ``o_i`` port sends to the callee' s `` f_init`` port and the callee' s ``o_f``
156+ port sends back to the caller' s ``s`` port. The caller' s component timeline then becomes
157+ the callee' s parent timeline, so the callee' s component timeline is nested inside the
158+ caller' s. Every level of nesting adds one more name, giving each timeline in the model
159+ an addressable path, a bit like a folder structure. A dispatch coupling, in which one
160+ component' s ``o_f`` port sends to the next component' s `` f_init`` port, does not add a
161+ level: the second component gets the same parent timeline as the first, so the two end
162+ up side by side.
163+
164+ Components and their ports are related to timelines in slightly different ways. A
165+ component' s ``o_i`` and ``s`` ports send and receive during its run, so they are on its
166+ component timeline. Its `` f_init`` and `` o_f`` ports sit at the beginning and the end of
167+ the component timeline, where the component hands over to and from its caller, so the
168+ messages they receive and send belong to the parent timeline.
169+
170+ To make a valid conduit, you should connect two ports whose messages live on the same
171+ timeline. :ref:`Conduit filters` and :ref:`Matching timelines` relax this rule
172+ in specific cases.
149173
150174Take a macro model that calls a meso model in a loop, and where that meso model in turn
151- calls a micro model in its own loop. This produces three levels of timelines: the root
152- timeline for `` macro`` , a timeline nested inside it for `` meso`` , and a timeline nested
153- inside * that* for `` micro`` :
175+ calls a micro model in its own loop:
154176
155177.. literalinclude:: timelines_macro_meso_micro.ymmsl
156178 :caption: `` docs/ timelines_macro_meso_micro.ymmsl``
@@ -166,6 +188,19 @@ inside *that* for ``micro``:
166188 from top to bottom, mirrors the nesting in time: `` macro`` first, then `` meso``
167189 below it, then `` micro`` below `` meso`` .
168190
191+ `` macro`` isn' t called by anything, so its parent timeline is empty and its
192+ component timeline is `` macro`` . `` macro`` calls `` meso`` , so `` meso`` ' s parent
193+ timeline is `` macro`` and its component timeline is `` macro:meso`` . Likewise,
194+ `` micro`` has parent timeline `` macro:meso`` and component timeline
195+ `` macro:meso:micro`` .
196+
197+ The conduit from `` macro.bc_out`` to `` meso.init_in`` isvalid because `` bc_out`` is an
198+ `` o_i`` port on `` macro`` ' s component timeline ``macro``, and the messages received by
199+ the `` f_init`` port `` init_in`` are on `` meso`` ' s parent timeline, which is also
200+ `` macro`` . The same reasoning applies to the other three conduits.
201+ None of these timelines are written in the yMMSL file itself: yMMSL works them out
202+ automatically from how the components are wired together with conduits.
203+
169204A single component can also be connected to more than one timeline at once, for example
170205when it drives two other components that run at different rates. `` macro`` calling
171206`` micro1`` in one loop and `` micro2`` in a separate loop puts `` micro1`` and `` micro2`` on
0 commit comments