Data Flow Channels play a central role in the DATAFLOW System Development. They visualize and define the flow of the data within the designed model. Data Flow Channels are used to connect an output port of an Active Part to one or more input ports of an Active Part. They transport messages according to the defined protocol from input to output ports.
Connect Ports with Channels
To connect an output port and an input port with a Channel, drag from the output port to the target input port. Once the mouse hovers over the target, three connectors are visible. When the channel is dropped on the center connector, it is automatically placed on the left or right side of the port based on the position of the other end. If it is dropped on the left or right connector, the channel is fixed there and will now never change sides. The channel line will turn solid to indicate a valid connection.
Figure 1 - Connect Data Flow Channel
The label on the channel can only be changed by assigning a protocol to the connected output port.
The Diagram Editor does allow connecting any ports with channels. For the purposes of code generation, there are some limits, so be aware of the following:
- An output port can only be connected to one outgoing channel.
- An input port can be connected to multiple incoming channels.
- A channel target can only connect to an input port, external output port, channel multiplier or channel sink.
- A channel source can only connect to an external input port, channel multiplier, output port or channel source.
Connect ports to external ports
When creating the diagram for an Active Container, all external ports of the Container are placed in its child diagram as external ports (also called connectors in the context of the DFF Domain Specific Language). Those will share the same name as the port on the parent diagram. To connect such an external port to a port in one of the child components, use the same procedure as described above.
Figure 2 - Connect External Ports
The Diagram Editor does allow connecting any ports with channels. For purposes of code generation, there are some limits when external ports are involved, so be aware of the following:
- An external input port can be connected to multiple input ports (this will generate a PortSplit).
- An external output port can be the target of multiple output ports (this will generate a PortJoin).
Connect Output port to multiple input ports
To create a channel that connects an output port to multiple input ports, an OneToAny element must be used:
Connect the source output port to the OneToAny element. Then connect the element to all target input ports.
Figure 3 - Connect One to Any Element
There are some rules that must be followed to allow code generation using an OneToAny Element:
- An OneToAny element must be connected to at least two input ports. Otherwise, a normal channel can be used.
Connect output port to input port and external output port(s)
To create a channel that connects an output port to an input port of another component and at the same time to an external output port of a Container, an OneToAny channel element can be used as well: Connect the source output port to the OneToAny element. Then connect the element to the target input port and external output port.
Figure 4 - Connect an One to Any Element to an External Port
Advanced Channel Options
Hide channel lines using Source/Sink Elements
In bigger projects, there can be a large number of channels so that it is not possible to route all of the lines without creating intersects and confusing diagrams. In this case, the software provides a way to hide the channel lines using Sink and Source elements.
A Sink is connected to a Channel Target and references a source.
A Source is connected to a Channel Source and can be referenced by one or more Sinks.
Whatever is connected to a sink will be also connected to the source. When code is generated, the connection is treated as if it was created with a regular channel.
Figure 5 - Add Source
Figure 6 - Add Sink to Source
To add a source, drag & drop it from the Diagram Toolbox. To add a Sink referencing the source, use the context menu of the source and select ‘Add Sink’. When the name of the source is changed, the name of the referencing sink is also changed. Then the Source and Sink can be connected with channels.
Figure 7 - Add Sink/Source in the existing Channel
To add a Sink/Source to an existing channel, select the channel and select ‘Add Sink/Source’ from the context menu. Once created, sink and source elements can be freely positioned in the diagram.
Each source in a diagram must have an unique name. The name of all referencing sinks is automatically updated.
Mark port as Unused with Terminator Element
Figure 8 - Connect Channel Terminator
In certain circumstances, the software architect wants to add a port to a component that is not used. To avoid a compiler warning for this port, it can be connected to a Terminator element. This will suppress the warning for an unused port.
To add a Terminator, drag & drop it from the diagram toolbox and connect the output port to the Terminator using a channel.