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
55
56
57
58
59
60
|
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
55
56
57
58
59
60
|
-
+
-
+
-
+
-
+
-
+
|
# Tell user
Sys=$1
lang=$2
date=`date`
outfile=$1_input.$2
Nu=`mtt_getsize $Sys u` # Inputs
Nu=`mtt_getsize ${Sys} u` # Inputs
echo "Creating $outfile for standard input"
## Pascal code
make_p()
{
cat <<EOF > $outfile
PROCEDURE $Sys_input(VAR mttu : InputVector;
PROCEDURE ${Sys}_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{$Sys_input}
BEGIN{${Sys}_input}
{Zap comments}
IF (input^ = chr("#")) THEN
BEGIN
readln;
WHILE (input^ = chr("#")) DO readln;
END;
read(t); { Read, and discard, first column (time) }
FOR mtti:=1 TO $Nu DO {Read the inputs}
read(mttu[mtti]);
readln; {Next line}
END{$Sys_input};
END{${Sys}_input};
EOF
}
make_m() {
mtt_header $Sys input m stdin > $outfile
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
|