Overview
Comment:Error handling included.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 262fb60e4140d2b431efb8da0b482149ee75df12005e6ca0d223fc048a299a2b
User & Date: gawthrop@users.sourceforge.net on 1996-08-24 14:40:31
Other Links: branch diff | manifest | tags
Context
1996-08-24
14:53:06
Initial revision check-in: 76b5921940 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:40:31
Error handling included. check-in: 262fb60e41 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:27:59
Global parameters.
Error handling.
check-in: f5e9ca2fd9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2cbg_m from [f1e9e9e1ac] to [1b1475635d].

9
10
11
12
13
14
15



16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+
+







# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1996/08/19 15:38:31  peter
## Removed bug work round.
##
## Revision 1.4  1996/08/16 14:28:45  peter
## Some debugging lines removed.
##
## Revision 1.3  1996/08/08 18:06:55  peter
## Unified naming scheme.
##
## Revision 1.2  1996/08/05 11:25:00  peter
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
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
123
124
125
126
127
128
129
130
131
132







-
+















+
+
+
+
+
+
+
+
+
+
+
+
+
+




rm -f mtt_info.txt


#Inform user
echo Creating $1_cbg.m

# Use matrix manipulation to accomplish the transformation
$MATRIX  >abg2cbg_m.log  2>>abg2cbg_m.log << EOF
$MATRIX  >abg2cbg_m.log  2>mtt_error << EOF

  infofile= '$infofile';

  %Convert from acausal to causal bond graph in m-file form.
  system_name = '$1';

  % THIS IS A NASTY BUG WORKROUND FOR OCTAVE
  % abg2cbg('RC','RC' ,'', [], infofile);
  
  port_bonds = [];
  [cbonds,status] = abg2cbg(system_name, '', '', port_bonds,infofile);

EOF

cat mtt_info.txt

# Test for errors and print if any
err_length=$(wc -c <mtt_error)
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi



cp $1_$1_cbg.m $1_cbg.m 



Modified mttroot/mtt/bin/trans/cbg2ese_m2r from [240d47acec] to [b03ad55bb6].

12
13
14
15
16
17
18



19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+
+
+








###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.4  1996/08/19 09:02:12  peter
## Errors go to user - not log.
##
## Revision 1.3  1996/08/18 20:05:55  peter
## Included zero outputs.
##
## Revision 1.2  1996/08/08 18:08:37  peter
## Sorted out file naming scheme.
##
## Revision 1.1  1996/08/08 15:57:15  peter
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58











59
60
61
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







-
+











+
+
+
+
+
+
+
+
+
+
+



touch $infofile

#Inform user
echo Creating $eqnfile
echo Creating $1_def.r

# Use matrix manipulation to accomplish the transformation
$MATRIX > cbg2ese_m2r.log << EOF
$MATRIX > cbg2ese_m2r.log 2>mtt_error << EOF

infofile = '$infofile'
system_name = '$1'
deffile = '$1_def.r';

structure = cbg2ese(system_name,'','',infofile)
makedef(structure,deffile);
  
EOF

cat $infofile

# Test for errors and print if any
err_length=$(wc -c <mtt_error)
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi



Modified mttroot/mtt/bin/trans/cbg_m2fig from [bb20371075] to [bd4bd64312].

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
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







+
+
+



















-
+











+
+
+
+
+
+
+
+
+
+






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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/08/08 18:07:31  peter
## Sorted out naming scheme for files
##
## Revision 1.1  1996/08/05 20:13:56  peter
## Initial revision
##
###############################################################


# Remove the old log file
rm -f cbg_m2fig.log
rm -f mtt_info.txt

# The following sets up the fig header file for the system
# and each sub system.
ls $1_*_cbg.m | sed 's/\(.*_\)\(.*_\)cbg.m/cp \2fig.fig \1\2cbg.fig/' | sh


#Inform user
echo Creating $1_cbg.fig

# Use  matrix manipulation to accomplish the transformation
$MATRIX > cbg_m2fig.log  2>> cbg_m2fig.log << EOF
$MATRIX > cbg_m2fig.log  2>mtt_error << EOF

  system_name = '$1';
  thick = 3; length = 250; red = 4; blue = 1; green = 12; font = 18;
  cbg2fig(system_name, ...
          '', '', ...
          length, thick, blue, ...
          font, green, red);
EOF

cp $1_$1_cbg.fig $1_cbg.fig

# Test for errors and print if any
err_length=$(wc -c <mtt_error)
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi






Modified mttroot/mtt/bin/trans/rbg2abg_m from [52de56a8f5] to [cf0f480a8c].

1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23













+
+
+







#! /bin/sh

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

# Bourne shell script: rbg2abg_m
#
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/08/05 12:22:16  peter
## Initial revision
##
###############################################################

# Raw bond graph to structured acausal bond graph: mfile format
# The structured BG is described by four matrices:
#   junctions: describes the junctions -
#     Column 1   Index of component (see components)
#     Column 2.. Indices of bonds on junction (see jbonds)
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
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







-





-
+

-
+


-
+















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



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


# Remove the old log file
rm -f rbg2abg_m.log
rm -f $1_abg.m
rm -f warning.txt; touch warning.txt

#Inform user
echo Creating $1_abg.m

# Use matrix manipulation to accomplish the transformation
$MATRIX > rbg2abg_m.log  2>>rbg2abg_m.log << EOF
$MATRIX > rbg2abg_m.log  2>mtt_err << EOF

  warningfile = 'warning.txt';
  infofile = 'mtt_info.txt';
  %Convert from the fig version of the bonds to a structured version
  [rbonds,rstrokes,rcomponents,rports,n_ports] = $1_rbg;
  [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,warningfile);
  [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile);

  %Write the function m-file for the causal bond graph
  filename = '$1_abg.m';
  c = '%';
  fprintf(filename, 'function [bonds,components,n_ports] = $1_abg\n');
  fprintf(filename, '%s [bonds,components] = $1_abg\n', c);
  fprintf(filename, '%s Acausal bond graph created by MTT on %s\n\n', ...
                     c, date);
  mat2mfile(bonds, 'bonds', filename);
  mat2mfile(components, 'components', filename);
  fprintf(filename, 'n_ports = %1.0f;\n', n_ports);


EOF

touch mtt_info.txt
cat mtt_info.txt
cat warning.txt

# Test for errors and print if any
err_length=$(wc -c <mtt_error)
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi






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