Package ptolemy.domains.fmima.kernel
Class FMIMADirector
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,SuperdenseTimeDirector
,PeriodicDirector
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class FMIMADirector extends SRDirector
This is an experimental director. We don't really know if we need it or not. The idea is to have a director that coordinates the execution of a model based on Co-simulation FMI- Since:
- Ptolemy II 11.0
- Version:
- $Id: FMIMADirector.java$
- Author:
- Fabio Cremona
- 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 protected boolean
_isFirstFire
A boolean variable used to flag the first fire() execution.-
Fields inherited from class ptolemy.domains.sr.kernel.SRDirector
period
-
Fields inherited from class ptolemy.actor.sched.FixedPointDirector
_actorsAllowedToFire, _actorsFinishedFiring, _actorsFired, _index, _receivers, iterations, synchronizeToRealTime
-
Fields inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_postfireReturns, _prefire
-
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 FMIMADirector()
Construct a director in the default workspace with an empty string as its name.FMIMADirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.FMIMADirector(Workspace workspace)
Construct a director in the given workspace with an empty name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fire()
Fire FMUs according to a given scheduler until the iteration converges.Time
fireAt(Actor actor, Time time, int microstep)
Request a firing of the given actor at the given absolute time, and return the time at which the specified will be fired.void
initialize()
Initialize the director and all deeply contained actors by calling the super.initialize() method.boolean
postfire()
Call postfire() on all contained FMUs that were fired in the current iteration.-
Methods inherited from class ptolemy.domains.sr.kernel.SRDirector
clone, getModelNextIterationTime, periodValue, prefire
-
Methods inherited from class ptolemy.actor.sched.FixedPointDirector
_areAllInputsKnown, _fireActor, _hasIterationConverged, _isReadyToFire, _receiverChanged, _resetAllReceivers, _sendAbsentToAllUnknownOutputsOf, _synchronizeToRealTime, getIndex, implementsStrictActorSemantics, isFireFunctional, isStrict, newReceiver, setIndex, suggestedModalModelDirectors, transferInputs, transferOutputs
-
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, resumeActor, setScheduler
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, attributeChanged, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, initialize, invalidateResolvedTypes, isEmbedded, isStopRequested, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, supportMultirateFiring, suspend, terminate, transferOutputs, 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, _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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
Methods inherited from interface ptolemy.actor.util.PeriodicDirector
isEmbedded
-
-
-
-
Constructor Detail
-
FMIMADirector
public FMIMADirector() 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:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
FMIMADirector
public FMIMADirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a director in the given 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 for this object.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
FMIMADirector
public FMIMADirector(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 name collides with an attribute in the container.
-
-
Method Detail
-
fire
public void fire() throws IllegalActionException
Fire FMUs according to a given scheduler until the iteration converges. An iteration converges when a pass through the schedule does not change the status of any receiver.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classFixedPointDirector
- Throws:
IllegalActionException
- If we couldn't process an event or if an event of smaller timestamp is found within the event queue.
-
fireAt
public Time fireAt(Actor actor, Time time, int microstep) throws IllegalActionException
Request a firing of the given actor at the given absolute time, and return the time at which the specified will be fired. If the period is 0.0 and there is no enclosing director, then this method returns the current time. If the period is 0.0 and there is an enclosing director, then this method delegates to the enclosing director, returning whatever it returns. If the period is not 0.0, then this method checks to see whether the requested time is equal to the current time plus an integer multiple of the period. If so, it returns the requested time. If not, it returns current time plus the period.- Overrides:
fireAt
in classSRDirector
- Parameters:
actor
- The actor scheduled to be fired.time
- The requested time.microstep
- The microstep (ignored by this director).- Returns:
- Either the requested time or the current time plus the period.
- Throws:
IllegalActionException
- If the operation is not permissible (e.g. the given time is in the past).- See Also:
Director.fireAtCurrentTime(Actor)
,Director.fireContainerAt(Time)
-
initialize
public void initialize() throws IllegalActionException
Initialize the director and all deeply contained actors by calling the super.initialize() method. If the period parameter is greater than zero, then request a first firing of the executive director, if there is one.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classSRDirector
- Throws:
IllegalActionException
- If the superclass throws it.
-
postfire
public boolean postfire() throws IllegalActionException
Call postfire() on all contained FMUs that were fired in the current iteration. Return false if the model has finished executing, either by reaching the iteration limit, or if no actors in the model return true in postfire(), or if stop has been requested, or if no actors fired at all in the last iteration. This method is called only once for each iteration. Note that FMUs are postfired in arbitrary order.- Specified by:
postfire
in interfaceExecutable
- Overrides:
postfire
in classSRDirector
- Returns:
- True if the execution is not finished.
- Throws:
IllegalActionException
- If the iterations parameter does not have a valid token, or if there still some unknown inputs (which indicates a causality loop).
-
-