Differences From Artifact [986b2d0d8d]:

To Artifact [9da3cf8d4e]:


1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23





24
25
26
27

28
29
30
31
32
33
34
1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22

23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38



-
+














-
+



-
+
+
+
+
+



-
+







function [T,y,u,X,Iterations] = 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,Delta_ol,mu,movie)
					    W,x_0,Delta_ol,mu,test,movie)

  ## usage: [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,movie)
  ## Needs documentation - see ppp_ex11 for example of use.
  ## OUTPUTS
  ## T: Time vector
  ## y,u,J output, input and cost

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	
  
  if nargin<19			# No intermittent control
    Delta_ol = 0;
  endif

  if nargin<20			# No movie
  if nargin<20			# Mu
    mu = 0;
  endif

  if nargin<21			# No movie
  if nargin<21
    test=0
  endif
  
  if nargin<22			# No movie
    movie = 0;
  endif


test = test
  ## Check some sizes
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  [n_x0,m_x0] = size(x_0);
  if (n_x0 != n_x)||(m_x0 != 1)
    error(sprintf("Initial state x_0 must be %ix1 not %ix%i",n_x,n_x0,m_x0));
  endif
109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
113
114
115
116
117
118
119

120
121
122
123
124
125
126
127







-
+







    Gamma = [Gamma_u; Gamma_y];
    gamma = [gamma_u; gamma_y];
    
    ## Current Setpoint value
    w = W(:,floor(t/dt)+1);
    
    ## Compute U(t) via QP optimisation
    [uu, U, iterations] = ppp_qp (x,w,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu); # Compute U
    [uu, U, iterations] = ppp_qp (x,w,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu,test); # Compute U

    ## Compute the cost (not necessary but maybe interesting)
#    [J_t] = ppp_cost (U,x,W,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww); # cost
#    J = [J J_t];

    ## OL Simulation (exact)
    [ys,us,xs] = ppp_ystar (A,B,C,D,x,A_u,U,T_ol);

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