9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Acausal bond graph to causal bond graph: mfile format
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11 1998/01/23 13:29:54 peterg
## $RMATRIX --> $MATRIX
##
# Revision 1.10 1996/12/04 21:51:02 peterg
# Now uses filenum instead of line name.
# Uses fopen
#
|
>
>
>
|
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.12 1998/07/10 08:43:46 peterg
## Added -I switch
##
## Revision 1.11 1998/01/23 13:29:54 peterg
## $RMATRIX --> $MATRIX
##
# Revision 1.10 1996/12/04 21:51:02 peterg
# Now uses filenum instead of line name.
# Uses fopen
#
|
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
|
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
shift
done
infofile='mtt_info.txt'
typefile="$1_type.sh"
# Remove the old log file
rm -f abg2cbg_m.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
#Inform user
echo Creating $1_cbg.m
echo Creating $1_type.sh
# Use matrix manipulation to accomplish the transformation
$MATRIX << EOF >abg2cbg_m.log 2>mtt_error.txt
infofile= '$infofile';
typefile = '$typefile';
infofilenum = fopen(infofile,'w');
typefilenum = fopen(typefile,'w');
%Convert from acausal to causal bond graph in m-file form.
system_name='$1';
port_bonds = [];
port_direction = [];
port_status = [];
[cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ...
typefilenum, infofilenum);
EOF
if [ "$info" = "info" ]; then
cat $infofile
fi
# cp $1_$1_cbg.m $1_cbg.m 2>> mtt_error.txt
# Print errors, if any.
mtt_error mtt_error.txt
|
>
|
|
<
|
|
|
|
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
|
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
shift
done
infofile='mtt_info.txt'
errorfile='mtt_error.txt'
typefile="$1_type.sh"
# Remove the old log file
rm -f abg2cbg_m.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
#Inform user
echo Creating $1_cbg.m
echo Creating $1_type.sh
# Use matrix manipulation to accomplish the transformation
$MATRIX << EOF >abg2cbg_m.log #2>mtt_error.txt
infofilenum = fopen("$infofile",'w');
errorfilenum = fopen("$errorfile",'w');
typefilenum = fopen("$typefile",'w');
%Convert from acausal to causal bond graph in m-file form.
system_name='$1';
port_bonds = [];
port_direction = [];
port_status = [];
[cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ...
typefilenum, infofilenum, errorfilenum);
EOF
if [ "$info" = "info" ]; then
cat $infofile
fi
# cp $1_$1_cbg.m $1_cbg.m 2>> mtt_error.txt
# Print errors, if any.
mtt_error mtt_error.txt
|