Overview
| Comment: | Addes Q weighting matrix |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
302ba43d9cb69ad58c1eca69599d2c68 |
| User & Date: | gawthrop@users.sourceforge.net on 2002-05-13 16:01:10.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2002-05-13
| ||
| 16:11:09 | Various changes check-in: 12e17795c6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 16:01:10 | Addes Q weighting matrix check-in: 302ba43d9c user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 08:52:23 |
FIRST parameter of simpar now specifies first printed point - simulation still starts at zero check-in: eb24171cc0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/lib/control/PPP/ppp_nlin.m
from [543adc29f3]
to [d0ab21bae9].
| 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 | - + - + - + + + + + - + |
|
Modified mttroot/mtt/lib/control/PPP/ppp_nlin_run.m
from [a7eaf434e3]
to [37eb564d85].
| 1 2 3 4 5 6 7 8 | - + |
|
| ︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | ## Real-time implementatipn of nonlinear PPP Copyright (C) 2001,2002 ## by Peter J. Gawthrop ## Globals to pass details to simulation global system_name_sim i_ppp_sim x_0_sim y_sim u_sim A_u_sim simpar_sim ## Defaults |
| ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | + + + + |
simpar_pred = simpar; # Initial prediction simulation params
T_ol_0 = simpar.last; # The initial specified interval
n_t = round(simpar.last/simpar.dt); # Corresponding length
x_0 = eval(sprintf("%s_state(par);", system_name));
x_0_model = x_0;
[n_x,n_y,n_u] = eval(sprintf("%s_def;", system_name));
if nargin<8
Q = ones(n_y,1);
endif
## Sensitivity system details -- defines moving horizon simulation
simpars = eval(sprintf("%s_simpar;", s_system_name));
pars = eval(sprintf("%s_numpar;", s_system_name));
x_0s = eval(sprintf("%s_state(pars);", s_system_name));
x_0_models = x_0s;
## Times
|
| ︙ | |||
161 162 163 164 165 166 167 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - + | ## Optimise tick = time; [pars,Par,Error,Y,its] = \ ppp_optimise(s_system_name,x_0_models,pars,simpar_est,u_star_t,y_est,i_par,extras); if extras.visual |
| ︙ | |||
201 202 203 204 205 206 207 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - + - + |
x_next = x_next(n_t+1,:)'; # Initial state for next time
x_nexts(1:2:(2*n_x)-1) = x_next; # And for internal sensitivity model
## Optimize for next interval
U_old = U; # Save previous value
U = expm(A_u*T_ol)*U; # Initialise from continuation trajectory
pars(i_ppp(:,1)) = U; # Put initial value of U into the parameter vector
|
| ︙ |
Modified mttroot/mtt/lib/control/PPP/ppp_optimise.m
from [fc79616ba1]
to [bf1568c82a].
1 | 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 39 40 41 | - + + + + + | function [par,Par,Error,Y,iterations,x] = \ |
| ︙ | |||
59 60 61 62 63 64 65 | 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 | - + + + + + |
## Copyright (C) 1999,2000 by Peter J. Gawthrop
sim_command = sprintf("%s_ssim(x_0,par,simpar,u,i_s)", system_name);
## Extract indices
i_t = free(:,1); # Parameters
i_s = free(:,2)'; # Sensitivities
|
| ︙ | |||
126 127 128 129 130 131 132 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + - - + + |
##Evaluate error, cost derivative J and cost second derivative JJ
err = 0;
J = zeros(n_th,1);
JJ = zeros(n_th,n_th);
for i = 1:n_y
E = y(:,i) - y_0(:,i); # Error in ith output
|
| ︙ |