-
Notifications
You must be signed in to change notification settings - Fork 1
/
test0.m
96 lines (84 loc) · 2.91 KB
/
test0.m
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%% Basic Information
%%% Overview
% Transmission-line parameters extractor
% MATLAB implementation of Patent US8892414B1
% Author Name: Guorui Wei
% Created in: 2020-03-15 12:45
clc; clear; close all;
%% Import data
lineLength = 0.0127; % Line Length(meters)
% Import simulated data
filename_1line = 'data/1line/1line_Polar_500mil.s2p';
SingleEnded2PortData = read(rfdata.data,filename_1line);
freq = SingleEnded2PortData.Freq;
freqPts = length(freq);
z0 = SingleEnded2PortData.Z0; % Reference Impedance
SingleEnded2PortData.S_Parameters = snp2smp(SingleEnded2PortData.S_Parameters,...
z0,[1 2]); % Classic style
numOfLines = size(SingleEnded2PortData.S_Parameters,1)/2;
% Import Cadence-PowerSI-extracted params
filename_PowerSI = 'data/1line/Transmission_RLGC_res.csv';
opts = detectImportOptions(filename_PowerSI);
rlgc_PowerSI_mat = readtable(filename_PowerSI);
% Allocate memory
rlgc_PowerSI.R = zeros(numOfLines,numOfLines,freqPts);
rlgc_PowerSI.L = rlgc_PowerSI.R;
rlgc_PowerSI.C = rlgc_PowerSI.R;
rlgc_PowerSI.G = rlgc_PowerSI.R;
% Import data
for idx = 1:freqPts
rlgc_PowerSI.R(:,:,idx) = rlgc_PowerSI_mat{4*idx-3,3}/lineLength;
rlgc_PowerSI.L(:,:,idx) = rlgc_PowerSI_mat{4*idx-2,3}/lineLength;
rlgc_PowerSI.G(:,:,idx) = rlgc_PowerSI_mat{4*idx-1,3}/lineLength;
rlgc_PowerSI.C(:,:,idx) = rlgc_PowerSI_mat{4*idx-0,3}/lineLength;
end
%% Extract RLGC params using proposed method
rlgc_t = s2rlgc_t(SingleEnded2PortData.S_Parameters,lineLength,freq,z0);
check_consistence(rlgc_t.R, rlgc_t.L, rlgc_t.G, rlgc_t.C, lineLength, freq, z0);
%% Extracted RLGC compared with Cadence Sigrity PowerSI
figure('Name','RLGC Comparison')
sgtitle({'Comparison Between Proposed Algorithm and';'Cadence Sigrity PowerSI: Extracted RLGC'})
subplot(221)
plot(freq/1e9,squeeze(rlgc_t.R(1,1,:)),'k-')
hold on
plot(freq/1e9,squeeze(rlgc_PowerSI.R(1,1,:)),'g--')
hold off
grid on
xlabel('Freq(GHz)');
ylabel('R(Ohms/m)');
title('R Comparison');
legend({'Proposed Algorithm','Cadence Sigrity PowerSI'},'Location','best','NumColumns',1)
legend('boxoff')
subplot(222)
plot(freq/1e9,squeeze(rlgc_t.L(1,1,:)),'k-')
hold on
plot(freq/1e9,squeeze(rlgc_PowerSI.L(1,1,:)),'g--')
hold off
grid on
xlabel('Freq(GHz)');
ylabel('L(H/m)');
title('L Comparison');
legend({'Proposed Algorithm','Cadence Sigrity PowerSI'},'Location','best','NumColumns',1)
legend('boxoff')
subplot(223)
plot(freq/1e9,squeeze(rlgc_t.G(1,1,:)),'k-')
hold on
plot(freq/1e9,squeeze(rlgc_PowerSI.G(1,1,:)),'g--')
hold off
grid on
xlabel('Freq(GHz)');
ylabel('G(S/m)');
title('G Comparison');
legend({'Proposed Algorithm','Cadence Sigrity PowerSI'},'Location','best','NumColumns',1)
legend('boxoff')
subplot(224)
plot(freq/1e9,squeeze(rlgc_t.C(1,1,:)),'k-')
hold on
plot(freq/1e9,squeeze(rlgc_PowerSI.C(1,1,:)),'g--')
hold off
grid on
xlabel('Freq(GHz)');
ylabel('C(F/m)');
title('C Comparison');
legend({'Proposed Algorithm','Cadence Sigrity PowerSI'},'Location','best','NumColumns',1)
legend('boxoff')