ports: save U/I filenames and return ref-impedance

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2013-03-22 13:52:27 +01:00
parent e113afb656
commit ec4d133b04
5 changed files with 33 additions and 28 deletions

View File

@ -93,14 +93,16 @@ u_stop = 0.5*(start + stop);
u_start(n_dir) = start(n_dir);
u_stop(n_dir) = stop(n_dir);
CSX = AddProbe(CSX,['port_ut' int2str(portnr)], 0, 'weight', -direction);
CSX = AddBox(CSX,['port_ut' int2str(portnr)], prio, u_start, u_stop);
port.U_filename = ['port_ut' int2str(portnr)];
CSX = AddProbe(CSX, port.U_filename, 0, 'weight', -direction);
CSX = AddBox(CSX, port.U_filename, prio, u_start, u_stop);
i_start = start;
i_stop = stop;
i_start(n_dir) = 0.5*(start(n_dir)+stop(n_dir));
i_stop(n_dir) = 0.5*(start(n_dir)+stop(n_dir));
CSX = AddProbe(CSX,['port_it' int2str(portnr)], 1, 'weight', direction, 'NormDir', n_dir-1);
CSX = AddBox(CSX,['port_it' int2str(portnr)], prio, i_start, i_stop);
port.I_filename = ['port_it' int2str(portnr)];
CSX = AddProbe(CSX, port.I_filename, 1, 'weight', direction, 'NormDir', n_dir-1);
CSX = AddBox(CSX, port.I_filename, prio, i_start, i_stop);

View File

@ -189,25 +189,25 @@ i2_start(idx_prop) = sum(meshlines(2:3))/2;
i2_stop(idx_prop) = i2_start(idx_prop);
% create the probes
name = ['port_ut' num2str(portnr) 'A'];
port.U_filename{1} = ['port_ut' num2str(portnr) 'A'];
% weight = sign(stop(idx_height)-start(idx_height))
weight = upsidedown;
CSX = AddProbe( CSX, name, 0, 'weight', weight );
CSX = AddBox( CSX, name, prio, v1_start, v1_stop );
name = ['port_ut' num2str(portnr) 'B'];
CSX = AddProbe( CSX, name, 0, 'weight', weight );
CSX = AddBox( CSX, name, prio, v2_start, v2_stop );
name = ['port_ut' num2str(portnr) 'C'];
CSX = AddProbe( CSX, name, 0, 'weight', weight );
CSX = AddBox( CSX, name, prio, v3_start, v3_stop );
name = ['port_it' num2str(portnr) 'A'];
CSX = AddProbe( CSX, port.U_filename{1}, 0, 'weight', weight );
CSX = AddBox( CSX, port.U_filename{1}, prio, v1_start, v1_stop );
port.U_filename{2} = ['port_ut' num2str(portnr) 'B'];
CSX = AddProbe( CSX, port.U_filename{2}, 0, 'weight', weight );
CSX = AddBox( CSX, port.U_filename{2}, prio, v2_start, v2_stop );
port.U_filename{3} = ['port_ut' num2str(portnr) 'C'];
CSX = AddProbe( CSX, port.U_filename{3}, 0, 'weight', weight );
CSX = AddBox( CSX, port.U_filename{3}, prio, v3_start, v3_stop );
weight = direction;
CSX = AddProbe( CSX, name, 1, 'weight', weight );
CSX = AddBox( CSX, name, prio, i1_start, i1_stop );
name = ['port_it' num2str(portnr) 'B'];
CSX = AddProbe( CSX, name, 1,'weight', weight );
CSX = AddBox( CSX, name, prio, i2_start, i2_stop );
port.I_filename{1} = ['port_it' num2str(portnr) 'A'];
CSX = AddProbe( CSX, port.I_filename{1}, 1, 'weight', weight );
CSX = AddBox( CSX, port.I_filename{1}, prio, i1_start, i1_stop );
port.I_filename{2} = ['port_it' num2str(portnr) 'B'];
CSX = AddProbe( CSX, port.I_filename{2}, 1,'weight', weight );
CSX = AddBox( CSX, port.I_filename{2}, prio, i2_start, i2_stop );
% create port structure
port.LengthScale = 1;

View File

@ -57,11 +57,11 @@ for n=1:2:numel(varargin)
end
end
port.ZL_ref = ref_ZL;
% read time domain data
filename = ['port_ut' num2str(port.nr)];
U = ReadUI(filename, SimDir, f, UI_args{:} );
filename = ['port_it' num2str(port.nr)];
I = ReadUI(filename, SimDir, f, UI_args{:} );
U = ReadUI( port.U_filename, SimDir, f, UI_args{:} );
I = ReadUI( port.I_filename, SimDir, f, UI_args{:} );
% store the original frequency domain waveforms
u_f = U.FD{1}.val;

View File

@ -23,6 +23,7 @@ function [port] = calcPort( port, SimDir, f, varargin)
% port.f the given frequency fector
% port.uf.tot/inc/ref total, incoming and reflected voltage
% port.if.tot/inc/ref total, incoming and reflected current
% port.ZL_ref used refernce impedance
%
% if port is a transmission line port:
% port.beta: propagation constant
@ -50,5 +51,7 @@ if strcmpi(port.type,'MSL')
elseif (strcmpi(port.type,'Lumped') || strcmpi(port.type,'Curve'))
port = calcLumpedPort( port, SimDir, f, varargin{:});
return
else
error 'unknown port type'
end

View File

@ -26,6 +26,7 @@ function [port] = calcTLPort( port, SimDir, f, varargin)
% port.if.tot/inc/ref total, incoming and reflected current
% port.beta: propagation constant
% port.ZL: characteristic line impedance
% port.ZL_ref used refernce impedance
%
% example:
% port{1} = calcTLPort( port{1}, Sim_Path, f, 'RefImpedance', 50);
@ -75,11 +76,9 @@ for n=1:2:numel(varargin)
end
end
% read time domain data
filename = ['port_ut' num2str(port.nr)];
U = ReadUI( {[filename 'A'],[filename 'B'],[filename 'C']}, SimDir, f, UI_args{:} );
filename = ['port_it' num2str(port.nr)];
I = ReadUI( {[filename 'A'],[filename 'B']}, SimDir, f, UI_args{:} );
% read time domain data (multiples files)
U = ReadUI( port.U_filename, SimDir, f, UI_args{:} );
I = ReadUI( port.I_filename, SimDir, f, UI_args{:} );
% store the original frequency domain waveforms
u_f = U.FD{2}.val;
@ -119,6 +118,7 @@ end
port.ZL = ZL;
port.beta = beta;
port.ZL_ref = ref_ZL;
port.f = f;
uf_inc = 0.5 * ( u_f + i_f .* ref_ZL );