Differences From Artifact [f68525ae49]:

To Artifact [5a106f2435]:


15
16
17
18
19
20
21




22
23
24
25
26
27
28
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$




## Revision 1.18  1996/08/19 13:30:54  peter
## New CLEAN target.
##
## Revision 1.17  1996/08/19 06:48:14  peter
## Explicit figure editing.
##
## Revision 1.16  1996/08/18 19:58:36  peter







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.19  1996/08/19 15:33:22  peter
## Included new state matric (sm) rep.
## Generate step response (sr) from sm.
##
## Revision 1.18  1996/08/19 13:30:54  peter
## New CLEAN target.
##
## Revision 1.17  1996/08/19 06:48:14  peter
## Explicit figure editing.
##
## Revision 1.16  1996/08/18 19:58:36  peter
81
82
83
84
85
86
87


88
89
90
91
92
93
94
95
96
echo 'This is free software with ABSOLUTELY NO WARRANTY.'
echo 'Type `mtt warranty'\' 'for details.'
echo

if [ "$1" = "" ]; then
  echo 'Usage: mtt info'
  echo '       mtt warranty'


   echo '       mtt system_name representation language'
   echo '       mtt system_name representation language parameters'
  exit
fi

if [ "$1" = "info" ] && [$2 = ""]; then
  info -f $MTTPATH/../doc/mtt.info
  exit
fi







>
>
|
|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
echo 'This is free software with ABSOLUTELY NO WARRANTY.'
echo 'Type `mtt warranty'\' 'for details.'
echo

if [ "$1" = "" ]; then
  echo 'Usage: mtt info'
  echo '       mtt warranty'
  echo '       mtt system_name clean'
  echo '       mtt system_name representation vc'
  echo '       mtt system_name representation language'
  echo '       mtt system_name representation language parameters'
  exit
fi

if [ "$1" = "info" ] && [$2 = ""]; then
  info -f $MTTPATH/../doc/mtt.info
  exit
fi
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

228
229
230
231

232
233
234
235
236
237
238

239
240
241
242
243
244
245
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
279
280
281
282
283
284
285
286
287
288
289
	nyfr)
		REPTYPE='data' ;;
	nifr)
		REPTYPE='data' ;;
	*)
		REPTYPE='tex' ;;
esac




































# This is the main mtt programme
 
make -s  -f -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m

#Create acausal bond graph figure using xfig
#.PHONY: $1_abg.fig 
$1_abg.fig:
	$FIG $1_abg.fig 

#Create empty files (with titles) if not already there
$1_lbl.txt:
	echo Creating $1_lbl.txt
	( \
	echo "%% Label file for $1 ($1_lbl.txt)"; \

	echo "%% Each line should be of one of the following forms:"; \
	echo "%	a comment (ie starting with %)"; \
	echo "%	Component-name	CR_name	arg1,arg2,..argn"; \
	echo "%	blank"; \
        )> $1_lbl.txt
$1_cr.r:
	makecr $1
$1_sympar.r:
	echo Creating $1_sympar.r
	( \
	echo "%% Symbolic parameter file for $1 ($1_sympar.r)"; \

	echo "%% Change the following line to reflect the number of variables"; \
	echo "MTTNVar := 0;"; \
	echo "IF MTTNVar>0 THEN MATRIX MTTVar(MTTNVar,1);"; \
 	echo "%% Add an assignment statement here for each variable"; \
 	echo "%% For example: MTTVar(1,1) := r"; \
        )> $1_sympar.r
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce comands to simplify output for $1 ($1_simp.r)"; \

        )> $1_simp.r

$1_numpar.m: $1_sympar.r
	mknumpar $1; matlab_tidy $1_numpar.m;


$1_input.m:
	echo Creating $1_input.m
	( \
	echo "function u = $1_input(t)"; \
	echo "%% Input file for $1 ($1_input.m)"; \
	echo "%% This file provides the system input for simulation:";\

	echo; \
	echo "% Set up system definitions"; \
	echo "[nx,ny,nu,nz,nyz] = $1_def;"; \
	echo "% Change the following lines as you wish"; \
	echo "u = zeros(nu,1);"; \
	echo "u(1) = 1;"; \
        )> $1_input.m

$1_sspar.r:
	echo Creating $1_sspar.r

	echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)" \

	> $1_sspar.r

$1_rep.txt:
	echo Creating $1_rep.txt
	( \
	echo "%% Outline report file for system $1 ($1_rep.txt)"; \

	echo "abg ps"; \
	echo "lbl txt"; \
	echo "cbg ps"; \
	echo "dae tex"; \
	)> $1_rep.txt


#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
	rbg_fig2m $1

$1_cmp.m: $1_rbg.m

$1_fig.fig: $1_rbg.m

#Bond graph conversions using matlab
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m
	rbg2abg_m $1	

#Causal bond graph: mfile to fig conversion
$1_cbg.fig: $1_cbg.m $1_rbg.m $1_fig.fig
	cbg_m2fig $1

#Causal bond graph: xfig display
#$1_cbg.view: $1_cbg.fig
#	echo "Creating view of $1_cbg"; xfig $1_cbg.fig &


#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1

#Elementary system equations + definitions
$1_ese.r: $1_cbg.m







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













<







|
>










|
>









|
>




>





|

>










>

>
|





>





>




<

<











<
<
<
<







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
228
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
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
279
280
281
282
283
284
285
286
287
288
289
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
327
328
329
330
331
332
	nyfr)
		REPTYPE='data' ;;
	nifr)
		REPTYPE='data' ;;
	*)
		REPTYPE='tex' ;;
esac


# Version control
if [ "$3" = "vc" ]; then
  case $2 in
	abg )
		VC='ok'
		VCext='fig' ;;
	lbl )
		VC='ok'
		VCext='txt' ;;
	 cr)
		VC='ok'
		VCext='r' ;;
	sympar )
		VC='ok'
		VCext='r' ;;
	simp )
		VC='ok'
		VCext='r' ;;
	numpar )
		VC='ok'
		VCext='m' ;;
	input )
		VC='ok'
		VCext='m' ;;
	sspar )
		VC='ok'
		VCext='r' ;;
	*)
		echo Version control is not appropriate for representation $2
		exit  ;;
  esac
fi


# This is the main mtt programme
 
make -s  -f -  $1_$2.$3 << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m

#Create acausal bond graph figure using xfig

$1_abg.fig:
	$FIG $1_abg.fig 

#Create empty files (with titles) if not already there
$1_lbl.txt:
	echo Creating $1_lbl.txt
	( \
	echo "%% Label file for system $1 ($1_lbl.txt)"; \
	cat $MTTPATH/m/rcs_header.txt; \
	echo "%% Each line should be of one of the following forms:"; \
	echo "%	a comment (ie starting with %)"; \
	echo "%	Component-name	CR_name	arg1,arg2,..argn"; \
	echo "%	blank"; \
        )> $1_lbl.txt
$1_cr.r:
	makecr $1
$1_sympar.r:
	echo Creating $1_sympar.r
	( \
	echo "%% Symbolic parameter file for system $1 ($1_sympar.r)"; \
	cat $MTTPATH/m/rcs_header.txt; \
	echo "%% Change the following line to reflect the number of variables"; \
	echo "MTTNVar := 0;"; \
	echo "IF MTTNVar>0 THEN MATRIX MTTVar(MTTNVar,1);"; \
 	echo "%% Add an assignment statement here for each variable"; \
 	echo "%% For example: MTTVar(1,1) := r"; \
        )> $1_sympar.r
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce comands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/m/rcs_header.txt; \
        )> $1_simp.r

$1_numpar.m: $1_sympar.r
	mknumpar $1; matlab_tidy $1_numpar.m;
	mv $1_numpar.m junk; cat $MTTPATH/m/rcs_header.txt junk>$1_numpar.m

$1_input.m:
	echo Creating $1_input.m
	( \
	echo "function u = $1_input(t)"; \
	echo "%% Input file for system $1 ($1_input.m)"; \
	echo "%% This file provides the system input for simulation:";\
	cat $MTTPATH/m/rcs_header.txt; \
	echo; \
	echo "% Set up system definitions"; \
	echo "[nx,ny,nu,nz,nyz] = $1_def;"; \
	echo "% Change the following lines as you wish"; \
	echo "u = zeros(nu,1);"; \
	echo "u(1) = 1;"; \
        )> $1_input.m

$1_sspar.r:
	echo Creating $1_sspar.r
	(\
	echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)" \
	cat $MTTPATH/m/rcs_header.txt; \
	)> $1_sspar.r

$1_rep.txt:
	echo Creating $1_rep.txt
	( \
	echo "%% Outline report file for system $1 ($1_rep.txt)"; \
	cat $MTTPATH/m/rcs_header.txt; \
	echo "abg ps"; \
	echo "lbl txt"; \
	echo "cbg ps"; \
	echo "dae tex"; \
	)> $1_rep.txt


#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
	rbg_fig2m $1

$1_cmp.m: $1_rbg.m

$1_fig.fig: $1_rbg.m

#Bond graph conversions using matlab
#Raw bond graph to acausal bond graph: mfile
$1_abg.m: $1_rbg.m
	rbg2abg_m $1	

#Causal bond graph: mfile to fig conversion
$1_cbg.fig: $1_cbg.m $1_rbg.m $1_fig.fig
	cbg_m2fig $1






#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m $1

#Elementary system equations + definitions
$1_ese.r: $1_cbg.m
494
495
496
497
498
499
500








501
#$1_rep.rep: $1_rep.make
#	sh<$1_rep.make; cp $1_rep.tex $1_rep.doc

$1_rep.html: $1_rep.dvi
	echo Creating $1_rep.html 
	latex2html $1_rep.tex









EOF







>
>
>
>
>
>
>
>

537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
#$1_rep.rep: $1_rep.make
#	sh<$1_rep.make; cp $1_rep.tex $1_rep.doc

$1_rep.html: $1_rep.dvi
	echo Creating $1_rep.html 
	latex2html $1_rep.tex

# Version control system - uses RCS
RCS:
	echo Creating RCS
	mkdir RCS
$1_$2.vc: RCS $1_$2.$VCext 
	echo Version control on $1_$2.$VCext
	ci -I $1_$2.$VCext </dev/tty  ; co -l $1_$2.$VCext 

EOF

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