Package ptolemy.domains.metroII.kernel
Class MetroIIPtidesPort
- 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.metroII.kernel.MetroIIPtidesPort
-
- All Implemented Interfaces:
java.lang.Cloneable,HasTypeConstraints,Typeable,Changeable,Debuggable,DebugListener,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
public class MetroIIPtidesPort extends MirrorPort
A specialized port for Ptides platform I/O implementing functionality for sensors, actuators and network ports.This class is identical to PtidesPort except Ptides director is mapped to MetroIIPtidesDirector.
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Patricia Derler, Liangpeng Guo
- 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 ParameteractuateAtEventTimestampActuate at event timestamp parameter that defaults to the boolean value TRUE.ParameterdeviceDelayDevice delay parameter that defaults to the double value 0.0.ParameterdeviceDelayBoundDevice delay bound parameter that defaults to the double value 0.0.ParameterisNetworkPortFlag that is true if the port is a network receiver or transmitter.ParameternetworkDelayBoundNetwork delay bound parameter that defaults to the double value 0.0.ParameterplatformDelayBoundPlatform delay bound parameter that defaults to the double value 0.0.ParametersourcePlatformDelayBoundSource platform delay bound parameter that defaults to the double value 0.0.-
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 MetroIIPtidesPort(CompositeEntity container, java.lang.String name)Creates a new PtidesPort with a given container and a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactuateAtEventTimestamp()Return true if actuation should happen at event timestamp and false if actuation can happen sooner.voidattributeChanged(Attribute attribute)React to a change in an attribute.intgetMicrostepForToken(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.booleanisActuatorPort()Returns true if this object is actuator port.booleanisNetworkReceiverPort()Returns true if this object is network receiver port.booleanisNetworkTransmitterPort()Returns true if this object is network transmitter port.booleanisSensorPort()Returns true if this object is sensor port.voidsend(int channelIndex, Token token)Save token and remember timestamp of the token.voidsetInput(boolean isInput)Override the base class to also set the associated port, if there is one.voidsetOutput(boolean isInput)Override the base class to also set the associated port, if there is one.-
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
Network delay bound parameter that defaults to the double value 0.0.
-
platformDelayBound
public Parameter platformDelayBound
Platform delay bound parameter that defaults to the double value 0.0.
-
sourcePlatformDelayBound
public Parameter sourcePlatformDelayBound
Source platform delay bound parameter that defaults to the double value 0.0.
-
-
Constructor Detail
-
MetroIIPtidesPort
public MetroIIPtidesPort(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Creates 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:
attributeChangedin 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()
Returns true if this object is actuator port.- Returns:
- true if port is an actuator port.
-
isSensorPort
public boolean isSensorPort()
Returns true if this object is sensor port.- Returns:
- true if this object is sensor port.
-
isNetworkReceiverPort
public boolean isNetworkReceiverPort()
Returns true if this object is network receiver port.- Returns:
- true if this object is network receiver port.
-
isNetworkTransmitterPort
public boolean isNetworkTransmitterPort()
Returns true if this object is network transmitter port.- Returns:
- true if this object is network transmitter port.
-
setInput
public void setInput(boolean isInput) throws IllegalActionExceptionDescription copied from class:MirrorPortOverride the base class to also set the associated port, if there is one.- Overrides:
setInputin 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 IllegalActionExceptionDescription copied from class:MirrorPortOverride the base class to also set the associated port, if there is one.- Overrides:
setOutputin 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, NoRoomExceptionSave token and remember timestamp of the token. Then call send of super class.- Overrides:
sendin 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.
-
-