Overview
Comment:Write longer sequence to Ustar.h
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 7ffabd23a19427c014a3995b5b48f45329684c1133e5d5440447bdf31ff534dc
User & Date: gawthrop@users.sourceforge.net on 2003-06-26 11:55:05
Other Links: branch diff | manifest | tags
Context
2003-06-26
15:36:09
Tidied check-in: ab2b1d8791 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:55:05
Write longer sequence to Ustar.h check-in: 7ffabd23a1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:01:46
Added comments
Correct observer pole computation
check-in: 6762457683 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/control/PPP/ppp_lin_run.m from [c55486575a] to [a8dbb844ec].

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  endif
  
  if nargin<5
    x_0 = zeros(n_x,1);
  endif
  
  if nargin<6
    p_c.N = 5;
  endif

  if nargin<7
    p_o.sigma = 1e-1;
  endif

  if !struct_contains(p_c,"delta_ol")
    p_c.delta_ol = 0.5;	# OL sample interval
  endif
  
  if !struct_contains(p_c,"T")
    p_c.T = 5.0;			# Last time point.
  endif
  
  if !struct_contains(p_c,"Method")
    p_c.Method = "lq";
  endif

  if struct_contains(p_c,"Method")







|







|



|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  endif
  
  if nargin<5
    x_0 = zeros(n_x,1);
  endif
  
  if nargin<6
    p_c.N = 10;
  endif

  if nargin<7
    p_o.sigma = 1e-1;
  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 = 10.0;			# Last time point.
  endif
  
  if !struct_contains(p_c,"Method")
    p_c.Method = "lq";
  endif

  if struct_contains(p_c,"Method")
150
151
152
153
154
155
156

157

158
159
160
161
162
163
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178
179
180
181
  ## Display the poles
  obs_poles

  ## Short sample interval
  dt = p_c.delta_ol/p_c.N;

  ## Write the include file for the real-time function

  disp("Writing Ustar.h");

  ppp_ustar2h(ppp_ustar (p_c.A_u, n_u, [0:dt:p_c.delta_ol], 0,0)); 


  ## Control loop
  y = [];
  u = [];
  t = [];
  y_e = [];
  t_e = [];
  e_e = [];
  tick = time;
  for i=1:I
    i

    if Simulate			# Exact simulation 
      t_sim = [0:p_c.N]*dt;	# Simulation time points
      [yi,ui,xsi] = ppp_ystar(A,B,C,D,x,p_c.A_u,U,t_sim); # Simulate
      x = xsi(:,p_c.N+1);	# Current state
      y_now = yi(:,p_c.N+1);	# Current output
    else			# The real thing
      to_rt(U');		# Send U
      data = from_rt(p_c.N);	# Receive data
      [yi,ui] = convert_data(data); # And convert from integer format
      y_now = yi(:,p_c.N);	# Current output
    endif







>

>
|












>



|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
  ## Display the poles
  obs_poles

  ## Short sample interval
  dt = p_c.delta_ol/p_c.N;

  ## Write the include file for the real-time function
  ## Use double length to allow for overuns
  disp("Writing Ustar.h");
  overrun = 2;
  ppp_ustar2h(ppp_ustar (p_c.A_u, n_u, [0:dt:overrun*p_c.delta_ol], 0,0)); 


  ## Control loop
  y = [];
  u = [];
  t = [];
  y_e = [];
  t_e = [];
  e_e = [];
  tick = time;
  for i=1:I
    i
    tim=time;			# Timing
    if Simulate			# Exact simulation 
      t_sim = [0:p_c.N]*dt;	# Simulation time points
      [yi,ui,xsi] = ppp_ystar(A,B,C,D,x,p_c.A_u,U,t_sim); # Simulate
      x = xsi(:,p_c.N+1);	# Current state (for next time)
      y_now = yi(:,p_c.N+1);	# Current output
    else			# The real thing
      to_rt(U');		# Send U
      data = from_rt(p_c.N);	# Receive data
      [yi,ui] = convert_data(data); # And convert from integer format
      y_now = yi(:,p_c.N);	# Current output
    endif
190
191
192
193
194
195
196


197
198
199
200
201
202
203
    ti  = [(i-1)*p_c.N:i*p_c.N-1]*dt; 
    t = [t;ti'];
    y = [y;yi(:,1:p_c.N)'];
    u = [u;ui(:,1:p_c.N)'];
    y_e = [y_e; y_est'];
    t_e = [t_e; (i*p_c.N)*dt];
    e_e = [e_e; e_est];


  endfor			# Main loop
  
  sample_interval = (time-tick)/(I*p_c.N)

  ## Put data on file (so can use for identification)
  filename = sprintf("%s_ident_data.dat",Name);
  eval(sprintf("save -ascii %s t y u",filename));







>
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
    ti  = [(i-1)*p_c.N:i*p_c.N-1]*dt; 
    t = [t;ti'];
    y = [y;yi(:,1:p_c.N)'];
    u = [u;ui(:,1:p_c.N)'];
    y_e = [y_e; y_est'];
    t_e = [t_e; (i*p_c.N)*dt];
    e_e = [e_e; e_est];
    sample_time = (time-tim)/p_c.N
    dt
  endfor			# Main loop
  
  sample_interval = (time-tick)/(I*p_c.N)

  ## Put data on file (so can use for identification)
  filename = sprintf("%s_ident_data.dat",Name);
  eval(sprintf("save -ascii %s t y u",filename));


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