Overview
Comment:Generic amplifier sorted equation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 19c95e4756dc5669723aba61f9d4a3a7ac5c03f3ecae3058f88d84313b85ea93
User & Date: gawthrop@users.sourceforge.net on 2003-03-25 16:55:42
Other Links: branch diff | manifest | tags
Context
2003-03-25
16:56:30
Effort amplifier sorted equation check-in: 29a8d1f06e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:55:42
Generic amplifier sorted equation check-in: 19c95e4756 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:50:54
Added is_port -- but not used at the moment.
Some explanation added.
check-in: 38c4342cd1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/comp/simple/Amp_seqn.m version [fde6465120].























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
function [eqn,insigs,innames] = Amp_seqn (AmpType,Name, name, cr, arg, outsig, insigs, innames)

  ## usage:  [eqn,inbonds] = AF_seqn (Name, cr, arg, outbond, inbonds)
  ##
  ## 

  N = mtt_check_sigs (outsig,insigs);
  if (N!=2)
    mtt_error("Amplifier component must have exactly two ports");
  endif
  

  ## On which port is the equation required?
  outbond_number = outsig(1);
  outport = find(abs(insigs(:,1))!=outbond_number*ones(N,1));

  ## Some definitions
  flow = -1;
  effort = 1;

  if strcmp(AmpType,"AE")
    causality = effort;
    other_causality = flow;
  elseif strcmp(AmpType,"AF")
    causality = flow;
    other_causality = effort;
  else
    mtt_error(sprintf("Amp_seqn: type %s unknown", AmpType));
  endif
  
  ## Standard causality
  if (outport==2)
    qAmpType = sprintf("""%s""", AmpType);
    eqn = equation(qAmpType,Name,cr,arg,outsig(1),causality,2, ...
		 insigs(2,1),causality,1);
  elseif (outport==1)
    LHS = varname(Name,insigs(2,1),other_causality);
    eqn = sprintf("%s := 0;", LHS);
  else
    mtt_error("AF_seqn: outport must be 1 or 2");
  endif

endfunction


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