Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#158 PZ analysis gives wrong results

open
nobody
analyses (40)
5
2011-08-20
2011-08-20
ASCO developer
No

1) On the three-stage frequency compensation example from the ASCO tool, this is the amp3, the poles and zeros given by ngspice are wrong. The bode diagram from the AC analysis is what I would expect, the gain is correct as is the UGF. The poles and zeros, are however far from what theory says.

2) Still related to the PZ analysis. I can run a PZ analysis and get the poles with .control and not
with .pz. The reason is that I need "print all" which seems to workonly on a .control loop and not with a dot command.

Discussion

  • Robert Larice
    Robert Larice
    2011-08-20

    Can you please provide a complete spice file ?
    including a .control sequence which plots the things you like
    and prints the things you don't like
    Robert

     
  • ASCO developer
    ASCO developer
    2011-08-20

    amp3 exampe files

     
    Attachments
  • ASCO developer
    ASCO developer
    2011-08-20

    See attached file for the simulation example along with the output results given by ngspice-23. In the amp3.out show the results of the PZ analysis, but it lacks the complex conjugated pole pair expected from theory and available when simulating with other electric simulators.

    The amp3.raw has two variables, which at least for me give the exactly same results, even though one is for the magnitude (VDB) and the other is for the phase (VP).

    On the control sequence within lines 43-47, commenting some lines at random, just crashes ngspice whereas other times, the simulation result from tf is just not printed. Might be that I'm not using all the necessary commands, I admit.

     
  • Robert Larice
    Robert Larice
    2011-08-21

    Thank you,
    it is so much easier to have a specific thing to look upon.

    concerning your .probe vp(node) and vdb(node).
    ngspice saves in both cases simply the complex vector v(node)
    if you read this back you can again plot and print it
    with db(v(node)) and ph(v(node))
    if you need the db itself in a data file
    you can use something like this as a workaround:
    .control
    ac ...
    let vthing_db = db(v(node))
    let vthing_phase = ph(v(node))
    write myfile vthing_db vthing_phase
    .endc

    concerning your crashes,
    i was not very sucessfull to reproduce them.
    but I've committed a fix for one possible cause,
    when the pzan run for more than aprox 250msec
    then a certain printf for user feedback tried to
    dereference a pointer, which was NULL for the pzan.
    perhaps you've run into this.
    please retry and eventually attach again a piece of .cir
    which fails.

    then the pz analysis problem itself.
    this obviously simply fails,
    propably because the algorithm is not up to
    the task.
    your circuit has a much larger matrix,
    compared to the few working examples
    I've seen so far.
    I can't fix that, too complex for me, sorry.

    Thank You,
    Robert

     
  • ASCO developer
    ASCO developer
    2011-08-21

    From reading the manual I concluded that "vdb" and "vp" would work differently, but apparently this is not the case. Should you find it valuable and is within your reach, writing a clarification in the manual might be helpful.

    I first observed the ngspice behavior back in May, but I assumed it was to being unfamiliar with the simulator way of doing things. From now on, I will keep the netlist and aks you or someone from the developing team for a clarification.

    Regards,
    João Ramos