Connect with us

spice3f5 under linux

Discussion in 'CAD' started by Ian Bell, Jan 8, 2004.

Scroll to continue with content
  1. Ian Bell

    Ian Bell Guest

    I am having a problem with dc analysis with spice 3f5 under linux in batch
    mode. I get an error which says dc analysis not done because doAnalyses
    not found. .ac et al seem to be OK. Any ideas?

    Ian
     
  2. : I am having a problem with dc analysis with spice 3f5 under linux in batch
    : mode. I get an error which says dc analysis not done because doAnalyses
    : not found. .ac et al seem to be OK. Any ideas?

    Download tclspice-0.2.15 and try again. Tclspice is the best
    supported port of SPICE 3f5 to Linux.

    http://tclspice.sourceforge.net/

    Although tclspice has its issues, it does do .dc, .ac, and .tran
    analyses without any problem. It incorporates the command-line SPICE
    program ngspice, which is probably what you want to use.

    Stuart
     
  3. Ian Bell

    Ian Bell Guest

    THanks for that. I have downloaded it and will give it a try.

    Ian
     
  4. : Stuart Brorson wrote:
    :> Download tclspice-0.2.15 and try again. Tclspice is the best
    :> supported port of SPICE 3f5 to Linux.
    :>
    :> http://tclspice.sourceforge.net/
    :>
    : THanks for that. I have downloaded it and will give it a try.

    Let us know how you make out! I am keeping a (long and growing) list
    of tclspice bugs; I also occasionally submit patches to the keepers of
    the code, so if you have a problem I would like to hear about it.

    I won't promise that I'll fix anything, or commit to any bugfix
    schedule however . . . . :-S

    Stuart
     
  5. Ian Bell

    Ian Bell Guest

    Well, apart from installing BLT, dev libs, flex, lex, readlin, tclreadlin
    just to get configure to complete without choking, when I finaly got to
    make it stops on an error in terminal.c where it can't find a include file
    termcaps.h which I could not find either. So I commented out the include
    and to my surprise it all compiles and it runs.

    First comments - not the worlds best GUI and the usual linux lack of basic
    get you started documentation. I'll let you know how I get on.

    Ian
     
  6. Ian Bell

    Ian Bell Guest

    I've just tried my simple test circuit and out popped some errors. here's
    the orignal spice. maybe you would like to run it with spicewish and see
    if it works for you:

    First Circuit for Spice
    vs 1 0 24V
    R1 1 2 10
    R2 2 0 1K
    R3 2 3 300
    R4 3 0 500
    *.OPTIONS nopage list nomod
    * Operating Point
    ..op
    * DC Analysis
    ..dc vs 10 24 1
    *.PRINT DC I(R1) I(R2) I(R3)
    ..end


    Ian
     
  7. I wouldn't expect this to run without errors because with the .PRINT commented
    out and no .SAVE statement there is nothing for the dc analysis to do.

    If you uncomment the print line it still won't work because I(R1) etc
    is not valid spice3f4 syntax. The correct syntax would be

    ..PRINT DC @r1 @r2 @r3

    Charles.
     
  8. Charles,


    If there's no .save statement, I thought 3f4 was
    supposed to act as if you had ".save all" in the
    deck. Isn't the way the examples that ship with
    it were written?

    --Mike
     
  9. Thanks for pointing this out.

    You are right about what *should* happen. The spice 3f4 userguide says

    http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/sec4.html#4.4.1

    "If no .SAVE line is given, then the default set of vectors are saved
    (node voltages and voltage source branch currents)."

    However, ISTR that, due to a bug in spice, what I described is what *does*
    happen for netlists that have .op in them. I may be wrong about this.
    I remember thinking about this problem in connection with MacSpice but
    never getting roung to fixing it.

    Anyway, let's try the OPs netlist in MacSpice, which is similar (but not
    identical) in behaviour to Spice 3f5, I find:

    ----------
    MacSpice 1 -> source ianbell

    Circuit: First Circuit for Spice

    MacSpice 2 -> run
    Error: analysis 'D.C. Transfer curve analysis' is being cancelled.
    doAnalyses: No valid data saves. Try the 'status' command.

    run simulation(s) aborted
    MacSpice 3 -> status
    1 [OP] save all
    MacSpice 4 ->
    ----------

    MacSpice has various modifications over 3f4. Inter alia its error messages are
    more informative and the status command prints the ownership of the saves.
    MacSpice skipped the DC analysis because there were no applicable saves.
    The status command shows that a 'save all' was created, but it was created to
    service the .OP command only. The presence of this save inhibits the
    default 'save all' behaviour specified in the userguide. Now uncomment the
    ..PRINT command...

    ----------
    MacSpice 4 -> delete all
    MacSpice 5 -> status
    MacSpice 6 -> edit
    MacSpice 7 -> source ianbell

    Circuit: First Circuit for Spice

    MacSpice 8 -> run
    Warning: can't parse 'r1#branch' in save statement: ignored
    Note: use 'status' and 'delete' to deal with obsolete save statements.
    Warning: can't parse 'r2#branch' in save statement: ignored
    Note: use 'status' and 'delete' to deal with obsolete save statements.
    Warning: can't parse 'r3#branch' in save statement: ignored
    Note: use 'status' and 'delete' to deal with obsolete save statements.
    Error: analysis 'D.C. Transfer curve analysis' is being cancelled.
    doAnalyses: No valid data saves. Try the 'status' command.

    run simulation(s) aborted
    MacSpice 9 -> status
    2 [OP] save all
    3 [dc] save r1#branch
    4 [dc] save r2#branch
    5 [dc] save r3#branch
    MacSpice 10 ->

    ----------

    Here, MacSpice tried to create the necessary saves to service the .PRINT DC
    command, but because I(R1) is a syntax error the were still no valid saves.
    However, change the print line so it says '.PRINT DC @r1 ...' and all
    is well.

    Anyway, I think that Ian should probably try fixing his print statement and/or
    add an explicit '.save all' line to his source.

    And, I should probably fix MacSpice so that it does what the userguide
    says it should...

    Charles.
     
  10. : Ian Bell wrote:
    :> Well, apart from installing BLT, dev libs, flex, lex, readlin, tclreadlin
    :> just to get configure to complete without choking, when I finaly got to
    :> make it stops on an error in terminal.c where it can't find a include file
    :> termcaps.h which I could not find either. So I commented out the include
    :> and to my surprise it all compiles and it runs.

    You only need BLT and much of the other stuff if you want to use the
    TCL API stuff. Ngspice alone (which is part of the dist) doesn't need
    all that stuff. However, now that you've built it, you've got it!

    :> First comments - not the worlds best GUI and the usual linux lack of basic
    :> get you started documentation. I'll let you know how I get on.

    Hey -- at least it ran! :)

    : I've just tried my simple test circuit and out popped some errors. here's
    : the orignal spice. maybe you would like to run it with spicewish and see
    : if it works for you:

    : First Circuit for Spice
    : vs 1 0 24V
    : R1 1 2 10
    : R2 2 0 1K
    : R3 2 3 300
    : R4 3 0 500
    : *.OPTIONS nopage list nomod
    : * Operating Point
    : .op
    : * DC Analysis
    : .dc vs 10 24 1
    : *.PRINT DC I(R1) I(R2) I(R3)
    : .end

    This didn't work for me. The issue is that ngspice will only report
    current flowing through independent voltage sources:

    http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/sec4.html#4.4.2

    Perhaps there are some vendor-specific extensions which permit you to
    use the above syntax? And as for Charles' suggestion, it didn't work
    for me either.

    I modified your circuit to incorporate voltage sources. Here is a
    session log:

    -------------------- Session log ----------------
    ******
    ** tclspice-0.2.15 : Circuit level simulation program
    ** The U. C. Berkeley CAD Group
    ** Copyright 1985-1994, Regents of the University of California.
    ** Please submit bug-reports to:
    ** Creation Date: Sun Dec 21 22:06:36 EST 2003
    ******

    Circuit: First Circuit for Spice

    tclspice 380 -> run
    Doing analysis at TEMP = 300.150000 and TNOM = 300.150000

    No. of Data Rows : 15

    No. of Data Rows : 1
    tclspice 381 -> listing
    First Circuit for Spice

    1 : first circuit for spice
    2 : vs 1 0 24v
    3 : r1 1 2 10
    4 : vdc1 2 2a 0v
    5 : r2 2a 2b 1k
    6 : vdc2 2b 0 0v
    7 : r3 2a 3 300
    8 : vdc3 3 3a 0v
    9 : r4 3a 0 500
    12 : .op
    14 : .dc vs 10 24 1
    15 : .print dc i(vdc1) i(vdc2) i(vdc3)
    17 : .end
    tclspice 382 -> print dc i(vdc1) i(vdc2) i(vdc3)
    Error: dc: no such vector.
    tclspice 383 -> print i(vdc1) i(vdc2) i(vdc3)
    i(vdc1) = 5.281174e-02
    i(vdc2) = 2.347188e-02
    i(vdc3) = 2.933985e-02
    tclspice 384 ->
    -------------------- End session log -----------------

    Note that "print dc i(vdc1) i(vdc2) i(vdc3)" didn't work. This is a
    bug, since it is apparently correct syntax. I'll add it to the bug
    list.

    Stuart
     
  11. : And as for Charles' suggestion, it didn't work
    : for me either.

    Well, I am a bonehead sometimes. :) I tried the following:

    tclspice 384 -> PRINT DC @r1 @r2 @r3
    PRINT: no such command available in tclspice
    tclspice 385 -> print DC @r1 @r2 @r3
    Error: DC: no such vector.
    tclspice 386 -> print @r1 @r2 @r3
    @r1 = 5.281174e-02
    @r2 = 2.347188e-02
    @r3 = 2.933985e-02

    So Charles is right! Thanks for the suggestion, Charles!

    I don't know why tclspice won't do the print when you enter it in the
    file itself. It's another bug for the list. . . .

    Stuart
     
  12. Charles,
    Looks like your suggestion fixed the problem, but I've never
    seen Berkeley SPICE work that way. The last tape I got from
    Berkeley didn't do that. The port I did for Linux didn't do
    that. Maybe the error was introduced by whoever compiled
    the OP's SPICE.

    --Mike
     
  13. Ian Bell

    Ian Bell Guest

    Thanks Charles, Stuart and Mike for all your input. The syntax errors are
    undoubtedly due to me using an old pspice text book with Berkeley spice3f5.
    My justification for this is that the one? area where I have found the
    spice docmentation lacking is in the definition (and examples of ) vectors.
    I came across the display command in interactive mode so that gave me some
    syntactically correct ones to play with plot. Interestingly these use ()
    brackets, yet in the examples from you guys [] are common plus the @ prefix
    to reference a component. Anyway what this is all leading to is a request
    for a pointer to a comprehensive tutorial on vectors.

    I have doenloaded umpteen user guides but they are all more or less the help
    built into 3f5. Is there some more comprehensive spice documentation
    anywhere.

    Add to this that I have tried about six variants of linux spice so far and
    they all behave differently (the Suse one only accepts lower case commands)
    and you can imagine my frustration. Anyway, thanks once again for showing
    me the light.

    Ian
     
  14. Ian Bell

    Ian Bell Guest

    I am making some real progress now - thanks to all who helped. This is my
    latest test pack which works fine.

    First Circuit for Spice
    vs 1 0 24V
    R1 1 2 10
    R2 2 0 1K
    R3 2 3 300
    R4 3 0 500
    *.OPTIONS nopage list nomod
    * Operating Point
    ..op
    * DC Analysis
    ..dc vs 10 24 1
    ..PRINT DC @R1 @R2 @R3
    ..PLOT DC @R1
    ..PLOT DC V(2)
    ..end

    Though I am still puzzled by the different types of brackets used in
    vectors.

    Ian
     
  15. Not a bug. The 'dc' parameter only applies to the dotcard version of the
    command, not the interactive interpreter version where it has been
    superceded by 'setplot dc'.

    Charles
     
  16. Yes, that would be confusing. Try

    Introductory tutorial and exercises:

    http://newton.ex.ac.uk/teaching/CDHW/Electronics2/Spice3Quickstart.html
    http://newton.ex.ac.uk/teaching/CDHW/Electronics2/SimSheet-01.html

    and online Spice 3 manual with corrections, addditions, cross-refs, notes
    and search:

    http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/
    You can either buy a textbook (try amazon) and/or inspect the source code.
    If you have specific questions post them here.

    Charles.
     
  17. I think the issue only arises with specific combinations
    of compile time and runtime options.

    Charles.
     
  18. Ian Bell

    Ian Bell Guest

    I had already found and downloaded the quickstart and userguide but did not
    realise until last night they were by you. The SimSheet is a useful
    addition.
    Again this is very similar to the standard user guide but it does have some
    aditions so I'll download and read - thanks.
    I have a couple of (pspice) books which I suspect will be more of a
    hindrance than help. Don't know why I didn't think of Amazon myself.
    Will do and once again many thanks for the help.

    ian
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-