260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
+
+
|
i=0;
for j=1:p_c.Iterations
for k=1:I
tim=time; # Timing
i++;
if Simulate # Exact simulation
X = x; # Current state
t_sim = [1: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); # Current state (for next time)
ti = [(i-1)*p_c.N:i*p_c.N-1]*dt;
y_i = yi(1); # Current output
t_i = ti(1);
##X = xsi(:,1);
else # The real thing
if strcmp(p_o.method, "remote")
[t_i,y_i,X] = ppp_put_get_X(U); # Remote-state interface
u_i = X(3); # Integrated control is third state
else
[t_i,y_i,u_i] = ppp_put_get(U); # Generic interface to real-time
endif
|