Menu

#10 4π-factor mismatch

v1.0_(example)
closed-invalid
None
2
2017-01-27
2017-01-21
No

Subject: output of CPW calculator
Test seems like calculated capacity is wrong.
I suggest to figure out and fix bug if it exists.

I had checked it for simple case using the formula I know. The calculator and the formula resulted in different answers. Calculator output is smaller than formula answer, and mismatch is factor equaled to 4π.

I hope that mentioned formula is OK: brief review
Your "spacing (s)" is my "gap (g)".
Case: metal thickness (Tmet) << w, s; metal surface roughness (RGH) = 0 (ideal rectangular); substrate thickness (H) >> w, s, Tmet; substrate loss tangent (tand) = 0.

Discussion

  • Dan McMahill

    Dan McMahill - 2017-01-24

    Hi, Thanks for the bug report. I'm always interested in them because it is quite easy to get something wrong in the code. I'm actually not convinced that the bug report is accurate. Here are the couple of things I tried. Please let me know if you still think I have something wrong because it is certainly possible.

    In wcalc I put in a trace width of 11um, gap of 18um, turned off the bottom side ground, set er=1.0, tmet = 0.0, and length = 1mm. This gave 19.6961 fF and 1/sqrt(LC) is consistent with the speed of light. sqrt(L/C) matched the reported Z0 of 169 Ohms. Then I tried to evalute C0 from equation 6a in the reference you posted. BTW, thanks for the reference. I always appreciate those. This is what I got in scipy:

    import scipy.special as sp   
    import scipy.constants as sc
    import math
    def C_strip(length, w, g):
        kp = w/(w+2*g)
        k = math.sqrt(1 - kp**2)
        # from (6a) in the reference
        C0 = 4.0*sc.epsilon_0*sp.ellipk(kp)/sp.ellipk(k)
        return length*C0
    
    # L = 1mm, W=11um, g=18um, Capacitance in fF
    C_strip(1e-3, 11e-6, 18e-6)*1e15
    
    18.600809187922426
    

    So it is not an exact match (not sure why) but it is pretty close.

    Then I tried fastcap. In this case I made the two ground traces 500um wide. Here is how I ran fastcap:

    cubegen -naCPW -n7 -xh11e-6 -yh1000e-6 -zh1e-9 -p > cpw_line.qui
    cubegen -naGND -n50 -xh500e-6 -yh1000e-6 -zh1e-9 -p > cpw_gnd.qui
    cat <<EOF> cpw.lst
    G test CPW structure
    the main signal line
    C cpw_line.qui 1 0 0 0
    ground planes (use of same file repeatedly)
    C cpw_gnd.qui 1.0 2.9e-05 0 0 +
    C cpw_gnd.qui 1.0 -0.000518 0 0
    **
    EOF

    fastcap -m./cpw.ps -l./cpw.lst
    ps2pdf cpw.ps
    fastcap -l./cpw.lst | tee cpw.out

    You can play with the discretization and get slightly different results but with the values listed here I get 19.01 fF.

    To summarize:

    wcalc - 19.7 fF
    scipy using your reference - 18.6 fF
    fastcap - 19.01 fF

    Let me know what you think.

    Cheers
    -Dan

     
  • Stanislav Gilmulin

    Hi, Dan! Thank you for fast response time!

    I think during convertaion of capacity in formulas from CGS to SI it should be multipled to 1/(4πepsilon_0). Therefore, formula shows bigger result (4π-factor).

    Second point would be that python ellipk is to expect k^2 as argument (not k).

    WBR,
    Stas

     
  • Dan McMahill

    Dan McMahill - 2017-01-25

    I think we both have bugs in our python code. You are indeed correct that ellipk expects k^2 as the argument. I've corrected my python code. That causes my python result to match wcalc exactly.

    print(sc.epsilon_0)
    8.854187817620389e-12

    which is the correct value in Farads/meter. The rest of that equation is unitless so I think it should be correct. As another data point, I put in this same CPW into

    https://www.microwaves101.com/calculators/864-coplanar-waveguide-calculator

    and that gave Z0 = 169.47 Ohms which is fairly close to the 169.355 Ohms that wcalc is giving me. Since er=1, the velocity should be the speed of light. From wcalc:
    Ls=5.64908e-07 H/m
    Cs=1.96961e-11 F/m
    and this indeed gives sqrt(Ls/Cs) = 169.355 Ohms and 1/sqrt(Ls x Cs) = speed of light in vacuum in meters/sec

    import scipy.special as sp   
    import scipy.constants as sc
    import numpy as np
    import math
    
    def C_strip(length, w, g):
        kp = w/(w+2*g)
        k = math.sqrt(1 - kp**2)
        # from (6a)
        C0 = 4.0*sc.epsilon_0*sp.ellipk(kp**2)/sp.ellipk(k**2)
        return length*C0
    
    # L = 1mm, W=11um, g=18um, Capacitance in fF
    print(C_strip(1e-3, 11e-6, 18e-6)*1e15)
    print(sc.epsilon_0)
    
    19.6961441803
    8.854187817620389e-12
    
     
  • Stanislav Gilmulin

    Your calculator was OK all time. Sorry. I wasted too much your time. Sorry.
    Thank you for reference to Simons book. It's extremely useful.

    I found mistake. I converted formula (first reference) to CGS (for other research) month ago (and, as I see, it was not correct = the mistake = "4π-factor mismatch"). But recently I had converted my numerical result from cm to fF. Then I tried your calculator and guessed that calculator is wrong.
    P.S. my python has k^2 in definition of K function. It don't cause.

    Now I'm going to fix my code.
    Thank you!

     
  • Dan McMahill

    Dan McMahill - 2017-01-27
    • status: open --> closed-invalid
     
  • Dan McMahill

    Dan McMahill - 2017-01-27

    No worries. It was a good discussion. I'd rather spend time and find it was ok than just assume it is right.

     

Log in to post a comment.