Overview
Comment:Includes fix_c.r in ese2rdae and def2write_r to eliminate occurrances of x**y.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 7c60b4e8bede7547f272a5a94dca34b782ae5f2b03744e9e69212d0677b07b58
User & Date: geraint@users.sourceforge.net on 2002-06-28 10:13:40
Other Links: branch diff | manifest | tags
Context
2002-06-28
15:35:47
Commented out aej.r generation (not used yet). check-in: c8e99b135f user: geraint@users.sourceforge.net tags: origin/master, trunk
10:13:40
Includes fix_c.r in ese2rdae and def2write_r to eliminate occurrances of x**y. check-in: 7c60b4e8be user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-06-21
20:02:34
New identification representation check-in: a66095af7e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [81bcd286f8] to [90dfcccb37].

13
14
15
16
17
18
19



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







+
+
+







# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.356  2002/06/17 13:14:50  geraint
## Fixed some rules to reduce number of implicit rule searches.
##
## Revision 1.355  2002/06/10 23:18:44  geraint
## Adjusted cr.h comment delimiters to be C compliant.
##
## Revision 1.354  2002/06/10 10:43:19  gawthrop
## ode2odes now prerequisite for sim.m and ssim.m
##
## Revision 1.353  2002/05/28 18:08:38  geraint
2714
2715
2716
2717
2718
2719
2720
2721

2722
2723
2724
2725
2726
2727
2728
2717
2718
2719
2720
2721
2722
2723

2724
2725
2726
2727
2728
2729
2730
2731







-
+








${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} rdae r
endif
	mtt_prepend.sh -p $1_modpar.r $1_ese.r # Add modulated parameters to start
	ese2rdae_r ${cr_first} ${Subsystem}; tidy ${Subsystem}_rdae.r
	ese2rdae_r ${cr_first} ${fixcc} ${Subsystem}; tidy ${Subsystem}_rdae.r

${sys}_dae.r: ${Subsystem}_rdae.r ${Subsystem}_def.r ${Subsystem}_subs.r ${Subsystem}_cr.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} dae r
endif
ifeq ($rdae_is_dae,1)

Modified mttroot/mtt/bin/trans/dae2cse_r from [e055f9ba28] to [19f9b6274c].

11
12
13
14
15
16
17




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







+
+
+
+







# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.20  2002/04/28 18:41:26  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.19  2001/10/26 01:01:49  geraint
## fixcc when rdae_is_dae (-cr).
##
## Revision 1.18  2001/10/05 23:37:32  geraint
## Fixed assignment statement in ae.r when RHS=0.
##
## Revision 1.17  2001/07/27 23:29:10  geraint
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
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







+
-
+












-
-
-
+
+
+







optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
        -A )
                solve=1
		solve_msg=' with explicit solution of algebraic equations' ;;
	-fixcc )
		fixcc='-fixcc'
                fixcc=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
                include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
                fix_msg='fixing c and cc code';
		;;
	-optimise)
	    optimise='-optimise'
	    optimise_msg=' with optimisation' ;;
        *)
                echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Create the reduce output code
def2write_r $optimise $1 cse 
def2write_r $optimise $1 csex # Version without E matrix
def2write_r $optimise $1 cseo
def2write_r $optimise $fixcc $1 cse 
def2write_r $optimise $fixcc $1 csex # Version without E matrix
def2write_r $optimise $fixcc $1 cseo

echo "Creating $1_cse.r $solve_msg $optimise_msg $fix_msg"
echo "Creating $1_csex.r $optimise_msg"
echo "Creating $1_cseo.r $optimise_msg"

# Remove the old log file
rm -f dae2cse_r.log
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169







-
+







in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;
OFF Nat;
ON NERO;

%Fix c code if required
$fixcc
$include

in "$1_def.r";
MTTdxs := MTTdX;  %Save the symbolic form of dX

in "$1_subs.r";
in "$1_dae.r";

Modified mttroot/mtt/bin/trans/def2write_r from [10c4312f8d] to [24c886d294].

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







+
+
+







# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  2002/05/17 09:14:58  geraint
## Optimises each line in a separate session. Allows larger models to be built.
##
## Revision 1.10  2002/04/28 18:41:27  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.9  2001/07/27 23:29:10  geraint
## Optimises only when requested (-opt).
##
55
56
57
58
59
60
61


62
63
64
65
66
67
68
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73







+
+








optimise=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-optimise)
	    opt='-optimise'
	    optimise_msg=' with optimisation' ;;
	-fixcc )
	    include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'` ;;
	*)
	    echo "$1 is an invalid argument - ignoring" ;;
    esac
    shift
done

sys=$1 # System name
159
160
161
162
163
164
165

166
167
168
169
170
171
172
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178







+







off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$
$include

out "$tmp2"$
EOF
    } > $tmp
    
    echo "optimize" >> $tmp
    grep -i -e "^$lhs" $dae |\

Modified mttroot/mtt/bin/trans/ese2rdae_r from [713fa3d927] to [3c6373acf2].

10
11
12
13
14
15
16
















17
18
19
20
21
22
23
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







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







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12.2.2  2002/06/05 17:28:00  geraint
## Cosmetic change.
##
## Revision 1.12.2.1  2002/06/05 11:14:51  geraint
## ae.r now generated using def2write_r like cse?.r
## fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r.
##
## These changes produce the desired result (optimised algebraic equations) but
## have highlighted a problem; when optimisation fails, Reduce does not write
## a result. For complicated systems, this can lead to missing assignments in
## the resultant code.
##
## Revision 1.12  2001/07/23 23:31:17  gawthrop
## Added -cr option to load CRs first - avoids alg. loops with R
## implementation of mutiports.
##
## Revision 1.11  2001/07/06 00:46:50  gawthrop
## Added -cr option -- forces cr to be loaded before the ese.r file
## This avoids causality problems when using multi-port Rs to represent
## arbitary equations
##
## Revision 1.10  2000/11/30 15:23:16  peterg
## Taken out all subsystem stuff - now done in mtt using
96
97
98
99
100
101
102




103
104
105
106
107
108
109
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129







+
+
+
+







  case $1 in
	-I )
                info=info;;
	-cr )
                load_cr=yes;
                blurb2=' using cr and subs first';
                ;;
      -fixcc )
		include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
		blurb3='fixing c and cc code';
		;;
	-partition )
                partition=yes;
                blurb='with partitioning';
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
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
162
163
164
165
152
153
154
155
156
157
158

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188







-
+



















+
+
+








if [ -n "${load_cr}" ]; then
    load_cr_comm="in \"${crname}\";"
    load_subs_comm="in \"${subsname}\";"
fi

# Inform user
echo Creating $daename $blurb $blurb2
echo Creating $daename $blurb $blurb2 $blurb3

# Remove the old log file
rm -f $logname

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

%Read in the cr and sub when  -cr is set
$load_cr_comm
$load_subs_comm

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

% Definitions
in "$defname";

% Elementary system equations
in "$esename";

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