ptolemy.domains.ct.lib
Class ContinuousTransferFunction

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.kernel.CompositeEntity
                      extended byptolemy.actor.CompositeActor
                          extended byptolemy.actor.TypedCompositeActor
                              extended byptolemy.domains.ct.lib.ContinuousTransferFunction
All Implemented Interfaces:
ptolemy.actor.Actor, ptolemy.kernel.util.Changeable, java.lang.Cloneable, ptolemy.kernel.util.Debuggable, ptolemy.kernel.util.DebugListener, ptolemy.kernel.util.Derivable, ptolemy.actor.Executable, ptolemy.kernel.util.Instantiable, ptolemy.kernel.util.ModelErrorHandler, ptolemy.kernel.util.MoMLExportable, ptolemy.kernel.util.Nameable, java.io.Serializable, ptolemy.actor.TypedActor

public class ContinuousTransferFunction
extends ptolemy.actor.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 1.0
Version:
$Id: ContinuousTransferFunction.java,v 1.32 2004/04/13 05:13:16 cxh Exp $
Author:
Jie Liu
See Also:
CTBaseIntegrator, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (liuj)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.CompositeEntity
ptolemy.kernel.CompositeEntity.ContainedObjectsIterator
 
Field Summary
 ptolemy.data.expr.Parameter denominator
          The coefficients of the denominator, containing an array of DoubleTokens.
 ptolemy.actor.TypedIOPort input
          Single input port.
 ptolemy.data.expr.Parameter numerator
          The coefficients of the numerator, containing an array of DoubleTokens.
 ptolemy.actor.TypedIOPort output
          Single output port.
 
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
ContinuousTransferFunction(ptolemy.kernel.CompositeEntity container, java.lang.String name)
          Construct the composite actor with a name and a container.
 
Method Summary
 void attributeChanged(ptolemy.kernel.util.Attribute attribute)
          If the argument is the numerator or the denominator parameters, request for initialization from the director if there is one.
 ptolemy.actor.Director getDirector()
          Return the executive director, regardless what isOpaque returns.
 boolean isOpaque()
          Return the opaqueness of this composite actor.
 void preinitialize()
          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.
 void wrapup()
          Set the opaqueness to true and wrapup.
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList
 
Methods inherited from class ptolemy.actor.CompositeActor
_finishedAddEntity, _setDirector, clone, connectionsChanged, fire, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newInsideReceiver, newReceiver, outputPortList, postfire, prefire, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate
 
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
getExecutiveDirector, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
fire, initialize, iterate, postfire, prefire, stop, stopFire, terminate
 
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

input

public ptolemy.actor.TypedIOPort input
Single input port.


output

public ptolemy.actor.TypedIOPort output
Single output port.


numerator

public ptolemy.data.expr.Parameter numerator
The coefficients of the numerator, containing an array of DoubleTokens. The default value is {1.0}.


denominator

public ptolemy.data.expr.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(ptolemy.kernel.CompositeEntity container,
                                  java.lang.String name)
                           throws ptolemy.kernel.util.NameDuplicationException,
                                  ptolemy.kernel.util.IllegalActionException
Construct the composite actor with a name and a container.

Parameters:
container - The container.
name - The name.
Throws:
ptolemy.kernel.util.NameDuplicationException - If another entity already had this name.
ptolemy.kernel.util.IllegalActionException - If there was an internal problem.
See Also:
CTBaseIntegrator
Method Detail

attributeChanged

public void attributeChanged(ptolemy.kernel.util.Attribute attribute)
                      throws ptolemy.kernel.util.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.

Parameters:
attribute - The attribute that changed.
Throws:
ptolemy.kernel.util.IllegalActionException - If the numerator and the denominator matrix is not a row vector.

getDirector

public ptolemy.actor.Director getDirector()
Return the executive director, regardless what isOpaque returns.


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.


preinitialize

public void preinitialize()
                   throws ptolemy.kernel.util.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.

Throws:
ptolemy.kernel.util.IllegalActionException - If there is no CTDirector, or any contained actors throw it in its preinitialize() method .

wrapup

public void wrapup()
            throws ptolemy.kernel.util.IllegalActionException
Set the opaqueness to true and wrapup.

Throws:
ptolemy.kernel.util.IllegalActionException - If there is no director.