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
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
## $Id$
# Copyright (C) 1999 by Peter J. Gawthrop
# Tell user
Sys=$1
lang=$2
date=`date`
Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'`
echo "Creating $1_input.$2 for standard input"
cat <<EOF > $1_input.$2
PROCEDURE $1_input(VAR mttu : InputVector;
mttt : REAL;
mttx : StateVector;
mtty : OutputVector);
{Created by MTT on $date for standard input to simulation}
VAR t : REAL; Start:BOOLEAN;
BEGIN{$1_input}
{Zap comments}
|
|
>
|
>
|
>
>
>
|
<
|
>
>
|
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
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
## $Id$
# Copyright (C) 1999,2000 by Peter J. Gawthrop
# Tell user
Sys=$1
lang=$2
date=`date`
outfile=$1_input.$2
Nu=`mtt_getsize $Sys u` # Inputs
echo "Creating $outfile for standard input"
## Pascal code
make_p()
{
cat <<EOF > $outfile
PROCEDURE $1_input(VAR mttu : InputVector;
mttx : StateVector;
mtty : OutputVector;
mttt : REAL;
par : ParameterVector);
{Created by MTT on $date for standard input to simulation}
VAR t : REAL; Start:BOOLEAN;
BEGIN{$1_input}
{Zap comments}
|
37
38
39
40
41
42
43
|
FOR mtti:=1 TO $Nu DO {Read the inputs}
read(mttu[mtti]);
readln; {Next line}
END{$1_input};
EOF
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
|
FOR mtti:=1 TO $Nu DO {Read the inputs}
read(mttu[mtti]);
readln; {Next line}
END{$1_input};
EOF
}
make_m() {
mtt_header $Sys input m stdin > $outfile
cat >> $outfile <<EOF
## The "standard input"
global MTT_input MTT_input_index MTT_input_last
MTT_input_index = min(++MTT_input_index,MTT_input_last);
mttu = MTT_input(MTT_input_index,:);
## END Code
endfunction
EOF
}
make_cc() {
cat > $outfile <<EOF
#include "${Sys}_def.h"
DEFUN_DLD (sidRC_input, args, ,
"Usage: [mttu] = sidRC_input(mttx,mtty,mttt,mttpar)
Octave input representation of system sidRC");
{
static ColumnVector u (MTTNU);
static Matrix mtt_input;
octave_value_list retval;
mtt_input = octave_value (get_global_value ("MTT_input"));
retval (0) = octave_value (mtt_input);
return (retval);
}
EOF
}
case $lang in
p)
make_p
;;
m)
make_m
;;
cc)
make_cc
;;
*)
echo language $lang not supported - sorry
esac
|