Package ptolemy.domains.ptides.lib
Class PtidesPort
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.Port
-
- ptolemy.kernel.ComponentPort
-
- ptolemy.actor.IOPort
-
- ptolemy.actor.TypedIOPort
-
- ptolemy.actor.lib.hoc.MirrorPort
-
- ptolemy.domains.ptides.lib.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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.actor.TypedIOPort
TypedIOPort.RunTimeTypeCheckException
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
actuateAtEventTimestamp
Actuate at event timestamp parameter that defaults to the boolean value TRUE.Parameter
deviceDelay
Device delay parameter that defaults to the double value 0.0.Parameter
deviceDelayBound
Device delay bound parameter that defaults to the double value 0.0.Parameter
isNetworkPort
Flag that is true if the port is a network receiver or transmitter.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).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.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.-
Fields inherited from class ptolemy.actor.TypedIOPort
_resolvedType, TYPE
-
Fields inherited from class ptolemy.actor.IOPort
_constantLimit, _constantToken, _constantTokensSent, _hasPortEventListeners, _portEventListeners, CONFIGURATION, defaultValue, RECEIVERS, REMOTERECEIVERS
-
Fields inherited from class ptolemy.kernel.Port
_insideLinks, _relationsList
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description PtidesPort(CompositeEntity container, java.lang.String name)
Create a new PtidesPort with a given container and a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
actuateAtEventTimestamp()
Return true if actuation should happen at event timestamp and false if actuation can happen sooner.void
attributeChanged(Attribute attribute)
React to a change in an attribute.int
getMicrostepForToken(Token t)
Get the microstep of the event that contained the token.java.lang.Object[]
getTimestampForToken(Token t)
Return the timestamp and sourceTimestamp for a specific token.boolean
isActuatorPort()
Check whether port is output and network port parameter is not set.boolean
isNetworkReceiverPort()
Check whether port is input and network port parameter is set.boolean
isNetworkTransmitterPort()
Check whether port is output and network port parameter is set.boolean
isSensorPort()
Check whether port is input and network port parameter is not set.void
send(int channelIndex, Token token)
Save token and remember timestamp of the token.void
setInput(boolean isInput)
Make port input port and update visual representation.void
setOutput(boolean isInput)
Make port output port and update visual representation.-
Methods inherited from class ptolemy.actor.lib.hoc.MirrorPort
clone, getAssociatedPort, setAssociatedPort, setContainer, setMultiport, setName
-
Methods inherited from class ptolemy.actor.TypedIOPort
_checkContainer, _checkLiberalLink, _checkLink, _checkType, _checkTypedIOPortContainer, _description, addTypeListener, broadcast, broadcast, convert, getAutomaticTypeConversion, getType, getTypeTerm, isTypeAcceptable, removeTypeListener, send, sendInside, setAutomaticTypeConversion, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.IOPort
_checkLiberalLink, _exportMoMLContents, _getInsideWidth, _getOutsideWidth, _getReceiversLinkedToGroup, _newInsideReceiver, _newInsideReceiver, _newReceiver, _newReceiver, _notifyPortEventListeners, _removeReceivers, _setConstant, _wrapReceiver, addIOPortEventListener, broadcastClear, checkWidthConstraints, createReceivers, deepConnectedInPortList, deepConnectedInPorts, deepConnectedOutPortList, deepConnectedOutPorts, deepGetReceivers, get, get, getChannelForReceiver, getCommunicationAspects, getCurrentTime, getDefaultWidth, getInside, getInsideReceivers, getIOPortEventListeners, getModelTime, getModelTime, getReceivers, getReceivers, getReceivers, getRelationIndex, getRemoteReceivers, getRemoteReceivers, getWidth, getWidthFromConstraints, getWidthInside, hasNewToken, hasNewTokenInside, hasRoom, hasRoomInside, hasToken, hasToken, hasTokenInside, hasWidthConstraints, insertLink, insideSinkPortList, insideSourcePortList, invalidateCommunicationAspects, isInput, isInsideConnected, isKnown, isKnown, isKnownInside, isMultiport, isOutput, isOutsideConnected, liberalLink, link, numberOfSinks, numberOfSources, removeIOPortEventListener, reset, sendClear, sendClearInside, setDefaultWidth, setWidthEquals, setWidthEquals, sinkPortList, sourcePortList, transferInputs, transferOutputs, unlink, unlink, unlinkAll, unlinkAllInside, unlinkInside, unlinkInside
-
Methods inherited from class ptolemy.kernel.ComponentPort
_deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _isInsideLinkable, deepConnectedPortList, deepConnectedPorts, deepInsidePortList, deepInsidePorts, insertInsideLink, insidePortList, insidePorts, insideRelationList, insideRelations, isDeeplyConnected, isInsideGroupLinked, isInsideLinked, isOpaque, numInsideLinks
-
Methods inherited from class ptolemy.kernel.Port
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isGroupLinked, isLinked, linkedRelationList, linkedRelations, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, numLinks
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
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.
-
-
Constructor Detail
-
PtidesPort
public PtidesPort(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new PtidesPort with a given container and a name.- Parameters:
container
- The container of the port.name
- The name of the port.- Throws:
IllegalActionException
- If parameters cannot be set.NameDuplicationException
- If name already exists.
-
-
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 classTypedIOPort
- 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 classMirrorPort
- 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 classMirrorPort
- 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 classTypedIOPort
- 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.
-
-