Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 9928b68158fd22c5cbaa9ce414ea7042d44d414e6c7bc67eb93c48ea3635e83a
User & Date: gawthrop@users.sourceforge.net on 2000-12-28 12:29:52
Other Links: branch diff | manifest | tags
Context
2000-12-28
12:31:15
*** empty log message *** check-in: 7c2e142b43 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:29:52
Initial revision check-in: 9928b68158 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:02:48
Initial revision check-in: 5f1e8a3807 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/abg2sabg_fig version [b4a5f4fe24].













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2sabg_fig
#
# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997

infofile='mtt_info.txt'
typefile="$1_type.sh"

# Remove the old log file
rm -f abg2sabg_fig.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile


#Inform user
echo Creating $1_sabg.txt

awk '{\
    Depth=7;\
    print $Depth}' $1_abg.fig

Added mttroot/mtt/bin/trans/abg_m2a4c version [18547a7f99].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg_m2a4c
#
# Acausal bond graph to ascend format

infofile='mtt_info.txt'
errorfile='mtt_error.txt'


# Remove the old log file
rm -f abg_m2a4c_m.log
rm -f $1_abg.a4c



#Inform user
echo "Creating $1_abg.a4c" 

# Use matrix manipulation to accomplish the transformation
octave -q << EOF  >$1_abg.a4c
    ABG = $1_abg;
    name = "$1";
    abg_m2a4c(ABG,name);
EOF

if [ "$info" = "info" ]; then
  cat $infofile
fi

Added mttroot/mtt/bin/trans/can_r2m version [4c4db15907].





















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: can_r2m
# Reduce canonical forsm to matlab
# P.J.Gawthrop  January 8th 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################



# Inform user
echo Creating $1_can.m

# Remove the old log file
rm -f can_r2m.log

# Use reduce to accomplish the transformation
reduce >can_r2m.log << EOF

%Read in the definitions file
IN "$1_def.r";

%Read the reduce state-space A,B,C and D matrices file
IN "$1_can.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read in the parameter file
IN "$1_sympar.r";

OUT "$1_can.m";
%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)

write "function [A_c,B_c,C_c,D_c,Con,Obs,K,L,A_comp,B_comp,C_comp] = $1_can;;";
write "%function [A_c,B_c,C_c,D_c,Con,Obs,K,L,A_comp,B_comp,C_comp] = $1_can;;";

write "%Canonical forms and controller design for system $1";
write "%File $1_can.m";
write "%Generated by MTT";
write "";

IF MTTNvar>0 THEN
BEGIN
  write "% Set the parameters";
  write "global ...;;";
  FOR i := 1:MTTNx DO
    write "alpha_c",i, " alpha_o",i, "...;;";
  
  FOR i := 1:MTTNvar DO
    BEGIN
      IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
        % Do nowt
      END
      ELSE  
      BEGIN
        write MTTVar(i,1), " ...";
      END;
    END;
    write " ";
END;


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "MTTA_c = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTB_c = zeros(", MTTNx, ",", MTTNu, ");";
write "MTTC_c = zeros(", MTTNy, ",", MTTNx, ");";
write "MTTD_c = zeros(", MTTNy, ",", MTTNu, ");";

write "MTTCon = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTObs = zeros(", MTTNx, ",", MTTNx, ");";

write "MTTK = zeros(", MTTNy, ",", MTTNx, ");";
write "MTTL = zeros(", MTTNx, ",", MTTNu, ");";

write "MTTA_comp = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTB_comp = zeros(", MTTNx, ",", MTTNy, ");";
write "MTTC_comp = zeros(", MTTNu, ",", MTTNx, ");";


ON NERO;	% Suppress zero elements.
MTTA_c := MTTA_c;
MTTB_c := MTTB_c;
MTTC_c := MTTC_c;
MTTD_c := MTTD_c;

MTTCon := MTTCon; 
MTTObs := MTTObs; 


MTTK := MTTK; 
MTTL := MTTL;

MTTA_comp := MTTA_comp;
MTTB_comp := MTTB_comp;
MTTC_comp := MTTC_comp;
MTTD_comp := MTTD_comp;


OFF FORT;
write "";

SHUT "$1_can.m";

Added mttroot/mtt/bin/trans/cmp2cmp_m version [3837859c2d].

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cmp2cmp_m
# Revises the component file (cmp) to account for aliases.

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Inform user
echo Revising $1_cmp.m

# Copy the alias and cmp files.
cat $1_alias.txt $1_cmp.m > junk

#Create the cmp file complete with headers.
#echo "# Component file ($1_cmp.m)" #> $1_cmp.m
#echo "# Revised by MTT at `date`" #>> $1_cmp.m

#Write out the variables 
awk '
BEGIN{
alias_file=1
Parameter_Regexp = "^_Parameter_"
Line_Regexp = "cr|arg"
quote = "\047"
}
{
  if (alias_file) {
    if (match($1,Parameter_Regexp)>0){
      alias[$2] = $1;
      sub(Parameter_Regexp,"$",alias[$2]); # Replace by $ format
    }
  }
  else {
    if (match($1,Line_Regexp)){
      cr_or_args = substr($3,2,length($3)-3); # It it a cr or arg line
      N=split(cr_or_args,a,";"); # Split into parts
      for (i=1;i<=N;i++){
        if (a[i] in alias)       # Replace by alias
          a[i] = alias[a[i]];
      }
      cr_or_args = a[1];         # Recombine
      for (i=2;i<=N;i++)
        cr_or_args = sprintf("%s;%s", cr_or_args, a[i]);
      print   "\t" $1 "\t" $2 "\t" quote cr_or_args quote
    }
    else
      print $0
  }
  if ($1=="###_END_OF_ALIAS_###")
    alias_file=0;
}' <junk > $1_cmp.m

rm -f junk








Added mttroot/mtt/bin/trans/convert_simpar.sh version [884ce541cf].





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
#!/bin/sh

## Gets rid of redundant METHOD lines.
echo Converting $1
## backup
cp $1 $1_old
sed 's/METHOD/## METHOD/'< $1_old > $1



Added mttroot/mtt/bin/trans/ctf_r2tex version [995ac3d6a0].







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ctf_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


# Inform user
echo Creating $1_ctf.tex

# Remove the old log file
rm -f ctf_r2tex.log

# Use reduce to accomplish the transformation
reduce >ctf_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the smconical-form matrices file
in "$1_ctf.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_ctf.tex";

%Write out the canonical matrices
write "%Controler TF $1";
write "%File: $1_ctf.tex";
write"";

MTT_Matrix := MTTcTF$ 
MTT_Matrix_name := "MTTcTF"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNy$
Latex_Matrix()$


SHUT "$1_ctf.tex";
quit;
EOF

Added mttroot/mtt/bin/trans/dae2lde_r version [1356811527].









































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lde2ode.r
# Reduce differential-algebraic equations to Lagranges equations
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Create the reduce output code
def2write_r $1 lde
def2write_r $1 ldeo

#Inform user
echo Creating $1_lde.r
echo Creating $1_ldeo.r

# Remove the old log file
rm -f cse2lde_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC  << EOF >cse2lde_r.log

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

%Read the definitions file
in "$1_def.r";

%Read the substitution file
in "$1_subs.r";

%Read the dae file
in "$1_dae.r";

% Zap bits we dont need
clear mttui, mttu, mttdu, mttx, mttdz;

%% The lagrangian eqns are those set to zero.
MTTL := mttyz;

% Create the second derivative of z
MATRIX mttddz(MTTNz,1);
FOR i := 1:MTTNz DO
BEGIN
  mttuii := mkid(mttui,i);
  mttdduii := mkid(mttddui,i);
  mttddz(i,1) :=  sub(mttuii=mttdduii,mttz(i,1));
END;
mttddz;

% Create Lagranges Equations
FOR j := 1:MTTNyz DO
BEGIN
  %% Create derivative of the equations by substituting:
  %du for u
  mttuj := mkid(mttu,j);
  mttduj := mkid(mttdu,j);
  MTTL :=  sub(mttuj=mttduj,MTTL);

  % dv for v
  mttuij := mkid(mttui,j);
  mttduij := mkid(mttdui,j);
  MTTL :=  sub(mttuij=mttduij,MTTL);

  % dx for x
  mttxj := mkid(mttx,j);
  MTTL :=  sub(mttxj=mttdx(j,1),MTTL);

  % ddz for dz
  mttdzj := mkid(mttdz,j);
  MTTL :=  sub(mttdzj=mttddz(j,1),MTTL);

END;

L = MTTL;

OFF Echo;
OFF Nat;


%Write out the  ordinary differential equations.
OUT "$1_lde.r";
write "%File: $1_lde.r";
in ("$1_lde_write.r");
write "in ""$1_ldeo.r"";";
write "END;";
SHUT "$1_lde.r";

%Write out the  output equations
OUT "$1_ldeo.r";
write "%File: $1_ldeo.r";
in ("$1_ldeo_write.r");
write "END;";
SHUT "$1_ldeo.r";
quit;
EOF

# Now invoke the standard error handling.
mtt_error_r cse2lde_r.log








Added mttroot/mtt/bin/trans/doc2pdf version [17899ec521].























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: doc2pdf
# Converts doc file to pdf file

# Copyright (c) P.J.Gawthrop 1998


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
##
###############################################################

system=$1
documenttype=$2

# Inform user
echo "Creating $system.pdf"

#Run pdflatex , bibtex and makeindex
pdflatex $system.doc > doc2pdf.log
bibtex $system    >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log

if [ "$documenttype" = "book" ]; then
    makeindex $system >> doc2pdf.log
else
    touch $system.ind
fi

pdflatex $system.doc >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log

# Make sure transformation succeeeds
exit 0

Added mttroot/mtt/bin/trans/doc2ps version [d08f5c88d0].























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: doc2dvi
# Converts doc file to dvi file

# Copyright (c) P.J.Gawthrop 1998


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1999/11/02 07:56:46  peterg
## Removed documenttype in blurb
##
## Revision 1.3  1998/11/24 12:03:27  peterg
## Indexing of book docs.
##
## Revision 1.2  1998/04/15 18:40:43  peterg
## Run LateX three times
##
## Revision 1.1  1998/03/03 08:35:50  peterg
## Initial revision
##
###############################################################

system=$1
documenttype=$2

# Inform user
echo "Creating $system.ps"

doc2dvi $system $documenttype

dvips -o $system.ps $1 

# Make sure transformation succeeeds
exit 0

Added mttroot/mtt/bin/trans/ese_tidy version [351111a9a5].



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


# Bourne shell script: ese_tidy
# Tidies up Matlab format files
# P.J.Gawthrop May 1998
# Copyright (c) P.J.Gawthrop, 1990, 1994, 1995.

#Puts the state & output equations at the end of the file

grep -v '^MTT' $1_ese.r>junk1
grep '^MTT' $1_ese.r>junk2
echo 'END;' >junk3
cat junk1 junk2 junk3> $1_ese.r




Added mttroot/mtt/bin/trans/gdat2fig version [b25999b04d].

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: gdat2ps

# Converts a data file in gplot format to a ps file

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  1997/12/07 18:45:44  peterg
## Set to monochrome (not colour). This gives clearer plots.
##
## Revision 1.7  1996/08/26 13:04:43  peterg
## Changed $() to ``.
##
# Revision 1.6  1996/08/16  14:51:21  peter
# Put in some cosmetic postscript options.
#
## Revision 1.5  1996/08/15 09:37:58  peter
## Parameters in title.
##
## Revision 1.4  1996/08/14 09:21:17  peter
## Gnu plot conversion now done externally in dat2gdat
##
## Revision 1.3  1996/08/10 14:12:48  peter
## Revised to new dat format: [x y x y x y] in place of [x y y y].
##
## Revision 1.2  1996/08/10 12:54:56  peter
## Reorganised data file for gnuplot input.
##
## Revision 1.1  1996/08/10 09:52:39  peter
## Initial revision
##
###############################################################

echo Creating $1.fig

gnuplot << EOF
  set terminal fig color portrait fontsize 16 size 20 10 metric
  set output '$1.fig'
  set grid
  set title "MTT simulation on `date` "
  plot '$1.gdat' with lines
  exit

EOF

## Add a gold box to give a nice picture
cat >> $1.fig <<EOF
2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5
	 9675 5310 9675 270 225 270 225 5310 9675 5310
EOF


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