equal
deleted
inserted
replaced
|
1 #!/usr/bin/python |
|
2 # 9.11 |
|
3 |
|
4 import os, sys |
|
5 sys.path += [os.getcwdu() + os.sep + ".." + os.sep + "python"] |
|
6 |
|
7 import scipy as sp |
|
8 from scipy import signal |
|
9 from myc2d import myc2d |
|
10 |
|
11 # Motor control problem |
|
12 # Transfer function |
|
13 |
|
14 a1 = sp.array([[-1, 0], [1, 0]]) |
|
15 b1 = sp.array([[1],[0]]) |
|
16 c1 = sp.array([0, 1]) |
|
17 d1 = 0 |
|
18 G = signal.lti(a1, b1, c1, d1) |
|
19 Ts = 0.25 |
|
20 B, A, k = myc2d(G,Ts) |
|
21 |
|
22 # Transient specifications |
|
23 rise = 3 |
|
24 epsilon = 0.05 |
|
25 phi = desired(Ts,rise,epsilon) |
|
26 |
|
27 # Controller design |
|
28 Delta = 1 # No internal model of step used |
|
29 Rc, Sc, Tc, gamm = pp_im(B, A, k, phi, Delta) |
|
30 |
|
31 # simulation parameters |
|
32 st = 1 # desired change in position |
|
33 t_init = 0 # simulation start time |
|
34 t_final = 10 # simulation end time |
|
35 |
|
36 xInitial = [0, 0] # initial conditions |
|
37 N = 1 |
|
38 C = 0 |
|
39 D = 1 |
|
40 N_var = 0 |