Design Pattern: Local Multicast
Problem Statement
Provide efficient intraprocess multicasting of data without
resorting to more expensive interprocess communication methods such as
UDP multicast.
Framework
In contrast to the PUBLISH and SUBSCRIBE types
described in Annex F.2.1 of IEC 61499-1, which use communication networks for
exchange of data, instances of PUBL_n and SUBL_n
service interface types are used for local (within the same runtime
process) multicast publishing and subscribing of data. The service
interface types for n=1 are illustrated below.
In addition to increased speed of data transfer vs. PUBLISH/SUBSCRIBE,
these blocks offer the following convenience features:
- The local multicast group is identified by the ID
input. For convenience, the default value of this input is set to the
function block's instance name. This can be overridden by connection to
a non-default variable or configuration parameter.
- The number of data elements is given by the n suffix
of the function block type. The number of data elements, say nP,
transmitted by a PUBL_n instance on a given channel need not
match the number of output elements, say nS, of a SUBL_n
instance on the same channel. If nP>nS,
the SUBL_n instance will ignore the extra data elements; if nP<nS
the extra outputs of the SUBL_n instance will remain at their
initial values.
- If a RD_i output of a SUBL_n block is not
connected or is connected to a variable of a different data type than
that of the corresponding SD_i input of a PUBL_n
block on the same local mulitcast channel, the SD_i value will
not be copied to the RD_i variable and no error condition will
result.
[Viewer
Help]
Methodology
As noted above, the use of the local
multicast function block types PUBL_n/SUBL_n is subject to
substantially fewer restrictions than the use of the corresponding
distributed multicast types PUBLISH_n/SUBSCRIBE_n. As a result,
care must be exercised when converting from a design which uses local
multicast to a design using distributed multicast. In particular, for
distributed multicast:
- The ID input must be an appropriate identifier for a
distributed multicast group, such as a UDP multicast group address.
- The number of data elements given by the n suffix of
the function block type must be identical for all publishers and
subscribers in distributed multicast group.
- The SD_i (i=0,1,...,n-1) inputs of PUBLISH_n
instances must be connected to variables of concrete type, i.e., not
the abstract ANY type, in order to permit their proper
encoding for transmission. Similar restrictions apply to the
corresponding RD_i (i=0,1,...,n-1) outputs of SUBSCRIBE_n
instances, and the types of each SD_i variable and the
corresponding RD_i variable must match at both ends of the
multicast connection for each value of i.
For examples of the application of this methodology see the
documentation of the layered
MVC design pattern.
Last updated: 2007-09-11.
©2006,2007 Holobloc
Inc
Licensed under the Academic Free
License version 3.0.