|
From: <kk...@us...> - 2011-02-08 22:17:33
|
Revision: 94
http://python-control.svn.sourceforge.net/python-control/?rev=94&view=rev
Author: kkchen
Date: 2011-02-08 22:17:26 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Modified docstrings for h2syn, hinfsyn, ctrb, obsv, gram, era, markov, step, impulse, initial, bode
Steven Brunton <sbr...@pr...>
Modified Paths:
--------------
branches/control-0.4a/src/matlab.py
branches/control-0.4a/src/modelsimp.py
branches/control-0.4a/src/robust.py
branches/control-0.4a/src/statefbk.py
Modified: branches/control-0.4a/src/matlab.py
===================================================================
--- branches/control-0.4a/src/matlab.py 2011-02-08 22:17:21 UTC (rev 93)
+++ branches/control-0.4a/src/matlab.py 2011-02-08 22:17:26 UTC (rev 94)
@@ -685,13 +685,13 @@
def bode(*args, **keywords):
"""Bode plot of the frequency response
- Usage
- =====
- bode(sys)
- bode(sys, w)
- bode(sys1, sys2, ..., sysN)
- bode(sys1, sys2, ..., sysN, w)
- bode(sys1, 'plotstyle1', ..., sysN, 'plotstyleN')
+ Examples
+ --------
+ >>> bode(sys)
+ >>> bode(sys, w)
+ >>> bode(sys1, sys2, ..., sysN)
+ >>> bode(sys1, sys2, ..., sysN, w)
+ >>> bode(sys1, 'plotstyle1', ..., sysN, 'plotstyleN')
"""
# If the first argument is a list, then assume python-control calling format
@@ -749,20 +749,23 @@
def lsim(*args, **keywords):
"""Simulate the output of a linear system
- Usage
- =====
- (T, yout, xout) = lsim(sys, u, T, X0)
+ Examples
+ --------
+ >>> T, yout, xout = lsim(sys, u, T, X0)
- Inputs:
- sys LTI system
- u input array giving input at each time T
- T time steps at which the input is defined
- X0 initial condition (optional, default = 0)
+ Parameters
+ ----------
+ sys: StateSpace, or TransferFunction
+ LTI system to simulate
+ u: input array giving input at each time T
+ T: time steps at which the input is defined
+ X0: initial condition (optional, default = 0)
- Outputs:
- T time values of the output
- yout response of the system
- xout time evolution of the state vector
+ Returns
+ -------
+ T: time values of the output
+ yout: response of the system
+ xout: time evolution of the state vector
"""
sys = args[0]
ltiobjs = sys.returnScipySignalLti()
@@ -775,18 +778,24 @@
def step(*args, **keywords):
"""Step response of a linear system
- Usage
- =====
- (T, yout) = step(sys, T, X0)
+ Examples
+ --------
+ >>> T, yout = step(sys, T, X0)
- Inputs:
- sys LTI system
- T time steps (optional; autocomputed if not gien)
- X0 initial condition (optional, default = 0)
+ Parameters
+ ----------
+ sys: StateSpace, or TransferFunction
+ T: array
+ T is the time vector (optional; autocomputed if not given)
+ X0: array
+ X0 is the initial condition (optional; default = 0)
- Outputs:
- T time values of the output
- yout response of the system
+ Returns
+ -------
+ T: array
+ Time values of the output
+ yout: array
+ response of the system
"""
sys = args[0]
ltiobjs = sys.returnScipySignalLti()
@@ -804,18 +813,25 @@
def initial(*args, **keywords):
"""Initial condition response of a linear system
- Usage
- =====
- (T, yout) = initial(sys, T, X0)
+ Examples
+ --------
+ >>> T, yout = initial(sys, T, X0)
- Inputs:
- sys LTI system
- T time steps (optional; autocomputed if not gien)
- X0 initial condition (optional, default = 0)
+ Parameters
+ ----------
+ sys: StateSpace, or TransferFunction
+ T: array
+ T is the time vector (optional; autocomputed if not given)
+ X0: array
+ X0 is the initial condition (optional; default = 0)
- Outputs:
- T time values of the output
- yout response of the system
+ Returns
+ -------
+ T: array
+ Time values of the output
+ yout: array
+ response of the system
+
"""
sys = args[0]
ltiobjs = sys.returnScipySignalLti()
@@ -827,20 +843,27 @@
# Redefine impulse to use initial()
#! Not yet implemented (uses impulse for now)
def impulse(*args, **keywords):
- """Step response of a linear system
+ """Impulse response of a linear system
- Usage
- =====
- (T, yout) = impulse(sys, T, X0)
+ Examples
+ --------
+ >>> T, yout = impulse(sys, T, X0)
- Inputs:
- sys LTI system
- T time steps (optional; autocomputed if not gien)
- X0 initial condition (optional, default = 0)
+ Parameters
+ ----------
+ sys: StateSpace, or TransferFunction
+ T: array
+ T is the time vector (optional; autocomputed if not given)
+ X0: array
+ X0 is the initial condition (optional; default = 0)
- Outputs:
- T time values of the output
- yout response of the system
+ Returns
+ -------
+ T: array
+ Time values of the output
+ yout: array
+ response of the system
+
"""
sys = args[0]
ltiobjs = sys.returnScipySignalLti()
Modified: branches/control-0.4a/src/modelsimp.py
===================================================================
--- branches/control-0.4a/src/modelsimp.py 2011-02-08 22:17:21 UTC (rev 93)
+++ branches/control-0.4a/src/modelsimp.py 2011-02-08 22:17:26 UTC (rev 94)
@@ -69,7 +69,7 @@
Examples
--------
- H = hsvd(sys)
+ >>> H = hsvd(sys)
"""
@@ -107,7 +107,7 @@
Examples
--------
- rsys = modred(sys,ELIM,method)
+ >>> rsys = modred(sys,ELIM,method='truncate')
"""
@@ -193,7 +193,7 @@
Examples
--------
- rsys = balred(sys,order,elimination,method)
+ >>> rsys = balred(sys,order,method='truncate')
"""
@@ -245,42 +245,45 @@
def era(YY,m,n,nin,nout,r):
"""Calculate an ERA model of order r based on the impulse-response data YY
- Usage
- =====
- sys = era(YY,m,n,nin,nout,r)
+ Parameters
+ ----------
+ YY: nout x nin dimensional impulse-response data
+ m: number of rows in Hankel matrix
+ n: number of columns in Hankel matrix
+ nin: number of input variables
+ nout: number of output variables
+ r: order of model
- Inputs
- ------
- YY : nout x nin dimensional impulse-response data
- m : number of rows in Hankel matrix
- n : number of columns in Hankel matrix
- nin : number of input variables
- nout : number of output variables
- r : order of model
-
- Outputs
+ Returns
-------
- sys : a reduced order model sys=ss(Ar,Br,Cr,Dr)
+ sys: a reduced order model sys=ss(Ar,Br,Cr,Dr)
+ Examples
+ --------
+ >>> rsys = era(YY,m,n,nin,nout,r)
+
"""
def markov(Y,U,M):
"""Calculate the first M Markov parameters [D CB CAB ...] from input U, output Y
- Usage
- =====
- H = markov(Y,U,M)
+ Parameters
+ ----------
+ Y: output data
+ U: input data
+ M: number of Markov parameters to output
+
+ Returns
+ -------
+ H: first M Markov parameters
+
+ Notes
+ -----
Currently only works for SISO
- Inputs
- ------
- Y : output data
- U : input data
- M : number of Markov parameters to output
+ Examples
+ --------
+ >>> H = markov(Y,U,M)
- Outputs
- -------
- H : first M Markov parameters
-
"""
# Convert input parameters to matrices (if they aren't already)
Modified: branches/control-0.4a/src/robust.py
===================================================================
--- branches/control-0.4a/src/robust.py 2011-02-08 22:17:21 UTC (rev 93)
+++ branches/control-0.4a/src/robust.py 2011-02-08 22:17:26 UTC (rev 94)
@@ -49,19 +49,29 @@
def h2syn(P,nmeas,ncon):
"""H_2 control synthesis for plant P.
- Usage
- =====
- K = h2syn(P,nmeas,ncon)
+ Parameters
+ ----------
+ P: partitioned lti plant (State-space sys)
+ nmeas: number of measurements (input to controller)
+ ncon: number of control inputs (output from controller)
- Inputs
- ======
- P : partitioned lti plant
- nmeas : number of measurements (input to controller)
- ncon : number of control inputs (output from controller)
+ Returns
+ -------
+ K: controller to stabilize P (State-space sys)
- Outputs
- =======
- K : controller to stabilize P
+ Raises
+ ------
+ ImportError
+ if slycot routine sb10hd is not loaded
+
+ See Also
+ --------
+ StateSpace
+
+ Examples
+ --------
+ >>> K = h2syn(P,nmeas,ncon)
+
"""
#Check for ss system object, need a utility for this?
@@ -95,22 +105,32 @@
def hinfsyn(P,nmeas,ncon):
"""H_{inf} control synthesis for plant P.
- Usage
- =====
- K, CL, gam, info = hinfsyn(P,nmeas,ncon)
+ Parameters
+ ----------
+ P: partitioned lti plant
+ nmeas: number of measurements (input to controller)
+ ncon: number of control inputs (output from controller)
- Inputs
- ======
- P : partitioned lti plant
- nmeas : number of measurements (input to controller)
- ncon : number of control inputs (output from controller)
+ Returns
+ -------
+ K: controller to stabilize P (State-space sys)
+ CL: closed loop system (State-space sys)
+ gam: infinity norm of closed loop system
+ info: info returned from siycot routine
- Outputs
- =======
- K : controller to stabilize P
- CL : closed loop system
- gam : infinity norm of closed loop system
- info : info returned from siycot routine
+ Raises
+ ------
+ ImportError
+ if slycot routine sb10ad is not loaded
+
+ See Also
+ --------
+ StateSpace
+
+ Examples
+ --------
+ >>> K, CL, gam, info = hinfsyn(P,nmeas,ncon)
+
"""
#Check for ss system object, need a utility for this?
Modified: branches/control-0.4a/src/statefbk.py
===================================================================
--- branches/control-0.4a/src/statefbk.py 2011-02-08 22:17:21 UTC (rev 93)
+++ branches/control-0.4a/src/statefbk.py 2011-02-08 22:17:26 UTC (rev 94)
@@ -188,17 +188,18 @@
def ctrb(A,B):
"""Controllabilty matrix
- Usage
- =====
- C = ctrb(A, B)
-
- Inputs
- ------
+ Parameters
+ ----------
A, B: Dynamics and input matrix of the system
- Outputs
+ Returns
-------
C: Controllability matrix
+
+ Examples
+ --------
+ >>> C = ctrb(A, B)
+
"""
# Convert input parameters to matrices (if they aren't already)
@@ -214,19 +215,20 @@
def obsv(A, C):
"""Observability matrix
- Usage
- =====
- O = obsv(A, C)
-
- Inputs
- ------
+ Parameters
+ ----------
A, C: Dynamics and output matrix of the system
- Outputs
+ Returns
-------
O: Observability matrix
- """
+ Examples
+ --------
+ >>> O = obsv(A, C)
+
+ """
+
# Convert input parameters to matrices (if they aren't already)
amat = np.mat(A)
cmat = np.mat(C)
@@ -239,12 +241,30 @@
return obsv
def gram(sys,type):
- """Gramian
-
- Usage
- =====
- Wc = gram(sys,'c')
- Wo = gram(sys,'o')
+ """Gramian (controllability or observability)
+
+ Parameters
+ ----------
+ sys: state-space system to compute Gramian for
+ type: type is either 'c' (controllability) or 'o' (observability)
+
+ Returns
+ -------
+ gram: Gramian of system
+
+ Raises
+ ------
+ ValueError
+ if `type` is not 'c' or 'o'
+ if system is unstable (sys.A has eigenvalues not in left half plane)
+ ImportError
+ if slycot routin sb03md cannot be found
+
+ Examples
+ --------
+ >>> Wc = gram(sys,'c')
+ >>> Wo = gram(sys,'o')
+
"""
#Check for ss system object, need a utility for this?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|