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: abfb9ed90e715c94a6f8c3eae39af565690e8237dac302ab72413ae83693a6ed
User & Date: gawthrop@users.sourceforge.net on 1997-09-03 09:30:45
Other Links: branch diff | manifest | tags
Context
1997-09-04
08:34:53
Initial revision check-in: e069dc6b0c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-09-03
09:30:45
Initial revision check-in: abfb9ed90e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-08-30
19:35:39
Added date to mtt line check-in: f6786c2201 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/comp/simple/RS_cause.m version [c96451fbaa].

































































































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

%SUMMARY RS: resistor with entropy generation
%DESCRIPTION Port[in]: a simple one port resistor
%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,'RS')==0
  return
end

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

% Port [in] is an ordinary resistor
[in_bonds,in_status] = R_cause(in_bonds); 

% Port [out] has the same causality pattern as an ordinary resistor
[out_bonds,out_status] = R_cause(out_bonds); 

% Reconstruct the bonds
bonds = [in_bonds; out_bonds];

% Generate an overall status
if (in_status==1)|(out_status==1)
  status = 1;
elseif
  (in_status==-1)|(out_status==-1)
  status=-1;
else
  status = 0;
end;


Added mttroot/mtt/lib/comp/simple/RS_eqn.m version [47ff4db70d].















































































































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


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



% 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,'RS')==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
structure = R_eqn(name,bond_number(1),in_bonds,in_direction,cr,args, ...
    structure,eqnfile);

% Do port [out] - the thermal bit. RS 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)) );



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