︙ | | | ︙ | |
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.
###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.51 1997/01/21 13:16:40 peterg
## Included transformations to language c for:
## ode
## params
## numpar
##
## Revision 1.50 1996/12/21 19:46:52 peterg
|
>
>
>
>
>
>
>
>
>
|
10
11
12
13
14
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.54 1997/02/07 13:33:03 peterg
# Added ; to _input.c file - bug fix.
#
# Revision 1.53 1997/02/07 13:25:04 peterg
# Version 2.3
#
# Revision 1.52 1997/01/21 22:55:59 peterg
# Minor bug fixes
#
## Revision 1.51 1997/01/21 13:16:40 peterg
## Included transformations to language c for:
## ode
## params
## numpar
##
## Revision 1.50 1996/12/21 19:46:52 peterg
|
︙ | | | ︙ | |
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
|
## Revision 1.1 1996/08/04 17:29:42 peter
## Initial revision
##
###############################################################
# MTT recursion level is zero unless explicitly set
level=0
#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
case $1 in
-q )
quiet=quiet ;;
-l )
level=$2; shift ;;
esac
shift
done
#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
echo
echo 'MTT (Model Transformation Tools) version 2.2++'
echo 'This is free software with ABSOLUTELY NO WARRANTY.'
echo 'Type `mtt warranty'\' 'for details.'
echo
fi
if [ -z "$1" ]; then
echo 'Usage: mtt help'
|
>
>
>
>
>
|
|
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
|
## Revision 1.1 1996/08/04 17:29:42 peter
## Initial revision
##
###############################################################
# MTT recursion level is zero unless explicitly set
level=0
#Computation mode is octave by default
computation=octave
#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
case $1 in
-q )
quiet=quiet ;;
-c )
computation=c ;;
-l )
level=$2; shift ;;
esac
shift
done
#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
echo
echo 'MTT (Model Transformation Tools) version 2.3'
echo 'This is free software with ABSOLUTELY NO WARRANTY.'
echo 'Type `mtt warranty'\' 'for details.'
echo
fi
if [ -z "$1" ]; then
echo 'Usage: mtt help'
|
︙ | | | ︙ | |
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
)> $1_simp.r
#SUMMARY numpar numerical parameter declaration (m)
$1_numpar.m: $1_sympar.r $1_params.m
sympar2numpar_r2m $1
#SUMMARY numpar numerical parameter declaration (c)
$1_numpar.c: $1_sympar.r $1_params.c
sympar2numpar_r2c $1
#SUMMARY params numerical parameter setting (m)
$1_params.m:
echo Creating $1_params.m
( \
echo "%% Parameter file for system $1 ($1_params.m)"; \
|
|
|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
)> $1_simp.r
#SUMMARY numpar numerical parameter declaration (m)
$1_numpar.m: $1_sympar.r $1_params.m
sympar2numpar_r2m $1
#SUMMARY numpar numerical parameter declaration (c)
$1_numpar.c: $1_sympar.r
sympar2numpar_r2c $1
#SUMMARY params numerical parameter setting (m)
$1_params.m:
echo Creating $1_params.m
( \
echo "%% Parameter file for system $1 ($1_params.m)"; \
|
︙ | | | ︙ | |
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
echo Creating $1_params.c
( \
echo '/*'; \
echo "%% Parameter file for system $1 ($1_params.c)"; \
echo "%% This file provides the system params for simulation:";\
echo '*/'; \
echo '$1_params()'; \
echo '{'; \
echo '};'; \
)> $1_params.c
#SUMMARY params symbolic parameter setting (r)
$1_params.r:
echo Creating $1_params.r
( \
echo "%% Parameter file for system $1 ($1_params.r)"; \
echo "%% This file provides symbolic parameters for simplification";\
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
|
echo Creating $1_params.c
( \
echo '/*'; \
echo "%% Parameter file for system $1 ($1_params.c)"; \
echo "%% This file provides the system params for simulation:";\
echo '*/'; \
echo '$1_params()'; \
echo '{'; \
echo '};'; \
)> $1_params.c
#SUMMARY odes ODE simulation header file (h)
$1_odes.h:
echo Creating $1_odes.h
( \
echo '/*'; \
echo "%% Parameter file for system $1 ($1_odes.h)"; \
echo "%% This file provides the params for simulation:";\
echo '*/'; \
echo '#define DT 0.1 /* Time step (for printing) */'; \
echo '#define LAST 10.0 /* Last time */'; \
echo '#define STEPFACTOR 1000 /* Integration steps per time step */'; \
)> $1_odes.h
#SUMMARY params symbolic parameter setting (r)
$1_params.r:
echo Creating $1_params.r
( \
echo "%% Parameter file for system $1 ($1_params.r)"; \
echo "%% This file provides symbolic parameters for simplification";\
|
︙ | | | ︙ | |
518
519
520
521
522
523
524
525
526
527
528
529
530
531
|
cat $MTTPATH/trans/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 = ones(nu,1);"; \
)> $1_input.m
#SUMMARY sspar steady-state definition (r)
$1_sspar.r:
echo Creating $1_sspar.r
(\
echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)"; \
cat $MTTPATH/trans/m/rcs_header.txt; \
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
|
cat $MTTPATH/trans/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 = ones(nu,1);"; \
)> $1_input.m
#SUMMARY input input signal definition (c)
$1_input.c:
echo Creating $1_input.c
( \
echo "$1_input(t)"; \
echo ' float t;'; \
echo '/*'; \
echo "%% Input file for system $1 ($1_input.c)"; \
echo "%% This file provides the system input for simulation:";\
echo '*/'; \
cat $MTTPATH/trans/rcs_header.c; \
echo; \
echo "/* Change the following lines as you wish */"; \
echo '{'; \
echo '};'; \
)> $1_input.c
#SUMMARY sspar steady-state definition (r)
$1_sspar.r:
echo Creating $1_sspar.r
(\
echo "%% Reduce steady-state parameter file for $1 ($1_sspar.r)"; \
cat $MTTPATH/trans/m/rcs_header.txt; \
|
︙ | | | ︙ | |
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
|
#SUMMARY ode ordinary differential equations (view)
#SUMMARY ode ordinary differential equations (ps)
#Ordinary differential equations
$1_ode.r: $1_cse.r $1_def.r $1_sympar.r
cse2ode_r $1; tidy $1_ode.r
$1_ode.m: $1_def.r $1_ode.r $1_sympar.r $1_numpar.m
ode_r2m $1; matlab_tidy $1_ode.m; matlab_tidy $1_odeo.m
$1_ode.c: $1_def.r $1_ode.r $1_sympar.r $1_numpar.c
ode_r2c $1
$1_ode.tex: $1_ode.r $1_sympar.r $1_simp.r
ode_r2tex $1; latex_tidy $1_ode.tex
#SUMMARY obs observer equations for CGPC (r)
#SUMMARY obs observer equations for CGPC (m)
#SUMMARY obs observer equations for CGPC (tex)
|
|
|
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
#SUMMARY ode ordinary differential equations (view)
#SUMMARY ode ordinary differential equations (ps)
#Ordinary differential equations
$1_ode.r: $1_cse.r $1_def.r $1_sympar.r
cse2ode_r $1; tidy $1_ode.r
$1_ode.m: $1_def.r $1_ode.r $1_sympar.r $1_numpar.m
ode_r2m $1; matlab_tidy $1_ode.m; matlab_tidy $1_odeo.m
$1_ode.c: $1_def.r $1_ode.r $1_sympar.r
ode_r2c $1
$1_ode.tex: $1_ode.r $1_sympar.r $1_simp.r
ode_r2tex $1; latex_tidy $1_ode.tex
#SUMMARY obs observer equations for CGPC (r)
#SUMMARY obs observer equations for CGPC (m)
#SUMMARY obs observer equations for CGPC (tex)
|
︙ | | | ︙ | |
749
750
751
752
753
754
755
756
757
758
759
760
761
762
|
#SUMMARY sro step response - output (ps)
#SUMMARY sro step response - output (view)
#SUMMARY odes ode solution - state (m)
#SUMMARY odes ode solution - state (dat)
#SUMMARY odes ode solution - state (ps)
#SUMMARY odes ode solution - state (view)
#SUMMARY odeso ode solution - output (m)
#SUMMARY odeso ode solution - output (dat)
#SUMMARY odeso ode solution - output (ps)
#SUMMARY odeso ode solution - output (view)
#SUMMARY daes dae solution - state (m)
|
>
|
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
#SUMMARY sro step response - output (ps)
#SUMMARY sro step response - output (view)
#SUMMARY odes ode solution - state (m)
#SUMMARY odes ode solution - state (dat)
#SUMMARY odes ode solution - state (ps)
#SUMMARY odes ode solution - state (view)
#SUMMARY odes ode solution - state & output(c)
#SUMMARY odeso ode solution - output (m)
#SUMMARY odeso ode solution - output (dat)
#SUMMARY odeso ode solution - output (ps)
#SUMMARY odeso ode solution - output (view)
#SUMMARY daes dae solution - state (m)
|
︙ | | | ︙ | |
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
|
sm2ir_m $1 '$ARGS'
$1_iro.m: $1_ir.m
touch $1_iro.m
$1_sr.m: $1_sm.m $1_numpar.m $1_params.m $1_args.m $1_def.m
sm2sr_m $1 '$ARGS'
$1_sro.m: $1_sr.m
touch $1_sro.m
$1_odes.m: $1_ode.m $1_numpar.m $1_params.m $1_args.m $1_def.m $1_input.m
ode2odes_m $1 '$ARGS'
$1_odeso.m: $1_odes.m
touch $1_odeso.m
$1_daes.m: $1_dae.m $1_numpar.m $1_params.m $1_args.m $1_def.m $1_input.m
dae2daes_m $1 '$ARGS'
$1_daeso.m: $1_daes.m
touch $1_daeso.m
|
>
>
>
>
>
>
>
>
>
>
>
|
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
|
sm2ir_m $1 '$ARGS'
$1_iro.m: $1_ir.m
touch $1_iro.m
$1_sr.m: $1_sm.m $1_numpar.m $1_params.m $1_args.m $1_def.m
sm2sr_m $1 '$ARGS'
$1_sro.m: $1_sr.m
touch $1_sro.m
$1_odes.c: $1_ode.c $1_def.r $1_sympar.r
ode2odes_r2c $1
ifeq ($computation,octave)
$1_odes.m: $1_ode.m $1_numpar.m $1_params.m $1_args.m $1_def.m $1_input.m
ode2odes_m $1 '$ARGS'
endif
ifeq ($computation,c)
$1_odes.m: $1_odes.c $1_ode.c $1_numpar.c $1_odes.h $1_params.c $1_input.c
echo Creating $1_odes.m
echo 'Compiling ...'
gcc $1_odes.c $1_ode.c $1_numpar.c $1_params.c $1_input.c
echo 'Running ...'; a.out; echo 'Done.'
endif
$1_odeso.m: $1_odes.m
touch $1_odeso.m
$1_daes.m: $1_dae.m $1_numpar.m $1_params.m $1_args.m $1_def.m $1_input.m
dae2daes_m $1 '$ARGS'
$1_daeso.m: $1_daes.m
touch $1_daeso.m
|
︙ | | | ︙ | |