Differences From Artifact [572a950a69]:

To Artifact [566d14aa8d]:


39
40
41
42
43
44
45
46








47
48
49
50
51
52
53
  endif
  
  if nargin<6
    p_o.sigma = 0.001;
  endif

  if !struct_contains(p_c,"N")
    p_c.N = 10;			# Number of small samples








  endif
  
  if !struct_contains(p_c,"A_w")
    p_c.A_w = 0;
  endif
  
  if !struct_contains(p_c,"A_u")







|
>
>
>
>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  endif
  
  if nargin<6
    p_o.sigma = 0.001;
  endif

  if !struct_contains(p_c,"N")
    p_c.N = 10;			# Number of small samples per large sample
  endif
  
  if !struct_contains(p_c,"delta_ol")
    p_c.delta_ol = 1.0;	# OL sample interval
  endif
  
  if !struct_contains(p_c,"T")
    p_c.T = 5.0;			# Last time point.
  endif
  
  if !struct_contains(p_c,"A_w")
    p_c.A_w = 0;
  endif
  
  if !struct_contains(p_c,"A_u")
63
64
65
66
67
68
69






70
71
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
  
  ## System
  sys = mtt2sys(Name); # Create system
  [A,B,C,D] = sys2ss(sys);	# SS form
  [n_x, n_u, n_y] = abcddim(A,B,C,D)
  ol_poles = eig(A)







  ## Initialise
  x_0 = zeros(n_x,1);
  x_est = x_0;

  ## Initilise simulation state
  x = x_0;
##x(2) = 0.2;		
		#   x(2) = y_0(1);
				#   x(4) = y_0(2);

  if ControlType==0		# Step input
    N = 50;			# Number of small samples
    I = 1;			# Number of large samples 

    K_w = zeros(p_c.N_u,n_y);
    K_w(1,1) = 1;
    K_w(2,1) = -1;
    K_x = zeros(p_c.N_u,n_x);
    U = K_w*w;			# Initial control U
  else				# PPP control
    I = ceil(50/p_c.N);		# Number of large samples
    tau = [10:0.1:11]*(2/a_u);	# Time horizons
    [k_x,k_w,K_x,K_w] = ppp_lin(A,B,C,D,p_c.A_u,p_c.A_w,tau); # Design
    U = K_w*w			# Initial control U

    ## Checks
    cl_poles = eig(A - B*k_x)
  endif







>
>
>
>
>
>











<
|
>






|







71
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
108
109
110
  
  ## System
  sys = mtt2sys(Name); # Create system
  [A,B,C,D] = sys2ss(sys);	# SS form
  [n_x, n_u, n_y] = abcddim(A,B,C,D)
  ol_poles = eig(A)

  ## Check w.
  [n_w,m_w] = size(w);
  if ( (n_w<>n_y) || (m_w<>1) )
    error(sprintf("ppp_lin_run: w must a column vector with %i elements",n_y));
  endif
  
  ## Initialise
  x_0 = zeros(n_x,1);
  x_est = x_0;

  ## Initilise simulation state
  x = x_0;
##x(2) = 0.2;		
		#   x(2) = y_0(1);
				#   x(4) = y_0(2);

  if ControlType==0		# Step input

    I = 1;			# 1 large sample
    p_c.delta_ol = p_c.T	# I
    K_w = zeros(p_c.N_u,n_y);
    K_w(1,1) = 1;
    K_w(2,1) = -1;
    K_x = zeros(p_c.N_u,n_x);
    U = K_w*w;			# Initial control U
  else				# PPP control
    I = ceil(p_c.T/p_c.delta_ol); # Number of large samples
    tau = [10:0.1:11]*(2/a_u);	# Time horizons
    [k_x,k_w,K_x,K_w] = ppp_lin(A,B,C,D,p_c.A_u,p_c.A_w,tau); # Design
    U = K_w*w			# Initial control U

    ## Checks
    cl_poles = eig(A - B*k_x)
  endif

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