Nengo.ca

ca.nengo.dynamics.impl
Class LTISystem

java.lang.Object
  extended by ca.nengo.dynamics.impl.LTISystem
All Implemented Interfaces:
DynamicalSystem, LinearSystem, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SimpleLTISystem

public class LTISystem
extends java.lang.Object
implements LinearSystem

A linear time-invariant dynamical system model in state-space form. Such a system can be defined in terms of the four matrices that must be provided in the constructor. TODO: test

See Also:
Serialized Form

Constructor Summary
LTISystem(float[][] A, float[][] B, float[][] C, float[][] D, float[] x0, Units[] outputUnits)
          Each argument is an array of arrays that represents a matrix.
 
Method Summary
 DynamicalSystem clone()
           
 float[] f(float t, float[] u)
          The dynamic equation.
 float[] g(float t, float[] u)
          The output equation.
 float[][] getA()
           
 float[][] getA(float t)
           
 float[][] getB()
           
 float[][] getB(float t)
           
 float[][] getC()
           
 float[][] getC(float t)
           
 float[][] getD()
           
 float[][] getD(float t)
           
 int getInputDimension()
           
 int getOutputDimension()
           
 Units getOutputUnits(int outputDimension)
           
 float[] getState()
           
 int getStateDimension()
           
 void setA(float[][] newA)
           
 void setB(float[][] newB)
           
 void setC(float[][] newC)
           
 void setD(float[][] newD)
           
 void setInputDimension(int dim)
           
 void setOutputDimension(int dim)
           
 void setOutputUnits(int outputDimension, Units units)
           
 void setState(float[] state)
           
 void setStateDimension(int dim)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LTISystem

public LTISystem(float[][] A,
                 float[][] B,
                 float[][] C,
                 float[][] D,
                 float[] x0,
                 Units[] outputUnits)
Each argument is an array of arrays that represents a matrix. The first dimension represents the matrix row and the second the matrix column, so that A_ij corresponds to A[i-1][j-1] (since arrays are indexed from 0). The matrices must have valid dimensions for a state-space model: A must be n x n; B must be n x p; C must be q x n; and D must be q x p.

Parameters:
A - Dynamics matrix
B - Input matrix
C - Output matrix
D - Passthrough matrix
x0 - Initial state
outputUnits - Units in which each dimension of the output are expressed
Method Detail

f

public float[] f(float t,
                 float[] u)
Description copied from interface: DynamicalSystem
The dynamic equation.

Specified by:
f in interface DynamicalSystem
Parameters:
t - Time
u - Input vector
Returns:
Ax + Bu
See Also:
DynamicalSystem.f(float, float[])

g

public float[] g(float t,
                 float[] u)
Description copied from interface: DynamicalSystem
The output equation.

Specified by:
g in interface DynamicalSystem
Parameters:
t - Time
u - Input vector
Returns:
Cx + Du
See Also:
DynamicalSystem.g(float, float[])

getState

public float[] getState()
Specified by:
getState in interface DynamicalSystem
Returns:
State vector
See Also:
DynamicalSystem.getState()

setState

public void setState(float[] state)
Specified by:
setState in interface DynamicalSystem
Parameters:
state - New state vector
See Also:
DynamicalSystem.setState(float[])

getInputDimension

public int getInputDimension()
Specified by:
getInputDimension in interface DynamicalSystem
Returns:
Dimension of input vector
See Also:
DynamicalSystem.getInputDimension()

setInputDimension

public void setInputDimension(int dim)
Parameters:
dim - Input dimensionality. Affects B and D.

getOutputDimension

public int getOutputDimension()
Specified by:
getOutputDimension in interface DynamicalSystem
Returns:
Dimension of output vector
See Also:
DynamicalSystem.getOutputDimension()

setOutputDimension

public void setOutputDimension(int dim)
Parameters:
dim - Output dimensionality. Affects C and D.

getStateDimension

public int getStateDimension()
Returns:
State (x) dimensionality.

setStateDimension

public void setStateDimension(int dim)
Parameters:
dim - State (x) dimensionality

getOutputUnits

public Units getOutputUnits(int outputDimension)
Specified by:
getOutputUnits in interface DynamicalSystem
Parameters:
outputDimension - Numbered from 0
Returns:
Units of output in the given dimension
See Also:
DynamicalSystem.getOutputUnits(int)

setOutputUnits

public void setOutputUnits(int outputDimension,
                           Units units)
Parameters:
outputDimension - dimensionality of output
units - Units to work in

getA

public float[][] getA(float t)
Specified by:
getA in interface LinearSystem
Parameters:
t - Simulation time
Returns:
The dynamics matrix at the given time
See Also:
LinearSystem.getA(float)

getA

public float[][] getA()
Returns:
The dynamics matrix at the current time

setA

public void setA(float[][] newA)
Parameters:
newA - New dynamics matrix

getB

public float[][] getB(float t)
Specified by:
getB in interface LinearSystem
Parameters:
t - Simulation time
Returns:
The input matrix at the given time
See Also:
LinearSystem.getB(float)

getB

public float[][] getB()
Returns:
The input matrix at the current time

setB

public void setB(float[][] newB)
Parameters:
newB - New input matrix

getC

public float[][] getC(float t)
Specified by:
getC in interface LinearSystem
Parameters:
t - Simulation time
Returns:
The output matrix at the given time
See Also:
LinearSystem.getC(float)

getC

public float[][] getC()
Returns:
The output matrix at the current time

setC

public void setC(float[][] newC)
Parameters:
newC - New output matrix

getD

public float[][] getD(float t)
Specified by:
getD in interface LinearSystem
Parameters:
t - Simulation time
Returns:
The passthrough matrix at the given time
See Also:
LinearSystem.getD(float)

getD

public float[][] getD()
Returns:
The passthrough matrix at the current time

setD

public void setD(float[][] newD)
Parameters:
newD - New passthrough matrix

clone

public DynamicalSystem clone()
                      throws java.lang.CloneNotSupportedException
Specified by:
clone in interface DynamicalSystem
Overrides:
clone in class java.lang.Object
Returns:
An identical copy of this system which references an independent copy of the state variables
Throws:
java.lang.CloneNotSupportedException - if something causes clone not to work
See Also:
DynamicalSystem.clone()

Nengo.ca