## #123 Error on waveguide component

0.0.19
open
roucarb
5
2014-09-17
2013-09-26
Oscar
No

Hello,

I am a recent Qucs user. First at all I want to express my happiness because of this project.

I wrote because I find a mistake in rectline.cpp file on wave impedance, the error origin is on the wave number for vacuum k0, that parameter should be calculated in this way:

k0 = (2.0 * M_PI * frequency/ C0; %% without relative permittivity and permeability.

But the wave number with dielectric should be calculated to calculate beta parameter, so:

k = sqrt (er * mur)) * k0;
beta = sqrt (sqr (k) - sqr (kc));

On the other hand, there are similar problems on rectwaveguide.cpp file (used by qucs-transcalc). the line:

Z0 = k * ZF0 / beta;

Should be:

Z0 = k0 * ZF0 / beta;

then k0 should be calculated in that file too.

also, the attenuation due to conductor losses should be checked, taking in to account that both files calculate it with different procedures. I think that the correct way is used in rectline.cpp. Because the energy transfer between modes only occurs by irregularities in the waveguide and generally is neglected. Then, if Qucs only calculates TE10 propagation mode there is no reason to take in to account the losses in the other modes.

That is all, thanks for attention.

Oscar M.

## Discussion

• Richard C - 2014-02-05

Regarding the first part of this report, in rectline.cpp beta is calculated as

beta = std::sqrt (sqr (k0) - sqr (kc));


where k0 is calculated as

k0 = (2.0 * M_PI * frequency * std::sqrt (er * mur)) / C0;


isn't

k0 = (2.0 * M_PI * frequency * std::sqrt (er * mur)) / C0;
beta = std::sqrt (sqr (k0) - sqr (kc));


identical to doing the following?

k0 = (2.0 * M_PI * frequency)  / C0
k =  std::sqrt (er * mur) * k0;
beta = std::sqrt (sqr (k) - sqr (kc));


is this just a confusion due to the choice of variable names?

• Oscar - 2014-02-05

In some code lines the term Z0 (wave impedance in vacuum) appears multiplying k0, which is not correct with that definition.

For example, from Pozar's book the waveguide impedance in TE mode is
Z = k * eta/(2 * beta)

If we assume mur=1 then we have
Z = k0 * eta_0/(2 * beta)
approximation used in the code where k0 must be the wave number in vacuum and eta_0 the wave impedance in vacuum.

• Richard C - 2014-02-06

Oscar, thanks for the extra information.

So far I only looked at the first part of your first report. I will try to look into this further, however, if you can provide an example showing incorrect output from Qucs vs correct output, or can supply a patch which you think corrects any bug for review, this would speed the process.

• Richard C - 2014-02-06

looking again, only at rectline.cpp, the impedance is calculated as

zl = (k0 * Z0) / beta;


here Z0 is a constant defined as

/*!\brief Wave impedance in vacuum (\f$Z_0=\sqrt{\frac{\mu_0}{\varepsilon_0}}\f$)*/
#define Z0   376.73031346958504364963


i.e. it is eta_0. k0 in the code is defined as:

k0 = (2.0 * M_PI * frequency * std::sqrt (er * mur)) / C0;


which seems correct to me, isn't it just using k0 for the variable name instead of k?

Also, to confirm, by

Z = k * eta/(2 * beta)

did you mean

Z = k * eta/beta

From Ponzars book (Microwave Engineering 4th edition pg. 113 eq 3.86).

From Ponzars book also

k = w * srqt ( mu eps)

and

Z = k * eta / beta

and then

k = w * sqrt( mu_0 eps_0 mu_r eps_r)
= w * sqrt ( mu_r eps_r ) * sqrt ( mu_0 eps_0 )
= w * sqrt ( mu_r eps_r ) / c
= 2 * pi * f * sqrt ( mu_r eps_r ) / c

Isn't this how it is calculated in rectline.cpp, although it's called k0 in the code?

Last edit: Richard C 2014-02-06
• Oscar - 2014-02-06

Richard, your last equations are correct. But if you use

k = w * srqt ( mu * eps)
then
eta = sqrt (mu / eps)

if terms are multiplied k * eta, and assuming mu_r = 1, we have
k * eta = w * srqt ( mu * eps) * sqrt (mu / eps)
= w * srqt ( mu_0 * eps_0) * sqrt (mu_0 / eps_0)
= k0 * eta_0

then, if you use eta_0 you must use
k0 = w * srqt ( mu_0 * eps_0) = w/c

otherwise the impedance must be
eta = sqrt (mu_0 * mu_r / eps_0 * mu_r)

instead of the impedance in vacuum

• Oscar - 2014-02-06

I modified the function rectline::calcPropagation. Please check it.

• Guilherme - 2014-05-17

Can someone provide a testcase for this fix?

• Guilherme - 2014-09-17
• Group: 0.0.17 --> 0.0.19