AlterPCB-TLineSim: an open-source transmission line simulation tool - Page 1
Forum section: electronics / general

author: Maarten Baert
author_rank: Newbie
timestamp: October 29, 2017, 09:21:45 pm
content: Hi everyone,I've created a free, open-source, cross-platform transmission line simulation tool which I though you may find useful, especially those of you who design RF PCBs. This isn't just a simple calculator, it include an actual field solver which makes it far more accurate and flexible. It's similar to ADS LineCalc, for those who are familiar with that. Except for the fact that this tool is completely free.There's a webpage about the toolon my website, which I've also copy-pasted below:What is AlterPCB Transmission Line Simulator?AlterPCB Transmission Line Simulator (a.k.a. TLineSim) is a tool that can be used to design transmission lines for PCBs. When working with RF frequencies, good transmission line design is critical. There are many free tools available for this purpose, both online and offline. Unfortunately, these tools almost always rely on approximate formulas which are often highly inaccurate, or are only accurate for a narrow range of input parameters. Usually they are limited to simple transmission line types for which approximate formulas are known, and can't be adapted to more complex transmission lines that are often necessary (such as differential coplanar waveguides).TLineSim is different: instead of hard-coded approximate formulas, it uses a field solver to determine the properties of arbitrary transmission lines. TLineSim is essentially solving a slightly simplified version ofMaxwell's equationsusing thefinite element method. This method is far more accurate and not restricted to specific transmission line types.This program is a part of AlterPCB, an open-source, cross-platform PCB design program which I am currently developing together with a few friends. TLineSim will be integrated with AlterPCB once it is ready, but since the tool is quite useful by itself, I decided to release it as a stand-alone program as well. Like AlterPCB itself, TLineSim is completely free, open-source and cross-platform.The TLineSim user interface. In this example, TLineSim is used to automatically tune the track width of a differential coplanar waveguide in order to obtain a differential impedance of 100 ohm.FeaturesCalculates transmission line properties such as characteristic impedance, propagation velocity, wavelength, loss, capacitance, inductance, ...Uses an accurate quasi-TEM field solver rather than approximate formulas. As a result it can simulate arbitrary cross sections.Includes models for uncommon transmission line types such as differential coplanar waveguides.Models optionally include solder mask (which can have a small impact on characteristic impedance and loss).Simulates both resistive and dielectric losses (including skin effect and proximity effect).Supports anisotropic materials (most PCB substrates such as FR4 are in fact anisotropic).Supports single frequency analysis as well as frequency and parameter sweeps.Supports automatic parameter tuning (e.g. to determine the track width that will result in an impedance of 50 ohm).Straightforward graphical user interface (Qt-based).Open-source and cross-platform.DownloadWindows:Download AlterPCB-TLineSim 0.0.0 (32-bit)Download AlterPCB-TLineSim 0.0.0 (64-bit)Linux:Right now there are no precompiled packages for Linux, but I will try to create these soon. For now, you should compile from source.Mac:In theory Mac is supported if you compile from source, but this has not been tested yet.Source code:You can find the source code on GitHub:https://github.com/MaartenBaert/alterpcb-tlinesimIf you're not familiar with git, you can also download theZIP file (for Windows)or theTAR.GZ file (for Linux and Mac).LicenseAlterPCB-TLineSim is distributed under the terms of theGNU General Public License.All feedback is welcome.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 29, 2017, 10:51:40 pm
content: I'll have to check this out. Looks like it's everything that ATLC2 should be. Hope it lives up to the hype...Edit:Sure looks niceSeems nice and straightforward, for the options provided!I like that diff CPW is in there. Seems hard to find among calculators: e.g., last I looked, there wasn't an online calculator for it.Some options that occur to me:- User defined geometry (draw your own? construct from primitive shapes?).- User assigned resistivity, permeability, permittivity, loss, rolloff.- More zoom on the field view, and pan (e.g use left-drag for pan, scroll wheel for zoom).- Show lines of force (hm, I guess if equipotential lines are already plotted, this shouldn't be any more difficult at least).- Sweep results could be opened in a table view, or a side dialog, or expanding the Results region, etc. Or plotted, maybe the Viewer region could be tabbed?- View type: Current seems to be blank.- Selectable units would be nice. A lot of PCB work is done in mils, and TL parameters in in^-1 or ft^-1 or m^-1 would be nice.- Log frequency sweep (and maybe some parameters too, might as well make it general, right)Hmm, that's weird. I entered somewhat arbitrary values, and get unexpected results (unexpected to the extent that 1. this type of solver should not be subject to the approximations and geometry limitations that conventional formulas are subject to, and 2. there is no note about what limitations it does have, if any). Try this:Microstrip (single), Track width 1mm, thickness 3, copper, substrate 0.5, Isola FR406, SM 0.2, 0.25. Simulation: single freq.Going down in frequency I see,100MHz: 0.000372872 dB/mm loss10MHz: 6.51618e-51MHz: 1.48751e-5100kHz: 4.31892e-610kHz: 1.27398e-61kHz: 3.09939e-7However, a structure of this size should be flattening out by 10kHz. Indeed, if I keep adding zeroes, the resistance and loss continue to drop towards zero, clearly a faulty result. Likewise, the H-field plot does not show the field penetrating into the conductor. (But, because the conductor itself is always drawn brightly, it's not clear to me if it's being assumed as ideal, or I just can't see it because it's not being drawn, or it's not visible because of the appearance.)Taking a peek at materials.json, I see a variety of parameters can be specified (which, if/until user parameters are added, this looks very useful in the mean time!). FWIW, if permeability_unity_frequency is in Hz, it's probably overestimated for most of the materials -- most steel drops off in the 100kHz range (this is independent of skin effect). Of course, why someone would be making a PCB with steel traces, or how you'd make one with tungsten for that matter, I'm not sure.I understand providing materials just for reference, and completeness; the numbers might be wrong, but there are many alloys and conditions for commercially important metals, and a list like this is analogous to going to a candy shop to taste fruits: it might be close, or reminiscent in some way, but it's not the same thing, and one shouldn't expect it to be the same. A note might be added to this effect?Thanks again, and I look forward to updates and added features.Tim

author: Maarten Baert
author_rank: Newbie
timestamp: October 30, 2017, 04:07:59 am
content: Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmYep, there's no standard formula for it (AFAIK), so very few tools even attempt to support this type.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmI don't feel like creating an entire drawing program in a little tool like this, but I am considering adding an option to load arbitrary geometries from a JSON file. This would also work nicely with a command-line interface, for those who want to automate it.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmRight now this requires editing the materials.json file (which is very easy actually), but I'm planning to make a user interface for this to make it easier. Unfortunately it's hard to get good data for most materials - many manufacturers only spec their FR4-like materials at 1 MHz, which isn't very useful when you're working in the 1 GHz to 10 GHz range (cheap materials are usually highly frequency-dependent).Rolloff is based on the Djordjevic-Sarkar model, i.e. it is extrapolated from the loss tangent in a way that satisfies the Kramers-Kronig relations, such that the resulting material model is causal. This basically means that the loss tangent is proportional to the slope of the permittivity as a function of frequency. In other words, low-loss materials also have a very nice near-constant permittivity, whereas cheap materials have a lot more roll-off.I've noticed that manufacturers often specify combinations of permittivity and loss tangent that seem to violate this requirement, I don't really know what to do with that. Either the permittivity or the loss tangent must be wrong. If I override the loss tangent based on the permittivity slope, I get completely nonsensical results for some materials, such as negative loss tangent (because some manufacturers claim that their permittivity increases with frequency - presumably just measurement errors, but it ended up in the datasheets anyway). So I usually trust the loss tangent values given in the datasheet over the slope of the permittivity, which means that one permittivity value is enough to determine the rest.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmNoted.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmThis is actually surprisingly hard! Especially with limited CPU power available. There's theSurfaceLICalgorithm which looks very nice, but is also way too computationally expensive for real-time. Right now the plot is generated on the CPU, there is no hardware acceleration (yet).Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmNoted.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmIt's not blank, the current is just hard to see because it tends to be concentrated in the corners of the conductors. You need to zoom in a lot to see it. I added the option for debugging purposes, it's probably not really useful for most regular users.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmNoted.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmNot really a bug, but a known limitation. The solver assumes that the skin depth is significantly smaller than the conductor itself (which is generally true for frequencies above 100 MHz for most PCBs). I actually have an alternative solver which can simulate this properly, but it requires a lot more processing power. I've used it to simulate Litz wire to see how it affects losses:The problem with this type of solver is that it requires way more processing power than the idealized solver, because:Once you introduce non-ideal conductors, the matrix you need to solve becomes complex instead of real.Since the resulting matrix is non-Hermitian, you can't use Cholesky decomposition anymore, instead you have to use LU decomposition (which requires about 2 times more processing power). Right now the program doesn't even include an LU solver yet, so this will also increase the size of the executable.In order to make the solver work at high frequencies, you need to add tiny cells near the surface of all conductors (much smaller than the skin effect itself). But in order to make it work at lower frequencies, you need to fill the entire conductor with cells, you can't leave the center empty. This results in a huge increase in the total number of cells, especially with the simplistic mesh generator which I'm using now. I could also re-generate the mesh for each frequency independently, but this is also pretty slow.Maybe I can make it an option once I have a better mesh generator, but for now I think it's just too slow. Most users don't care about loss at low frequencies, since you don't need transmission lines in that frequency range anyway.I suppose I could throw in a crude hack that basically prevents the AC equivalent resistance from becoming lower than the DC resistance (calculated based on the area of the conductor). Not very accurate, but it would avoid the unrealistically low loss figures at low frequencies.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmI'm making the assumption that permeability drops off at a rate inversely proportional to the frequency. It's a very crude approximation, but it's the best I could find. The 'unity frequency' is the frequency at which the permeability becomes equal to 1. So if you have a DC permeability of 4000, it will start dropping off at 250kHz. Maybe this is indeed too optimistic, I'm not sure. I could switch to a model where you can set both the frequency where the roll-off starts, and the frequency where it ends. But again, I'm having a really hard time finding reliable data for this.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmSteel is included mostly to demonstrate that ferromagnetic materials are a bad idea for RF applications. Fun fact: ENIG coatings actually contain mostly Nickel, which is ferromagnetic (the gold layer on top is extremely thin). So if you remove the solder mask on an ENIG-coated board in an attempt to get more predictable transmission line performance, you are actually making things a lot worse.The material list includes a lot of stuff that's not very realistic for PCBs, but I'm also planning to use the same solver for other applications, such as IC design. Tungsten is actually a very common material for vias inside ICs. It's also used as a diffusion barrier I believe, to prevent the copper from contaminating the silicon substrate.Quote from: T3sl4co1l on October 29, 2017, 10:51:40 pmWhy would the numbers be wrong? Resistivity is relatively easy to measure, and AFAIK it's not very frequency-dependent or even manufacturer-dependent. Permeability is a different story, getting good data for this is a real problem. A warning may be a good idea in those cases.

author: KE5FX
author_rank: Super Contributor
timestamp: October 30, 2017, 04:33:23 am
content: Very nifty. I plugged in some microstrip parameters that should yield 50 ohms, and got... 50 ohms.Feature-wise, in addition to supporting mixed mm/mil units, you might consider adding buttons to save/recall the user-entered parameter set. Also, each transmission line type should have its own copy of these variables, so that selecting a different topology doesn't blow the existing entries away.(Actually, a better approach would be to maintain only one set of parameters, and show only the ones that are relevant to the selected TL type at any given time.)

author: hcglitte
author_rank: Regular Contributor
timestamp: October 30, 2017, 02:15:46 pm
content: Hi, Good work!I had a look in the json file, example:"name": "Isola FR406","permittivity_x": 4.362,"permittivity_y": 3.933,"loss_tangent_x": 0.01487,"loss_tangent_y": 0.01879,"test_frequency": 5e+09Where do you get the data from? I am only able to find one permittivity constant. Not for x and y - what does that mean anyway?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 30, 2017, 08:59:40 pm
content: Quote from: Maarten Baert on October 30, 2017, 04:07:59 amYeah, free data is a mess.Maybe if you partnered with some manufacturers to get the actual test data or something... but needless to say that's a heck of a stretch!QuoteAh.. just lovely.FYI, note that loss tangent is just that, the tangent. If it were negative, well, that'd be weird of course, but the loss factor is still |delta|, and it could be they're reporting that. Or their data is presented inconsistently, so they give so-and-so curve but tan delta is actually at 1MHz and has basically nothing to do with the rest.Where mu or epsilon is a function of frequency, you can build an equivalent circuit to arbitrary precision; for example, typical reasonably-complete* inductor models have a skin effect term, a core loss term (if applicable), and the overall dominant terms of resistance, inductance and capacitance.*The completeness being, I would guess, 10% or better accuracy in most parameters (R, L and C), over >3 decades range.Which would be handy enough for PCBs, say from 10MHz to 10GHz, if you could extract such data, and make use of it.This perspective is rather more useful to me -- I mostly work with circuits and their simulations -- than to a field solver, but if it's useful, hey.QuoteAhhh.... so this isn't a full solver, but it's using a sheet conductor model (I guess), and approximating losses as... well, as given, I guess, since you'd plug in a complex permittivity and go with it.So the trick would be, modeling the conductor's complex conductivity (or mostly-imaginary permeability and/or permittivity, if better), and doing so without grinding to a halt..Or even better, doing the full sim, if you can afford the computation time of course.QuoteAhh.Well, a factor of 2 isn't bothersome to me -- if you recast this more as a field solver (for simplified extruded geometries) than an impedance calculator, a few seconds is no trouble.As is, it takes I think a bit under a second to do a run, on my computer, which isn't a particularly special machine. If you want people to run this on Android, say, you might have a harder time justifying that (but, who needs to calculate fields on the go, anyway?).A progress bar, compute time estimate, and choice of solver options might be cool.QuoteHey, don't tell me what I don't need!It might not be a transmission line down there (i.e., much less than a sizable fraction of a wavelength in length), but a quick tool that can solve for loss and skin effect can still be a very useful engineering tool.QuoteAnd one can always do curve fitting to spackle over the hack. Instead of max(DCR, ACR), use a smoothing function, etc.QuoteAh.Yeah, reliable data isn't something you're going to find -- it depends on the alloy (e.g., AISI 1020 low carbon (mild) steel, or a hundred other common varieties?), and condition (grain size, mechanical working, hardness (annealed vs. quenched), and so on.I believe I've ran across a few papers that talk about the gyromagnetic moment running out in the GHz, so that would be the ultimate limit, at least for iron atoms. I'm not sure what you do inbetween, aside from measuring precisely the material you're about to use in an application -- clearly, powdered iron cores are useful into the VHF range, so it's not an absolute cutoff. Real measurements will be frustrated by eddy currents, grain size (one thing that powdered iron has to its advantage: fine crystallites, and also weird structures where applicable, like concentric spheres with carbonyl iron), dielectric environment (powdered iron cores use a resin binder; one could imagine ferrite or dielectric loaded PCB materials that would have similar concerns) and so on.QuoteYup! I've heard tales of waveguides accidentally being ENIG plated, instead of silver. Whoops.On the upside: plating is on the side and top of the conductor, away from most of the field (which is in the laminate). And this only matters if it's plated before, not after, soldermask. A SMOBC + ENIG board might have lower RF losses if it's left coated with soldermask!QuoteAh, true -- and, at least there, you have the expectation that the tungsten will be chemically pure (hmm, I don't offhand know what process they use to deposit it -- sputtering?), or at least a consistent alloy, and grain structure.QuoteAbout alloys, and conditions, I mean -- how often are you going to use analytically pure, vacuum annealed anything in an assembly?Example, copper is more or less copper at room temperature, but at cryogenic temperatures, impurities make a tremendous difference in the residual resistance ratio (RRR).Which, well, not that many people are doing cryogenic PCBs either, but then, some are -- another reason to have that flexibility, I guess.I noticed something else: the window always opens in the same place, on whichever monitor it was opened from. I have asymmetrical monitors, so when I open it on the main screen, it shows up in the bottom-right corner (more or less), which seems like the intended location. On my other monitor, it gets pushed off screen a little bit! Most programs remember their screen locations on exit. So, yet another little thing to toss in a new config file.Tim

author: Maarten Baert
author_rank: Newbie
timestamp: October 31, 2017, 12:18:04 am
content: Quote from: KE5FX on October 30, 2017, 04:33:23 amDefinitely something I will look into. Especially stuff like the PCB substrate should be remembered when you switch to a different transmission line type.Quote from: hcglitte on October 30, 2017, 02:15:46 pmFR4 is anisotropic, the properties are not the same in the horizontal (X) and vertical (Y) direction. The value you see in the datasheet is usually some kind of average of the two, depending on the test method that was used. Very few people have actually bothered to measure these material properties completely, so I'm mostly relying onthis paper. For materials that aren't listed in the paper (which is most of them), I take the most similar material I can find, and I rescale the X and Y values of the known material based on the 'average' value from the datasheet. It's not great, but it's more accurate than pretending that the material is isotropic when it clearly isn't.Quote from: T3sl4co1l on October 30, 2017, 08:59:40 pmActually loss tangent doesn't refer to the tangent of the permittivity, it refers to the ratio of the imaginary vs the real component of the permittivity, or in other words, the phase shift of the displacement current. In a lossless material, the displacement current is 90 degrees out of phase with the electric potential, so the power is purely reactive and there are no losses. However in reality, the current lags slightly behind as a result of imperfections in the material, so you yet a small amount of active power, which absorbs energy. If the loss tangent was negative, it would indicate that the material is generating power rather than absorbing it, which doesn't make sense. So the loss tangent must be positive.It is possible for the permittivity to increase with frequency without generating energy, but not when the loss tangent stays constant across the entire frequency range. A constant, positive loss tangent across the entire frequency range implies that the permittivity should decrease with frequency.There is a certain relation between the slope of the permittivity-vs-frequency curve and the loss tangent, at least under the Djordjevic-Sarkar model, but the relation isn't as simple and you make it sound.Quote from: hcglitte on October 30, 2017, 02:15:46 pmThe solver calculates electric and magnetic fields as if the conductors and dielectrics are perfect (zero loss), because this is much simpler. It then pretends that the fields will stay the same when you introduce a small amount of loss, which is a very reasonable approximation for most practical cases. Of course it breaks at lower frequencies because the current starts to flow inside the conductor instead of just on the surface, and that in turn changes the magnetic field, but usually you don't really care about the characteristic impedance at such low frequencies.Quote from: hcglitte on October 30, 2017, 02:15:46 pmThe factor 2 is just what you get when switching from Cholesky to LU. You will have to spend a lot more processing power once you factor in all the other sources of overhead, such as the increased mesh size which increases the size of the matrix that needs to be solved. In the end it will be more like a factor 5 to 10.Quote from: hcglitte on October 30, 2017, 02:15:46 pmIt's a problem for sweeps though. But I could probably work around this by adding a 'quality' setting so you can reduce the level of detail of the mesh if you don't need super high accuracy. In practice, the material models are usually the limiting factor anyway, so it doesn't make sense to spend a lot of CPU time to get 0.1% accuracy from the solver, when your material models may be off by 5% or more.Quote from: hcglitte on October 30, 2017, 02:15:46 pmThat's true. And in that case you really need the skin effect solver, the surface current approximation isn't good enough if that's your goal.Quote from: hcglitte on October 30, 2017, 02:15:46 pmThat was my plan. Do a sweep with the slow, accurate solver, and try to approximate that result with a simple formula.Quote from: hcglitte on October 30, 2017, 02:15:46 pmSo I should probably just display a warning whenever a ferromagnetic material is selected by the user.Quote from: hcglitte on October 30, 2017, 02:15:46 pmWhat kind of losses did that produce?Quote from: hcglitte on October 30, 2017, 02:15:46 pmI'm not aware of any PCB manufacturers that do ENIG coating before soldermask, why would you even want that?Solder mask losses seem to be pretty low, so I just leave it on for all my boards to avoid these problems.Quote from: hcglitte on October 30, 2017, 02:15:46 pmYes, but the real problem there is getting this information from the manufacturer. The tracks may be partially tungsten (or another diffusion barrier) and partially copper (for lower resistance), but they won't tell you exactly which materials they use and how thick the diffusion barriers are! Even under NDA they refuse to tell you more than the physical layer thickness and average conductivity of the material.Quote from: hcglitte on October 30, 2017, 02:15:46 pmGood point, I didn't consider that.Quote from: hcglitte on October 30, 2017, 02:15:46 pmWeird, I'm just using the default location. But I can definitely save and restore the window state, no problem.