public class LinearStateSpace extends TypedCompositeActor
The State-Space model implements a system whose behavior is defined by:
dx/dt = Ax + Bu y = Cx + Du x(0) = x0where x is the state vector, u is the input vector, and y is the output vector. The matrix coefficients must have the following characteristics:
A must be an n-by-n matrix, where n is the number of states. B must be an n-by-m matrix, where m is the number of inputs. C must be an r-by-n matrix, where r is the number of outputs. D must be an r-by-m matrix.The actor accepts m inputs and generates r outputs through a multi-input port and a multi-output port. The widths of the ports must match the number of rows and columns in corresponding matrices, otherwise, an exception will be thrown.
This actor works like a higher-order function. It is opaque after construction or the change of parameters. Upon preinitialization, the actor will create a subsystem using integrators, adders, and scales. After that, the actor becomes transparent, and the director takes over the control of the actors contained by this actor.
This actor is based on the ptolemy.domains.ct.lib.LinearStateSpace actor by Jie Liu.
| Red (cxh) |
| Red (liuj) |
CompositeEntity.ContainedObjectsIterator| Modifier and Type | Field and Description |
|---|---|
Parameter |
A
The A matrix in the state-space representation.
|
Parameter |
B
The B matrix in the state-space representation.
|
Parameter |
C
The C matrix in the state-space representation.
|
Parameter |
D
The D matrix in the state-space representation.
|
Parameter |
initialStates
The initial condition for the state variables.
|
TypedIOPort |
input
Multi-input port.
|
TypedIOPort |
output
Multi-output port.
|
TypedIOPort |
stateOutput
State output multiport.
|
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts_levelCrossingLinks_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKSCOMPLETED, NOT_READY, STOP_ITERATING| Constructor and Description |
|---|
LinearStateSpace(CompositeEntity container,
java.lang.String name)
Construct the composite actor with a name and a container.
|
LinearStateSpace(Workspace workspace)
Construct a LinearStateSpace in the specified
workspace with no container and an empty string as a name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attributeChanged(Attribute attribute)
If the argument is A, B, C, D or initialState
parameters, check that they are indeed matrices and vectors,
and request for initialization from the director if there is one.
|
Director |
getDirector()
Return the executive director, regardless what isOpaque() returns.
|
boolean |
isOpaque()
Return the opaqueness of this composite actor.
|
boolean |
postfire()
Request the reinitialization.
|
void |
preinitialize()
Sanity check the parameters; if the parameters are legal
create a continuous-time subsystem that implement the model,
preinitialize all the actors in the subsystem,
and set the opaqueness of this actor to true.
|
void |
stopFire()
Stop the current firing.
|
void |
wrapup()
Set the opaqueness back to true and call the wrapup() method
of the super class.
|
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspaceequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateReceivers, getCausalityInterface, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortListfire, isFireFunctional, isStrict, iterate, prefire, stop, terminateaddInitializable, initialize, removeInitializabledescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic TypedIOPort input
public TypedIOPort output
public TypedIOPort stateOutput
public Parameter A
public Parameter B
public Parameter C
public Parameter D
public Parameter initialStates
public LinearStateSpace(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container - The container.name - The name.NameDuplicationException - If another entity already had
this name.IllegalActionException - If there was an internal problem.public LinearStateSpace(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace - The workspace that will list the actor.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.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged in class TypedCompositeActorattribute - The attribute that changed.IllegalActionException - If the numerator and the
denominator matrix is not a row vector.public Director getDirector()
getDirector in interface ActorgetDirector in class CompositeActorCompositeActor.setDirector(Director)public boolean isOpaque()
isOpaque in class CompositeActorCompositeEntitypublic boolean postfire()
throws IllegalActionException
postfire in interface Executablepostfire in class CompositeActorIllegalActionException - If thrown by super class.public void preinitialize()
throws IllegalActionException
preinitialize in interface Initializablepreinitialize in class CompositeActorIllegalActionException - If there is no CTDirector,
or any contained actors throw it in its preinitialize() method.public void stopFire()
stopFire in interface ExecutablestopFire in class CompositeActorpublic void wrapup()
throws IllegalActionException
wrapup in interface Initializablewrapup in class CompositeActorIllegalActionException - If there is no director.