Overview
Comment:*** empty log message ***
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 40e6c207b163ddbf44f67e022de377ce4279c2da2602b2fa138e2b8962c8e099
User & Date: gawthrop@users.sourceforge.net on 2000-12-28 11:46:33.000
Other Links: branch diff | manifest | tags
Context
2000-12-28
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
11:43:16
Put under RCS check-in: d55e37d172 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙
13
14
15
16
17
18
19



20
21
22
23
24
25
26
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







+
+
+







%DESCRIPTION Port[2]: amplifier effort output e_2 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/11/01 11:40:30  peterg
% %% Documentation.
% %%
% %% Revision 1.1  1996/08/30 19:05:21  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.
︙
68
69
70
71
72
73
74
75

76
71
72
73
74
75
76
77

78
79







-
+

     else
       status = 1;
     end
 end;
end;
 
 bonds = [e_1 f_1
           e_2 f_2];
           e_2 f_2]

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

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
-
+

+






-
-
-
-
-
-

+







-
+



-
+




+




-
+


-
+

-
+


-
+

-
+








-
+


-
+

-
+


-
+

-
+






+
+
+







function  structure = TF_eqn(name,bond_number,bonds,direction,cr,args, ...
function  structure = EMTF_eqn(name,bond_number,bonds,direction,cr,args, ...
                            structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/09/10 10:41:37  peter
% %% Now used equation.m to write the equations.
% %%
% %% Revision 1.1  1996/08/19 09:05:04  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


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

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

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


% Effort
outcause = 1;
incause = 1;
incause = [1;1];
if e_1==1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  inbond =  bond_number([1 3]);
  outport = 2;
  inport = 1;
  inport = [1;3];
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  inbond =  bond_number([2 3]);
  outport = 1;
  inport = 2;
  inport = [2;3];
end;

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

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

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

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







1
2
3
4
5
6
7



8
9
10
11
12
13
14



15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24







+
+
+







+
+
+




function alias = FP_alias	# Port aliases for FP

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/07 15:01:09  peterg
## Named ports correctely  f --> 1, p --> 2
##
## Revision 1.1  1998/07/02 14:46:42  peterg
## Initial revision
##
###############################################################

  alias.f     = '1';
  alias.p     = '2';

  alias.s     = '1';
  alias.e     = '2';

endfunction


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
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 [bonds,status] = SS_cause(bonds)
% SS_cause = causality for an SS component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  SS_cause
% [bonds,status] = SS_cause(bonds)

%SUMMARY SS: source-sensor component
%DESCRIPTION one-port source sensor component
%DESCRIPTION when the name is [i], acts as ith port of a system.
%DESCRIPTION multi-port source sensor component
%DESCRIPTION when the name is [name], acts as port `name' of a system.
%DESCRIPTION may be bicausal

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/11/01 14:41:14  peterg
% %% Check correct bonds
% %%
% %% Revision 1.1  1996/11/01 12:18:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


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

% Check that there is exactly one bonds.
if check_bonds(bonds,1,'SS')==0
  return
end
## Check that there is exactly one bonds.
##if check_bonds(bonds,1,'SS')==0
##  return
##end

disp("Starting SS_cause");

[n_bonds,junk] = size(bonds);
Status=zeros(n_bonds,1);
for i=1:n_bonds
if (bonds(1)==0)|(bonds(2)==0) % Under causal
  status = -1;
else                          % causal
  status = 0;
end;
  if (bonds(i,1)==0)|(bonds(i,2)==0) % Under causal
    Status(i) = -1;
  else                          % causal
    Status(i) = 0;
 end;
end;
status=min(Status);







︙
10
11
12
13
14
15
16



17
18
19
20
21
22
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







+
+
+









% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  1998/06/29 12:16:05  peterg
% %% Whoops - FP bonds are p and f (in that order)
% %%
% %% Revision 1.7  1998/06/29 12:13:36  peterg
% %% Changed FP ports to f and p
% %%
% %% Revision 1.6  1998/06/29 09:55:17  peterg
% %% Changed name to FP from ES
% %%
% %% Revision 1.5  1998/04/12 15:01:53  peterg
︙
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

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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+

junctions = '-zero-one-';
one_ports = '-SS-';
two_ports = '-TF-GY-AE-AF-FMR-RS-EBTF-';
N_ports   = '-R-C-I-';
comp_type = ['-', comp_type, '-'];

if length(findstr(comp_type,junctions))==1
  ports = ['[undefined]'];
elseif length(findstr(comp_type,one_ports))==1
  ports = ['[in]'];
elseif length(findstr(comp_type,two_ports))==1
  ports = ['[in]';'[out]'];
elseif length(findstr(comp_type,'[-EMTF-]'))==1
  ports = ['[in]';'[out]';'[mod]'];
elseif length(findstr(comp_type,'[-FP-]'))==1
  ports = ['[p]';'[f]'];
elseif length(findstr(comp_type,'[-PS-]'))==1
  ports = ['[in]';'[out]';'[power]'];
elseif length(findstr(comp_type,N_ports))==1
  if N==1
    ports = ['[in]'];
  elseif N==2
    ports = ['[in]';'[out]'];
  elseif N>2
    ports = '[1]';
    for i=2:N
      ports = [ports; sprintf("[%i]",i)];
    end;
  end;
end;


#if length(findstr(comp_type,junctions))==1
#  ports = ['[undefined]'];
#elseif length(findstr(comp_type,one_ports))==1
#  ports = ['[in]'];
#elseif length(findstr(comp_type,two_ports))==1
#  ports = ['[in]';'[out]'];
#elseif length(findstr(comp_type,'[-EMTF-]'))==1
#  ports = ['[in]';'[out]';'[mod]'];
#elseif length(findstr(comp_type,'[-FP-]'))==1
#  ports = ['[p]';'[f]'];
#elseif length(findstr(comp_type,'[-PS-]'))==1
#  ports = ['[in]';'[out]';'[power]'];
#elseif length(findstr(comp_type,N_ports))==1
#  if N==1
#    ports = ['[in]'];
#  elseif N==2
#    ports = ['[in]';'[out]'];
#  elseif N>2
#    ports = '[1]';
#    for i=2:N
#      ports = [ports; sprintf("[%i]",i)];
#    end;
#  end;
#end;
 
# All the above is now done in the alias files
  ports = '[1]';
  for i=2:N
    ports = [ports; sprintf("[%i]",i)];
  end;

endfunction
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
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










+
+
+












-
+







function [bonds,status] = juncause(bonds,jun,cause)
% [bonds,status] = juncause(bonds,jun,cause)

% Causality for  either effort or flow on  either zero or one junctions

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/09  08:29:04  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


j =  (3-cause)/2; % j is 1 for effort, 2 for flow

[n_bonds,junk] = size(bonds);
[causing_bond, n,other_bonds,m] = getindex(bonds(:,j),jun);
if n>1 % over causal
  status = 1;
elseif n==1 %causal
  status = 0;
  bonds(other_bonds(:,1),j) = -jun*ones(m,1);
else  % undercausal - try other way
elseif n==0  % undercausal - try other way
  [causing_bond, n,other_bonds,m] = getindex(bonds(:,j),-jun);
  if n==n_bonds % over causal
    status = 1;
  elseif n==n_bonds-1 %causal
    status = 0;
    bonds(other_bonds(:,1),j) = jun*ones(m,1);
  else  % undercausal
︙
︙
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
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







+
+
+
+











-
+










-
+


-
+




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

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/12/05 10:02:45  peterg
% %% Explicit generation of strong-causality equations -- oneequation not
% %% used now.
% %%
% %% Revision 1.2  1996/08/08  18:09:10  peter
% %% Changed to finenumber format.
% %%
% %% Revision 1.1  1996/08/08 16:38:50  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Same causality as junction
column =  (3-jun)/2; 
[causing_bond,n,other_bonds,m] = getindex(bonds(:,column),jun);
[causing_bond,n,other_bonds,m] = getindex(bonds(:,column),jun)
for i=other_bonds'
  fprintf(filenumber, '%s \t:=\t%s;\n', ...
      varname(name, bond_number(i),jun), ...
      varname(name, bond_number(causing_bond),jun) ...
  );
end;


% Opposite causality to junction
column =  (3+jun)/2;
[caused_bond,n,other_bonds,m] = getindex(bonds(:,column),jun);
[caused_bond,n,other_bonds,m] = getindex(bonds(:,column),jun)
fprintf(filenumber, '%s\t:= \n',  varname(name, bond_number(caused_bond),-jun));
for i=other_bonds'
  term_sign = -direction(caused_bond,column)*direction(i,column);
  term_sign = -direction(caused_bond,column)*direction(i,column)
  fprintf(filenumber, '\t\t%s %s\n', sign2name(term_sign), ...
      varname(name, bond_number(i),-jun));
end;
fprintf(filenumber, ';\n');
︙
11
12
13
14
15
16
17



18
19
20


21
22
23
24
25
26
27
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31







+
+
+


-
+
+







%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/12/05 10:00:49  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


disp("one-eqn")
name,bond_number,bonds,direction,cr,args
if nargin<7
  eqnfile = 'stdout';
end;

juneqn(name,bond_number,bonds,direction,cr,args,-1,eqnfile)


︙

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