Package ptolemy.domains.metroII.kernel
Class MetroIIPtidesPlatform
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.kernel.CompositeEntity
-
- ptolemy.actor.CompositeActor
-
- ptolemy.actor.TypedCompositeActor
-
- ptolemy.domains.metroII.kernel.MetroIICompositeActor
-
- ptolemy.domains.metroII.kernel.MetroIIMirrorComposite
-
- ptolemy.domains.metroII.kernel.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetroIIPtidesPlatform.PtidesMirrorPort
This is a specialized port for PtidesPlatform.static class
MetroIIPtidesPlatform.PtidesNetworkType
The Ptides type that is sent over the network.static class
MetroIIPtidesPlatform.PtidesPlatformContents
This is a specialized composite actor for use in PtidesPlatform.-
Nested classes/interfaces inherited from class ptolemy.domains.metroII.kernel.MetroIIMirrorComposite
MetroIIMirrorComposite.MetroIIMirrorCompositeContents
-
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
-
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
-
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
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description MetroIIPtidesPlatform(CompositeEntity container, java.lang.String name)
Creates an actor with a name and a container.MetroIIPtidesPlatform(Workspace workspace)
Constructs an PtidesPlatform in the specified workspace with no container and an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addPort(Port port)
Add a port to this actor.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.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.protected void
_transferPortParameterInputs()
Reads inputs from ParameterPorts and update the paramter of the associatedPort.java.lang.Object
clone(Workspace workspace)
Clones the object into the specified workspace.Port
newPort(java.lang.String name)
FIXME: Return SensorPort or ActuatorPort.-
Methods inherited from class ptolemy.domains.metroII.kernel.MetroIIMirrorComposite
_addEntity, _exportMoMLContents, _removeEntity, _removePort, newParameterPort
-
Methods inherited from class ptolemy.domains.metroII.kernel.MetroIICompositeActor
adapter, getfire
-
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addRelation, attributeChanged, attributeTypeChanged, isBackwardTypeInferenceEnabled, newRelation, resolveTypes, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, addActorFiringListener, addInitializable, addPiggyback, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, preinitialize, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort, wrapup
-
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
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 classMetroIIMirrorComposite
- 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 classMetroIIMirrorComposite
- 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.
-
_addPort
protected void _addPort(Port port) throws IllegalActionException, NameDuplicationException
Description copied from class:MetroIIMirrorComposite
Add a port to this actor. This overrides the base class to mirror the new port in the contained actor, if there is one, and to establish a connection to a port on the contained actor.- Overrides:
_addPort
in classMetroIIMirrorComposite
- Parameters:
port
- The TypedIOPort to add to this actor.- Throws:
IllegalActionException
- If the port is not an instance of IteratePort, or the port has no name.NameDuplicationException
- If the port name collides with a name already in the actor.
-
_transferPortParameterInputs
protected void _transferPortParameterInputs() throws IllegalActionException
Reads inputs from ParameterPorts and update the paramter of the associatedPort.- Overrides:
_transferPortParameterInputs
in classCompositeActor
- Throws:
IllegalActionException
- If reading from parameter associated with port fails.
-
_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 classTypedCompositeActor
- 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 classTypedCompositeActor
- Parameters:
sourcePort
- The source port.- Returns:
- A list of instances of Inequality.
-
-