Overview
Comment:Octavised.
Added new first argument to write component type to cr in ese file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: f5b5f826d55a2baaabbddd75a99562fa3de1845a53302176c1a28368b0116aab
User & Date: gawthrop@users.sourceforge.net on 2003-01-07 10:11:45
Other Links: branch diff | manifest | tags
Context
2003-01-07
10:16:26
Added dummy first argument for compatibility with new _ese.r format. check-in: 1484260aed user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:11:45
Octavised.
Added new first argument to write component type to cr in ese file.
check-in: f5b5f826d5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:10:14
Uses new version of equation.m - passes component type to cr. check-in: 3581948d08 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/equation.m from [ebd4d7871d] to [c703094e12].

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
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
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.5  1996/12/05  11:26:51  peterg
% %% Null strings now detected with strcmp not length.
% %%
% %% Revision 1.4  1996/09/12 16:42:01  peter
% %% Default now out side this function - need to be none for each
% %% component.
% %%
% %% 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
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



inbonds
incauses

% Find the number of inports
nports = length(inbonds)

% Check some arguments
if length(incauses) ~= nports
  error('equation.m: incauses inconsistent with inbonds');
end;


if length(inports) ~= nports
  error('equation.m: inports inconsistent with inbonds');
end;


% Set up LHS
LHS = varname(name, outbond, outcause);

% Set up various strings to get correct syntax if some strings are empty
if strcmp(cr,'')
  cause_name = '';
  port_name = '';
  lp = '';
  rp = '';
  c_comma = '';
else
  cause_name = cause2name(outcause);
  port_name = sprintf('%1.0f', outport');
  lp = '(';
  rp = ')';
  c_comma = ',';
end

if strcmp(args,'')
  a_comma = '';
else
  a_comma = ',';
end;


% Set up first line of RHS
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 strcmp(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);


|
|
|
<
<
>
>
|
|
|
<
>
|
|
|


|
|
<
|
>
|
|
|
<
|
|
<
<
|
<
|
|
<
<
|
<
|
|
<
<
>


|
|

|
|

|
|
|
|

>
|
|
|

>
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|

>
|
|
|


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

|
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
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
function eqn =  equation(comp_type, 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:
  ## equation.m,v 1.6 2000/12/27 16:06:00 peterg Exp $ ## $Log:
  ## equation.m,v $ ## Revision 1.6  2000/12/27 16:06:00  peterg ## ***
  ## empty log message *** ## ## Revision 1.5  1996/12/05  11:26:51
  ## peterg ## Null strings now detected with strcmp not length. ## ##

  ## Revision 1.4  1996/09/12 16:42:01  peter ## Default now out side
  ## this function - need to be none for each ## component. ## ##


  ## 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:11peter
  ## ## Initial revision ##


  ## ###############################################################


  inbonds
  incauses

  ## Find the number of inports
  nports = length(inbonds)

  ## Check some arguments
  if length(incauses) ~= nports
    error("equation.m: incauses inconsistent with inbonds");
  endif


  if length(inports) ~= nports
    error("equation.m: inports inconsistent with inbonds");
  endif


  ## Set up LHS
  LHS = varname(name, outbond, outcause);

  ## Set up various strings to get correct syntax if some strings are empty
  if strcmp(cr,"")
    cause_name = "";
    port_name = "";
    lp = "";
    rp = "";
    c_comma = "";
  else
    cause_name = cause2name(outcause);
    port_name = sprintf("%i", outport');
    lp = sprintf("(%s, ", comp_type); 
    rp = ")";
    c_comma = ",";
  end

  if strcmp(args,"")
    a_comma = "";
  else
    a_comma = ",";
  endif


  ## Set up first line of RHS
  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 strcmp(cr,"")==0 # add the causality & port info
      RHS2 = sprintf("%s,%s,%i", ...
		     RHS2, cause2name(incauses(i)), inports(i));
      
    endif
    
    if (i<nports) # Add a comma
      RHS2 = sprintf("%s,\n",RHS2);
    else
      RHS2 = sprintf("%s\n",RHS2);

    endif

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

endfunction


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