|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
function structure = PS_eqn(name,bond_number,bonds,direction,cr,args, ...
structure,eqnfile);
% PS_eqn - equations for a power sensor
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%% Model Transformation Tools %%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function PS_eqn
% PS_eqn(name,bond_number,bonds,direction,cr,args, ...
% structure,eqnfile);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (c) P.J. Gawthrop, 1997.
if nargin<6
eqnfile = 'stdout';
end;
% Check that there are exactly three bonds.
ports = 3;
if check_bonds(bonds,ports,'PS')==0
return
end
% There are 3 ports; extract the information
inout_bonds = bonds(1:2,:);
power_bonds = bonds(3,:);
inout_direction = direction(1:2,:);
power_direction = direction(3,:);
% Do ports [in] and [out] - unit gain TF.
structure = TF_eqn(name,bond_number(1:2),inout_bonds,inout_direction, ...
'lin','effort,1', structure,eqnfile);
% Do port [power] - the power bit.
% This computes f_2 = e_1*f_1
fprintf(eqnfile,'%s := %s*%s;\n' , ...
varname(name,bond_number(3), -power_bonds(1)), ...
varname(name,bond_number(1), 1), ...
varname(name,bond_number(1), -1) );
|