Software to calculate Bode Plot based on diylc schematic/layout

Discussion in 'Shock Brother's DIY Amps' started by Tom Kamphuys, Jan 21, 2019.

  1. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    For my JTM45 build I made scripts (in Octave) based on the attached pdf that uses Kirchhoff's laws to calculate the bode plot from an arbitrary RC circuit.

    Previously I've writting scripts that parses the DIYLC schematic and layout files for comparison (http://www.tdpri.com/threads/software-to-compare-layout-and-schematic-in-diylc.888412/).

    Both scripts combined allow one to determine the Bode plot of a schematic and/or layout made in DIYLC:
    DIYBode.png

    It is currently in a pre-alpha state, but I would like to get some feedback whether or not you guys would be interested in this.
     

    Attached Files:

    tubeswell and sds1 like this.
  2. johnDH

    johnDH TDPRI Member

    Age:
    59
    Posts:
    90
    Joined:
    Jun 24, 2016
    Location:
    Wilton NSW
    Looks interesting. I do analysis of similar things, such as attenuators, guitar circuits and stompboxes. Im not familiar with DIYLC, but am I right that it relates schematics to layouts, but doesn't do its own circuit analysis?

    I do my analysis either with Spice programs such as LTSpice and 5Spice, or, if I really want to deeply investigate a complex LRC circuit (eg a guitar or a reactive attenuator), I might crunch out a specific spreadsheet using complex numbers.

    So, for what what you are showing, is it to analyze just that specific RC topology? Or, will it develop into a more general tool?

    If it doesn't exist already, a tool to take a general schematic say from DIYLC, and produce a netlist for Spice analysis would be useful
     
  3. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    DIYLC (http://diy-fever.com/software/diylc/) is an electronics drawing program that can be used for both schematics and layouts. Especially layouts are nice (see e.g. @robrob 's site or recent posts). It doesn't do much besides that.
    It does not relate schematics and layouts. That's why I wrote the first scripts. I had a schematic as it shows more clearly the working of the circuit and a layout for reference when building the amp. I wanted to make sure that both (schematic and layout) were the same. The scripts convert both the schematic and the layout to something similar to a netlist which can than be easily compared by Meld, Kompare or any other diff-tool.

    Besides that schematic and layout in DIYLC I also had a schematic in LTSpice. That was where I did my circuit analysis. I found however that comparing bode plots with different values for components were difficult to compare, so I wrote scripts to parse the output file and plot it on my own (multiple in one plot). This involved repeated manual actions (in LTSpice) and I don't like repeated silly things, nor keeping 3 files in sync (layout and schematic in DIYLC and the schematic in LTSpice).
    So I wrote scripts to calculate the bode plot of an input of my JTM45 amp. I wanted to see how both channels interacted with each other, but wasn't able to capture that in formula's. On the net I found the pdf from the first post that allowed me to analyse circuits (using complex numbers) for arbitrary (L)RC circuits and wrote scripts to make it handy. At first I entered the netlists-like structures manually, but I got bored and wrote some more scripts to convert the netlist-like output from the DIYLC files to the circuit analysis input. So it does not only work for this particular circuit but works for any LRC circuit. Current limitations are that e.g. it does not understand coils, and pots. Both can be added though.

    A netlist output should be do-able. But as explained before I find the comparing of circuits cumbersome in LTSpice.
     
    Last edited: Jan 22, 2019
    sds1 likes this.
  4. RLee77

    RLee77 Friend of Leo's

    Posts:
    4,297
    Joined:
    May 15, 2016
    Location:
    Nevada
    I would think it would make more sense to convert things into a format that all the already-working and commonly-used spice and other analysis programs understand, instead of trying to re-implement those. Those programs have matured over the years to include many devices and options and features... you really want to recreate all that?
     
    sds1 likes this.
  5. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    I've seen it as a learning experience for Kirchhoff's laws, but you have a point. It would be nice if there was a scriptable Spice version: netlist+sim command in -> bode plot (data) out.

    Does anyone have some suggestions?
     
  6. elpico

    elpico Tele-Holic

    Posts:
    753
    Joined:
    Sep 14, 2011
    Location:
    Vancouver BC
    Spice has variables. You define them with the .param or .step command and use them in the circuit by placing the variable name between curly braces {}. That allows you to easily sweep any component through a range of values and compare the results. For example:

    [​IMG]

    There are several pieces of software out there already that integrate spice circuit simulation and board layout tools in one app. Probably want to check those out before reinventing the wheel.
     
    sds1 and Tom Kamphuys like this.
  7. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    I am (was? :)) checking out ngspice and a Matlab script on Matlab central called ngspice.

    I'll do some googling.
     
    sds1 likes this.
  8. elpico

    elpico Tele-Holic

    Posts:
    753
    Joined:
    Sep 14, 2011
    Location:
    Vancouver BC
    I think the most popular commercial packages are Altium and Eagle, but I know there are a number of smaller ones out there too like EasyEDA. Altium is the only one I've tried so I couldn't say how they all compare. The layout tools in these things are of course geared towards creating modern circuit boards, I'm not sure how much use they'd be for recreating antique building styles.
     
  9. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    Thanks for the options. I feel they are geared towards modern circuit boards too much.
    DIYLC is easy to use and has great graphics. I think I'll continue with DIYLC and ngspice. I have a proof-of-principle working. The image below is showing 'my' frequency reponse, the Tone Stack Calculator frequency response and the diylc of the Marshall tone stack (which is the source for 'my' frequency response):

    ngspice.png
     
    Snfoilhat and sds1 like this.
  10. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    Last edited: Aug 17, 2019
    sds1 and LudwigvonBirk like this.
  11. tubeswell

    tubeswell Friend of Leo's

    Posts:
    2,370
    Joined:
    Jul 1, 2008
    Location:
    NZ
    Check out mobile app
    called Tonestack Kit.
     
  12. Tom Kamphuys

    Tom Kamphuys Tele-Meister

    Age:
    40
    Posts:
    204
    Joined:
    Sep 18, 2018
    Location:
    The Netherlands
    The tone stack is just an example. I hope someday we can use diylc to (somehow) generate bode plots of whatever circuit.
     
IMPORTANT: Treat everyone here with respect, no matter how difficult!
No sex, drug, political, religion or hate discussion permitted here.


  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.