Index: mttroot/mtt/lib/comp/simple/AE_cause.m ================================================================== --- mttroot/mtt/lib/comp/simple/AE_cause.m +++ mttroot/mtt/lib/comp/simple/AE_cause.m @@ -15,10 +15,13 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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 % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -70,7 +73,7 @@ end end; end; bonds = [e_1 f_1 - e_2 f_2]; + e_2 f_2] Index: mttroot/mtt/lib/comp/simple/EMTF_eqn.m ================================================================== --- mttroot/mtt/lib/comp/simple/EMTF_eqn.m +++ mttroot/mtt/lib/comp/simple/EMTF_eqn.m @@ -1,76 +1,76 @@ -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)); Index: mttroot/mtt/lib/comp/simple/FP_alias.m ================================================================== --- mttroot/mtt/lib/comp/simple/FP_alias.m +++ mttroot/mtt/lib/comp/simple/FP_alias.m @@ -3,16 +3,22 @@ ############################################################### ## 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 Index: mttroot/mtt/lib/comp/simple/SS_cause.m ================================================================== --- mttroot/mtt/lib/comp/simple/SS_cause.m +++ mttroot/mtt/lib/comp/simple/SS_cause.m @@ -7,37 +7,49 @@ % % 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 - -if (bonds(1)==0)|(bonds(2)==0) % Under causal - status = -1; -else % causal - status = 0; +## 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(i,1)==0)|(bonds(i,2)==0) % Under causal + Status(i) = -1; + else % causal + Status(i) = 0; + end; end; +status=min(Status); + + Index: mttroot/mtt/lib/comp/simple/comp_ports.m ================================================================== --- mttroot/mtt/lib/comp/simple/comp_ports.m +++ mttroot/mtt/lib/comp/simple/comp_ports.m @@ -12,10 +12,13 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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 @@ -42,32 +45,37 @@ 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 Index: mttroot/mtt/lib/comp/simple/juncause.m ================================================================== --- mttroot/mtt/lib/comp/simple/juncause.m +++ mttroot/mtt/lib/comp/simple/juncause.m @@ -6,10 +6,13 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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 @@ -18,11 +21,11 @@ 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; Index: mttroot/mtt/lib/comp/simple/juneqn.m ================================================================== --- mttroot/mtt/lib/comp/simple/juneqn.m +++ mttroot/mtt/lib/comp/simple/juneqn.m @@ -14,10 +14,14 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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 @@ -25,11 +29,11 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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) ... ); @@ -36,13 +40,13 @@ 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'); Index: mttroot/mtt/lib/comp/simple/one_eqn.m ================================================================== --- mttroot/mtt/lib/comp/simple/one_eqn.m +++ mttroot/mtt/lib/comp/simple/one_eqn.m @@ -13,13 +13,17 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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)