|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.kernel.CompositeEntity
ptolemy.actor.CompositeActor
ptolemy.actor.TypedCompositeActor
ptolemy.domains.ct.kernel.CTCompositeActor
ptolemy.domains.fsm.modal.ModalModel
This is a typed composite actor designed to be a modal model. Inside the modal model is a finite-state machine controller, and inside each state in the FSM is a refinement model. To use this actor, just drag it into a model, and look inside to start constructing the controller. You may add ports to get inputs and outputs, and add states to the controller. You may add one or more refinements to a state (each of these refinements will be executed when this actor is executed). Each refinement is required to have its own director, so you will need to choose a director.
The controller is a finite-state machine (FSM), which consists of states and transitions. One of the states is an initial state. When this actor executes, if the current state has a refinement, then that refinement is executed. Then the guards on all the outgoing transitions of the current state are evaluated, and if one of those guards is true, then the transition is taken. Taking the transition means that the actions associated with the transition are executed (which can result in producing outputs), and the new current state is the state at the destination of the transition. It is an error if more than one of the guards evaluates to true.
To add a state, click on a state button in the toolbar, or drag in a state from the library at the left. To add a transition, position the mouse over the source state, hold the control button, and drag to the destination state. The destination state may be the same state, in which case the transition is used simply to execute its actions.
Adding or removing ports in this actor results in the same ports appearing or disappearing in the FSM controller and in each of the refinements. Similarly, adding or removing ports in the controller or in the refinements results in this actor and the other refinements reflecting the same change to the ports. That is, this actor, the controller, and the refinments all contain the same ports.
There is one subtlety regarding ports however. If you add an output port to a refinement, then the corresponding port in the controller will be both an input and an output. The reason for this is that the controller can access the results of executing a refinement in order to choose a transition.
This class is designed to work closely with ModalController and Refinement, since changes to ports can be initiated in this class or in those. It works with continuous-time as well as discrete-time models.
This class also fulfills the CTEventGenerator interfact so that it can report events generated inside.
ModalController,
Refinement,
Serialized Form
| Red (reviewmoderator) |
| Red (eal) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.CompositeEntity |
ptolemy.kernel.CompositeEntity.ContainedObjectsIterator |
| Field Summary | |
ptolemy.kernel.util.StringAttribute |
directorClass
A director className string, configured using a ChoiceStyle attribute. |
protected java.lang.String[] |
modalDirectorClassNames
Class names of directors compatible with this ModalModel. |
| Fields inherited from class ptolemy.actor.CompositeActor |
_stopRequested |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Fields inherited from interface ptolemy.actor.Executable |
COMPLETED, NOT_READY, STOP_ITERATING |
| Constructor Summary | |
ModalModel(ptolemy.kernel.CompositeEntity container,
java.lang.String name)
Construct a modal model with a name and a container. |
|
ModalModel(ptolemy.kernel.util.Workspace workspace)
Construct a modal model in the specified workspace with no container and an empty string as a name. |
|
| Method Summary | |
void |
attributeChanged(ptolemy.kernel.util.Attribute attribute)
React to a change of the _director or other property. |
java.lang.Object |
clone(ptolemy.kernel.util.Workspace workspace)
Override the base class to ensure that the _controller private variable is reset to the controller of the cloned object. |
FSMActor |
getController()
Get the FSM controller. |
ptolemy.actor.util.FunctionDependency |
getFunctionDependency()
Return an instance of DirectedGraph, where the nodes are IOPorts, and the edges are the relations between ports. |
FSMDirector |
newDirector()
Create a new director for use in this composite. |
ptolemy.kernel.Port |
newPort(java.lang.String name)
Create a new port with the specified name in this entity, the controller, and all the refinements. |
void |
preinitialize()
Reset internal non-persistent variables and invoke the preinitialize() method of the CompositeActor. |
| Methods inherited from class ptolemy.domains.ct.kernel.CTCompositeActor |
hasCurrentEvent, isThisStepAccurate, predictedStepSize, refinedStepSize |
| Methods inherited from class ptolemy.actor.TypedCompositeActor |
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newRelation, resolveTypes, typeConstraintList |
| Methods inherited from class ptolemy.actor.CompositeActor |
_finishedAddEntity, _setDirector, connectionsChanged, fire, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isOpaque, iterate, newInsideReceiver, newReceiver, outputPortList, postfire, prefire, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.CompositeEntity |
_adjustDeferrals, _description, _exportMoMLContents, _removeEntity, _removeRelation, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, entityList, entityList, exportLinks, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, numberOfClassDefinitions, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.ComponentEntity |
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, propagateExistence, setName |
| Methods inherited from class ptolemy.kernel.Entity |
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition |
| Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ptolemy.actor.Actor |
getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
| Methods inherited from interface ptolemy.actor.Executable |
fire, initialize, iterate, postfire, prefire, stop, stopFire, terminate, wrapup |
| Methods inherited from interface ptolemy.kernel.util.Derivable |
getDerivedLevel, getDerivedList, propagateValue |
| Methods inherited from interface ptolemy.kernel.util.Nameable |
description, getFullName, getName, getName |
| Field Detail |
public ptolemy.kernel.util.StringAttribute directorClass
protected java.lang.String[] modalDirectorClassNames
| Constructor Detail |
public ModalModel(ptolemy.kernel.util.Workspace workspace)
throws ptolemy.kernel.util.IllegalActionException,
ptolemy.kernel.util.NameDuplicationException
workspace - The workspace that will list the actor.
public ModalModel(ptolemy.kernel.CompositeEntity container,
java.lang.String name)
throws ptolemy.kernel.util.IllegalActionException,
ptolemy.kernel.util.NameDuplicationException
container - The container.name - The name of this actor.
ptolemy.kernel.util.IllegalActionException - If the container is incompatible
with this actor.
ptolemy.kernel.util.NameDuplicationException - If the name coincides with
an actor already in the container.| Method Detail |
public void attributeChanged(ptolemy.kernel.util.Attribute attribute)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException
public java.lang.Object clone(ptolemy.kernel.util.Workspace workspace)
throws java.lang.CloneNotSupportedException
workspace - The workspace for the cloned object.
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.public ptolemy.actor.util.FunctionDependency getFunctionDependency()
public FSMActor getController()
public FSMDirector newDirector()
throws ptolemy.kernel.util.IllegalActionException,
ptolemy.kernel.util.NameDuplicationException
ptolemy.kernel.util.IllegalActionException - If constructing the director
triggers an exception.
ptolemy.kernel.util.NameDuplicationException - If there is already a director
with name "_Director".
public ptolemy.kernel.Port newPort(java.lang.String name)
throws ptolemy.kernel.util.NameDuplicationException
name - The name to assign to the newly created port.
ptolemy.kernel.util.NameDuplicationException - If the entity already has a port
with the specified name.
public void preinitialize()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the preinitialize()
method of the CompositeActor throws a IllegalActionException.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||