Class PtidesPort

  • All Implemented Interfaces:
    java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class PtidesPort
    extends MirrorPort
    A specialized port for Ptides platform I/O implementing functionality for sensors, actuators and network receiver and transmitter ports. When creating a port in vergil, a sensor or actuator port is created. To create a network port, the parameter isNetworkPort is changed. Upon changing the type of the port, the icon is changed as well. PtidesPorts are configured by parameters where some parameters are the same for all types of ports and others are specific to the type. Every PtidesPort can be configured with a deviceDelay and a deviceDelayBound. The deviceDelay is the amount of platform time passing between the port receiving the event and the platform time the event is put on the event queue (for input ports) or the time the event is released to the environment (for output ports). The deviceDelayBound is the maximum of this value and it is used in the safe-to-process analysis. Actuators additionally have a parameter actuateAtEventTimestamp which is used to specify whether the actuator can output events before the event timestamp or only at the event timestamp. A network transmitter has a parameter platformDelayBound which is configured to represent the maximum difference between platform time and the event timestamp if platform time is ahead of the event timestamp. This is used for the safe-to-process analysis. A network receiver has a parameter sourcePlatformDelayBound which can be used to match the parameter platformDelayBound on the sending platform. Again, this parameter is used for the safe-to-process analysis. Network receivers have an additional parameter networkDelayBound which describes the maximum physical time input events spent on the network after being sent by the another PtidesPlatform.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Patricia Derler
    Pt.AcceptedRating:
    Pt.ProposedRating:
    Red (derler)
    • Field Detail

      • actuateAtEventTimestamp

        public Parameter actuateAtEventTimestamp
        Actuate at event timestamp parameter that defaults to the boolean value TRUE. If this parameter is set to FALSE, an actuator can produce outputs as soon as they are available.
      • deviceDelay

        public Parameter deviceDelay
        Device delay parameter that defaults to the double value 0.0.
      • deviceDelayBound

        public Parameter deviceDelayBound
        Device delay bound parameter that defaults to the double value 0.0.
      • isNetworkPort

        public Parameter isNetworkPort
        Flag that is true if the port is a network receiver or transmitter. The flag defaults to false.
      • networkDelayBound

        public Parameter networkDelayBound
        An assumed upper bound on the network delay, used if this is a network receiver port (isNetworkPort is true and the port is an input). If the actual network delay exceeds this assumed value, then an exception may result if actual received time of the input is too late to ensure that DE semantics is respected. This is a double that defaults to 0.0.
      • platformDelayBound

        public Parameter platformDelayBound
        An assumed upper bound on the difference between platform time and the event timestamp sent to a network transmitter port (isNetworkPort is true and the port is an output), where platform time is smaller than the event timestamp. If the platform time plus the platformDelayBound is smaller than the event timestamp, an exception is thrown. This parameter is used in cases where the execution time is larger than the logical time delays on the platform to indicate that the designer knows that the execution time is bigger than the time delay on the platform. This is a double that defaults to 0.0. In that case, an exception is thrown when platform time is smaller than the event timestamp.
      • sourcePlatformDelayBound

        public Parameter sourcePlatformDelayBound
        An assumed upper bound on the difference between platform time and the event timestamp received at a network receiver port (isNetworkPort is true and the port is an output), where platform time is smaller than the event timestamp.

        This is used to indicate that the designer knows that the execution time on the sending platform is bigger than the time delay on the sending platform.

        Together with the networkDelayBound and the clockSychronizationErrorBound parameters, this parameter is used to determine whether an event is arriving at a network receiver too late.

        The value specified for the platformDelayBound on a network transmitter and the value specified for the sourcePlatformDelayBound on a network receiver should ideally match, however, this is not enforced. This is a double that defaults to 0.0.

    • Method Detail

      • actuateAtEventTimestamp

        public boolean actuateAtEventTimestamp()
        Return true if actuation should happen at event timestamp and false if actuation can happen sooner.
        Returns:
        whether actuation should be done at the event timestamp.
      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        React to a change in an attribute. This method is called by a contained attribute when its value changes. This overrides the base class so that if the attribute is an instance of TypeAttribute, then it sets the type of the port.
        Overrides:
        attributeChanged in class TypedIOPort
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container.
      • getTimestampForToken

        public java.lang.Object[] getTimestampForToken​(Token t)
        Return the timestamp and sourceTimestamp for a specific token.
        Parameters:
        t - The token.
        Returns:
        The timestamp.
      • getMicrostepForToken

        public int getMicrostepForToken​(Token t)
        Get the microstep of the event that contained the token.
        Parameters:
        t - The token.
        Returns:
        The microstep.
      • isActuatorPort

        public boolean isActuatorPort()
        Check whether port is output and network port parameter is not set.
        Returns:
        True if port is an actuator port.
      • isSensorPort

        public boolean isSensorPort()
        Check whether port is input and network port parameter is not set.
        Returns:
        True if is sensor port.
      • isNetworkReceiverPort

        public boolean isNetworkReceiverPort()
        Check whether port is input and network port parameter is set.
        Returns:
        True if is network receiver port.
      • isNetworkTransmitterPort

        public boolean isNetworkTransmitterPort()
        Check whether port is output and network port parameter is set.
        Returns:
        True if port is an network transmitter port.
      • setInput

        public void setInput​(boolean isInput)
                      throws IllegalActionException
        Make port input port and update visual representation.
        Overrides:
        setInput in class MirrorPort
        Parameters:
        isInput - True to make this an input port.
        Throws:
        IllegalActionException - If changing the port status is not permitted.
      • setOutput

        public void setOutput​(boolean isInput)
                       throws IllegalActionException
        Make port output port and update visual representation.
        Overrides:
        setOutput in class MirrorPort
        Parameters:
        isInput - True to make this an output port.
        Throws:
        IllegalActionException - If changing the port status is not permitted.
      • send

        public void send​(int channelIndex,
                         Token token)
                  throws IllegalActionException,
                         NoRoomException
        Save token and remember timestamp of the token. Then call send of super class.
        Overrides:
        send in class TypedIOPort
        Parameters:
        channelIndex - The index of the channel, from 0 to width-1.
        token - The token to send, or null to send no token.
        Throws:
        IllegalActionException - If the token to be sent cannot be converted to the type of this port, or if the token is null.
        NoRoomException - If there is no room in the receiver.