Differences From Artifact [8afbccc82d]:

To Artifact [b816bab9e6]:


29
30
31
32
33
34
35
36

37
38
39
40

41
42
43
44
45
46
47
29
30
31
32
33
34
35

36
37
38
39

40
41
42
43
44
45
46
47







-
+



-
+







  t = [6:0.02:7];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions

  Q = ones(n_y,1);;
  

  ## Constaints
  ## Constraints
  Gamma = [];
  gamma = [];

  ## Constaints - u
  ## Constraints - u
  Tau_u = [0:0.5:2];
  one = ones(size(Tau_u));
  limit = 1.5;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

72
73
74
75
76
77
78
79

80
81

82

83
84
85
86
87
88
89
90

91
92

93

94
95
96
97
98
99





100
101
102
103
104
105
72
73
74
75
76
77
78

79
80
81
82

83
84
85
86
87
88
89
90

91
92
93
94

95
96





97
98
99
100
101
102
103
104
105
106
107







-
+


+
-
+







-
+


+
-
+

-
-
-
-
-
+
+
+
+
+






  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  disp("Computing unconstrained ol response");
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constained and unconstrained y*");
  title("Constrained and unconstrained y*");
  xlabel("t");
  grid;
  figure(1);
  plot(T,ys,T,ysu)
  plot(T,ys,"-;y*: constrained;", T,ysu, "--;y*: unconstrained;")

  ## Non-linear - closed-loop
    disp("Computing constrained closed-loop response");
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  Tau_u,Min_u,Max_u,Order_u, \
			  Tau_y,Min_y,Max_y,Order_y,W,x_0);

  title("y,y*,u and u*");
  title("Constrained closed-loop response");
  xlabel("t");
  grid;
  figure(2);
  plot(T,y,T,u,T,ys,T,us);
  plot(T,y,"-;y;", T,u,"--;u;");

  ## Compute derivatives.
  dt = t(2)-t(1);
  du = diff(u)/dt;
  dus = diff(us)/dt;
  T1 = T(1:length(T)-1);
#   ## Compute derivatives.
#   dt = t(2)-t(1);
#   du = diff(u)/dt;
#   dus = diff(us)/dt;
#   T1 = T(1:length(T)-1);
  ##plot(T1,du,T1,dus);
endfunction





MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]