Overview
Comment:Default now out side this function - need to be none for each
component.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 635243c46913ba01407a9150c24fa06a00825bcd1c6cdf8db328689c02abd3ae
User & Date: gawthrop@users.sourceforge.net on 1996-09-12 16:42:01
Other Links: branch diff | manifest | tags
Context
1996-09-12
17:18:44
Don't add an RCS header .. check-in: 804f3fd797 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:42:01
Default now out side this function - need to be none for each
component.
check-in: 635243c469 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:40:45
Now does a default (when no constitutive relationship) with a unit
constitutive relationship on each port.
check-in: 5878a5ebb6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/equation.m from [a0a9f54678] to [b4ad922159].

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
function eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                              inbonds,incauses,inports)
% eqn is a string containing the equation
% 
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  printcr
% printcr(name,outport,bond_number,cr,args,RHS_cause,eqnfile



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





% %% Revision 1.2  1996/09/10 11:29:47  peter
% %% Removed causality & port info when no constitutive relationship.
% %%
% %% Revision 1.1  1996/09/10 11:11:11  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%









|
|
>







>
>
>
>
>







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
function eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                              inbonds,incauses,inports)
% eqn is a string containing the equation
% 
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function equations.m
% eqn =  equation(name,cr,args,outbond,outcause,outport, ...
%                              inbonds,incauses,inports)


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/09/12 12:03:58  peter
% %% Added some error checking.
% %% If no constitutive relationship, only add diagonal elementts to
% %% default unity output.
% %%
% %% Revision 1.2  1996/09/10 11:29:47  peter
% %% Removed causality & port info when no constitutive relationship.
% %%
% %% Revision 1.1  1996/09/10 11:11:11  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
RHS1 = sprintf('%s%s%s%s%s%s%s%s\n', ...
    cr, lp, args, a_comma, cause_name, c_comma, port_name, c_comma);


% Set up rest of RHS - the input variables, causality and ports.
RHS2 = '';
for i=1:nports
  if (length(cr)>0) | (i == outport) % only do diag terms if no cr
    RHS2 = sprintf('%s\t%s', ...
	RHS2, varname(name, inbonds(i), incauses(i)))
  
    if length(cr)>0 % add the causality & port info
      RHS2 = sprintf('%s,%s,%1.0f', ...
	  RHS2, cause2name(incauses(i)), inports(i));
    end;
  
    if i<nports % Add a comma
      RHS2 = sprintf('%s,\n',RHS2);
    else
      RHS2 = sprintf('%s\n',RHS2);
    end;
  end;
end;
 
  

% Set up equation
eqn = sprintf('%s := %s%s\t%s;\n', LHS, RHS1, RHS2, rp);









<
|
|

|
|
|
|

|
|
|
|
|
|
<

|
<




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
RHS1 = sprintf('%s%s%s%s%s%s%s%s\n', ...
    cr, lp, args, a_comma, cause_name, c_comma, port_name, c_comma);


% Set up rest of RHS - the input variables, causality and ports.
RHS2 = '';
for i=1:nports

  RHS2 = sprintf('%s\t%s', ...
      RHS2, varname(name, inbonds(i), incauses(i)))
  
  if length(cr)>0 % add the causality & port info
    RHS2 = sprintf('%s,%s,%1.0f', ...
	RHS2, cause2name(incauses(i)), inports(i));
  end;
  
  if (i<nports) % Add a comma
    RHS2 = sprintf('%s,\n',RHS2);
  else
    RHS2 = sprintf('%s\n',RHS2);
  end;
end;

 
 

% Set up equation
eqn = sprintf('%s := %s%s\t%s;\n', LHS, RHS1, RHS2, rp);



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