def make_T_Testing(self):
        '''Generate the approximating transfer function using the identified
        poles of the transfer function.

        '''
        self.T_testing = Potapov.get_Potapov(self.T,self.roots,self.vecs)
        return
    def make_vecs(self):
        '''Generate an ordered list of vectors representing the form of the
        Potapov factors.

        '''
        self.vecs = Potapov.get_Potapov_vecs(self.T,self.roots)
        return
def time_sim(Example, omega = 0., t1=150, dt=0.05, freq=None,
                port_in = 0, port_out = [0,1], kind='FP',
             ):
    '''
    takes an example and simulates it up to t1 increments of dt.
    freq indicates the maximum frequency where we look for modes
    omega indicates the frequency of driving. omega = 0 is DC.
    port_in and port_out are where the system is driven.
    '''
    E = Example(max_freq = freq) if freq != None else Example()
    E.run_Potapov()
    T,T_testing,poles,vecs = E.get_outputs()
    print "number of poles is ", len(poles)
    num = len(poles)
    [A,B,C,D] = Potapov.get_Potapov_ABCD(poles,vecs)

    y0 = np.matrix([[0]]*A.shape[1])
    t0 = 0

    force_func = lambda t: np.cos(omega*t)

    r = ode(f).set_integrator('zvode', method='bdf')
    r.set_initial_value(y0, t0).set_f_params(A,B,force_func,port_in)

    Y = [C*y0+D*force_func(t0)]

    while r.successful() and r.t < t1:
        r.integrate(r.t+dt)
        #print r.t, r.y
        u = force_func(r.t)
        Y.append(C*r.y+D*u)

    time = np.linspace(t0,t1,len(Y))
    plot_time(time,Y,port_out,port_in,num=num,kind=kind)
    return
 def make_commensurate_vecs(self,):
     self.commensurate_vecs = Potapov.get_Potapov_vecs(
         self.T,self.commensurate_roots)
     self.vecs = map(
         lambda i: self.commensurate_vecs[self.map_root_to_commensurate_index[i]],
         range(len(self.roots)) )
     return
Exemple #5
0
    def make_vecs(self):
        '''Generate an ordered list of vectors representing the form of the
        Potapov factors.

        '''
        self.vecs = Potapov.get_Potapov_vecs(self.T, self.roots)
        return
Exemple #6
0
    def make_T_Testing(self):
        '''Generate the approximating transfer function using the identified
        poles of the transfer function.

        '''
        self.T_testing = Potapov.get_Potapov(self.T, self.roots, self.vecs)
        return
Exemple #7
0
 def make_commensurate_vecs(self, ):
     self.commensurate_vecs = Potapov.get_Potapov_vecs(
         self.T, self.commensurate_roots)
     self.vecs = map(
         lambda i: self.
         commensurate_vecs[self.map_root_to_commensurate_index[i]],
         range(len(self.roots)))
     return
    def get_Potapov_ABCD(self,z=0.,doubled=False):
        '''
        Find the ABCD matrices from the Time_Delay_Network.

        Args:
            z (optional [complex number]): location where to estimate D.

        Return:
            (tuple of matrices):
                A,B,C,D matrices.

        '''
        A,B,C,D = Potapov.get_Potapov_ABCD(self.roots,self.vecs,self.T,z=z)
        if not doubled:
            return A,B,C,D
        else:
            A_d,C_d,D_d = map(double_up,(A,C,D))
            B_d = -double_up(C.H)
            return A_d,B_d,C_d,D_d
def time_sim(
    Example,
    omega=0.,
    t1=150,
    dt=0.05,
    freq=None,
    port_in=0,
    port_out=[0, 1],
    kind='FP',
):
    '''
    takes an example and simulates it up to t1 increments of dt.
    freq indicates the maximum frequency where we look for modes
    omega indicates the frequency of driving. omega = 0 is DC.
    port_in and port_out are where the system is driven.
    '''
    E = Example(max_freq=freq) if freq != None else Example()
    E.run_Potapov()
    T, T_testing, poles, vecs = E.get_outputs()
    print "number of poles is ", len(poles)
    num = len(poles)
    [A, B, C, D] = Potapov.get_Potapov_ABCD(poles, vecs)

    y0 = np.matrix([[0]] * A.shape[1])
    t0 = 0

    force_func = lambda t: np.cos(omega * t)

    r = ode(f).set_integrator('zvode', method='bdf')
    r.set_initial_value(y0, t0).set_f_params(A, B, force_func, port_in)

    Y = [C * y0 + D * force_func(t0)]

    while r.successful() and r.t < t1:
        r.integrate(r.t + dt)
        #print r.t, r.y
        u = force_func(r.t)
        Y.append(C * r.y + D * u)

    time = np.linspace(t0, t1, len(Y))
    plot_time(time, Y, port_out, port_in, num=num, kind=kind)
    return
Exemple #10
0
    def get_Potapov_ABCD(self, z=0., doubled=False):
        '''
        Find the ABCD matrices from the Time_Delay_Network.

        Args:
            z (optional [complex number]): location where to estimate D.

        Return:
            (tuple of matrices):
                A,B,C,D matrices.

        '''
        A, B, C, D = Potapov.get_Potapov_ABCD(self.roots,
                                              self.vecs,
                                              self.T,
                                              z=z)
        if not doubled:
            return A, B, C, D
        else:
            A_d, C_d, D_d = map(double_up, (A, C, D))
            B_d = -double_up(C.H)
            return A_d, B_d, C_d, D_d