Use of "save" in interactive mode

kriszhyan
2013-02-01
2013-06-12
  • kriszhyan

    kriszhyan - 2013-02-01

    I was trying to save only a few interesting nodes when simulating a circuit. However, I had a hard time to figure out the exact use of the "save" command. Here is an example (the Hartley's oscillator from ngspice examples).

    .model qnl npn(level=1 bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf va=50)
    vcc     1 0     5 pwl 0 0 1e-5 5
    r1  1 2 0.2k
    q1  2 3 0   qnl
    c1  3 4 633n
    l1  3 0 1.5
    l2  0 4 500m
    r2  4 2 100
    .tran 3u 30m
    .end
    

    For example, I want to save v(4) only. The commands "save 4" and "save "4"" (double quotes around 4) seem to do the job. But "save v(4)" does not work. I'm worried about these notations because I have a program to communicate with ngspice and run it according to some inputs.

    Besides, I also have trouble with saving currents, say i(r1). I understand that i(r1) is not computed unless requested. Is there a way to let ngspice compute and save i(r1) while discarding the rest points?

    Thanks.

     
  • Holger Vogt

    Holger Vogt - 2013-02-01

    Using ngspice-25, the following is o.k.:

    kriszhyan 130201
    .model qnl npn(level=1 bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf va=50)
    vcc     1 0     5 pwl 0 0 1e-5 5
    r1  1 22    0.2k
    Vmeas 22 2 0
    q1  2 3 0   qnl
    c1  3 4 633n
    l1  3 0 1.5
    l2  0 4 500m
    r2  4 2 100
    .save 3 v(22)
    .tran 3u 30m
    .control
    save 4 v(2)
    save i(vmeas) 
    run
    display
    .endc
    .end
    

    Holger

     
  • kriszhyan

    kriszhyan - 2013-02-03

    Thanks Holger. For my implementation, I have to use ngspice in the interactive mode, in which case I have trouble to save with the syntax like "save v(2)".

    I'm using ngspice-25. I can confirm that the above netlist works fine. Could you also try the commands "save v(2)" and "save i(vmeas)" in the interactive mode?

    Thanks.

     
  • Holger Vogt

    Holger Vogt - 2013-02-03

    You are right, in pure interactive mode
    save v(2) i(vmeas)
    doesn't work.
    You have to use
    save 2 vmeas#branch
    instead.

    I will look into this, as time allows.

    Holger

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks