Class TDLModuleDirector

  • All Implemented Interfaces:
    java.lang.Cloneable, Executable, Initializable, QuasiTransparentDirector, SuperdenseTimeDirector, ExplicitChangeContext, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class TDLModuleDirector
    extends ModalDirector
    Director for a TDL (= Timing Definition Language) module. A TDL module consists of modes, modes consist of TDL tasks and TDL tasks are SDF actors. All actions inside a TDL module are executed periodically and the timing information is specified in parameters. This director parses the parameters and builds a schedule for all the TDL actions. The schedule is represented in a graph showing the dependencies between the TDL actions (see TDLActionsGraph).

    In the initialization, output ports and actuators are initialized with values specified in the parameters of the ports. The schedule is generated and events are scheduled. Events that are safe to process at current model time are executed, then the fireAt(time) of the enclosing director is called with the time stamp of the next event. Events are processed in the order specified in the graph.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Patricia Derler
    • Constructor Detail

      • TDLModuleDirector

        public TDLModuleDirector​(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 this director.
        name - Name of this director.
        Throws:
        IllegalActionException - If the name has a period in it, or 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

      • fire

        public void fire()
                  throws IllegalActionException
        Select all actions that can be fired at the current model time. After executing an action, schedule actions that are executed next according to the schedule. If an action with a WCET > 0 was started, schedule a refiring and return.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class FSMDirector
        Throws:
        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.
      • getModePeriod

        public Time getModePeriod​(NamedObj obj)
        Get mode period from state parameter "period".
        Parameters:
        obj - The object
        Returns:
        The value of the "period" parameter. If there is no period parameter or it cannot be converted to a double, then return 1.0.
      • getModelTime

        public Time getModelTime()
        Return the current model time which is the model time of the executive director.
        Overrides:
        getModelTime in class Director
        Returns:
        the model time of the executive directory
        See Also:
        Director.setModelTime(Time)
      • getWCETParameter

        public static double getWCETParameter​(Actor actor)
        Return the worst case execution time of the actor or 0 if no worst case execution time was specified.
        Parameters:
        actor - The actor for which the worst case execution time is requested.
        Returns:
        The worst case execution time.
      • getWCET

        public double getWCET()
                       throws IllegalActionException
        Return the worst case execution time of the actor or 0 if no worst case execution time was specified.
        Returns:
        The worst case execution time.
        Throws:
        IllegalActionException
      • isFast

        public static boolean isFast​(NamedObj obj)
        Find out if task (=actor) or actuator (=output port) is fast task.
        Parameters:
        obj - The object that could be a fast task or actuator.
        Returns:
        True if it is a fast task.
      • getCausalityInterface

        public CausalityInterface getCausalityInterface()
        Return a causality interface for the composite actor that contains this director. This class returns an instance of TDLCausalityInterface.
        Overrides:
        getCausalityInterface in class Director
        Returns:
        A representation of the dependencies between input ports and output ports of the container.
      • getFrequency

        public static int getFrequency​(NamedObj obj)
        Get frequency of the task.
        Parameters:
        obj - The object that could be a fast task or actuator.
        Returns:
        True if it is a fast task.
      • getSlots

        public static java.lang.String getSlots​(NamedObj obj)
        Get frequency of the task.
        Parameters:
        obj - The object that could be a fast task or actuator.
        Returns:
        True if it is a fast task.
      • scheduleEventsAfterAction

        public void scheduleEventsAfterAction​(Node node)
                                       throws IllegalActionException
        Schedules actions which depend on the action specified in the given node.
        Parameters:
        node - Given node.
        Throws:
        IllegalActionException - Not thrown here but in the base class.
      • transferOutputs

        public boolean transferOutputs​(IOPort port)
        Outputs are only transferred when scheduled, therefore do nothing if transfer outputs is called by another actor.
        Overrides:
        transferOutputs in class Director
        Parameters:
        port - output port.
        Returns:
        True.
      • transferInputs

        public boolean transferInputs​(IOPort port)
                               throws IllegalActionException
        Don't read inputs as this is specifically scheduled by a TDLModule.
        Overrides:
        transferInputs in class FSMDirector
        Parameters:
        port - Input port.
        Returns:
        True if ports transferred inputs.
        Throws:
        IllegalActionException - Thrown if inputs are about to be transferred for a non opaque input port.