-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tapered line component #380
Conversation
1) It was created the component entry for an exponentially tappered transmission line. 2) The S-parameter simulation was implemented by discretizing the line into differential slots and calculating the global S-param matrix as the product of the T matrix of the differential slots References: [1] Microwave engineering. David Pozar. 4th Edition. Pg 262-263 [2] Investigation on Tapered multiple microstrip lines for VLSI circuits. Mehalic, Chan, Mittra. IEEE MTT-S Digest 1988
It was added a general model for tapered lines. It is based on dividing the entire transmission line into differential slots (under the assumption that the characteristic impedance in each slot is constant). The ABCD matrix of every slot is calculated so the overall ABCD is trivial to obtain. Finally, the S/Y-parameters are calculated. So far, it supports exponential, linear and triangular impedance profiles. References: [1] Microwave engineering. David M Pozar. John Wiley and Sons. 4th edition. Pages 261-267
It was implemented the modified Bessel function I_{\alpha}(x). However, it is needed a much more efficient implementation. Currently, the Klopfenstein taper takes about 50 min to calculate and the results are not accurated enough.
The Klopfenstein taper is now fully working. The cpu time was improved by implementing a more efficient modified Bessel function (See http://people.math.sfu.ca/~cbm/aands/page_375.htm)
nice. this only extends qucs(ator), apart from minimal changes necessary to register the code. merging just now should not cause any problem. however, please
thanks. |
@andresmmera , Sorry, I have not yet tested your code, but it looks good. I think, it could be merged after release. I don't recommend to merge any new feature right before release. |
@ra3xdh this is not a feature, just a component. yes, we should make qucs more flexible, so components can be added without tampering with the code base. we are not there yet, but i would certainly appreciate your help. EDIT: @andresmmera by writing "just" i do not intend to de-emphasize your effort. |
Vadim, I am aware that this kind of PR should not be merged in this Felix, I will squash the commits tomorrow. Thank you
|
if you don't want to see this merged, please attach a milestone > 0.0.19. |
Great work! I was actually in need of doing some simulations with tapered lines and thought it was a pity that Qucs did not support them. Nice to see that you already did all the work ! 😁 I tried to look at all the code, but I'll need some time more to dig into all the details. I have some first comments:
(of course it will be even nicer if the ABCD matrix was a member of the
|
@in3otd Many thanks for your comments!
Ok, I was not aware of that. I'll try to fix it
The attenuation factor was set to -30dB just to check an almost lossless case. No problem, I'll set it to 0dB to be coherent with the other components.
Sure, I think it shouldn't be difficult :-)
Uhm, I'm 98% sure that Qucs cannot handle complex ports. Indeed, I remember that here (#339) I had to use RLC components to synthesize a (narrowband) complex load. In that case, I wouldn't be necessary to use real() and conj() in the integrations here and here I think you are not taking into account correctly the contributions from the endpoints, see the composite trapezoidal formula here . (makes only a small difference for the small steps you are using) To be honest, I haven't heard about this kind of interpolation ever :-) It's good to learn these things. Thanks!
Yes... it happened because I'm prone to using the copying and pasting technique...
Yes, Γ (f) are known for all the tapers. (I've been digging in this before I started coding). From the conservation energy principle you have: P_in = P_reflected + P_transmitted + P_dissipated = |S11|^2 + |S21|^2 + alpha*L where P denotes power, alpha is the attenuation coefficient (in natural units) and L is the length of the line. Γ (f)=|S11|, P_in and alpha are known, then |S21| can be calculated. But,... what about the phase of S11 and S21? I couldn't find the way to calculate them... :-) @felix-salfelder I reckon that I can't add a milestone. Probably, only you (@in3otd, @ra3xdh, @guitorri, you and maybe someone more) can add these tags. |
1) The bug on the AC simulation was corrected. 2) ABCD->S conversion was being normalized to the input/output impedances when they should be normalized to the internal reference impedance. 3) The attenuation coefficient was set to 0 dB by default
What I meant to say is that for the other lines in Qucs, if you want to specify a loss of 30 dB/m you have to set
Yes, make that 100%. Currently it does not handle complex reference impedances for the ports. I just wanted to point out that the formulas you wrote did not agree 100% with the reference you cited in the code. Sure, you could just consider the real reference impedance case here.
BTW, I did some comparison (with Octave) and the integration error is not that small currently.
uhm. did not dig into this, but for every causal component the real and imaginary parts are related to each other by the Hilbert transform, this should be enough to obtain the phase, with some work... To simplify the calculations, do you think that the the tapered line impedance profile |
@in3otd Unfortunately, this for loop https://github.com/andresmmera/qucs/blob/TaperedLines/qucs-core/src/components/taperedline.cpp#L63 is an iterative matrix product rather than an integration, so I think that conventional numerical integration techniques cannot be applied. Probably, it'd be possible to use some kind of interpolation (polinomial, spline,...) to find the coefficients of 'intermediate' matrices and improve the final results. On the other hand, I think that the difference between two consecutive matrices is small enough to get accurate results. I mean: ABCD(i) = ABCD(i-1) + E; and |E| -> 0 Concerning the phases problem, as you said, it is possible to obtain the real and imaginary parts are related to each other by the Hilbert transform. However, I (we) don't know the tapered line response H(omega) in the Hilbert domain. Indeed, if we get it, we can also derive the impulsive response, h(t) and implement transient simulation (this would be beautiful :-) ) Regarding the possibility of precalculating the impedance profile, it sounds good. It implies some code changes, but as you said, it is doable :-) Thank you |
I hope I'm not being annoying, just a question: Can a component know the range of frequencies in the S-parameter simulation or is it something 'external'? In order to pre-calculate the impedance profile, it is necessary to know the highest frequency so as to define a length step for the tapered line analysis. I mean, the impedance profile requires more samples as frequency increases, so it makes sense to sample the impedance profile at a high rate in initSP() and then 'decimate' such profile at lower frequencies. |
found the problem in the S21 values; the Regarding the ABCD matrices products, yes, it's not a quadrature, I was sloppy in the description because I wanted to make a common comment but there what I think should be done is taking the
No problem, here or on
uhm, at present it seems only the solvers ( |
(pssst, @andresmmera , don't tell anyone, but the phase of Γ(f) is in Pozar's book, same pages you cited already, and its value is... surprising! 😁 . I have implemented the computation of the S-matrix for the Klopfenstein case based on this, works beautifully and, of course, very fast) |
Uhm, Pozar gives the Γ(f) formula (i.e. it has module and phase). How could you get the phase of S21 from there? You have just left me scratching my head... |
The attenuation coefficient has been corrected according to Claudio's explanation. The integration step has been also corrected, although, hopefully, the integration will no longer needed soon :)
Yes, I didn't say that I had to make an additional assumption, to fix the phase of S22. I saw that, numerically, S22=S11* (when the S-parameters reference impedances are Anyway, looking at the literature I saw that, not surprisingly, someone else had the same problem of efficiently finding the impedance along a Klopfenstein taper before and almost 50 years ago a simple recursive formula was found. I also realized that you do not need to subdivide the taper depending on the wavelength; the important thing is not how much phase shift each section introduces but how much the actual impedance changes across the sections. This means you can use a fixed number of sections, depending on how big the overall impedance step is, but it seems between 10 and 50 section is enough and this also helps in speeding up things. I'll send you a PR with these latest modifications. BTW, your current code does not work here, I get a |
Uhm, I'm a little bit confused, transmission lines should be reciprocal devices since they are made of passive and isotropic materials, so according to Eq 4.48 (Pozar's book*, 4th Edition, Page 182), S = S^t => S11 = S22
Ok, I'll take a look as soon as possible. I've just checked the last commit: It doesn't crash here, but I'm getting weird results. Probably, I made some foolish mistake (I was too excited because of your last comment) :-) |
Nope, S = [S]t actually implies S12 = S21 |
:0 Hell, how could I say S = S^t => S11 = S22?
Well, I'll try to dig into this problem tomorrow...
|
Implemented the simple recursive formula from Grossberg, Proc. IEEE 1968, pp.1629-1630 to compute the phi(x, A) function needed for the Klopfenstein taper calculations. Changed the ABCD matrix to use a constant number of sections, instead of using constant fraction of wavelength sections, since the number of sections needed depends mainly on the impedance change across the section, not on its length. Corrected the ABCD matrix to Y-parameters conversion (had a missing negative sign). Now using the a Qucs function to set the S-matrix.
Speed-up Klopfenstein taper and ABCD matrix calculations
1) If the impedance at port 1 is bigger than the impedance at port 2, the model sweeps (Z1, Z2), and calculates the S matrix as usual. 2) The calculation of the impedance profile was moved to initSP(). This avoids redundant function calls.
good to move the impedance profile calculation, but it should be in a separate function, that needs to be called by both I just saw that the include guard in taperedline.h is not following the proper naming convention, see #268 and #264 for further details (in short, you should use |
1) It was created a specific function for calculating impedance profile 2) The include guard was also fixed so as to be coherent with the naming convention
Ok, I've fixed both issues. |
Glups, I'm sorry :) |
This PR will be the next candidate for merging in the develop after the #356. @andresmmera , Have you time to rebase and retarget this branch to |
I'll try find some spare time this evening/night... Otherwise, I'll let you
know. Thanks for you help, Vadim.
…On Jan 31, 2017 11:06 AM, "Vadim Kusnetsov" ***@***.***> wrote:
This PR will be the next candidate for merging in the develop after the
#356 <#356>. @andresmmera
<https://github.com/andresmmera> , Have you time to rebase and retarget
this branch to develop until the weekend?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#380 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMkfEajvuPxVNtLYU9N_3sflSAo2eYjsks5rXweTgaJpZM4GDqhv>
.
|
I'm closing this PR because I've just rebased it in #657 |
This component is aimed to model the S-param behaviour of a tapered line. It provides 4 impedance profiles: Exponential, Linear, Triangular and Klopfenstein [1]. The linear profile is not defined in [1] but I have added it anyway.
Regarding the implementation details, I didn't find a explicit model which calculates the S-Parameters of a tapered line, so I decided to tackle the problem as follows:
ABCD = [cosh(gamma·dl), Zi·sinh(gamma·dl); sinh(gamma·dl)/Zi, cosh(gamma·dl)]
where gamma = alpha+j·beta is the complex propagation constant and dl is the length of the slots.
https://en.wikipedia.org/wiki/Two-port_network#Table_of_transmission_parameters
According to the cascading property of the ABCD parameters, the overall ABCD matrix can be calculated as product of the ABCD matrices of the slots.
ABCD is converted into S/Y parameters.
I reckon that this model works, indeed the |S11| perfectly matches the reflection coefficient plots at [1]. Here are the results:
a) Impedance profile


a.1) Qucs taper line model
a.2) Pozar [1]
b) Exponential taper:
b.1) S11


b.2) S21
c) Triangular taper:
c.1) S11

c.2) S21

d) Klopfenstein taper:
d.1) S11

d.2) S21

As mentioned above, the |S11| seems to mimic the reflection coefficient plot given in [1]:

Please, notice that the length of the line is l=150mm, so freq = 1e9 <=> beta·l = pi
The plots above are taken from (this schematic)[https://gist.github.com/andresmmera/7b1b7a96d68ec0b8741c]. I have also written an Octave script in order to verify the model.
[1] Microwave engineering. David M Pozar. 4th Edition. Pages 261-267