Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0bc65abe8db8babf3a6cf44fd9cf728ab9e35d258e731fcaea94143a3b35b925
User & Date: gawthrop@users.sourceforge.net on 1997-04-09 10:18:26
Other Links: branch diff | manifest | tags
Context
1997-04-09
13:00:28
*** empty log message *** check-in: 27bc813392 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:18:26
Initial revision check-in: 0bc65abe8d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:26:44
Added crcopy feature to pull crs from library -- similar to copy
feature.
check-in: 5cdb0ece85 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/lib/comp/simple/cieqn.m version [d2d508e0d6].
















































































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
79
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function structure =  cieqn(name, bond_number,bonds,direction,cr,args, ...
    structure,CorI,eqnfile);
% cieqn - Equation function for a (multi-port) unicausal C or I component
% CorI = 1 for C, -1 for I

% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cieqn


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


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

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

% Find the number of ports
[ports,junk] = size(bonds);

% Right-hand side causality
RHS_cause = (bonds(:,1)==CorI*ones(ports,1))*CorI
state_cause = 0; % State causality

for outport = 1:ports
  LHS_number = bond_number(outport);
  if bonds(outport,1) == -CorI % Integral causality on this port
    state = structure(1)+1;
    LHS_cause = CorI;

    % Print equation of form x_i = MTTx(i)
    fprintf(eqnfile, '%s := MTTx(%1.0f,1);\n', ...
        varname(name,LHS_number, state_cause), state);
    % Print equation of form xdot = input
    fprintf(eqnfile, 'MTTdX(%1.0f,1) := %s;\n', state, ...
                     varname(name,LHS_number,-LHS_cause));
    % Print equation of form output = CR (state) 
    eqn =  equation(name,cr,args,LHS_number,LHS_cause,outport, ...
                             bond_number,state_cause,1:ports);
    fprintf(eqnfile, '%s',eqn);
    structure(1) = state;
  else % Derivative causality
    nonstate = structure(2)+1;
    LHS_cause = -CorI;

    % Print equation of form zdot = MTTdz(i)
    fprintf(eqnfile, '%s := MTTdz(%1.0f,1);\n', ...
                             varname(name,LHS_number,LHS_cause), ...
                             nonstate);
    % Print equation of form MTTz(i) = z_i
    fprintf(eqnfile, 'MTTz(%1.0f,1) := %s;\n', nonstate, ...
             varname(name,LHS_number, state_cause));
				 
   % Print equation of form z_i = CR(input)
      eqn =  equation(name,cr,args,LHS_number,state_cause, outport, ...
                             bond_number,RHS_cause,1:ports);
    fprintf(eqnfile, '%s',eqn);
    structure(2) = nonstate;
 end;
end;










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