ngspice questions

Discussion in 'General Electronics Chat' started by dfro, Oct 21, 2009.

  1. dfro

    Thread Starter Active Member

    Feb 6, 2006
    37
    0
    I am currently learning to use ngspice. I use the gEDA suite and ngspice is the preferred version of spice for gEDA. I am making some progress, but I am stuck on a few things.

    1. How do you get the 'plot' command to make the dotted lines on graphs, like the ones displayed on these web pages:

    http://www.linuxjournal.com/article/2169
    http://brainwagon.org/2009/01/23/common-emitter-amplifier-design-using-ngspice/

    I like the look of them, but I can't figure out what settings to change.

    2. When I use the 'plot' command I get the new graph popping up in a new window like it should. When I press the 'Hardcopy' button I get a file saved, like '/tmp/hc10663'. I cannot figure out what to do next with this file - what program to use, etc. I would like to get a .ps,.png, or .pdf kind of output file that looks like the graph ngspice produces. Any ideas? I could always just take a screenshot of the graph.

    Thanks,
    Dave
     
  2. Thav

    Member

    Oct 13, 2009
    82
    0
    You need to use a separate program to plot the results. I somehow ended up with gwave waveform viewer when I installed gEDA on Ubuntu. I think there are other programs, like nutmeg, and another recommended by gEDA. http://gtkwave.sourceforge.net/
     
  3. dfro

    Thread Starter Active Member

    Feb 6, 2006
    37
    0
    After further study, I realize nutmeg (ngnutmeg) is the part of spice (ngspice) that does the plotting of the results of spice's simulations. The linux journal article that I linked above shows a good example of a nutmeg session (Listing 4), and it describes how nutmeg can be used.

    I was just too bleary eyed last night to properly read it. I will experiment with what I learn from the article.

    Thanks for the gtkwave suggestion. I learned gnuplot can also be used to make some nice plots of spice data.

    Dave
     
  4. Thav

    Member

    Oct 13, 2009
    82
    0
    I use gnuplot at work when I need to plot data I save from our scopes. I like it a lot, but you usually have to know what your signals are going to look like in advance. I think ngnutmeg will have more interactive functions than gnuplot.

    Best of luck to you! I've had a hard time using gEDA after getting used to commercial packages.
     
  5. dfro

    Thread Starter Active Member

    Feb 6, 2006
    37
    0
    I got ngnutmeg working! And I'm getting those cool black and white graphs with the dotted lines. With a closer reading of the Linux Journal article and the Spice3 manual, I was able to get it working.

    IMHO, the Spice3 manual is lacking in many details. For example, its list of 'set' commands contain no information on how to properly write the variable. I got the command:

    set hcopydevtype=postscript

    from the Linux Journal article. What to write to set this variable, '=postscript', is not in the manual. Are there any other options? The manual doesn't tell you.

    The problem with all of this wonderful free and open-source software tends to be the documentation. The programmers making this software want to write programs, not manuals. Blogs and web articles often fill in the gaps. 'Lessons in Electric Circuits' has been great in helping me understand spice!! It is like the missing Spice manual. I think some more explanation of 'nutmeg' and possibly 'gnuplot', and how to use these to get the graphs you want, would be an excellent addition to the book series.

    The gEDA suite was difficult to learn, but there is some decent documentation. And I like the transparency and flexibility. If I can't find a symbol or footprint, I just make one and I'm back in business. Integrating gschem with ngspice is taking my design process to a whole other level. I am excited!

    I have a new spice question:

    I want to have a plot of a simulation a few seconds into its running (leaving out the first seconds), so that all of the capacitors get charged up in a power supply, for example. Do I have to do a long simulation and then plot the graph between times that I choose?
    Is there a way of doing this?

    This is the next thing I have to work out.

    And one more question:

    I would also like to figure out how to add 'set color0=ffffff' & 'set color1=000' to a .cmd file, so that I don't have to repeat writing it every time I plot a graph. But, I haven't been able to figure out if that is possible, yet.

    Thanks,
    Dave
     
    Last edited: Oct 21, 2009
  6. dfro

    Thread Starter Active Member

    Feb 6, 2006
    37
    0
    I figured this out. When running ngspice or ngnutmeg in interractive mode, the plot command has many arguments that let you limit the range of the x and y axis and manipulate the graph in other ways. To get a postscript file of a limited x,y graph, just use the 'hardcopy' command with any of the same arguments that the 'post' has. All of the 'post' arguments work under 'hardcopy'.

    I also found that right clicking and dragging a box over a graph display window produced a limited x,y graph from the full range graph. I like it. The left click-drag produced dx/dy-type information, which I don't get just yet.

    Dave
     
Loading...