1
1
# -*- coding: utf-8 -*-
2
- '''
2
+ """
3
3
Created on Jan 27, 2012
4
4
5
5
@author: Carl Sandrock
6
- '''
6
+ """
7
7
from __future__ import division
8
8
from __future__ import print_function
9
9
import numpy # do not abbreviate this module as np in utils.py
@@ -1595,7 +1595,7 @@ def feedback_mimo(forward, backward=None, positive=False):
1595
1595
1596
1596
1597
1597
def tf2ss(H):
1598
- '''
1598
+ """
1599
1599
Converts a mimotf object to the controllable canonical form state space
1600
1600
representation. This method and the examples were obtained from course work
1601
1601
notes available at
@@ -1660,7 +1660,7 @@ def tf2ss(H):
1660
1660
matrix([[ 0.],
1661
1661
[ 0.]])
1662
1662
1663
- '''
1663
+ """
1664
1664
1665
1665
p, m = H.shape
1666
1666
d = [[] for k in range(m)] # Construct some empty lists for use later
@@ -1737,7 +1737,7 @@ def lowerdiag(m):
1737
1737
1738
1738
1739
1739
def state_controllability(A, B):
1740
- '''
1740
+ """
1741
1741
This method checks if the state space description of the system is state
1742
1742
controllable according to Definition 4.1 (p127).
1743
1743
@@ -1761,7 +1761,7 @@ def state_controllability(A, B):
1761
1761
----
1762
1762
This does not check for state controllability for systems with repeated
1763
1763
poles.
1764
- '''
1764
+ """
1765
1765
1766
1766
state_control = True
1767
1767
@@ -2168,9 +2168,9 @@ def num_denom(A, symbolic_expr=False):
2168
2168
2169
2169
2170
2170
def minors(G, order):
2171
- '''
2171
+ """
2172
2172
Returns the order minors of a MIMO tf G.
2173
- '''
2173
+ """
2174
2174
minor = []
2175
2175
Nrows, Ncols = G.shape
2176
2176
for rowstokeep in itertools.combinations(range(Nrows), order):
@@ -2185,9 +2185,9 @@ def minors(G, order):
2185
2185
2186
2186
2187
2187
def lcm_of_all_minors(G):
2188
- '''
2188
+ """
2189
2189
Returns the lowest common multiple of all minors of G
2190
- '''
2190
+ """
2191
2191
Nrows, Ncols = G.shape
2192
2192
denoms = []
2193
2193
for i in range(1, min(Nrows, Ncols) + 1, 1):
@@ -2199,7 +2199,7 @@ def lcm_of_all_minors(G):
2199
2199
2200
2200
2201
2201
def poles(G=None, A=None):
2202
- '''
2202
+ """
2203
2203
If G is passed then return the poles of a multivariable transfer
2204
2204
function system. Applies Theorem 4.4 (p135).
2205
2205
If G is NOT specified but A is, returns the poles from
@@ -2225,7 +2225,7 @@ def poles(G=None, A=None):
2225
2225
array([-2.])
2226
2226
>>> A = numpy.matrix([[1,0,0],[0,8,0],[0,0,5]])
2227
2227
>>> Poles = poles(None, A)
2228
- '''
2228
+ """
2229
2229
2230
2230
if G:
2231
2231
if not (type(G) == tf or type(G) == mimotf):
@@ -2238,7 +2238,7 @@ def poles(G=None, A=None):
2238
2238
2239
2239
2240
2240
def zeros(G=None, A=None, B=None, C=None, D=None):
2241
- '''
2241
+ """
2242
2242
Return the zeros of a multivariable transfer function system for with
2243
2243
transfer functions or state-space. For transfer functions, Theorem 4.5
2244
2244
(p139) is used. For state-space, the method from Equations 4.66 and 4.67
@@ -2268,7 +2268,7 @@ def zeros(G=None, A=None, B=None, C=None, D=None):
2268
2268
----
2269
2269
Not applicable for a non-squared plant, yet. It is assumed that B,C,D will
2270
2270
have values if A is defined.
2271
- '''
2271
+ """
2272
2272
# TODO create a beter function to accept parameters and
2273
2273
# switch between tf and ss
2274
2274
@@ -2590,7 +2590,7 @@ def Dead_time_matrix(s, dead_time_vec_max_row):
2590
2590
2591
2591
2592
2592
def BoundKS(G, poles, up, e=0.00001):
2593
- '''
2593
+ """
2594
2594
The functions uses equaption 6.24 (p229) to calculate the peak value for KS
2595
2595
transfer function using the stable version of the plant.
2596
2596
@@ -2609,7 +2609,7 @@ def BoundKS(G, poles, up, e=0.00001):
2609
2609
-------
2610
2610
KS_max : float
2611
2611
Minimum peak value.
2612
- '''
2612
+ """
2613
2613
2614
2614
KS_PEAK = [numpy.linalg.norm(up.H * numpy.linalg.pinv(G(RHP_p + e)), 2)
2615
2615
for RHP_p in poles]
@@ -2652,7 +2652,7 @@ def distRej(G, gd):
2652
2652
2653
2653
2654
2654
def distRHPZ(G, Gd, RHP_Z):
2655
- '''
2655
+ """
2656
2656
Applies equation 6.48 (p239) For performance requirements imposed by
2657
2657
disturbances. Calculate the system's zeros alignment with the disturbacne
2658
2658
matrix.
@@ -2674,7 +2674,7 @@ def distRHPZ(G, Gd, RHP_Z):
2674
2674
Note
2675
2675
----
2676
2676
The return value should be less than 1.
2677
- '''
2677
+ """
2678
2678
if numpy.real(RHP_Z) < 0: # RHP-z
2679
2679
raise ValueError('Function only applicable to RHP-zeros')
2680
2680
Yz, _ = pole_zero_directions(G, [RHP_Z], 'z', 'y')
0 commit comments