Overview
Comment:MTT is now much more sophisticated in generating lbl files
Labels can contain maths
Repetative components are now broken
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d1d56ab81ce4a5d8494680e33ee433e0dc17ededd5039c8eedf706764c96c98b
User & Date: gawthrop@users.sourceforge.net on 2001-06-11 19:43:50
Other Links: branch diff | manifest | tags
Context
2001-06-11
19:46:17
New script for making simulation m file _sim.m check-in: f0fe3c35f3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
19:43:50
MTT is now much more sophisticated in generating lbl files
Labels can contain maths
Repetative components are now broken
check-in: d1d56ab81c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:53:49
Now uses abg2sympar_m2txt to get the arguments check-in: afb7ce9dfc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [7d4b078005] to [ab3d0cb1b4].

12
13
14
15
16
17
18






19
20
21
22
23
24
25
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$






## Revision 1.310  2001/05/08 08:30:12  gawthrop
## Added line to reverse the x^y --> pow(x,y) in default  _simp file to
## prettyfy LaTeX
##
## Revision 1.309  2001/04/28 03:15:03  geraint
## Fixed comment (interfered with "mtt help representations").
##







>
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.311  2001/05/26 18:36:43  gawthrop
## Further modifications. Now works on rcPPP
##  -- next jobs:
##     add identification to ppp_nlin_sim
##     create real-time ppp_nlin_run
##
## Revision 1.310  2001/05/08 08:30:12  gawthrop
## Added line to reverse the x^y --> pow(x,y) in default  _simp file to
## prettyfy LaTeX
##
## Revision 1.309  2001/04/28 03:15:03  geraint
## Fixed comment (interfered with "mtt help representations").
##
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
#Create skeleton files (with titles) if not already there
#SUMMARY lbl*	label file (txt)
#SUMMARY lbl	label file (txt)
#SUMMARY lbl*	label file (view)
#SUMMARY lbl	label file (view)
#SUMMARY lbl*	label file (tex)
#SUMMARY lbl	label file (tex)
$1_lbl.txt:
	abg2lbl_fig2txt $1 $sensitivity

$1_lbl.tex: $1_lbl.txt
	lbl_txt2tex $1

#SUMMARY alias  name aliases for each subsystem (txt)
$1_alias.txt: $1_lbl.txt







|







1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
#Create skeleton files (with titles) if not already there
#SUMMARY lbl*	label file (txt)
#SUMMARY lbl	label file (txt)
#SUMMARY lbl*	label file (view)
#SUMMARY lbl	label file (view)
#SUMMARY lbl*	label file (tex)
#SUMMARY lbl	label file (tex)
$1_lbl.txt: $1_abg.fig
	abg2lbl_fig2txt $1 $sensitivity

$1_lbl.tex: $1_lbl.txt
	lbl_txt2tex $1

#SUMMARY alias  name aliases for each subsystem (txt)
$1_alias.txt: $1_lbl.txt
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315

2316
2317




2318
2319
2320
2321
2322
2323
2324
else
$1_rep.txt:
	makerep_txt $1;
endif

#SUMMARY rbg	raw bond graph (m)
#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig $1_lbl.txt
	lbl2component $1 | sh || exit 1 # Grab specified components now
	rbg_fig2m $1
$1_cmp.m: $1_rbg.m
$1_fig.fig: $1_rbg.m

#SUMMARY sabg	stripped acausal bond graph (fig)
#SUMMARY sabg	stripped acausal bond graph (ps)
#SUMMARY sabg	stripped acausal bond graph (view)
$1_sabg.fig: $1_rbg.m


#Subsystem creation commands
#SUMMARY sub Executable subsystem list (sh)

$1_sub.sh: $1_abg.m
	abg2sub_m2sh $1





#SUMMARY sub LaTeX subsystem list (tex)
#SUMMARY sub subsystem list (ps)
#SUMMARY sub subsystem list (view)
$1_sub.tex: $1_sub.sh
ifeq ($documenttype,section)
	sub_sh2tex $1







|













>


>
>
>
>







2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
else
$1_rep.txt:
	makerep_txt $1;
endif

#SUMMARY rbg	raw bond graph (m)
#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig  $1_lbl.txt
	lbl2component $1 | sh || exit 1 # Grab specified components now
	rbg_fig2m $1
$1_cmp.m: $1_rbg.m
$1_fig.fig: $1_rbg.m

#SUMMARY sabg	stripped acausal bond graph (fig)
#SUMMARY sabg	stripped acausal bond graph (ps)
#SUMMARY sabg	stripped acausal bond graph (view)
$1_sabg.fig: $1_rbg.m


#Subsystem creation commands
#SUMMARY sub Executable subsystem list (sh)
ifeq ($start_at_abg,yes)
$1_sub.sh: $1_abg.m
	abg2sub_m2sh $1
else
$1_sub.sh: $1_abg.fig
	abg2sub_fig2sh $1
endif

#SUMMARY sub LaTeX subsystem list (tex)
#SUMMARY sub subsystem list (ps)
#SUMMARY sub subsystem list (view)
$1_sub.tex: $1_sub.sh
ifeq ($documenttype,section)
	sub_sh2tex $1

Modified mttroot/mtt/bin/trans/abg2lbl_fig2txt from [c8cd5a2aaa] to [9dabba8c1b].

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.14  2001/06/11 15:06:58  gawthrop
## Now handles user-defined components
##
## Revision 1.13  2001/06/04 08:13:37  gawthrop
## Various changes to support PPP
##
## Revision 1.12  2001/05/08 15:18:10  gawthrop







>
>
>







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.15  2001/06/11 16:53:49  gawthrop
## Now uses abg2sympar_m2txt to get the arguments
##
## Revision 1.14  2001/06/11 15:06:58  gawthrop
## Now handles user-defined components
##
## Revision 1.13  2001/06/04 08:13:37  gawthrop
## Various changes to support PPP
##
## Revision 1.12  2001/05/08 15:18:10  gawthrop
73
74
75
76
77
78
79
80



81






82

83
84
85
86
87
88
89
# Remove the old log file
rm -f abg2lbl_fig2txt.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
rm -f mtt_junk*

#Inform user












if [ -n "$sensitivity" ]; then
    echo "Creating $1_lbl.txt (sensitivity version)"
else
    echo "Creating $1_lbl.txt"
fi

	( \







|
>
>
>

>
>
>
>
>
>

>







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
# Remove the old log file
rm -f abg2lbl_fig2txt.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
rm -f mtt_junk*


## Create lbl files beneath this one
mtt -q -u -l 1 $1 sub sh # Create the list
sh $1_sub.sh "abg2lbl_fig2txt "

if [ -f "$1_lbl.txt" ]; then
  ##echo "$1_lbl.txt exists in `pwd` - no action taken"
  exit
##else 
  ##echo "$1_lbl.txt dosn not exist in `pwd` "
fi

#Inform user
if [ -n "$sensitivity" ]; then
    echo "Creating $1_lbl.txt (sensitivity version)"
else
    echo "Creating $1_lbl.txt"
fi

	( \
118
119
120
121
122
123
124


125
126
127
128
129
130
131
132
awk --field-separator ':' '
 BEGIN {
    OldComponent="None";
 }
 { 
  Component = $1;
  Name = $2;


  
##Aliases
  if (Component == "SS") {
    port_alias[++j] = Name;
  }
  else {
    alias[++i] = Name;
    if (length(sensitivity)>0) {







>
>
|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
awk --field-separator ':' '
 BEGIN {
    OldComponent="None";
 }
 { 
  Component = $1;
  Name = $2;
  name = Name;
  gsub(/[()-+*/]/,"",name); # Remove maths

##Aliases
  if (Component == "SS") {
    port_alias[++j] = Name;
  }
  else {
    alias[++i] = Name;
    if (length(sensitivity)>0) {
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    cr["RS"] = lin;  arg["RS"]  = sprintf("flow,%s%s", Name, s_arg);


  ## Heading
  if (Component !~ OldComponent) print "\n% Component type", Component

  ## Component
    printf("\t%s\t", Name);
    if (Component in cr)
      printf("%s\t\t", cr[Component])
    else 
      printf("none\t\t");

   if (Component in arg)
      printf("%s\t\t\n", arg[Component])







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
    cr["RS"] = lin;  arg["RS"]  = sprintf("flow,%s%s", Name, s_arg);


  ## Heading
  if (Component !~ OldComponent) print "\n% Component type", Component

  ## Component
    printf("\t%s\t", name);
    if (Component in cr)
      printf("%s\t\t", cr[Component])
    else 
      printf("none\t\t");

   if (Component in arg)
      printf("%s\t\t\n", arg[Component])

Modified mttroot/mtt/bin/trans/awk/rbg_fig2m.awk from [5b3d4236fa] to [783f4be4b3].

8
9
10
11
12
13
14



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

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



## Revision 1.38  2001/03/23 14:57:31  gawthrop
## Now puts space after header fields + writes _port.fig
##
## Revision 1.37  2000/09/14 08:43:32  peterg
## Add additional directional informatiuon to rbonds:
## 	cols 7-8 Arrow end directional bond
## 	cols 9-10 Arrow end directional bond







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.39  2001/05/09 08:50:02  gawthrop
## Uses _art.fig to transmit the art work to the cbg.fig rep.
##
## Revision 1.38  2001/03/23 14:57:31  gawthrop
## Now puts space after header fields + writes _port.fig
##
## Revision 1.37  2000/09/14 08:43:32  peterg
## Add additional directional informatiuon to rbonds:
## 	cols 7-8 Arrow end directional bond
## 	cols 9-10 Arrow end directional bond
238
239
240
241
242
243
244

245
246
247
248
249
250
251
# note that there may be more than one component per label
  if ((match($1,comment_regexp)==0)&&(NF>0))
    { 
      i_label++;
      name = $1;
      CR   = $2;
      args = $3;

      label[i_label,1] = name; 
      label[i_label,2] = CR;
      label[i_label,3] = args;
	}
}

function fig_info() {







>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# note that there may be more than one component per label
  if ((match($1,comment_regexp)==0)&&(NF>0))
    { 
      i_label++;
      name = $1;
      CR   = $2;
      args = $3;

      label[i_label,1] = name; 
      label[i_label,2] = CR;
      label[i_label,3] = args;
	}
}

function fig_info() {
264
265
266
267
268
269
270



271
272
273
274
275
276
277

# The depth is field 4 (for strings)
  depth = modulo10($4);

# It is terminated by \001 - so delete this termination
  str = substr(str,1,length(str)-4);




# A component string contains only alphanumeric  _ and :
  isa_plain_component = match(str, component_regexp)==0;
# It must also be specified at depth 0 (modulo 10)
  isa_plain_component = isa_plain_component && (depth==0);

# A port is a string within []
  isa_port = (match(str, port_regexp)>0)







>
>
>







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284

# The depth is field 4 (for strings)
  depth = modulo10($4);

# It is terminated by \001 - so delete this termination
  str = substr(str,1,length(str)-4);

# Zap maths
  gsub(/[()-+*/]/,"",str); 

# A component string contains only alphanumeric  _ and :
  isa_plain_component = match(str, component_regexp)==0;
# It must also be specified at depth 0 (modulo 10)
  isa_plain_component = isa_plain_component && (depth==0);

# A port is a string within []
  isa_port = (match(str, port_regexp)>0)
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    if (named_component) {
      split(str,a,delimiter);
      type = a[1];
      name = a[2];
# Check  if name is in label file and if used already
      found = 0; name_used = 0;
      for (i=1; i<=i_label; i++) {
	lname = label[i,1];
	if ( lname==name ) {
	  found = 1;
	  if (name in used) {
	    name_used = 1;
	    CR = label[i,2];
	    args = label[i,3];
	  }







|







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
    if (named_component) {
      split(str,a,delimiter);
      type = a[1];
      name = a[2];
# Check  if name is in label file and if used already
      found = 0; name_used = 0;
      for (i=1; i<=i_label; i++) {
	  lname = label[i,1];
	if ( lname==name ) {
	  found = 1;
	  if (name in used) {
	    name_used = 1;
	    CR = label[i,2];
	    args = label[i,3];
	  }

Modified mttroot/mtt/bin/trans/latex_tidy from [e0750229d8] to [75212ba689].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1990, 1994

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



## Revision 1.16  2000/10/10 21:03:20  peterg
## *** empty log message ***
##
## Revision 1.15  1998/04/07 08:44:11  peterg
## zapped eta - it messes up theta
##
## Revision 1.14  1998/02/25 22:12:07  peterg







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  2000/12/28 12:31:15  peterg
## *** empty log message ***
##
## Revision 1.16  2000/10/10 21:03:20  peterg
## *** empty log message ***
##
## Revision 1.15  1998/04/07 08:44:11  peterg
## zapped eta - it messes up theta
##
## Revision 1.14  1998/02/25 22:12:07  peterg
122
123
124
125
126
127
128

129
130
131
132
133
134
135
    -e "s/theta/\\\theta/g" \
    -e "s/tau/\\\tau/g" \
    -e "s/alpha/\\\alpha/g" \
    -e "s/beta/\\\beta/g" \
    -e "s/gamma/\\\gamma/g" \
    -e "s/delta/\\\delta/g" \
    -e "s/epsilon/\\\epsilon/g" \

    -e "s/kappa/\\\kappa/g" \
    -e "s/lambd/\\lambda/g" \
    -e "s/lambda/\\\lambda/g" \
    -e "s/mu/\\\mu/g" \
    -e "s/phi/\\\phi/g" \
    -e "s/pi/\\\pi/g" \
    -e "s/rho/\\\rho/g" \







>







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
    -e "s/theta/\\\theta/g" \
    -e "s/tau/\\\tau/g" \
    -e "s/alpha/\\\alpha/g" \
    -e "s/beta/\\\beta/g" \
    -e "s/gamma/\\\gamma/g" \
    -e "s/delta/\\\delta/g" \
    -e "s/epsilon/\\\epsilon/g" \
    -e "s/eta/\\\eta/g" \
    -e "s/kappa/\\\kappa/g" \
    -e "s/lambd/\\lambda/g" \
    -e "s/lambda/\\\lambda/g" \
    -e "s/mu/\\\mu/g" \
    -e "s/phi/\\\phi/g" \
    -e "s/pi/\\\pi/g" \
    -e "s/rho/\\\rho/g" \


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