|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.domains.modal.kernel.FSMDirector
ptolemy.domains.continuous.kernel.HybridModalDirector
public class HybridModalDirector
An HybridModalDirector governs the execution of the discrete dynamics of a hybrid system model. It extends ModalDirector by implementing the ContinuousStatefulComponent and ContinuousStepSizeController interfaces by delegating the function of those interfaces to the currently active state refinement.
Note that when a multi-step solver is used, the guards on the transitions are only evaluated when either the step size is zero or the multi-step solver has just completed its last step. The guards are not evaluated during intermediate steps.
This director is based on HSFSMDirector by Xiaojun Liu and Haiyang Zheng.
Red (liuxj) |
Yellow (eal) |
Nested Class Summary | |
---|---|
private class |
HybridModalDirector.ActorsFiredIterator
Iterator over _stateRefinementsToPostfire followed by _transitionRefinementsToPostfire. |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private double |
_distanceToBoundary
Local variable to indicate the distance to boundary. |
private ContinuousDirector |
_enclosingContinuousDirector
The enclosing continuous director, if there is one. |
private long |
_enclosingContinuousDirectorVersion
The version for __enclosingContinuousDirector. |
private double |
_lastDistanceToBoundary
Local variable to indicate the last committed distance to boundary. |
Fields inherited from class ptolemy.domains.modal.kernel.FSMDirector |
---|
_currentLocalReceiverMap, _disabledActors, _enabledRefinements, _indexOffset, _localReceiverMaps, _stateRefinementsToPostfire, _transitionRefinementsToPostfire, controllerName |
Fields inherited from class ptolemy.actor.Director |
---|
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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 | |
---|---|
HybridModalDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
Method Summary | |
---|---|
private Transition |
_checkEvent(java.util.List transitionList)
Return the first transition in the specified list that has an "event", which is a change in the boolean value of its guard since the last evaluation. |
protected ContinuousDirector |
_enclosingContinuousDirector()
Return the enclosing continuous director, or null if there is none. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Fire the model model for one iteration. |
double |
getErrorTolerance()
Return error tolerance used for detecting enabled transitions. |
ParseTreeEvaluator |
getParseTreeEvaluator()
Return the parse tree evaluator used to evaluate guard expressions. |
boolean |
isStepSizeAccurate()
Return true if all actors that were fired in the current iteration report that the step size is accurate and if no transition is enabled. |
boolean |
postfire()
Override the base class so that if there is no enabled transition then we record for each comparison operation in each guard expression the distance between the current value of the variable being compared and the threshold. |
boolean |
prefire()
Override the base class to set current time to match that of the enclosing executive director, if there is one, regardless of whether that time is in the future or past. |
double |
refinedStepSize()
Return the minimum of the step sizes suggested by any actors that were fired in the current iteration. |
void |
rollBackToCommittedState()
Roll back to committed state. |
double |
suggestedStepSize()
Return the minimum of the step sizes suggested by any actors that were fired in current iteration. |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
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 |
---|
private double _distanceToBoundary
private ContinuousDirector _enclosingContinuousDirector
private long _enclosingContinuousDirectorVersion
private double _lastDistanceToBoundary
Constructor Detail |
---|
public HybridModalDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of this director.name
- Name of this director.
IllegalActionException
- If the name has a period in it, or
the director is not compatible with the specified container.
NameDuplicationException
- If the container is not a
CompositeActor and the name collides with an entity in the container.Method Detail |
---|
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class FSMDirector
workspace
- The workspace for the new actor.
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class FSMDirector
IllegalActionException
- If there is more than one
transition enabled and nondeterminism is not permitted,
or there is no controller, or it is thrown by any
choice action.public final double getErrorTolerance()
getErrorTolerance
in class Director
public ParseTreeEvaluator getParseTreeEvaluator()
ParseTreeEvaluatorForGuardExpression
is returned.
The parse tree evaluator is set to construction mode.
getParseTreeEvaluator
in class FSMDirector
public boolean isStepSizeAccurate()
isStepSizeAccurate
in interface ContinuousStepSizeController
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class FSMDirector
IllegalActionException
- If thrown by any commit action
or there is no controller.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class FSMDirector
IllegalActionException
- If thrown by the superclass.public double refinedStepSize() throws IllegalActionException
refinedStepSize
in interface ContinuousStepSizeController
IllegalActionException
- If the step size cannot be further refined.public void rollBackToCommittedState()
rollBackToCommittedState
in interface ContinuousStatefulComponent
public double suggestedStepSize() throws IllegalActionException
suggestedStepSize
in interface ContinuousStepSizeController
IllegalActionException
- If an actor requests an
illegal step size.protected ContinuousDirector _enclosingContinuousDirector()
private Transition _checkEvent(java.util.List transitionList)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |