Package ptolemy.actor.lib
Class SynchronizeToRealTime
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.AbstractInitializableAttribute
-
- ptolemy.actor.lib.SynchronizeToRealTime
-
- All Implemented Interfaces:
java.lang.Cloneable
,Initializable
,TimeRegulator
,Changeable
,Debuggable
,DebugListener
,Derivable
,HierarchyListener
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class SynchronizeToRealTime extends AbstractInitializableAttribute implements TimeRegulator
Attribute that regulates the passage of time to wait for real time to catch up.The scaleFactor parameter is here to set up how many seconds in wallclock time should pass for a single second in model time. So a scale factor of 0.5 will make the model time passes twice as fast as real time, while make it equals 2 means that 2 seconds in wallclock are needed for a single unit of time in the model.
The default value is 1.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Gilles Lasnier, Patricia Derler
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
scaleFactor
How many seconds in wallclock time should pass for a single second in model time.-
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 SynchronizeToRealTime(CompositeEntity container, java.lang.String name)
Construct an instance of the attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
noNewActors()
This class does not create change request for new actor in proposeTime.Time
proposeTime(Time proposedTime)
Propose a time to advance to.-
Methods inherited from class ptolemy.actor.AbstractInitializableAttribute
_getInitializableContainer, addInitializable, clone, hierarchyChanged, hierarchyWillChange, initialize, preinitialize, removeInitializable, setContainer, wrapup
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, 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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
scaleFactor
public Parameter scaleFactor
How many seconds in wallclock time should pass for a single second in model time. So a scaleFactor of 0.5 will make the model time passes twice as fast as real time, while make it equals 2 means that 2 seconds in wallclock are needed for a single unit of time in the model. The default value is 1.0.
-
-
Constructor Detail
-
SynchronizeToRealTime
public SynchronizeToRealTime(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an instance of the attribute.- Parameters:
container
- The container.name
- The name.- Throws:
IllegalActionException
- If the superclass throws it.NameDuplicationException
- If the superclass throws it.
-
-
Method Detail
-
noNewActors
public boolean noNewActors()
This class does not create change request for new actor in proposeTime. Always return true then.- Specified by:
noNewActors
in interfaceTimeRegulator
- Returns:
- false is ChangeRequest has been queued for a new actor
-
proposeTime
public Time proposeTime(Time proposedTime) throws IllegalActionException
Propose a time to advance to.- Specified by:
proposeTime
in interfaceTimeRegulator
- Parameters:
proposedTime
- The proposed time.- Returns:
- The proposed time or a smaller time.
- Throws:
IllegalActionException
- If this attribute is not contained by an Actor.
-
-