Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 11101e05adb0c5258d89e74a4df1c4f42c1704167b8b2f4220cd72eed80d5b7b
User & Date: gawthrop@users.sourceforge.net on 2000-12-28 11:51:32
Other Links: branch diff | manifest | tags
Context
2000-12-28
11:58:07
Put under RCS check-in: d4245be859 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:51:32
Initial revision check-in: 11101e05ad user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:46:33
*** empty log message *** check-in: 40e6c207b1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/comp/simple/EMTF_cause.m version [e4232f67a5].




















































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [bonds,status] = EMTF_cause(bonds);
% EMTF_cause - causality for a modulated TF component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  EMTF_cause
% [bonds,status] = EMTF_cause(bonds)
% Causality for effort-modulated EMTF 
% At the moment, modulation can NOT be inverted.

%SUMMARY EMTF: effort-modulated transformer
%DESCRIPTION Energy conserving three-port
%DESCRIPTION Ports [1] and [2] as for TF
%DESCRIPTION e_1 = f(f_2); f_1 = f(e_2)
%DESCRIPTION Effort on port[3] modulates the CR


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


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

status = -1;

% Check that there are exactly three bonds.
if check_bonds(bonds,3,'EMTF')==0
  return
end

% Extract the bond information
TF_bonds = bonds(1:2,:);
e_3 = bonds(3,1);
f_3 = bonds(3,2);

%Causality of EMTF is same as that of a TF on ports 1 and 2
[TF_bonds,TF_status] = TF_cause(TF_bonds);


% Effort is the modulation - imposed on component.
if e_3==-1 				% Conflict
  mod_status_e = 1;
else 					% Do the rest of the causality
  if e_3==0 				% Set to the fixed causality
    e_3 = 1;
  end;
  mod_status_e = 0;
end;
 
% Zero flow imposed by component.
if f_3==-1 				% Conflict
  mod_status_f = 1;
else 					% Do the rest of the causality
  if f_3==0 				% Set to the fixed causality
    f_3 = 1;
  end;
  mod_status_f = 0;
end;
 
bonds = [TF_bonds
         e_3 f_3];
	
if (TF_status == 0) & (mod_status_e == 0) & (mod_status_f == 0)
  status = 0;
end;

if (TF_status == 1) | (mod_status_e == 1) | (mod_status_f == 1)
  status = 1;
end;

 
 
 
 
 
   

Added mttroot/mtt/lib/comp/simple/GY_eqn.m version [f2e485f0f7].














































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function  structure = GY_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% GY_eqn - equations for GY component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  GY_eqn
% structure = GY_eqn(bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

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


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


if nargin<8
  eqnfile = 'stdout';
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);


% Effort - flow
if e_1==1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
  outcause = -1;
  incause = 1;
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
  outcause = 1;
  incause = -1;
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

% Flow-effort
if f_1==-1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
  outcause = 1;
  incause = -1; 
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
  outcause = -1;
  incause = 1; 
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

Added mttroot/mtt/lib/comp/simple/RST_cause.m version [9248b5c94d].































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [bonds,status] = RST_cause(bonds);
% Causality for RST component

%SUMMARY RST: thermal resistor with entropy generation
%DESCRIPTION Port[in]: a simple one port resistor but:
%DESCRIPTION flow is multiplied by e_out
%DESCRIPTION Port[out]: thermal power - effort is temperature, flow is entropy flow
%DESCRIPTION Not bicausal (yet)


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


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

status = -1;

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

% Same causality as RS
[bonds,status] = RS_cause(bonds);

Added mttroot/mtt/lib/comp/simple/RST_eqn.m version [a09541d179].













































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function  structure = RT_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% RT_eqn - equations for flow-modulated resistor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  RT_eqn
% RT_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% VeRTion control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/03  09:30:45  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



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


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

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


% There are 2 ports; extract the information
in_bonds = bonds(1,:);
out_bonds = bonds(2,:);
in_direction = direction(1,:);
out_direction = direction(2,:);

% Do port [in] - a standard resistor -- except for modulation by e_2
structure = R_eqn(name,bond_number(1),in_bonds,in_direction,cr,args, ...
    structure,eqnfile);

% Resistance is multiplied by effort e_1 + e_2 (ie effort on upsteam side of
% the 1 junction)
if in_bonds(1) == 1 % Flow output - divide by e_1+e_2
  fprintf(eqnfile,'%s := %s/(%s+%s);\n' , ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
else
   % Effort output - multiply by e_1+e_2
  fprintf(eqnfile,'%s := %s*(%s+%s);\n' , ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
end;


% Do port [out] - the thermal bit. RT is power conserving.
% This computes f_2 = e_1*f_1/e_2 or  e_2 = e_1*f_1/f_2
fprintf(eqnfile,'%s := %s*%s/%s;\n' , ...
    varname(name,bond_number(2), -out_bonds(1)), ...
    varname(name,bond_number(1),  1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), out_bonds(1)) );


Added mttroot/mtt/lib/comp/simple/cicause.m version [94090e2bee].















































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [bonds,status] = cicause(bonds,default);
% cicause - Sets causality for C & I components
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cicause
% [bonds,status] = cicause(bonds,default)

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


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



if (norm(bonds)>1)
  if (bonds(1)==-bonds(2)) % Over causal
    status = 1;
  else                       % Causal
    status = 0;
  end;
elseif norm(bonds)==0 % Acausal
  % bonds = default*[1 1]; %Set integral causality
  % status = 0;
  status = -1;
else % Set causality 
  % Effort
  if bonds(1)==0
    status = 0;
    bonds(1) = bonds(2);
  end;

  % Flow
  if bonds(2)==0
    status = 0;
    bonds(2) = bonds(1);
  end;

end;

Added mttroot/mtt/lib/comp/simple/one_cause.m version [3018a4a5e9].



































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [bonds,status] = one_cause(bonds);
% one_cause - causality for a one junction
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  one_cause


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


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

%Effort
[bonds,e_status] = juncause(bonds,-1,1);

%Flow
[bonds,f_status] = juncause(bonds,-1,-1);

if (e_status==1)|(f_status==1)       % Over causal
  status = 1;
elseif (e_status==-1)|(f_status==-1) % Under causal
  status = -1;
else                                  % causal
  status = 0;
end;

Added mttroot/mtt/lib/comp/simple/zero_cause.m version [93a4da1931].

































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function [bonds,status] = zero_cause(bonds);
% zero_cause - causality for zero junctions
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  zero_cause
% [bonds,status] = zero_cause(bonds);

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

%Effort
[bonds,e_status] = juncause(bonds,1,1);

%Flow
[bonds,f_status] = juncause(bonds,1,-1);

status = 0;
if (e_status==1)|(f_status==1)       % Over causal
  status = 1;
endif;
if (e_status==-1)|(f_status==-1) % Under causal
  status = -1;
endif;

  


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