Class HlaAttributeReflector

  • All Implemented Interfaces:
    java.lang.Cloneable, HlaReflectable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class HlaAttributeReflector
    extends TypedAtomicActor
    implements HlaReflectable
    This actor produces an output event whenever the specified attribute of the specified instance is updated by another federate in the federation. In HLA, the terminology is that this actor "reflects" the specified attribute value whenever another federate "updates" the attribute value. The time stamp of the output depends on the parameters of the HlaManager, as explained in the documentation for that class. This actor assumes that there is exactly one HlaManager in the model that contains this actor.

    The attribute that this actor reflects is specified using three parameters: attributeName, className, and instanceName. These three parameters specify the attribute to which this actor listens for updates. Those updates could be produced, for example, by an HlaPublisher whose three parameters match those of this actor. The className and attributeName are required to match a class and attribute specified in the FED file that is specified in the HlaManager. The instanceName is an arbitrary name chosen by the designer for the instance of the class. It specifies the instance of the specified class whose attribute this actor reflects.

    A federate may not need to know the name of the instances, because all instances are treated the same way, or because it is not important to know their names. In these cases, the wildcard joker_N, N being any integer, may be used in the parameter instanceName. As the order in which the instances are discovered is not known before the run, the wildcard must be used with caution, see the manual and HlaAManager code.

    If there is no instance with the specified instanceName, or no updated attribute for the instance binded to a wildcard, then this actor produces no output. If a matching instance is later created, then this actor will begin producing outputs when that instance's attribute is updated. If the specified class does not have an attribute with the specified attributeName, as defined in the FED file, or there is no class matching className in the FED file, then an exception will be thrown.

    The attributeType parameter specifies the data type of the attribute to which this actor listens. This parameter has two effects. First, it sets the type of the output port. Second, it specifies how to interpret the bytes that are transported via the HLA runtime infrastructure (RTI). Currently, only a small set of primitive data types are supported.

    The useCertiMessageBuffer parameter works together with the attributeType parameter to interpret the bits that are transported over the RTI. Specifically, an HLA RTI will transport arbitrary byte sequences regardless of what they represent. CERTI, the particular RTI that Ptolemy II uses, provides a convenience feature that packs and unpacks the message bytes for a small set of data types. This feature takes into account the annoyance that the byte order can be different on different platforms (big endian or little endian). If the attribute that this actor is listening to is updated by a "foreign" federate (not implemented in Ptolemy II), then this useCertiMessageBuffer parameter should be set to true to ensure that byte order changes are handled. And in this case, only the small set of data types supported by CERTI can be used. On the other hand, if the attribute is updated by a Ptolemy II model, and that update does not not specify to use the CERTI message buffer, then this parameter should be false.

    Since:
    Ptolemy II 11.0
    Version:
    $Id: HlaAttributeReflector.java 214 2018-04-01 13:32:02Z j.cardoso $
    Author:
    Gilles Lasnier, Janette Cardoso, Edward A. Lee. Contributors: Patricia Derler, David Come
    Pt.AcceptedRating:
    Red (glasnier)
    Pt.ProposedRating:
    Yellow (glasnier)
    • Field Detail

      • attributeName

        public StringParameter attributeName
        The name of the attribute to which this actor listens for updates. This defaults to an empty string, but it must be non-empty to run the model.
      • attributeType

        public StringParameter attributeType
        The type of the attribute that this actor is listening to. This will be used to set the type of the output port. This is a string that defaults to "int". Currently, the only supported types are "int", "double", "string", and "boolean".
      • className

        public StringParameter className
        The name of the class whose attribute this actor listens for updates. This defaults to an empty string, but it must be non-empty to run the model.
      • instanceName

        public StringParameter instanceName
        The name of the instance of the class to whose attribute this actor listens for updates. If this name does not need to be known, then a wildcard can be used. This defaults to an empty string, but it must be non-empty to run the model.
      • output

        public TypedIOPort output
        The output port through which the new value of each update to the specified attribute of the specified instance are sent. The type of this port is given by attributeType.
      • useCertiMessageBuffer

        public Parameter useCertiMessageBuffer
        Indicate whether the attribute value is conveyed through a CERTI message buffer. This is a boolean that defaults to false. It should be set to true if the attribute to which this actor listens is updated by a foreign simulator. It can be false if the attribute is updated by a federate implemented in Ptolemy II, and if this corresponding parameter in the actor doing the updating is also false.