Overview
Comment:Updated to use new eqaution.m
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0fbf0a2c4e08df836362ad9b67747af0826b59e0c634e6e945633ab2b7f37cb9
User & Date: gawthrop@users.sourceforge.net on 1996-09-12 19:30:31.000
Other Links: branch diff | manifest | tags
Context
1996-09-13
17:54:08
Now writes default $PARAMS to $1_args.m - $1_ode may use it. check-in: 5531519ddd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1996-09-12
19:30:31
Updated to use new eqaution.m check-in: 0fbf0a2c4e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
19:29:35
Use new equation method. check-in: 4bef7dcb4f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
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
61













62













63
64
65
66
67
68
69
70
71
72
73
74
%    structure,eqnfile);

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



% %% Revision 1.1  1996/08/30 16:38:25  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.

if check_bonds(bonds,2,'FMR')==0
  return
end


% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);


if f_2 == -1 				% Standard with modulation
  if f_1 == 1 				% Flow out
    op = '*';
  else                                  % Effort out
    op = '/';
  end;
  
  fprintf(eqnfile, '%s := %s%s%s;\n', ...
      varname(name,bond_number(1), -e_1), ...
      varname(name,bond_number(1), e_1), ...
      op, ...
      varname(name,bond_number(2), -1));
else 					% Deduce modulation
  
   fprintf(eqnfile, '%s := %s/%s;\n', ...
      varname(name,bond_number(2), -1), ...
      varname(name,bond_number(1), -1), ...
      varname(name,bond_number(1), 1));
end;



























% Effort on port 2 is always zero
   fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(2), 1));

 
      


 










>
>
>














>
|










>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
|
|










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
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
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/08/30 18:35:43  peter
% %% New name argument added.
% %%
% %% Revision 1.1  1996/08/30 16:38:25  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'FMR')==0
  return
end


% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

if length(cr)==0  % Then do default unity CR
  if f_2 == -1 				% Standard with modulation
    if f_1 == 1 			% Flow out
      op = '*';
    else                                % Effort out
      op = '/';
    end;
    
    fprintf(eqnfile, '%s := %s%s%s;\n', ...
	varname(name,bond_number(1), -e_1), ...
	varname(name,bond_number(1), e_1), ...
	op, ...
	varname(name,bond_number(2), -1));
  else 					% Deduce modulation
    
    fprintf(eqnfile, '%s := %s/%s;\n', ...
	varname(name,bond_number(2), -1), ...
	varname(name,bond_number(1), -1), ...
	varname(name,bond_number(1), 1));
  end;
else  % write the full works
  if f_2 == -1 				% Standard with modulation
    outport = 1;
    outnumber = bond_number(1);
    if f_1 == 1 			% Flow out
      outcause = -1;
    else                                % Effort out
      outcause = 1;
    end;    
    incause = [-outcause; -1]; % Flow input on port 2
    eqn =  equation(name,cr,args,outnumber,outcause,outport, ...
                               bond_number,incause,1:ports);
    fprintf(eqnfile, '%s',eqn);

  else % Modulation is output
    outport = 2;
    outcause = -1;
    outnumber = bond_number(2);
    innumber = bond_number(1)*[1;1];    
    incause = [1; -1]; % Effort and flow on port 1
    inports = [1; 1];
    eqn =  equation(name,cr,args,outnumber,outcause,outport, ...
                               innumber,incause,inports);
    fprintf(eqnfile, '%s',eqn);
  end;
end;

  % Effort on port 2 is always zero
  fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(2), 1));

 
      


 




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