File mttroot/mtt/lib/comp/simple/FMR_eqn.m artifact fef81a6448 part of check-in 21c7904e95


function  structure = FMR_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% FMR_eqn - equations for flow-modulated resistor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  FMR_eqn
% FMR_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

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


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


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

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'FMR')==0
  return
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);

if f_2 == -1 				% Standard with modulation
  if f_1 == 1 				% Flow out
    op = '*';
  else                                  % Effort out
    op = '/';
  end;
  
  fprintf(eqnfile, '%s := %s%s%s;\n', ...
      varname(bond_number(1), -e_1), ...
      varname(bond_number(1), e_1), ...
      op, ...
      varname(bond_number(2), -1));
else 					% Deduce modulation
  
   fprintf(eqnfile, '%s := %s/%s;\n', ...
      varname(bond_number(2), -1), ...
      varname(bond_number(1), -1), ...
      varname(bond_number(1), 1));
end;

% Effort on port 2 is always zero
   fprintf(eqnfile, '%s := 0;\n', ...
      varname(bond_number(2), 1));

 
      


 





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