Overview
Comment:Included zero outputs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: a580330cb619fc86099443ed2c302803e4a52198c93839213fc5155e08defdf6
User & Date: gawthrop@users.sourceforge.net on 1996-08-18 20:06:21.000
Other Links: branch diff | manifest | tags
Context
1996-08-18
20:06:57
Initial revision check-in: 55104b9c7d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:06:21
Included zero outputs. check-in: a580330cb6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:02:21
Include zero outputs. check-in: 0b255bec4b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
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

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



## Revision 1.1  1996/08/08 15:57:15  peter
## Initial revision
##
###############################################################

infofile='stdout';
eqnfile="$1_ese.r";
deffile="$1_def.r";

# Remove the old log file
rm -f cbg2ese_m.log
rm -f $1_ese.r
rm -f $1_def.r
rm -f mtt_info.txt



#Inform user
echo Creating $eqnfile
echo Creating $1_def.r

# Use matrix manipulation to accomplish the transformation
$MATRIX > cbg2ese_m2r.log 2>> cbg2ese_m2r.log << EOF

infofile = '$infofile'
system_name = '$1'
deffile = '$1_def.r';

structure = cbg2ese(system_name,'','',infofile)
makedef(structure,deffile);
  

EOF












>
>
>





|


>




|

>















<


|



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

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.2  1996/08/08 18:08:37  peter
## Sorted out file naming scheme.
##
## Revision 1.1  1996/08/08 15:57:15  peter
## Initial revision
##
###############################################################

infofile='mtt_info.txt';
eqnfile="$1_ese.r";
deffile="$1_def.r";

# Remove the old log file
rm -f cbg2ese_m.log
rm -f $1_ese.r
rm -f $1_def.r
rm -f $infofile

touch $infofile

#Inform user
echo Creating $eqnfile
echo Creating $1_def.r

# Use matrix manipulation to accomplish the transformation
$MATRIX > cbg2ese_m2r.log 2>> cbg2ese_m2r.log << EOF

infofile = '$infofile'
system_name = '$1'
deffile = '$1_def.r';

structure = cbg2ese(system_name,'','',infofile)
makedef(structure,deffile);
  

EOF

cat $infofile



1
2
3
4
5
6
7
8



9
10
11
12
13
14
15
function structure =  SS_eqn(bond_number,bonds,direction,cr,args, ...
                            structure,filenum);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.2  1996/08/08 16:38:19  peter
% %% Changed to filenumer type of fprintf
% %%
% %% Revision 1.1  1996/08/08 16:19:08  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%








>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function structure =  SS_eqn(bond_number,bonds,direction,cr,args, ...
                            structure,filenum);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/09 14:08:04  peter
% %% Empty effort and flow attributes replaced by 'external'.
% %%
% %% Revision 1.2  1996/08/08 16:38:19  peter
% %% Changed to filenumer type of fprintf
% %%
% %% Revision 1.1  1996/08/08 16:19:08  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
︙︙
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
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

if length(flow_attribute)==0
  flow_attribute = 'external';
end;

inputs = structure(3);
outputs = structure(4);


% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', ...
        varname(bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', ...
        outputs, varname(bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else % named constant
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s;\n', ...
        varname(bond_number,1), effort_attribute);
  else % Sensor
  % THIS STILL NEEDS DOING!
  mtt_info('Constant outputs not implemented yet!');







  end;
end;

% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', varname(bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', outputs, ...
        varname(bond_number,-1));
  end;
elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(bond_number,-1), flow_attribute);
  else % Sensor
  % THIS STILL NEEDS DOING!
  mtt_info('Zero outputs not implemented yet!');








  end;
end;

  
structure(3) = inputs;
structure(4) = outputs;
  

  
  













>

















|

|
|
>
>
>
>
>
>
>




















<
|
>
>
>
>
>
>
>
>






|









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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114

if length(flow_attribute)==0
  flow_attribute = 'external';
end;

inputs = structure(3);
outputs = structure(4);
zero_outputs = structure(5);

% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', ...
        varname(bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', ...
        outputs, varname(bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else % named constant
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(bond_number,1), effort_attribute);
  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%1.0f := %s;\n', ...
	  zero_outputs, varname(bond_number,1));
      fprintf(filenum, '%s := MTTUi%1.0f;\n', ...
	  varname(bond_number,-1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output ']);
    end;
  end;
end;

% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', varname(bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', outputs, ...
        varname(bond_number,-1));
  end;
elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(bond_number,-1), flow_attribute);
  else % Sensor

    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%1.0f := %s;\n', ...
	  zero_outputs, varname(bond_number,-1));
      fprintf(filenum, '%s := MTTUi%1.0f;\n', ...
	  varname(bond_number,1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output ']);
    end;
  end;
end;

  
structure(3) = inputs;
structure(4) = outputs;
structure(5) = zero_outputs;  

  
  







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