Overview
Comment:*** empty log message ***
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 91db786a122cfdd6e2c80bec2b690b420727d7906d5d2ca60aa5fffb51054691
User & Date: gawthrop@users.sourceforge.net on 1998-07-27 20:30:12
Other Links: branch diff | manifest | tags
Context
1998-07-27
20:30:39
Mods for dm rep - no globals ... check-in: 9856ba297f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:30:12
*** empty log message *** check-in: 91db786a12 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:29:49
Had another go at causality ....
1. Impose external causality onto all port bonds
2. Set C_cause.m so that it DOESN'T set causality
-- I_cause is already ok !
check-in: b4b9bc1d47 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2cbg_m from [eed70ddc38] to [021928d3b8].

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

Modified mttroot/mtt/bin/trans/awk/rbg_fig2m.awk from [91084d36c1] to [1fa61c80d5].

9
10
11
12
13
14
15




16
17
18
19
20
21
22
# Copyright (c) P.J.Gawthrop, 1996.

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




## Revision 1.30  1998/04/12 15:01:17  peterg
## Converted to uniform port notation - always use []
##
## Revision 1.29  1998/04/12 12:35:32  peterg
## Named and unnamed SS handled in a uniform manner - in particular, the
## attributes are passed through
## wrote_component function used.







>
>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.31  1998/04/16 13:18:13  peterg
## Now ignores spurious ports (in lbl but not Figure \ref{) but gives
## warning
##
## Revision 1.30  1998/04/12 15:01:17  peterg
## Converted to uniform port notation - always use []
##
## Revision 1.29  1998/04/12 12:35:32  peterg
## Named and unnamed SS handled in a uniform manner - in particular, the
## attributes are passed through
## wrote_component function used.
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
    }

function write_component(i) {
    name = label[i,1];
    cr   = label[i,2];
    arg  = label[i,3];
    
    if (length(x[name])==0) {
        # print error - its in lbl but not fig file
        printf(warning_l, name);
    }
    else {
      component_index++;
      print x[name], y[name], info[name] >> b_file;







<







181
182
183
184
185
186
187

188
189
190
191
192
193
194
  return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
    }

function write_component(i) {
    name = label[i,1];
    cr   = label[i,2];
    arg  = label[i,3];

    if (length(x[name])==0) {
        # print error - its in lbl but not fig file
        printf(warning_l, name);
    }
    else {
      component_index++;
      print x[name], y[name], info[name] >> b_file;
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
  sys_name = ARGV[1];
  delete ARGV[1];

  b_file = sprintf("%s_rbg.m", sys_name);
  c_file = sprintf("%s_cmp.m", sys_name);
  fig_file = sprintf("%s_fig.fig", sys_name);
  cmp_file = sprintf("%s_cmp.fig", sys_name);
  bnd_file = sprintf("%s_bnd.fig", sys_name);
  head_file = sprintf("%s_head.fig", sys_name);

  warning_f = "WARNING %s \t in fig file but not lbl file  - using\n";
  warning_l = "WARNING %s \t in lbl file but not fig file  - ignoring\n";
  warning_p = "ERROR system ports are not consecutively numbered\n";
  warning_u = "ERROR %s has already appeared in the fig file\n";








|







523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
  sys_name = ARGV[1];
  delete ARGV[1];

  b_file = sprintf("%s_rbg.m", sys_name);
  c_file = sprintf("%s_cmp.m", sys_name);
  fig_file = sprintf("%s_fig.fig", sys_name);
  cmp_file = sprintf("%s_cmp.fig", sys_name);
  bnd_file = sprintf("%s_bnd.fig", sys_name); 
  head_file = sprintf("%s_head.fig", sys_name);

  warning_f = "WARNING %s \t in fig file but not lbl file  - using\n";
  warning_l = "WARNING %s \t in lbl file but not fig file  - ignoring\n";
  warning_p = "ERROR system ports are not consecutively numbered\n";
  warning_u = "ERROR %s has already appeared in the fig file\n";

566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
  i_name = 0;
  i_port_component = 0;

  component_index = 0;
}
{
# Start of .fig file?
  if ( (NF>0) && (match("#FIG", $1) > 0) ) {
    isa_fig_file=1;
  }

  if (isa_fig_file==0) {
    process_lbl()    
      }
  else {
    process_fig()
      }
}







|


<







569
570
571
572
573
574
575
576
577
578

579
580
581
582
583
584
585
  i_name = 0;
  i_port_component = 0;

  component_index = 0;
}
{
# Start of .fig file?
  if ($1=="#FIG") {
    isa_fig_file=1;
  }

  if (isa_fig_file==0) {
    process_lbl()    
      }
  else {
    process_fig()
      }
}

Modified mttroot/mtt/bin/trans/dae2dm_r from [73cd3789ce] to [b03f8606db].

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
# Copyright (c) P.J.Gawthrop, 1991, 1994.

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



## Revision 1.1  1996/08/18 20:03:51  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_dm.r

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

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

in "$1_def.r";
in "$1_dae.r";
in "$1_cr.r";
in "$1_sympar.r";

OFF Echo;
OFF Nat;


%Total number of descriptor variables
MTTN := MTTNx + 2*MTTNz + MTTNyz;







>
>
>

















|







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
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1996/08/25  09:53:35  peter
# Error handling added.
#
## Revision 1.1  1996/08/18 20:03:51  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_dm.r

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

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

in "$1_def.r";
in "$1_dae.r";
in "$1_cr.r";
%%in "$1_sympar.r";

OFF Echo;
OFF Nat;


%Total number of descriptor variables
MTTN := MTTNx + 2*MTTNz + MTTNyz;
239
240
241
242
243
244
245
246






















247
248
249
250
251
252
253
254
255
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO
    BEGIN
      uj := MTTU(j,1);
      MTTD(i,j) := df(MTTY(i,1), uj, 1);
    END;
END;























%Substitute the ss values
in "$1_ss.r";

%Create the output file
OUT "$1_dm.r";

%Write out the matrices.
IF MTTN>0 THEN
BEGIN








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

|







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
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO
    BEGIN
      uj := MTTU(j,1);
      MTTD(i,j) := df(MTTY(i,1), uj, 1);
    END;
END;

%Zap the dz terms (not a nice way)
MTTdz1 := 0;
MTTdz2 := 0;
MTTdz3 := 0;
MTTdz4 := 0;
MTTdz5 := 0;
MTTdz6 := 0;
MTTdz7 := 0;
MTTdz8 := 0;
MTTdz9 := 0;
MTTdz10 := 0;
MTTdz11 := 0;
MTTdz12 := 0;
MTTdz13 := 0;
MTTdz14 := 0;
MTTdz15 := 0;
MTTdz16 := 0;
MTTdz17 := 0;
MTTdz18 := 0;
MTTdz19 := 0;


%Substitute the ss values
in "$1_sspar.r";

%Create the output file
OUT "$1_dm.r";

%Write out the matrices.
IF MTTN>0 THEN
BEGIN


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