Beispiel #1
0
    plt.subplot(312), plt.grid(True)
    T = np.linspace(0, 2, 100)
    T, yout = step_response(CLOSED_R_to_Y, T)
    plt.plot(T, yout, color='b')
    plt.title('Close Loop Step Response')

    plt.subplot(313), plt.grid(True)
    T = np.linspace(0, 2, 100)
    T, yout = step_response(CLOSED_R_to_U, T)
    plt.plot(T, yout, color='b')
    plt.title('Control Effort for Step Response')

if PLOT:
    # Stops program from closing until the user presses button.
    print('Press key to close')
    plt.waitforbuttonpress()
    plt.close()

##############################################
#  Convert Controller to State Space Equations
##############################################
C_ss = cnt.tf2ss(C)  # convert to state space

########################################################
#  Convert Controller to discrete transfer functions for
#  implementation
########################################################
#bilinear: Tustin's approximation ("generalized bilinear
#transformation" with alpha=0.5)
C_in_d = tf.sample(C, P.Ts, method='bilinear')
Beispiel #2
0
    T, yout = cnt.step_response(CLOSED_R_to_U*F, T)
    plt.plot(T, yout, color='r')
    plt.title('Control Effort for Step Response')

if PLOT:
    # Keeps the program from closing until the user presses a
    # button.
    print('Press key to close')
    plt.waitforbuttonpress()
    plt.close()


##############################################
#  Convert Controller to State Space Equations
##############################################
C_ss = cnt.tf2ss(C)
F_ss = cnt.tf2ss(F)


##########################################################
#  Convert Controller to discrete transfer functions for
#  implementation
##########################################################
#bilinear: Tustin's approximation ("generalized bilinear
#transformation" with alpha=0.5)
C_out_d = tf.sample(C, P.Ts, method='bilinear') 

#bilinear: Tustin's approximation ("generalized bilinear
#transformation" with alpha=0.5)
F_d = tf.sample(F, P.Ts, method='bilinear') 
Beispiel #3
0
    plt.title('Close Loop Bode Plot')

    plt.subplot(312), plt.grid(True)
    T = np.linspace(0, 2, 100)
    T, yout = cnt.step_response(CLOSED_R_to_Y, T)
    plt.plot(T, yout, color='b')
    plt.title('Close Loop Step Response')

    plt.subplot(313), plt.grid(True)
    T = np.linspace(0, 2, 100)
    T, yout = cnt.step_response(CLOSED_R_to_U, T)
    plt.plot(T, yout, color='b')
    plt.title('Control Effort for Step Response')

if PLOT:
    # Keeps the program from closing until the user presses a button.
    print('Press key to close')
    plt.waitforbuttonpress()
    plt.close()

##############################################
#  Convert Controller to State Space Equations
##############################################
C_ss = cnt.tf2ss(C)  # convert to state space

########################################################################
#  Convert Controller to discrete transfer functions for implementation
########################################################################
C_in_d = tf.sample(C, P.Ts, method='bilinear') #bilinear: Tustin's approximation ("generalized bilinear transformation" with alpha=0.5)