Overview
Comment:Tidied up the optimisation stuff
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ca9ae39eaab3bd71115eac98a6013fdfbfbc8635ffa5a65317c91ae5e10c70b5
User & Date: gawthrop@users.sourceforge.net on 2001-08-10 16:19:06
Other Links: branch diff | manifest | tags
Context
2001-08-10
16:20:43
Fixed error and added test system check-in: 722c460774 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:19:06
Tidied up the optimisation stuff check-in: ca9ae39eaa user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-08-09
03:09:23
Fixed zeroing of initial guess of unknown inputs. check-in: 67b14533e7 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/control/PPP/ppp_error.m version [3cf9868bce].



















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function err = ppp_error(par)

  ## usage:  err = error (par)
  ##
  ## 

  global ppp_y_0 ppp_sim_command ppp_par ppp_i_par ppp_x0 ppp_sim ppp_u
  
  pars = ppp_par;
  pars(ppp_i_par) = par;
  
  y = sidSimpleExtruder_ssim(ppp_x0,pars,ppp_sim,ppp_u);
  
  [N,n_y] = size(y);

  Err = y - ppp_y_0;
  err = sum(diag(Err'*Err))/N
endfunction

Modified mttroot/mtt/lib/control/PPP/ppp_identify.m from [842e30c8e0] to [fae8c72792].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51






















52
53
54
55
56
57
58
59
60
61
24
25
26
27
28
29
30





















31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+










  s_system_name = sprintf("s%s", system_name); # Name of sensitivity system

  ## Set up parameters
  sim = eval([s_system_name, "_simpar;"]); # Simulation parameter
  sym = eval([s_system_name, "_sympar;"]); # Parameter names
  x0  = eval([s_system_name, "_state(par_0);"]); # Initial state

  ## Set up the free parameter list
  free = [];
  [n,m] = size(par_names);
  for i = 1:n
    p_name = deblank(par_names(i,:));
    s_name = sprintf("%ss", p_name);
    if struct_contains(sym, p_name)
      i_p = eval(sprintf("sym.%s;", p_name));
      if struct_contains(sym, s_name)
	i_s = eval(sprintf("sym.%s;", s_name));
	free_i = eval(sprintf("[%i,%i];", i_p, i_s));
	free = [free; free_i];
      else
	printf("Sensitivity parameter %s does not exist: ignoring \
	parameter %s\n", s_name, p_name);
      endif
    else
      printf("Parameter %s does not exist: ignoring\n", p_name)
    endif
  endfor
  
#   ## Set up the free parameter list
#   free = [];
#   [n,m] = size(par_names);
#   for i = 1:n
#     p_name = deblank(par_names(i,:));
#     s_name = sprintf("%ss", p_name);
#     if struct_contains(sym, p_name)
#       i_p = eval(sprintf("sym.%s;", p_name));
#       if struct_contains(sym, s_name)
# 	i_s = eval(sprintf("sym.%s;", s_name));
# 	free_i = eval(sprintf("[%i,%i];", i_p, i_s));
# 	free = [free; free_i];
#       else
# 	printf("Sensitivity parameter %s does not exist: ignoring \
# 	parameter %s\n", s_name, p_name);
#       endif
#     else
#       printf("Parameter %s does not exist: ignoring\n", p_name)
#     endif
#   endfor
#   free
  free = ppp_indices(par_names,sym);
  [par,Par,Error,Y] = ppp_optimise(s_system_name,x0,par_0,sim,u,y_0,free,extras);

endfunction







Added mttroot/mtt/lib/control/PPP/ppp_indices.m version [83cf0feda3].
































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function indices = ppp_indices (names,sympar)

  ## usage:  indices = ppp_indices (names,sympar)
  ##
  ## names: column vector of component names
  ## sympar: mtt-generated data structure od symbolic parameters


  ## Set up the
  indices = [];
  [n,m] = size(names);
  for i = 1:n
    p_name = deblank(names(i,:));
    s_name = sprintf("%ss", p_name);
    if struct_contains(sympar, p_name)
      i_p = eval(sprintf("sympar.%s;", p_name));
      if struct_contains(sympar, s_name)
	i_s = eval(sprintf("sympar.%s;", s_name));
	indices_i = eval(sprintf("[%i,%i];", i_p, i_s));
	indices = [indices; indices_i];
      else
	printf("Sensitivity parameter %s does not exist: ignoring \
	parameter %s\n", s_name, p_name);
      endif
    else
      printf("Parameter %s does not exist: ignoring\n", p_name)
    endif
  endfor
  

endfunction

Modified mttroot/mtt/lib/control/PPP/ppp_optimise.m from [1dce967d13] to [87f475bb1d].

24
25
26
27
28
29
30



31
32
33
34
35
36
37
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+
+
+







  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.6  2001/07/03 22:59:10  gawthrop
  ## Fixed problems with argument passing for CRs
  ##
  ## Revision 1.5  2001/06/06 07:54:38  gawthrop
  ## Further fixes to make nonlinear PPP work ...
  ##
  ## Revision 1.4  2001/05/26 15:46:38  gawthrop
  ## Updated to account for new nonlinear ppp
  ##
  ## Revision 1.3  2001/04/05 11:50:12  gawthrop
112
113
114
115
116
117
118
119
120


121
122
123
124
125
126
127
115
116
117
118
119
120
121


122
123
124
125
126
127
128
129
130







-
-
+
+







    endif
    
    ## Use the last part of the simulation to compare with data
    y = y(1+N_data-n_data:N_data,:);
    y_par = y_par(1+N_data-n_data:N_data,:);

    if extras.verbose		# Diagnostics
      printf("y and y_0\n");
      [y,y_0]
##      printf("y and y_0\n");
##      [y,y_0]
    endif
    
    ##Evaluate error, cost derivative J and cost second derivative JJ
    error = 0; 
    J = zeros(n_th,1);
    JJ = zeros(n_th,n_th);
    


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