Help needed in print command

Fahim
2012-07-10
2013-06-12
  • Fahim
    Fahim
    2012-07-10

    Hi,

    I am using the print command to print the output of particular node in a file.
    What I had done is I have run the transient analysis as .tran 0.01s 4s,now when I try to run the print command to know the output at different node(both analog and digital) in the file format I am actually getting the output in some weird form something like this


    Index   time            v(20)           v(1)            v(2)           

    0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
    1 1.000000e-04 0.000000e+00 0.000000e+00 0.000000e+00
    2 2.000000e-04 1.000000e+00 5.000000e-01 5.000000e-01
    3 4.000000e-04 1.000000e+00 5.000000e-01 5.000000e-01
    4 8.000000e-04 0.000000e+00 1.000000e+00 1.000000e+00
    5 1.600000e-03 0.000000e+00 1.000000e+00
    6 3.200000e-03 1.000000e+00 5.000000e-01
    7 6.400000e-03 1.000000e+00 5.000000e-01
    8 1.280000e-02 0.000000e+00 0.000000e+00
    9 2.280000e-02 0.000000e+00
    10 3.280000e-02 5.000000e-01
    11 4.280000e-02 5.000000e-01
    12 5.280000e-02 1.000000e+00
    13 6.280000e-02
    14 7.280000e-02
    15 8.280000e-02
    16 9.280000e-02
    17 1.028000e-01
    18 1.128000e-01
    19 1.228000e-01
    20 1.328000e-01
    21 1.428000e-01
    22 1.528000e-01
    23 1.628000e-01
    24 1.728000e-01
    25 1.828000e-01
    26 1.928000e-01
    27 2.028000e-01

    The problem is that the output is not reflecting till the 4s instead it stops at few milisecond only even though I have run tran analysis till 4s. Please let me know if I am doing anything wrong step over here.

    Regards,
    Fahim

     
  • Fahim
    Fahim
    2012-07-10

    the netlist is as follow

        1 : code model test : new d_ucm_adder
         2 : .global gnd
         4 : .tran .1s 4s
         8 : v2 200 0 dc pwl ( (0 0.0) (2 0.0) (2.0000000001 1.0) (4 1.0) )
         9 : v1 100 0 dc pwl ( (0 0.0) (1.0 0.0) (1.0000000001 1.0) (2 1.0) (2.0000000001 0.0) (3 0.0) (3.0000000001 1.0) (4 1.0) )
        14 : r1 100 0 1k
        15 : r2 200 0 1k
        18 : aconverter1   adc_bridge1
        20 : .model adc_bridge1 adc_bridge ( in_low=0.1 in_high=0.9 rise_delay=1.0e-12 fall_delay=1.0e-12)
        22 : add1  20 adder1
        23 : .model adder1 d_ucm_adder(rise_delay=1.0e-9 fall_delay=1.0e-9)
        27 : .end

     
  • Holger Vogt
    Holger Vogt
    2012-07-10

    Fahim,

    you can't print v(20) because it is an event (digital) node.

    So use

    print v(100) v(200)
    eprint 20

    or convert node 20 back to voltage by the dac_bridge before printing.

    Regards

    Holger

     
  • Fahim
    Fahim
    2012-07-11

    Hi Holger,

    Actually I need mechanism to store the digital input output details in the file to process it with some other method.

    Is there any way ?

    Regards,
    Fahim Khan

     
  • Holger Vogt
    Holger Vogt
    2012-07-11

    Fahim,

    I  have just uploaded to git an update to file src/xspice/evt/evtprint.c, which allows you to do an output redirection into file of the eprint command.

    So you may use the command
    eprint 1 2 20 > digi.out
    to print out your digital nodes in a form of value change format.

    Regards

    Holger

     
  • Fahim
    Fahim
    2012-07-12

    Hi Holger,

    Can please let me know from where I can get the updated evtprint.c file as I am not aware of git?

    Regards,
    Fahim Khan

     
  • Holger Vogt
    Holger Vogt
    2012-07-12

    Fahim,
    let me guess that you are on the forum page:
    http://sourceforge.net/projects/ngspice/forums/forum/127605
    Then choose 'code' from the menu on the top, 'Git Browse', ngspice repository, tree, src, xspice, evt, evtprint.c

    Not too difficult, right?

    Regards

    Holger

     
  • Fahim
    Fahim
    2012-07-12

    Hi Holger,

    I took the code from there and manually replace existing one with new.
    Is there any method to upgrade the installed ngspice with latest code.

    Regards,
    Fahim Khan

     
  • Fahim
    Fahim
    2012-07-30

    Hi Holger,

    I am trying to use eprint command inside the .cir file as follow.

    .control
    eprint 1 2 > temp.txt
    .endc

    But I am getting error of segmentation fault error.
    Is anything wrong with the syntax?

    Regards,
    Fahim Khan

     
  • Holger Vogt
    Holger Vogt
    2012-07-30

    Fahim,

    you have to run the simulation before you can print nodes, e.g.
    .control
    tran … …
    eprint 1 2 > temp.txt
    .endc

    Of course an error message would be better than a seg fault.

    Holger

     
  • Fahim
    Fahim
    2012-07-30

    Hi Holger,

    I have use the .tran option outside the control block. Do I need to do the tran inside the control block again?
    i.e we have to run the simulation again inside the control block also.

    Regards,
    Fahim Khan

     
  • Holger Vogt
    Holger Vogt
    2012-07-30

    Fahim,

    if you want to plot inside of a .control block, you have to do the simulation (only) inside the .control block. If the statement .tran is used outside, inside of the .control block you have to write:

    .control
    run
    eprint 1 2 > temp.txt
    .endc

    'Run' may be replaced by
    tran … …
    within the .control block. Then the .tran has to be deleted.

    When you use a .control block, ngspice has to be started in interactive mode by
    ngspice circuitfile.cir

    Using batch mode (-b) and a .control block will lead to unpredictable results.

    Regards

    Holger

     
  • Fahim
    Fahim
    2012-07-30

    Thanks a lot!!!!

    Regards,
    Fahim khan