Class PHY
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class PHY extends NetworkActorBase
The PHY class implements a physical layer which does the following: 1) collision detection; 2) carrier sense; 3) send TxStartConfirm to the MAC when TxStart is received; send TxEnd to the MAC when transmission is completed; send RxStart to the MAC when reception starts; send RxData and RxEnd to the MAC when reception ends. Things that can be added: 1) not send channel status in the transmit state; 2) The first received signal is above the sensitivity, so the PHY decides to receive it. If the second signal is much stronger, the PHY can abort the reception of the 1st one and receive the 2nd one instead.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Charlie Zhong
- Pt.AcceptedRating:
- Red (reviewmoderator)
- Pt.ProposedRating:
- Red (czhong)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PHY.ExtendedTimer
Extend the default timer to link the additional info (e.g.-
Nested classes/interfaces inherited from class ptolemy.domains.wireless.lib.network.NetworkActorBase
NetworkActorBase.Timer
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_aPlcpHeaderLength
protected int
_aPreambleLength
protected Variable
_duration
protected double
_sensitivity
protected double
_SNRThresholdInDB
Parameter
aPlcpHeaderLength
The size of the PLCP header in a frame.Parameter
aPreambleLength
The size of the Preamble header in a frame.TypedIOPort
channelStatus
Port sending channel status to the MACprotected static java.lang.String[]
ChMsgFields
TypedIOPort
fromChannel
Port receiving messages from the channelTypedIOPort
fromMAC
Port receiving messages from the MACTypedIOPort
PHYConfirm
Port sending transmit confirmation to the MACprotected static java.lang.String[]
RxDataMsgFields
protected static java.lang.String[]
RxEndMsgFields
protected static java.lang.String[]
RxStartMsgFields
Parameter
sensitivity
The power threshold above which the signal can be detected at the receiver.protected static java.lang.String[]
SignalMsgFields
Parameter
SNRThresholdInDB
The threshold for the signal to be recognized from interference.TypedIOPort
toChannel
Port sending messages to the channelTypedIOPort
toMAC
Port sending messages to the MAC-
Fields inherited from class ptolemy.domains.wireless.lib.network.NetworkActorBase
_timersSet, Ack, AckPacket, appl_data_msg, appl_interest_msg, Busy, cNetwDataMessageFields, cNetwInterestMessageFields, Cts, Data, DataPacket, Error, Gilbert, Idle, netw_data_msg, netw_interest_msg, NoError, PCRequestMsgFields, PCResponseMsgFields, Rts, RtsPacket, RxData, Rxdelay, RxEnd, RxStart, StartRspMsgFields, Timeout, Turnaround, TxData, TxEnd, TxStart, TxStartConfirm, UNKNOWN
-
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.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description PHY(CompositeEntity container, java.lang.String name)
Construct an actor with the specified name and container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
If the specified attribute is changed, check that a positive number is given.protected void
cancelTimer2(PHY.ExtendedTimer timerToCancel)
Remove the timer that matches with the timerToCancel argument from the timers set.void
declareDelayDependency()
Override the base class to declare that the fromMAC output port does not depend on the toMAC, channelStatus and PHYConfirm ports in a firing.void
fire()
Do nothing.void
initialize()
Initialize the private variables.protected PHY.ExtendedTimer
setTimer2(int kind, Time expirationTime, double power)
protected int
whoTimeout2()
Get the timer with expiration time that matches the current time.-
Methods inherited from class ptolemy.domains.wireless.lib.network.NetworkActorBase
cancelTimer, setTimer, whoTimeout
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, 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
-
aPreambleLength
public Parameter aPreambleLength
The size of the Preamble header in a frame. The Preamble header contains synchronization information and timing information for the frame.
-
aPlcpHeaderLength
public Parameter aPlcpHeaderLength
The size of the PLCP header in a frame. The PLCP header contains logical information for the physical layer to decode the frame.
-
SNRThresholdInDB
public Parameter SNRThresholdInDB
The threshold for the signal to be recognized from interference. It is specified in decibels (10 * log10(r), where r is the power ratio. This is a double that defaults to Infinity, which indicates that all overlapping messages are lost to collisions.
-
sensitivity
public Parameter sensitivity
The power threshold above which the signal can be detected at the receiver. Any message with a received power below this number is ignored. This has type double and defaults to 0.0, which indicates that all messages (with nonzero power) will be received.
-
fromMAC
public TypedIOPort fromMAC
Port receiving messages from the MAC
-
fromChannel
public TypedIOPort fromChannel
Port receiving messages from the channel
-
toMAC
public TypedIOPort toMAC
Port sending messages to the MAC
-
channelStatus
public TypedIOPort channelStatus
Port sending channel status to the MAC
-
PHYConfirm
public TypedIOPort PHYConfirm
Port sending transmit confirmation to the MAC
-
toChannel
public TypedIOPort toChannel
Port sending messages to the channel
-
_aPreambleLength
protected int _aPreambleLength
-
_aPlcpHeaderLength
protected int _aPlcpHeaderLength
-
_sensitivity
protected double _sensitivity
-
_SNRThresholdInDB
protected double _SNRThresholdInDB
-
RxStartMsgFields
protected static final java.lang.String[] RxStartMsgFields
-
RxEndMsgFields
protected static final java.lang.String[] RxEndMsgFields
-
RxDataMsgFields
protected static final java.lang.String[] RxDataMsgFields
-
SignalMsgFields
protected static final java.lang.String[] SignalMsgFields
-
ChMsgFields
protected static final java.lang.String[] ChMsgFields
-
_duration
protected Variable _duration
-
-
Constructor Detail
-
PHY
public PHY(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an actor with the specified name and container. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. This constructor write-synchronizes on the workspace.- Parameters:
container
- The container.name
- The name of 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
-
declareDelayDependency
public void declareDelayDependency() throws IllegalActionException
Override the base class to declare that the fromMAC output port does not depend on the toMAC, channelStatus and PHYConfirm ports in a firing.- Overrides:
declareDelayDependency
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If the causality interface cannot be computed.- See Also:
AtomicActor.getCausalityInterface()
,AtomicActor._declareDelayDependency(IOPort, IOPort, double)
-
fire
public void fire() throws IllegalActionException
Description copied from class:AtomicActor
Do nothing. Derived classes override this method to define their primary run-time action.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
initialize
public void initialize() throws IllegalActionException
Initialize the private variables.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classNetworkActorBase
- Throws:
IllegalActionException
- If thrown by the base class.
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
If the specified attribute is changed, check that a positive number is given. Otherwise, defer to the base class.- Overrides:
attributeChanged
in classNamedObj
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the change is not acceptable to this container.
-
setTimer2
protected PHY.ExtendedTimer setTimer2(int kind, Time expirationTime, double power) throws IllegalActionException
- Throws:
IllegalActionException
-
cancelTimer2
protected void cancelTimer2(PHY.ExtendedTimer timerToCancel) throws IllegalActionException
Remove the timer that matches with the timerToCancel argument from the timers set. If no match is found, do nothing.- Throws:
IllegalActionException
-
whoTimeout2
protected int whoTimeout2() throws IllegalActionException
Get the timer with expiration time that matches the current time. Remove the timer from the timers set and return the kind parameter of the timer to the caller method. If there are multiple timers with expiration time matching the current time, return the first one from the iterator list.- Returns:
- return the kind parameter of the timeout timer.
- Throws:
IllegalActionException
- If thrown by getDirector().getCurrentTime().
-
-