public class MultirateFSMDirector extends FSMDirector
The number of tokens to be transferred from an input port of the modal model is at most the token consumption rate inferred by the inside port of the current state refinement. The number of tokens to be transferred from an output port of the state refinement is exactly the token production rate inferred by the state refinement. If there are not enough tokens available from the refinement, an exception is thrown. The default token consumption and production rate of a port is 1.
When a state transition occurs, this director compares the port rates of the destination state refinement with that of the current state refinement. If the rates are different, then it invalidate the schedule of the executive director of the modal model and updates the port rates of the modal model to be the port rates of the destination state refinement.
FSMDirector
Red (hyzheng) |
Red (hyzheng) |
NamedObj.ContainedObjectsIterator
_currentLocalReceiverMap, _indexOffset, _localReceiverMaps, controllerName
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
MultirateFSMDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_declareDependency(ConstVariableModelAnalysis analysis,
IOPort port,
java.lang.String name,
java.util.List dependents)
Add a DependencyDeclaration (with the name
"_MultirateFSMRateDependencyDeclaration") to the variable with the
given name in the given port that declares the variable is dependent
on the given list of variables.
|
protected void |
_declareReconfigurationDependencyForRefinementRateVariables(ConstVariableModelAnalysis analysis,
IOPort port,
java.lang.String parameterName)
Declare the reconfiguration dependency in the given analysis
associated with the parameter name of the given port.
|
protected boolean |
_doPostfire()
Postfire the modal model and commit the transition.
|
protected CompositeActor |
_getEnclosingDomainActor()
If the container of this director does not have an MultirateFSMDirector
as its executive director, then return the container.
|
protected java.util.List |
_getRefinementRateVariables(IOPort port,
java.lang.String parameterName)
Return the set of variables with the given parameter name that are
contained by ports connected to the given port on the inside.
|
protected void |
_setProductionConsumptionRates()
Set the production and consumption rates based on the
refinement of the current state, after descending through a hierarchy of
state machines.
|
protected boolean |
_updateInputTokenConsumptionRates(TypedCompositeActor actor)
Extract the token consumption rates from the input ports of the current
refinement and update the rates of the input ports of the modal model
containing the refinement.
|
protected boolean |
_updateOutputTokenProductionRates(TypedCompositeActor actor)
Extract the token production rates from the output ports of the current
refinement and update the production and initial production rates of the
output ports of the modal model containing the refinement.
|
void |
fire()
Fire the modal model.
|
Time |
fireAtCurrentTime(Actor actor)
Override the base class to ignore the fireAt() call if the specified
actor is the controller.
|
void |
initialize()
Initialize the mode controller and all the refinements.
|
Receiver |
newReceiver()
Return a new receiver of a type compatible with this director.
|
boolean |
postfire()
Postfire the modal model and commit the transition.
|
void |
preinitialize()
Preinitialize all actors deeply contained by the container
of this director.
|
boolean |
supportMultirateFiring()
Return a boolean to indicate whether a ModalModel under control
of this director supports multirate firing.
|
boolean |
transferInputs(IOPort port)
Transfer data from the input port of the container to the
ports connected to the inside of the input port and on the
mode controller or the refinement of its current state.
|
boolean |
transferOutputs(IOPort port)
Transfer data from an output port of the current refinement actor
to the ports it is connected to on the outside.
|
_buildLocalReceiverMaps, _currentLocalReceivers, _getLastChosenTransition, _getStateRefinementsToPostfire, _getTransitionRefinementsToPostfire, _readInputs, _readOutputsFromRefinement, _setCurrentConnectionMap, _setCurrentState, _transferOutputs, attributeChanged, clone, defaultDependency, fireAt, getContext, getController, getIndex, getModelNextIterationTime, getModifiedVariables, getParseTreeEvaluator, handleModelError, implementsStrictActorSemantics, invalidateSchedule, isStrict, prefire, resetOutputReceivers, setContainer, setIndex
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, addInitializable, createSchedule, delayDependency, finish, fireAt, fireAt, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getErrorTolerance, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suggestedModalModelDirectors, suspend, terminate, transferOutputs, wrapup
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, 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, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public MultirateFSMDirector(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.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class FSMDirector
IllegalActionException
- If there is no controller or
the current state has no or more than one refinement, or if
the current state has any preemptive transitions.public Time fireAtCurrentTime(Actor actor) throws IllegalActionException
fireAtCurrentTime
in class Director
actor
- The actor scheduled to be fired.IllegalActionException
- If thrown by the executive director.Director.fireAt(Actor, Time)
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class FSMDirector
IllegalActionException
- If the refinement has no or more
than one refinement, or the initialize() method of one of the
associated actors throws it.public Receiver newReceiver()
newReceiver
in class FSMDirector
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class FSMDirector
IllegalActionException
- If a refinement throws it, or
if there is no controller.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class FSMDirector
IllegalActionException
- If there is no controller, or if the
non-transient initial state has no or more than one refinement, or if
the preinitialize() method of one of the associated actors throws it.public boolean supportMultirateFiring()
supportMultirateFiring
in class Director
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class FSMDirector
port
- The input port to transfer tokens from.IllegalActionException
- If the port is not an opaque
input port.public boolean transferOutputs(IOPort port) throws IllegalActionException
transferOutputs
in class Director
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
output port.protected void _declareDependency(ConstVariableModelAnalysis analysis, IOPort port, java.lang.String name, java.util.List dependents) throws IllegalActionException
analysis
- The object that contains the dependency declarations.port
- The IOPort to get rate variables from.name
- The name of the IOPort.dependents
- The dependents that the dependency declaration of the
given IO port depends on.IllegalActionException
- If a valid rate variable from the
given port can not be found, or the variable does not contain a
DependencyDeclaration attribute, or a new DependencyDeclaration object
can not be created, or can not associated with the analysis object the
newly created DependencyDeclaration object.protected void _declareReconfigurationDependencyForRefinementRateVariables(ConstVariableModelAnalysis analysis, IOPort port, java.lang.String parameterName) throws IllegalActionException
analysis
- The object that contains the dependency declarations.port
- The IOPort to get refinement rate variables from.parameterName
- The name of the rate variables.IllegalActionException
- If can not get the refinement rate
variables from the given port, or can not add the dependency declaration
of the given port to the analysis object, or a declared constant rate
variable does not contain a constant value.protected boolean _doPostfire() throws IllegalActionException
IllegalActionException
- If there is no controller, or if the
destination state has no or more than one refinement, or if the state
refinement throws it.protected CompositeActor _getEnclosingDomainActor() throws IllegalActionException
IllegalActionException
- If the top-level director is an
MultirateFSMDirector. This director is intended for use only inside
some other domain.protected java.util.List _getRefinementRateVariables(IOPort port, java.lang.String parameterName) throws IllegalActionException
port
- The given port.parameterName
- The given parameter name.IllegalActionException
- If can not get a rate variable
from the port that is connected to the given port from inside.protected void _setProductionConsumptionRates() throws IllegalActionException
IllegalActionException
- If the initial state does not
have exactly one refinement.protected boolean _updateInputTokenConsumptionRates(TypedCompositeActor actor) throws IllegalActionException
actor
- The current refinement.IllegalActionException
- If can not find the controller, or
the port connections between controller and refinements are not
correct, or can not get valid token consumption rates for input ports.protected boolean _updateOutputTokenProductionRates(TypedCompositeActor actor) throws IllegalActionException
actor
- The current refinement.IllegalActionException
- If we cannot get valid token
consumption rates for input ports.