Class ContinuousTransferFunction

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ContinuousTransferFunction
    extends TypedCompositeActor
    A transfer function in the continuous time domain. This actor implements a transfer function where the single input (u) and single output (y) can be expressed in (Laplace) transfer function form as the following equation:
     y(s)    b(1)*s^(m-1) + b(2)*s^(m-2) + ... + b(m)
     ----- = -------------------------------------------
     u(s)    a(1)*s^(n-1) + a(2)*s^(n-2) + ... + a(n)
     
    where m and n are the number of numerator and denominator coefficients, respectively. This actors has two parameters -- numerator and denominator -- containing the coefficients of the numerator and denominator in descending powers of s. These coefficients are double numbers. The order of the denominator (n) must be greater than or equal to the order of the numerator (m).

    This actor extends TypedCompositeActor and works as a higher-order function. Whenever the parameters are changed, the actor will build a transparent subsystem inside it using integrators, adders, and scales. This is called a realization of the transfer function. Notice that there are infinite number of realizations of a transfer function, and they are equivalent if and only if the initial conditions are all zero. Here we choose the controllable canonical form and preset all initial states of the integrators to zero. If you need to set arbitrary initial conditions you have to use the state-space representation, for example, use the LinearStateSpace actor.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Christopher Brooks, based on the CT ContinuousTransferFunction by Jie Liu
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (liuj)
    • Field Detail

      • output

        public TypedIOPort output
        Single output port.
      • numerator

        public Parameter numerator
        The coefficients of the numerator, containing an array of DoubleTokens. The default value is {1.0}.
      • denominator

        public Parameter denominator
        The coefficients of the denominator, containing an array of DoubleTokens. The array must have a length greater than or equal to the length of the numerator. The default value is {1.0}.
    • Constructor Detail

      • ContinuousTransferFunction

        public ContinuousTransferFunction​(Workspace workspace)
                                   throws IllegalActionException,
                                          NameDuplicationException
        Construct a ContinuousTransferFunction in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace.
        Parameters:
        workspace - The workspace that will list the actor.
        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.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        If the argument is the numerator or the denominator parameters, request for initialization from the director if there is one. Also check that the denominator vector cannot start with 0. Other sanity checks, like that the denominator must have a higher order than that of the numerator, and that the first element of the denominator should not be zero, are done in the preinitialize() method.
        Overrides:
        attributeChanged in class TypedCompositeActor
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the numerator and the denominator matrix is not a row vector.
      • isOpaque

        public boolean isOpaque()
        Return the opaqueness of this composite actor. This actor is opaque if it has not been preinitialized after creation or changes of parameters. Otherwise, it is not opaque.
        Overrides:
        isOpaque in class CompositeActor
        Returns:
        True if the entity is opaque.
        See Also:
        CompositeEntity
      • preinitialize

        public void preinitialize()
                           throws IllegalActionException
        Sanity check the parameters; if the parameters are legal create a continuous-time subsystem that implement the transfer function, preinitialize all the actors in the subsystem, and set the opaqueness of this actor to true. This method need the write access on the workspace.
        Specified by:
        preinitialize in interface Initializable
        Overrides:
        preinitialize in class CompositeActor
        Throws:
        IllegalActionException - If there is no ContinuousDirector, or any contained actors throw it in its preinitialize() method .