Package ptolemy.domains.qss.kernel
Class QSSDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.domains.de.kernel.DEDirector
-
- ptolemy.domains.qss.kernel.QSSDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,SuperdenseTimeDirector
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
QSSDirectorTest
public class QSSDirector extends DEDirector
A director that extends the discrete-event model of computation to include a Quantized-State System (QSS) solver to perform integration. This solver performs using a discrete-event style, quantizing the magnitude of signals rather than the time, as done by a conventional ODE solver. The absoluteQuantum and relativeQuantum parameters determine the quantization granularity. For information about QSS, seeQSSIntegrator
andQSSBase
.Note that the expression function smoothToken(double, {double}) is available in the expression language. This function creates a
SmoothToken
with value equal to the first argument and any number of derivatives given in the second argument. Actors in this domain can use such tokens, when they are provided, to perform more accurate calculations.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Thierry S. Nouidui and Edward A. Lee
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
absoluteQuantum
The minimum quantum for QSS integrations under the control of this director.StringParameter
QSSSolver
The class name of the QSS solver used for integration.Parameter
quantumScaleFactor
The quantum scale factor to use for QSS integrations under the control of this director.Parameter
relativeQuantum
The relative quantum to use for QSS integrations under the control of this director.-
Fields inherited from class ptolemy.domains.de.kernel.DEDirector
_actorsFinished, _actorsInExecution, _disabledActors, _eventQueue, _eventQueueLock, _isInitializing, _microstep, _noMoreActorsToFire, _stopFireRequested, binCountFactor, enforceMicrostepSemantics, isCQAdaptive, minBinCount, stopWhenQueueIsEmpty, synchronizeToRealTime
-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
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 QSSDirector()
Construct a director in the default workspace with an empty string as its name.QSSDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.QSSDirector(Workspace workspace)
Construct a director in the workspace with an empty name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QSSBase
_instantiateQSSSolver(java.lang.String className)
Instantiate an QSSSolver from its class name.void
attributeChanged(Attribute attribute)
React to a change in an attribute.static void
configureSolverParameter(StringParameter solverParameter, java.lang.String defaultSolver)
Set the default solver method and list solver alternatives for the specified solver.double
getAbsoluteQuantum()
Return the value of the absoluteQuantum parameter.static java.lang.String[]
getQSSSolverNames()
Gets the list of all available QSS solver names.double
getQuantumScaleFactor()
Return the value of the quantumScaleFactor parameter.double
getRelativeQuantum()
Return the value of the relativeQuantum parameter.QSSBase
newQSSSolver()
Return a new QSS solver for use.QSSBase
newQSSSolver(java.lang.String type)
Return a new QSS solver of the specified type.-
Methods inherited from class ptolemy.domains.de.kernel.DEDirector
_actorFired, _checkForNextEvent, _disableActor, _enqueueEvent, _enqueueTriggerEvent, _fire, _getDepthOfActor, _getDepthOfIOPort, _getNextActorToFire, _issueExecutionAspectWarning, _noActorToFire, _requestFiring, _schedule, addDebugListener, cancelFireAt, cancelFireAt, clone, describePriorities, fire, fireAt, fireAt, fireAtCurrentTime, fireAtRelativeTime, getCausalityInterface, getIndex, getMicrostep, getModelNextIterationTime, getNextEventTime, getStartTime, getStopTime, initialize, invalidateSchedule, mutexLockObject, newReceiver, postfire, prefire, preinitialize, removeDebugListener, resumeActor, setIndex, stop, stopFire, suggestedModalModelDirectors, transferInputs, wrapup
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireContainerAt, fireContainerAt, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, supportMultirateFiring, suspend, terminate, transferOutputs, transferOutputs
-
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, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, 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, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Field Detail
-
absoluteQuantum
public Parameter absoluteQuantum
The minimum quantum for QSS integrations under the control of this director. This is a double that defaults to 1E-4.
-
QSSSolver
public StringParameter QSSSolver
The class name of the QSS solver used for integration. This is a string that defaults to "QSS1". Solvers are all required to be in package "org.ptolemy.qss". Note that if the solver is changed during the execution of the model, the change will not take effect until the model re-initialized.
-
relativeQuantum
public Parameter relativeQuantum
The relative quantum to use for QSS integrations under the control of this director. If the value here is greater than zero, then the quantum will be the larger of theabsoluteQuantum
and |x| * relativeQuantum, where x is the current value of the state being quantized. This is a double that defaults to be 0.0, which causes the absoluteQuantum to be used.
-
quantumScaleFactor
public Parameter quantumScaleFactor
The quantum scale factor to use for QSS integrations under the control of this director. This value is used to scale the value of the absolute and relative quantum to achieve a finer quantization. This is a double which value must be greater than 0.0 and less or equal to 1.0.
-
-
Constructor Detail
-
QSSDirector
public QSSDirector() throws IllegalActionException, NameDuplicationException
Construct a director in the default workspace with an empty string as its name. The director is added to the list of objects in the workspace. Increment the version number of the workspace.- Throws:
NameDuplicationException
- If construction of Time objects fails.IllegalActionException
- If construction of Time objects fails.
-
QSSDirector
public QSSDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a director in the workspace with an empty name. The director is added to the list of objects in the workspace. Increment the version number of the workspace.- Parameters:
workspace
- The workspace of this object.- Throws:
NameDuplicationException
- If construction of Time objects fails.IllegalActionException
- If construction of Time objects fails.
-
QSSDirector
public QSSDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a director in the given container with the given name. 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. Increment the version number of the workspace.- Parameters:
container
- Container of the director.name
- Name of this director.- Throws:
IllegalActionException
- If the director is not compatible with the specified container.NameDuplicationException
- If the container not a CompositeActor and the name collides with an entity in the container.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
React to a change in an attribute. If the changed attribute matches a parameter of the director, then the corresponding local copy of the parameter value will be updated.- Overrides:
attributeChanged
in classDEDirector
- Parameters:
attribute
- The changed parameter.- Throws:
IllegalActionException
- If the new parameter value is not valid.
-
getQSSSolverNames
public static java.lang.String[] getQSSSolverNames()
Gets the list of all available QSS solver names.
-
configureSolverParameter
public static void configureSolverParameter(StringParameter solverParameter, java.lang.String defaultSolver)
Set the default solver method and list solver alternatives for the specified solver.- Parameters:
solverParameter
- The parameter specifying the solver method.defaultSolver
- The default solver to use.
-
getAbsoluteQuantum
public final double getAbsoluteQuantum()
Return the value of the absoluteQuantum parameter.- Returns:
- The absolute quantum.
-
getRelativeQuantum
public final double getRelativeQuantum()
Return the value of the relativeQuantum parameter.- Returns:
- The relative quantum.
-
getQuantumScaleFactor
public final double getQuantumScaleFactor()
Return the value of the quantumScaleFactor parameter.- Returns:
- The state output threshold quantum.
-
newQSSSolver
public QSSBase newQSSSolver() throws IllegalActionException
Return a new QSS solver for use.- Returns:
- A QSS solver.
- Throws:
IllegalActionException
- If creating the solver fails.
-
newQSSSolver
public QSSBase newQSSSolver(java.lang.String type) throws IllegalActionException
Return a new QSS solver of the specified type.- Parameters:
type
- The type of solver.- Returns:
- A QSS solver.
- Throws:
IllegalActionException
- If creating the solver fails.
-
_instantiateQSSSolver
protected final QSSBase _instantiateQSSSolver(java.lang.String className) throws IllegalActionException
Instantiate an QSSSolver from its class name. Given the solver's full class name, this method will try to instantiate it by looking for the corresponding java class. This method is based on _instantiateODESolver of the CT domain.- Parameters:
className
- The solver's full class name.- Returns:
- A new QSS solver.
- Throws:
IllegalActionException
- If the solver can not be created.
-
-