Overview
Comment:Added trig and hyperbolic functions to argument exclusion list
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 05dc62892f2abe548ff7ef55857477d086430cf2eae11466239041e2ebb5a2d1
User & Date: gawthrop@users.sourceforge.net on 2001-05-08 15:18:12.000
Other Links: branch diff | manifest | tags
Context
2001-05-09
08:01:39
Now generates the base path (for csh) as the current wd dir check-in: 60dbdc1724 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-05-08
15:18:12
Added trig and hyperbolic functions to argument exclusion list check-in: 05dc62892f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:30:12
Added line to reverse the x^y --> pow(x,y) in default _simp file to
prettyfy LaTeX
check-in: 3c4e19428e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
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.10  2000/01/26 10:11:10  peterg
## Added I component
##
## Revision 1.9  1999/11/10 00:47:08  peterg
## Replaced ifs by a table of cr/arg information
##
## Revision 1.8  1999/11/09 22:32:41  peterg







>
>
>







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.11  2000/09/19 11:14:30  peterg
## Now writes the first component type header correctely
##
## Revision 1.10  2000/01/26 10:11:10  peterg
## Added I component
##
## Revision 1.9  1999/11/10 00:47:08  peterg
## Replaced ifs by a table of cr/arg information
##
## Revision 1.8  1999/11/09 22:32:41  peterg
140
141
142
143
144
145
146


147
148
149
150
151
152
153
    cr["IS"] = "lin";  arg["IS"]  = sprintf("flow,%s;x_0%s", $2, s_arg);

    cr["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", $2, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", $2, s_arg);

    cr["AE"] = "lin";  arg["AE"]  = sprintf("%s%s", $2, s_arg);
    cr["AF"] = "lin";  arg["AF"]  = sprintf("%s%s", $2, s_arg);



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

  ## Component
    print  "\t" $2 "\t" cr[Component] "\t\t" arg[Component];
    OldComponent=Component;







>
>







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
    cr["IS"] = "lin";  arg["IS"]  = sprintf("flow,%s;x_0%s", $2, s_arg);

    cr["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", $2, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", $2, s_arg);

    cr["AE"] = "lin";  arg["AE"]  = sprintf("%s%s", $2, s_arg);
    cr["AF"] = "lin";  arg["AF"]  = sprintf("%s%s", $2, s_arg);

    cr["CDx"] = "lin";  arg["CDx"]  = sprintf("%s%s", $2, s_arg);

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

  ## Component
    print  "\t" $2 "\t" cr[Component] "\t\t" arg[Component];
    OldComponent=Component;
35
36
37
38
39
40
41
42




43
44
45
46
47
48
49
  }
  return matched;
}

BEGIN {
  var = "[%|#][PAR|VAR]";
  not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f sqrt exp log sign none abs";




  arg_line = "arg = ";
}
{
  ## Explicit VAR declarations
  if (match($1,var)>0) print $2 "\t" system_name;

   ## Implicit declarations from the arg list







|
>
>
>
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  }
  return matched;
}

BEGIN {
  var = "[%|#][PAR|VAR]";
  not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f\
		sqrt exp log sign sin asin cos acos tan atan \
		sin asin cos acos tan atan \
		sinh asinh cosh acosh tanh atanh \
                none abs";
  arg_line = "arg = ";
}
{
  ## Explicit VAR declarations
  if (match($1,var)>0) print $2 "\t" system_name;

   ## Implicit declarations from the arg list
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
function figfig(filename,language)
  ## Usage: figfig(filename[,language])
  ## Puts octave figure into fig file (filename.fig)
  ## If second argument, converts to filename.language using fig2dev
  ## eg:
  ##    figfig("foo");
  ##    figfig("foo","eps");
  ##    figfig("foo","pdf");


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



  ## Revision 1.2  2000/12/27 16:06:02  peterg
  ## *** empty log message ***
  ##
  ## Revision 1.1  2000/11/03 10:43:10  peterg
  ## Initial revision
  ###############################################################





  figfilename = sprintf("%s.fig",filename);
  
  eval(sprintf("gset output \"%s\" ",figfilename));

  gset term fig color portrait fontsize 16 size 20 10 metric
  replot;
  gset term x11
  gset output 
  replot;


  ## Add a box - makes a visible bounding box
  fid = fopen(figfilename,"a+");
  fprintf(fid,"2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5\n");
  fprintf(fid,"\t9675 5310 9675 270 225 270 225 5310 9675 5310\n");
  fclose(fid);



  if nargin>1			# Do a ps file
    psfilename = sprintf("%s.%s",filename,language);
    convert = sprintf("fig2dev -L%s %s > %s", language, figfilename, psfilename);
    system(convert);
  endif
  
|
|






>






>
>
>







>
>
>
>










>
|
|
|
|
|
>
>







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
function figfig(filename,language,boxed)
  ## Usage: figfig(filename[,language,boxed])
  ## Puts octave figure into fig file (filename.fig)
  ## If second argument, converts to filename.language using fig2dev
  ## eg:
  ##    figfig("foo");
  ##    figfig("foo","eps");
  ##    figfig("foo","pdf");
  ## Boxed=1 gives a box aroundd the figure

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.3  2001/04/10 12:54:50  gawthrop
  ## Minor fixes for sensitivity versions
  ##
  ## Revision 1.2  2000/12/27 16:06:02  peterg
  ## *** empty log message ***
  ##
  ## Revision 1.1  2000/11/03 10:43:10  peterg
  ## Initial revision
  ###############################################################

  if nargin<3
    boxed=1
  endif
  
  figfilename = sprintf("%s.fig",filename);
  
  eval(sprintf("gset output \"%s\" ",figfilename));

  gset term fig color portrait fontsize 16 size 20 10 metric
  replot;
  gset term x11
  gset output 
  replot;


  if boxed # Add a box - makes a visible bounding box
    fid = fopen(figfilename,"a+");
    fprintf(fid,"2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5\n");
    fprintf(fid,"\t9675 5310 9675 270 225 270 225 5310 9675 5310\n");
    fclose(fid);
  endif
  

  if nargin>1			# Do a ps file
    psfilename = sprintf("%s.%s",filename,language);
    convert = sprintf("fig2dev -L%s %s > %s", language, figfilename, psfilename);
    system(convert);
  endif
  
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


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



##
###############################################################

#Inform user
echo Creating $1_subs.r

cat > $1_subs.r <<EOF
% Default SUBS file
% File $1_subs.r
% Generated by MTT on `date`.

EOF

cat $MTTPATH/trans/m/rcs_header.txt	>> $1_subs.r

cat >> $1_subs.r <<EOF
% Put algebraic substitution commands here

END;
EOF


exit

## NB the following messes up the expansion switch ????







>
>
>

















|







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


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 09:09:52  peterg
## Initial revision
##
##
###############################################################

#Inform user
echo Creating $1_subs.r

cat > $1_subs.r <<EOF
% Default SUBS file
% File $1_subs.r
% Generated by MTT on `date`.

EOF

cat $MTTPATH/trans/m/rcs_header.txt	>> $1_subs.r

cat >> $1_subs.r <<EOF
% Put algebraic substitution commands here
FOR ALL i LET arbint(i) = 0; % Zap arbitary constants
END;
EOF


exit

## NB the following messes up the expansion switch ????
1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16
17
18
19
20
#! /bin/sh

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

# Bourne shell script: strip args
# Strips unwanted bits from a list of arguments
# Label file to symbolic parameters conversion
# Copyright (C) 2000 by Peter J. Gawthrop

## $Id$  ##
## $Log$



## Revision 1.2  2000/10/16 09:06:26  peterg
## Write out the system as a second columns as well
##
## Revision 1.1  2000/10/16 09:04:04  peterg
## Initial revision
## ##
# Inform user













>
>
>







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: strip args
# Strips unwanted bits from a list of arguments
# Label file to symbolic parameters conversion
# Copyright (C) 2000 by Peter J. Gawthrop

## $Id$  ##
## $Log$
## Revision 1.3  2000/10/17 12:33:13  peterg
## Added mtt_mod to the zapped list
##
## Revision 1.2  2000/10/16 09:06:26  peterg
## Write out the system as a second columns as well
##
## Revision 1.1  2000/10/16 09:04:04  peterg
## Initial revision
## ##
# Inform user
41
42
43
44
45
46
47
48
49




50
51
52
53
54
55
56
      break;
    }
  }
  return matched;
}

BEGIN {
  not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f mtt_mod sqrt exp log sign none abs";




}
{
    args=$1
    sys=$2
    N=split(args, arg, ",");
    for (i=1;i<=N;i++){
      if ( (length(arg[i])>0)&&(matches(not_an_arg,arg[i])==0)&&(match(arg[i],"^[0-9]+[.]*")==0) ){







|
|
>
>
>
>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
      break;
    }
  }
  return matched;
}

BEGIN {
 not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f\
		sqrt exp log sign sin asin cos acos tan atan \
		sin asin cos acos tan atan \
		sinh asinh cosh acosh tanh atanh \
                none abs";
}
{
    args=$1
    sys=$2
    N=split(args, arg, ",");
    for (i=1;i<=N;i++){
      if ( (length(arg[i])>0)&&(matches(not_an_arg,arg[i])==0)&&(match(arg[i],"^[0-9]+[.]*")==0) ){
10
11
12
13
14
15
16





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

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





## Revision 1.6  2001/02/03 13:40:45  gawthrop
## Added explicit MTTNu
##
## Revision 1.5  2000/12/28 12:39:02  peterg
## Put under RCS
##
## Revision 1.4  2000/09/04 08:42:53  peterg







>
>
>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2001/04/11 09:44:26  gawthrop
## Fixed cc and c problems to do with pow(x,y) and integers
## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
## -c, -cc and -oct options
##
## Revision 1.6  2001/02/03 13:40:45  gawthrop
## Added explicit MTTNu
##
## Revision 1.5  2000/12/28 12:39:02  peterg
## Put under RCS
##
## Revision 1.4  2000/09/04 08:42:53  peterg
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

# Remove the old log file
rm -f $logname

# Use symbolic algebra to accomplish the transformation
$SYMBOLIC >$logname  << EOF

% Fix c code if required
$include

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

% CRs
in "$crname";

% Raw dae
in "$rdaename";

% Substitution
in "$subsname";





OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";








<
<
<











>
>
>
>







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

# Remove the old log file
rm -f $logname

# Use symbolic algebra to accomplish the transformation
$SYMBOLIC >$logname  << EOF




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

% CRs
in "$crname";

% Raw dae
in "$rdaename";

% Substitution
in "$subsname";

% Fix c code if required
$include


OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";


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