Overview
Comment:Multiple ps files generated - view shows all
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ba51cc679bd5566acbb50dd42bf1460ddef3ed86a7e3634d9d5dee22e14df7e0
User & Date: gawthrop@users.sourceforge.net on 2002-05-22 16:59:59
Other Links: branch diff | manifest | tags
Context
2002-05-23
17:08:21
`mtt sys sfun zip` now produces an input block and an interface block for MTT models.
Models can be embedded within larger Simulink models by the 2 ports.
The user must edit 2 code blocks in <sys>_sfun_interface.c before compiling with mex.
check-in: 79e087b982 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-05-22
16:59:59
Multiple ps files generated - view shows all check-in: ba51cc679b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:33:18
Nameless components are now named according to type - replaces old
mtt1 etc style.
check-in: edd8b3a6d9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/rep/nppp_rep.make from [fee3bb99e4] to [14d73e2a97].

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
42

## m-files needed for nppp
nppp_m = ${SYS}_nppp.m ${SYS}_nppp_numpar.m 

## Targets for the nppp simulation
nppp_reps = ${nppp_m} ${sims} ${model_reps} ${sensitivity_reps}





all: ${SYS}_nppp.${LANG}

echo:
	echo "sims: ${sims}"
	echo "model_reps: ${model_reps}"
	echo "sensitivity_reps: ${sensitivity_reps}"
	echo "nppp_reps: ${nppp_reps}"

${SYS}_nppp.view: ${SYS}_nppp.ps
	nppp_rep.sh ${SYS} view

${SYS}_nppp.ps: ${SYS}_nppp.fig
	nppp_rep.sh ${SYS} ps

${SYS}_nppp.gdat: ${SYS}_nppp.dat2
	nppp_rep.sh ${SYS} gdat

${SYS}_nppp.fig ${SYS}_nppp.dat2: ${nppp_reps}
	nppp_rep.sh ${SYS} dat2







>
>
>
>











|







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
42
43
44
45
46

## m-files needed for nppp
nppp_m = ${SYS}_nppp.m ${SYS}_nppp_numpar.m 

## Targets for the nppp simulation
nppp_reps = ${nppp_m} ${sims} ${model_reps} ${sensitivity_reps}

## ps output files
psfiles = ${SYS}_nppp.ps ${SYS}_nppp.basis.ps ${SYS}_nppp.par.ps ${SYS}_nppp.U.ps
figfiles = ${psfiles:%.ps=%.fig}

all: ${SYS}_nppp.${LANG}

echo:
	echo "sims: ${sims}"
	echo "model_reps: ${model_reps}"
	echo "sensitivity_reps: ${sensitivity_reps}"
	echo "nppp_reps: ${nppp_reps}"

${SYS}_nppp.view: ${SYS}_nppp.ps
	nppp_rep.sh ${SYS} view

${psfiles}: ${SYS}_nppp.fig
	nppp_rep.sh ${SYS} ps

${SYS}_nppp.gdat: ${SYS}_nppp.dat2
	nppp_rep.sh ${SYS} gdat

${SYS}_nppp.fig ${SYS}_nppp.dat2: ${nppp_reps}
	nppp_rep.sh ${SYS} dat2

Modified mttroot/mtt/lib/rep/nppp_rep.sh from [5e19f4f312] to [60dbe41189].

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128


129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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

  if nargin<3
    i_par = []
  else
    i_par = ppp_indices (par_names,sympar,sympars); # Parameters
  endif
  

  if extras.visual		# Do some simulations
    ## System itself
    par = ${sys}_numpar;
    x_0_ol = ${sys}_state(par);
    [y_ol,x_ol, t_ol] =  ${sys}_sim(x_0_ol, par, simpar, ones(1,n_u));
    simpar_OL = simpar;
    simpar_OL.last = simpars.last;
    [y_OL,x_OL, t_OL] =  ${sys}_sim(x_0_ol, par, simpar_OL, ones(1,n_u));

    pars = s${sys}_numpar;
    x_0_ppp = s${sys}_state(pars);
    [y_ppp,y_par,x_ppp, t_ppp] =  s${sys}_ssim(x_0_ppp, pars, simpars, ones(1,n_u));

    simpar_PPP = simpars;
    simpar_PPP.first = simpar.first;
    [y_PPP,y_par,x_PPP, t_PPP] =  s${sys}_ssim(x_0_ppp, pars, simpar_PPP, ones(1,n_u));






    figure(2); 	
    grid; title("Outputs of ${sys}_sim and s${sys}_ssim");
    plot(t_ol,y_ol, '*', t_ppp, y_ppp, '+', t_OL, y_OL, t_PPP, y_PPP);

    ## Basis functions
    Us = ppp_ustar(A_u,1,t_OL',0,0)';

    figure(3); 	
    grid; title("Basis functions");
    plot(t_OL, Us);

  endif



  ## Do it
  [y,u,t,p,U,t_open,t_ppp,t_est,its_ppp,its_est] \
      = ppp_nlin_run ("${sys}",i_ppp,i_par,A_u,w_s,N,Q,extras);

  ## Compute values at ends of ol intervals
  T_open = cumsum(t_open);
  T_open = T_open(1:length(T_open)-1); # Last point not in t
  j=[];
  for i = 1:length(T_open)
    j = [j; find(T_open(i)*ones(size(t))==t)];
  endfor
  y_open = y(j,:);
  u_open = u(j,:);

  ## Plots

    gset nokey

    gset format x "%i"
    gset format y "%4.1f"
    gset term fig monochrome portrait fontsize 20 size 20 20 metric \
	     thickness 4
    gset output "${sys}_nppp.fig"

    title("");
    grid;
    xlabel("Time (s)");
    ylabel("u");
    subplot(2,1,2); plot(t,u,'-',  T_open, u_open,"^");  
    grid;
    ylabel("y");
    subplot(2,1,1); plot(t,y,'-', T_open, y_open,"^"); 














































endfunction

EOF
}

make_nppp_numpar() {







<
|
















>
>


>




<
<










|















>
|






<



<


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136


137
138
139
140
141
142
143
144
145
146
147
148
149
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

  if nargin<3
    i_par = []
  else
    i_par = ppp_indices (par_names,sympar,sympars); # Parameters
  endif
  

    ## Do some simulations to check things out
    ## System itself
    par = ${sys}_numpar;
    x_0_ol = ${sys}_state(par);
    [y_ol,x_ol, t_ol] =  ${sys}_sim(x_0_ol, par, simpar, ones(1,n_u));
    simpar_OL = simpar;
    simpar_OL.last = simpars.last;
    [y_OL,x_OL, t_OL] =  ${sys}_sim(x_0_ol, par, simpar_OL, ones(1,n_u));

    pars = s${sys}_numpar;
    x_0_ppp = s${sys}_state(pars);
    [y_ppp,y_par,x_ppp, t_ppp] =  s${sys}_ssim(x_0_ppp, pars, simpars, ones(1,n_u));

    simpar_PPP = simpars;
    simpar_PPP.first = simpar.first;
    [y_PPP,y_par,x_PPP, t_PPP] =  s${sys}_ssim(x_0_ppp, pars, simpar_PPP, ones(1,n_u));

    ## Basis functions
    Us = ppp_ustar(A_u,1,t_OL',0,0)';


  if extras.visual		#Show some graphs
    figure(2); 	
    grid; title("Outputs of ${sys}_sim and s${sys}_ssim");
    plot(t_ol,y_ol, '*', t_ppp, y_ppp, '+', t_OL, y_OL, t_PPP, y_PPP);




    figure(3); 	
    grid; title("Basis functions");
    plot(t_OL, Us);

  endif



  ## Do it
  [y,u,t,P,U,t_open,t_ppp,t_est,its_ppp,its_est] \
      = ppp_nlin_run ("${sys}",i_ppp,i_par,A_u,w_s,N,Q,extras);

  ## Compute values at ends of ol intervals
  T_open = cumsum(t_open);
  T_open = T_open(1:length(T_open)-1); # Last point not in t
  j=[];
  for i = 1:length(T_open)
    j = [j; find(T_open(i)*ones(size(t))==t)];
  endfor
  y_open = y(j,:);
  u_open = u(j,:);

  ## Plots

    gset nokey
    gset nogrid
    gset format x "%4.1f"
    gset format y "%4.1f"
    gset term fig monochrome portrait fontsize 20 size 20 20 metric \
	     thickness 4
    gset output "${sys}_nppp.fig"

    title("");

    xlabel("Time (s)");
    ylabel("u");
    subplot(2,1,2); plot(t,u,'-',  T_open, u_open,"^");  

    ylabel("y");
    subplot(2,1,1); plot(t,y,'-', T_open, y_open,"^"); 

    oneplot;
    gset output "${sys}_nppp.basis.fig"
    title("");
    xlabel("Time (s)");
    ylabel("Basis functions");
    plot(t_OL, Us);


    ## Create plot against time
    TTT = [ [0;T_open] [T_open; last] ]';
    TT = TTT(:);

    [n,m] = size(P);
    if m>0
      P = P(1:n-1,:);  # Loose last point
      PP = [];
      for j=1:m
        pp = [P(:,j) P(:,j)]';
        PP = [PP pp(:)];
      endfor

      oneplot;
      gset output "${sys}_nppp.par.fig"
      title("");
      xlabel("Time (s)");
      ylabel("Parameters");
      plot(TT,PP);
    endif

    [n,m] = size(U);
    if m>0    oneplot;
      gset output "${sys}_nppp.U.fig"
      title("");
      xlabel("Time (s)");
      ylabel("U");
      [n,m] = size(U);
      U = U(1:n-1,:);  # Loose last point
      UU = [];
      for j=1:m
        uu = [U(:,j) U(:,j)]';
        UU = [UU uu(:)];
      endfor
      plot(TT,UU);
    endif

endfunction

EOF
}

make_nppp_numpar() {
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260
261


262
263
264
265
266

267
268
269

270

271

272
273
274
275
276
277
278
        ## Make the numpar stuff
        make_nppp_numpar;
	;;
    m)
        ## Make the code
        make_nppp;
	;;
    dat2|fig)
    ## The dat2 language (output data) & fig file

	make_dat2; 
	;;
    gdat)
        cp ${dat2_file} ${dat2s_file} 
	dat22dat ${sys} ${rep} 
        dat2gdat ${sys} ${rep}
	;;


#    fig)
#	gdat2fig ${sys}_${rep}
#	;;
    ps)
	fig2dev -Leps ${sys}_${rep}.fig > ${sys}_${rep}.ps

	;;

    view)

	echo Viewing ${sys}_${rep}.ps

        gv ${sys}_${rep}.ps&

	;;
    *)
	echo Language ${lang} not supported by ${rep} representation
        exit 3
esac









|
|
>







>
>
|
|
<
<
|
>

<

>
|
>
|
>







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310


311
312
313

314
315
316
317
318
319
320
321
322
323
324
325
326
        ## Make the numpar stuff
        make_nppp_numpar;
	;;
    m)
        ## Make the code
        make_nppp;
	;;
    dat2|fig|basis.fig|par.fig|U.fig)
        ## The dat2 language (output data) & fig file
        rm ${sys}_nppp*.fig
	make_dat2; 
	;;
    gdat)
        cp ${dat2_file} ${dat2s_file} 
	dat22dat ${sys} ${rep} 
        dat2gdat ${sys} ${rep}
	;;
    ps|basis.ps|par.ps|U.ps)
        figs=`ls ${sys}_nppp*.fig | sed -e 's/\.fig//'`
        echo $figs
	for fig in ${figs}; do


            fig2dev -Leps ${fig}.fig > ${fig}.ps
	done
	;;

    view)
	pss=`ls ${sys}_nppp*.ps` 
        echo Viewing ${pss}
        for ps in ${pss}; do
          gv ${ps}&
	done
	;;
    *)
	echo Language ${lang} not supported by ${rep} representation
        exit 3
esac



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