Class MetroIIPtidesPlatform

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

    public class MetroIIPtidesPlatform
    extends MetroIIMirrorComposite
    This composite implements a Ptides platform, which is used for the design of distributed real-time systems. The main reason for implementing this composite is to allow for special treatment of tokens on input and output ports. Ptides platforms can only contain the following ports: SensorPort, ActuatorPort, NetworkReceiverPort, NetworkTransmitterPort. A Ptides platform must contain a PtidesDirector.

    Network ports receive and transmit RecordTokens that encapsulate Ptides events (timestamp and value). A NetworkReceiverPort extracts the timestamp of the Ptides event in the RecordToken and creates a new event on the event queue on the PtidesDirector with this timestamp.

    FIXME: The base class seems to have some support for ParameterPorts but nothing that really works?

    This class is identical to PtidesPlatform except ports are mapped to MetroIIPtidesPort, composite actors are mapped to MetroIICompositeActor, and Ptides director is mapped to MetroIIPtidesDirector.

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Patricia Derler, Liangpeng Guo
    Pt.AcceptedRating:
    Red (derler)
    Pt.ProposedRating:
    Red (derler)
    • Constructor Detail

      • MetroIIPtidesPlatform

        public MetroIIPtidesPlatform​(CompositeEntity container,
                                     java.lang.String name)
                              throws IllegalActionException,
                                     NameDuplicationException
        Creates an actor with a name and a container. The container argument must not be null, or a NullPointerException will be thrown. This actor will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace. This actor will have no local director initially, and its executive director will be simply the director of the container. You should set a director before attempting to execute it.
        Parameters:
        container - The container actor.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the container is incompatible with this actor.
        NameDuplicationException - If the name coincides with an actor already in the container.
      • MetroIIPtidesPlatform

        public MetroIIPtidesPlatform​(Workspace workspace)
                              throws IllegalActionException,
                                     NameDuplicationException
        Constructs an PtidesPlatform in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. You should set the local director or executive director before attempting to send data to the actor or to execute it. Add the actor to the workspace directory. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the actor.
        Throws:
        IllegalActionException - If the container is incompatible with this actor.
        NameDuplicationException - If the name coincides with an actor already in the container.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clones the object into the specified workspace. This overrides the base class to set the association with iterationCount.
        Overrides:
        clone in class MetroIIMirrorComposite
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        CompositeEntity.exportMoML(Writer, int, String)
      • newPort

        public Port newPort​(java.lang.String name)
                     throws NameDuplicationException
        FIXME: Return SensorPort or ActuatorPort. How do i know if the port is an input or an output? Override the base class to return a specialized port.
        Overrides:
        newPort in class MetroIIMirrorComposite
        Parameters:
        name - The name of the port to create.
        Returns:
        A new instance of PtidesMirrorPort, an inner class.
        Throws:
        NameDuplicationException - If the container already has a port with this name.
      • _checkTypesFromTo

        protected java.util.List _checkTypesFromTo​(TypedIOPort sourcePort,
                                                   java.util.List destinationPortList)
        Checks types from a source port to a group of destination ports, assuming the source port is connected to all the ports in the group of destination ports. Return a list of instances of Inequality that have type conflicts. This overrides the base class so that if one of the ports belongs to this PtidesPlatform actor, then its element type is compared against the inside port.
        Overrides:
        _checkTypesFromTo in class TypedCompositeActor
        Parameters:
        sourcePort - The source port.
        destinationPortList - A list of destination ports.
        Returns:
        A list of instances of Inequality indicating the type constraints that are not satisfied.
      • _destinationTypeConstraints

        protected java.util.List _destinationTypeConstraints​(TypedIOPort sourcePort)
        Returns the type constraints on all connections starting from the specified source port to all the ports in a group of destination ports. This overrides the base class to ensure that if the source port or the destination port is a port of this composite, then the port is forced to be an array type and the proper constraint on the element type of the array is made. If the source port has no possible sources of data, then no type constraints are added for it.
        Overrides:
        _destinationTypeConstraints in class TypedCompositeActor
        Parameters:
        sourcePort - The source port.
        Returns:
        A list of instances of Inequality.