ADDED mttroot/mtt/bin/trans/m/cr2name.m Index: mttroot/mtt/bin/trans/m/cr2name.m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/m/cr2name.m @@ -0,0 +1,39 @@ +function name = cr2name(RHS_number,LHS_cause,RHS_cause,cr,args); +cr2name. Construcs a string for the cr of a component. + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% Version control history +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% $Id$ +% %% $Log$ +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +if length(args)==0 + a_comma = ''; +else + a_comma = ','; +end; + +if length(cr)==0 + cause_name = ''; + lp = ''; + rp = ''; + c_comma = ''; +else + cause_name = cause2name(LHS_cause); + lp = '('; + rp = ')'; + c_comma = ','; +end; + +name = sprintf('%s%s%s%s%s%s%s%s', ... + cr,lp, args, a_comma, cause_name, c_comma, ... + varname(RHS_number,RHS_cause),rp); + + + + + + + ADDED mttroot/mtt/lib/comp/simple/AE_eqn.m Index: mttroot/mtt/lib/comp/simple/AE_eqn.m ================================================================== --- /dev/null +++ mttroot/mtt/lib/comp/simple/AE_eqn.m @@ -0,0 +1,44 @@ +function structure = AE_eqn(bond_number,bonds,direction,cr,args, ... + structure,eqnfile); +% AE_eqn. Equation generation for effort amplifier. + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% Version control history +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% $Id$ +% %% $Log$ +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +if nargin<6 + 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); + + +% Flow on port 1 is always zero + fprintf(eqnfile, '%s := 0;\n', ... + varname(bond_number(1), -1)); + + +LHS_cause = 1; +RHS_cause = 1; + +if e_2 == -1 % Unicausal: e_2 := e_1 + LHS_number = bond_number(2); + RHS_number = bond_number(1); +else % Bicausal: e_1 := e_2 + LHS_number = bond_number(1); + RHS_number = bond_number(2); +end + +oneeqn(LHS_number,LHS_cause,RHS_number,RHS_cause,cr,args,eqnfile); + + + + + ADDED mttroot/mtt/lib/comp/simple/C_eqn.m Index: mttroot/mtt/lib/comp/simple/C_eqn.m ================================================================== --- /dev/null +++ mttroot/mtt/lib/comp/simple/C_eqn.m @@ -0,0 +1,27 @@ +function structure = C_eqn(bond_number,bonds,direction,cr,args, ... + structure,eqnfile); +% C_eqn: equation generation for C component + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% Version control history +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% $Id$ +% %% $Log$ +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +if nargin<7 + eqnfile = 'stdout'; +end; + +% Unicausal version +CorI = 1; +structure = cieqn(bond_number,bonds,direction,cr,args, structure, ... + CorI, eqnfile); + + + + +