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 E 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 and associated service sequences 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 aPUBL_n
instance on a given channel need not match the number of output elements, saynS
, of aSUBL_n
instance on the same channel. If nP>
nS
, theSUBL_n
instance will ignore the extra data elements; if nP<
nS
the extra outputs of theSUBL_n
instance will remain at their initial values. -
If a
RD_i
output of aSUBL_n
block is not connected or is connected to a variable of a different data type than that of the correspondingSD_i
input of aPUBL_n
block on the same local mulitcast channel, theSD_i
value will not be copied to theRD_i
variable and no error condition will result.
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 ofPUBLISH_n
instances must be connected to variables of concrete type, i.e., not the abstractANY
type, in order to permit their proper encoding for transmission. Similar restrictions apply to the correspondingRD_i (i=0,1,...,n-1)
outputs ofSUBSCRIBE_n
instances, and the types of eachSD_i
variable and the correspondingRD_i
variable must match at both ends of the multicast connection for each value ofi
.
For other examples of the application of this methodology see the documentation of the MVCD design pattern.
Implementation
In addition to the sharing of local multicast channels across Resources
in the same Device, the FBRT implementation of this design
pattern permits the sharing of channels among Devices in the
same Java™ runtime process, for example Devices that are
launched from the same SystemManager. This usage can be documented
through the use of a LocalBus segment in the System diagram;
for an example see the ASM_VIEWL
System configuration.