Coupling your model
Multicast
With MUSCLE3 you can connect an output port to multiple input ports. When a submodel sends a message on a port that is connected to multiple input ports, the message is copied and sent to each connected port.
Note
It is not allowed to connect multiple output ports to a single input port.
Example
ymmsl_version: v0.2
models:
multicast:
components:
macro:
description: A macro model
implementation: macro
micro:
description: A micro model
implementation: micro
conduits:
macro.state_out: micro.state_in
micro.state_out: macro.state_in
ymmsl_version: v0.2
models:
multicast:
components:
macro:
description: A macro model
implementation: macro
micro:
description: A micro model
implementation: micro
printer:
description: Prints messages for debugging
implementation: printer
conduits:
macro.state_out: micro.state_in
micro.state_out:
- macro.state_in
- printer.in
In the second tab, a new component printer is added and wired to the
state_out port of the micro model. Whenever the micro model sends a message
on that port, one copy is sent to the macro model to continue the simulation.
Another copy is sent to the printer component, which (for example) prints a
summary of the state.