This is a specialized output port that publishes constant data sent on
the specified named channel. The tokens are
"tunneled" to any instance of <a href="../../ptolemy/actor/SubscriberPort.xml">ptolemy.actor.SubscriberPort</a> that names the same channel.
If <a href="../../ptolemy/actor/ConstantPublisherPort.xml#global">global</a> is false (the default), then this publisher
will only send to instances of SubscriberPort that are under the
control of the same director. That is, it can
be at a different level of the hierarchy, or in an entirely different
composite actor, as long as the relevant composite actors are
transparent (have no director). If <a href="../../ptolemy/actor/ConstantPublisherPort.xml#global">global</a> is true,
then the subscriber may be anywhere in the model, as long as its
<i>global</i> parameter is also true.
<p>
Note that this port should be used just like a <a href="../../ptolemy/actor/PublisherPort.xml">ptolemy.actor.PublisherPort</a>.
If you put it in an opaque composite actor, then it requires a
token on the inside in order to produce its output. It will replace
each token with the constant value. Similarly, if it is put into
a transparent composite actor, then tokens must be sent through
it. Those tokens will be replaced with the constant value. If it
is put into an atomic actor, then the actor should call one of
its broadcast or send methods, providing a token that will be
replaced with the constant token. This pattern ensures that data
dependencies work with this port just as with any other port.
<p>
It is an error to have two instances of PublisherPort
or ConstantPublisherPort using the same
channel under the control of the same director. When you create a
new PublisherPort or
ConstantPublisherPort, by default, it has no channel name. You have to
specify a channel name to use it.
<p>
<b>How it works:</b>
When the channel name
is specified, typically during model construction, this actor
causes a relation to be created in the least opaque composite
actor above it in the hierarchy and links to that relation.
In addition, if <a href="../../ptolemy/actor/ConstantPublisherPort.xml#global">global</a> is set to true, it causes
a port to be created in that composite, and also links that
port to the relation on the inside. The relation is recorded by the opaque
composite. When a SubscriberPort is preinitialized that refers
to the same channel, that SubscriberPort finds the relation (by
finding the least opaque composite actor above it) and links
to the relation. Some of these links are "liberal links" in that
they cross levels of the hierarchy.
<p>
Since publishers are linked to subscribers,
any data dependencies that the director might assume on a regular
"wired" connection will also be assumed across publisher-subscriber
pairs. Similarly, type constraints will propagate across
publisher-subscriber pairs. That is, the type of the subscriber
output will match the type of the publisher input.
Edward A. Lee
$Id: ConstantPublisherPort.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 10.0
Yellow (eal)
Red (eal)
The constant value to publish. This can have any type.
It defaults to the integer 0.
The number of constant tokens to publish. By default,
this is UNBOUNDED, which means that there is no limit.