Package ptolemy.domains.de.lib.aspect
Class AFDXESs
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,CommunicationAspect
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Decorator
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class AFDXESs extends AtomicCommunicationAspect
This actor is anCommunicationAspect
that simulates an AFDX End-systems component When itssendToken(Receiver, Receiver, Token)
method is called, the delivery of the specified token to the specified receiver is delayed according to the AFDX end-system protocol and behavior. Only one actor of this kind is required to manage all end-systems of one AFDX network.For more information please refer to: AFDX network simulation in PtolemyII. AFDX standard document.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Gilles Lasnier
- Pt.AcceptedRating:
- Yellow (glasnier)
- Pt.ProposedRating:
- Yellow (glasnier)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AFDXESs.AFDXESsAttributes
The attributes configured per port which is mediated by a AFDXESs.-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,java.util.LinkedList<TimedEvent>>
_afdxSchedMuxsQueue
Tokens received in the AFDX scheduler multiplexor.protected java.util.LinkedHashMap<java.lang.String,java.util.LinkedList<TimedEvent>>
_afdxVLinksQueue
Tokens received as input to the AFDX traffic regulator (aka Lissor or Shaper).protected double
_bitRate
Value of the bit rate of the bus.protected double
_delay
Computed delay according to the bag emission (see AFDX spec.).protected java.util.HashMap<java.lang.String,Time>
_lastEmissionTable
Last emission timestamp for a given virtual link.protected Time
_nextFireTime
Next time a token is sent and the next token can be processed.protected java.util.HashMap<IOPort,AFDXVlink>
_portToVirtualLinks
Routing table mapping ports to virtual link objects.protected java.util.HashMap<java.lang.String,AFDXVlink>
_virtualLinkTable
Routing table for virtual link object.Parameter
bitRate
The bit rate of the bus.-
Fields inherited from class ptolemy.actor.lib.aspect.AtomicCommunicationAspect
_parameters, _tokenCount
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
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.CommunicationAspect
decoratorHighlightColorName
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description AFDXESs(CompositeEntity container, java.lang.String name)
Construct a AFDXESs with a name and a container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Time
_getNextFireTime(Time nextFireTime, java.util.LinkedList<TimedEvent> tokens)
Get next fire time for a set of tokens which is either the minimum next fire time passed as an argument or the smallest timestamp of the tokens in the set.protected void
_scheduleRefire()
Schedule a refiring of this actor based on the tokens in the queues.void
attributeChanged(Attribute attribute)
If the attribute is bitRate, then ensure that the value is non-negative.java.lang.Object
clone(Workspace workspace)
Clone this actor into the specified workspace.DecoratorAttributes
createDecoratorAttributes(NamedObj target)
Return the decorated attributes for the target NamedObj.void
fire()
Fire the actor.IntermediateReceiver
getReceiver(Receiver receiver)
Create an intermediate receiver that wraps a given receiver.Receiver
getReceiver(Receiver receiver, IOPort port)
Create a receiver to mediate a communication via the specified receiver.void
initialize()
Initialize the actor.void
printSMQueue()
Print all elements of the scheduler multiplexor queue.void
printVlinksQueue()
Print all elements of the different VL queues.void
reset()
Reset the communication aspect.void
sendToken(Receiver source, Receiver receiver, Token token)
Initiate a send of the specified token to the specified receiver.void
setBag(IOPort port, java.lang.Double bag)
Set bag value that is parameterized on a port.void
setFrameSize(IOPort port, int size)
Set frame size that is parameterized on a port.void
setSchedulerMultiplexorName(IOPort port, java.lang.String name)
Set the name of the scheduler that is parameterized on a port..void
setVlinkName(IOPort port, java.lang.String name)
Set name of virtual link that is parameterized on a port.-
Methods inherited from class ptolemy.actor.lib.aspect.AtomicCommunicationAspect
_sendToReceiver, createIntermediateReceiver, decoratedObjects, isGlobalDecorator, registerListener, sendCommunicationEvent, setContainer
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
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, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, 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, requestChange, 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
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
bitRate
public Parameter bitRate
The bit rate of the bus. This is a double with default value to 100 Mbits/s. It is required to be positive.
-
_afdxVLinksQueue
protected java.util.LinkedHashMap<java.lang.String,java.util.LinkedList<TimedEvent>> _afdxVLinksQueue
Tokens received as input to the AFDX traffic regulator (aka Lissor or Shaper).
-
_virtualLinkTable
protected java.util.HashMap<java.lang.String,AFDXVlink> _virtualLinkTable
Routing table for virtual link object.
-
_portToVirtualLinks
protected java.util.HashMap<IOPort,AFDXVlink> _portToVirtualLinks
Routing table mapping ports to virtual link objects.
-
_lastEmissionTable
protected java.util.HashMap<java.lang.String,Time> _lastEmissionTable
Last emission timestamp for a given virtual link.
-
_afdxSchedMuxsQueue
protected java.util.HashMap<java.lang.String,java.util.LinkedList<TimedEvent>> _afdxSchedMuxsQueue
Tokens received in the AFDX scheduler multiplexor.
-
_nextFireTime
protected Time _nextFireTime
Next time a token is sent and the next token can be processed.
-
_delay
protected double _delay
Computed delay according to the bag emission (see AFDX spec.).
-
_bitRate
protected double _bitRate
Value of the bit rate of the bus.
-
-
Constructor Detail
-
AFDXESs
public AFDXESs(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a AFDXESs 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.- Parameters:
container
- The container.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.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
If the attribute is bitRate, then ensure that the value is non-negative.- Overrides:
attributeChanged
in classNamedObj
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the service time is negative.
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone this actor into the specified workspace. The new actor is not added to the directory of that workspace (you must do this yourself if you want it there). The result is a new actor with the same ports as the original, but no connections and no container. A container must be set before much can be done with this actor.- Overrides:
clone
in classAtomicCommunicationAspect
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- A new AFDXESs.
- Throws:
java.lang.CloneNotSupportedException
- If cloned ports cannot have as their container the cloned entity (this should not occur), or if one of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
fire
public void fire() throws IllegalActionException
Fire the actor. Typically, the fire() method performs the computation associated with an actor. Here, it delivers (if required) the intended token to the intended receiver(s).- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If firing is not permitted.
-
createDecoratorAttributes
public DecoratorAttributes createDecoratorAttributes(NamedObj target)
Return the decorated attributes for the target NamedObj. If the specified target is not an Actor, return null.- Specified by:
createDecoratorAttributes
in interfaceDecorator
- Overrides:
createDecoratorAttributes
in classAtomicCommunicationAspect
- Parameters:
target
- The NamedObj that will be decorated.- Returns:
- The decorated attributes for the target NamedObj, or null if the specified target is not an Actor.
-
getReceiver
public IntermediateReceiver getReceiver(Receiver receiver)
Create an intermediate receiver that wraps a given receiver.- Parameters:
receiver
- The receiver that is being wrapped.- Returns:
- A new intermediate receiver.
-
getReceiver
public Receiver getReceiver(Receiver receiver, IOPort port) throws IllegalActionException
Create a receiver to mediate a communication via the specified receiver. This receiver is linked to a specific port of the communication aspect.- Parameters:
receiver
- Receiver whose communication is to be mediated.port
- Port of the communication aspect.- Returns:
- A new receiver.
- Throws:
IllegalActionException
- If the receiver cannot be created.
-
initialize
public void initialize() throws IllegalActionException
Initialize the actor.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicCommunicationAspect
- Throws:
IllegalActionException
- If the superclass throws it.
-
printSMQueue
public void printSMQueue()
Print all elements of the scheduler multiplexor queue.
-
printVlinksQueue
public void printVlinksQueue()
Print all elements of the different VL queues.
-
reset
public void reset()
Reset the communication aspect.
-
sendToken
public void sendToken(Receiver source, Receiver receiver, Token token) throws IllegalActionException
Initiate a send of the specified token to the specified receiver. This method will schedule a refiring of this actor according to the requirements of the AFDX protocol.- Parameters:
source
- Sender of the token.receiver
- The receiver to send to.token
- The token to send.- Throws:
IllegalActionException
- If the refiring request fails.
-
setVlinkName
public void setVlinkName(IOPort port, java.lang.String name)
Set name of virtual link that is parameterized on a port.- Parameters:
port
- The port.name
- The virtual link name.
-
setBag
public void setBag(IOPort port, java.lang.Double bag)
Set bag value that is parameterized on a port.- Parameters:
port
- The port.bag
- The bag value.
-
setFrameSize
public void setFrameSize(IOPort port, int size)
Set frame size that is parameterized on a port.- Parameters:
port
- The port.size
- The frame size.
-
setSchedulerMultiplexorName
public void setSchedulerMultiplexorName(IOPort port, java.lang.String name) throws IllegalActionException
Set the name of the scheduler that is parameterized on a port..- Parameters:
port
- The port.name
- The name.- Throws:
IllegalActionException
- Not thrown in this base class
-
_getNextFireTime
protected Time _getNextFireTime(Time nextFireTime, java.util.LinkedList<TimedEvent> tokens)
Get next fire time for a set of tokens which is either the minimum next fire time passed as an argument or the smallest timestamp of the tokens in the set.- Parameters:
nextFireTime
- Minimum next fire time.tokens
- The set of tokens.- Returns:
- The next time this actor should be fired based on the tokens in the queue.
-
_scheduleRefire
protected void _scheduleRefire() throws IllegalActionException
Schedule a refiring of this actor based on the tokens in the queues.- Throws:
IllegalActionException
- If actor cannot be refired at the computed time.
-
-