imc/imc_stable1.py
changeset 0 0efde00f9229
equal deleted inserted replaced
-1:000000000000 0:0efde00f9229
       
     1 #!/usr/bin/python
       
     2 # 10.4
       
     3 
       
     4 import scipy as sp
       
     5 from imcsplit import imcsplit
       
     6 
       
     7 def imc_stable1(B, A, k, alpha):
       
     8     """ Designs Discrete Internal Model Controller
       
     9     for transfer function z^{-k}B(z^{-1})/A(z^{-1})
       
    10     Numerator and Denominator of IMC HQ are outputs
       
    11     Controller is also given in R,S form. """
       
    12     Kp, d, Bg, Bnmp, Bm = imcsplit(B, 1)
       
    13     Bg = Kp * Bg
       
    14     Bnmpr = Bnmp[::]
       
    15     Bms = sum(Bm)
       
    16     HiN = A
       
    17     HiD = Bms * sp.convolve(Bg, Bnmpr)
       
    18     k = k+d
       
    19     return k, HiN, HiD